DoctorModel.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\api\model\doctor;
  3. use app\api\model\department\DepartmentModel;
  4. use app\api\model\doctorclass\DoctorClassModel;
  5. use app\api\model\exam\ExamModel;
  6. use app\api\model\institution\InstitutionModel;
  7. use app\api\model\patient\PatientModel;
  8. use app\api\model\ZskkDefaultModel;
  9. use think\Db;
  10. use think\facade\Log;
  11. class DoctorModel extends ZskkDefaultModel {
  12. protected $table= 'doctors';
  13. protected $logName = "DoctorModel";
  14. public function getUser($where)
  15. {
  16. $doctor = $this->where($where)
  17. ->where('status' ,1)
  18. ->find();
  19. return $doctor;
  20. }
  21. public function getInstitution($id)
  22. {
  23. $institution = InstitutionModel::where('id',$id)->value('name');
  24. return $institution;
  25. }
  26. public function getInstitutionData($id)
  27. {
  28. $institution = InstitutionModel::where('id',$id)->find();
  29. return $institution;
  30. }
  31. public function getDepartment($id)
  32. {
  33. $department = DepartmentModel::where('id',$id)->value('department_name');
  34. return $department;
  35. }
  36. public function getDoctorByPhone($phone)
  37. {
  38. $info = $this->where('phone',$phone)->find();
  39. return $info;
  40. }
  41. public function changePwd($id,$password)
  42. {
  43. $info = $this
  44. ->where('id',$id)
  45. ->update(['password'=>md5($password)]);
  46. return $info;
  47. }
  48. public function changeInfo($data,$id)
  49. {
  50. $info = $this
  51. ->where('id',$id)
  52. ->update($data);
  53. return $info;
  54. }
  55. public function getPower($id){
  56. $info = DoctorClassModel::where('doctor_id',$id)->value('doctor_class');
  57. return $info;
  58. }
  59. public function getDoctorList($institution)
  60. {
  61. $list = $this->where('institution_id',$institution)->field('id,realname')->select()->toArray();
  62. return $list;
  63. }
  64. }