'use strict'; const Controller = require('egg').Controller; // 群患者 class GroupPatientsController extends Controller { constructor(ctx) { super(ctx); this.service = this.ctx.service.group; } // GET LIST async index() { const data = await this.service.fetchPatient(this.ctx.params); this.ctx.ok({ data }); } // GET /{id} async fetch() { const { groupid } = this.ctx.params; const data = await this.service.fetchPatient({ id: groupid }); this.ctx.ok({ data }); } // POST /{id} async update() { const { groupid, id } = this.ctx.params; await this.service.updatePatient({ groupid, id }, this.ctx.request.body); this.ctx.ok({ msg: 'accepted' }); } // DELETE /{id} async destroy() { const { groupid, id } = this.ctx.params; await this.service.deletePatient({ groupid, id }); this.ctx.ok({ msg: 'deleted' }); } } module.exports = GroupPatientsController;