doctor.js 834 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.doctor.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 医生管理
  7. class DoctorController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.doctor;
  11. }
  12. async update() {
  13. await this.service.update(this.ctx.params, this.ctx.request.body);
  14. this.ctx.ok({ msg: 'accepted' });
  15. }
  16. // 根据openid 取得医生信息
  17. async findopenid() {
  18. return await this.service.findByOpenid(this.ctx.query);
  19. }
  20. // 更新openid
  21. async updateopenid() {
  22. await this.service.updateopenid(this.ctx.params, this.ctx.request.body);
  23. this.ctx.ok({ msg: 'accepted' });
  24. }
  25. }
  26. module.exports = CrudController(DoctorController, meta);