12345678910111213141516171819202122232425262728293031323334353637383940 |
- '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;
|