DoctorModel.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 getOtherIns($ids)
  32. {
  33. $institution = InstitutionModel::whereIn('id',$ids)->field('id,name')->select();
  34. return $institution;
  35. }
  36. public function getDepartment($id)
  37. {
  38. $department = DepartmentModel::where('id',$id)->value('department_name');
  39. return $department;
  40. }
  41. public function getDoctorByPhone($phone)
  42. {
  43. $info = $this->where('phone',$phone)->find();
  44. return $info;
  45. }
  46. public function changePwd($id,$password)
  47. {
  48. $info = $this
  49. ->where('id',$id)
  50. ->update(['password'=>md5($password)]);
  51. return $info;
  52. }
  53. public function changeInfo($data,$id)
  54. {
  55. $info = $this
  56. ->where('id',$id)
  57. ->update($data);
  58. return $info;
  59. }
  60. public function getPower($id){
  61. $info = DoctorClassModel::where('doctor_id',$id)->value('doctor_class');
  62. return $info;
  63. }
  64. public function getDoctorList($institution)
  65. {
  66. $list = $this->where('institution_id',$institution)->field('id,realname')->select()->toArray();
  67. return $list;
  68. }
  69. }