123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 'use strict';
- const Controller = require('egg').Controller;
- // 患者病历
- class PatientEmrsController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.service = this.ctx.service.patient;
- }
- // GET LIST
- async index() {
- const { patientid } = this.ctx.params;
- const res = await this.service.fetch({ id: patientid }, { emrs: '+emrs' });
- this.ctx.ok({ data: res.emrs });
- }
- // POST
- async create() {
- const { patientid } = this.ctx.params;
- await this.service.createEmr({ patientid }, this.ctx.request.body);
- this.ctx.ok({ msg: 'created' });
- }
- // GET /{id}
- async fetch() {
- const { patientid, emrid } = this.ctx.params;
- const res = await this.service.fetchEmr({ patientid, emrid });
- this.ctx.ok({ data: res });
- }
- // POST /{id}
- async update() {
- const { patientid, id } = this.ctx.params;
- await this.service.updateEmr({ patientid, id }, this.ctx.request.body);
- this.ctx.ok({ msg: 'accepted' });
- }
- // DELETE /{id}
- async destroy() {
- const { patientid, id } = this.ctx.params;
- await this.service.deleteEmr({ patientid, id });
- this.ctx.ok({ msg: 'deleted' });
- }
- }
- module.exports = PatientEmrsController;
|