patient.repo.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * 患者库。
  3. *
  4. * author: Sand
  5. * since: 2016/11/18
  6. */
  7. "use strict";
  8. var ImDb = require('./db/im.db');
  9. class PatientRepo {
  10. constructor() {
  11. }
  12. static findOne(patientId, handler){
  13. ImDb.execQuery({
  14. "sql": "select id, name, sex, birthdate, avatar from patients where id = ? ",
  15. "args": [patientId],
  16. "handler": handler
  17. });
  18. }
  19. static findPatientOpenId(code, handler) {
  20. var sql = "select openid from patients where id = ? ";
  21. ImDb.execQuery({
  22. "sql": sql,
  23. "args": [code],
  24. "handler": handler
  25. });
  26. }
  27. // TODO: 不能直接访问三师库
  28. static getPatientDoctorConsult(patient, doctor, handler) {
  29. var sql = "select * from wlyy_consult_team where patient = ? and doctor = ? and status = 0 and del = '1' ";
  30. ImDb.execQuery({
  31. "sql": sql,
  32. "args": [patient, doctor],
  33. "handler": handler
  34. });
  35. };
  36. }
  37. module.exports = PatientRepo;