ButtModel.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace app\api\model\butt;
  3. use app\api\model\api\ApiModel;
  4. use app\api\model\doctor\DoctorModel;
  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\report\ReportModel;
  9. use app\api\model\ZskkDefaultModel;
  10. use think\facade\Log;
  11. use app\api\model\studies\StudiesModel;
  12. class XzModel extends ZskkDefaultModel {
  13. protected $table= 'xz';
  14. protected $logName = "XzModel";
  15. public function insertXz($data)
  16. {
  17. $info = $this->insert($data);
  18. return $info;
  19. }
  20. public function checkXz($where)
  21. {
  22. $data = $this->where($where)->find();
  23. return $data;
  24. }
  25. public function insertStudies($data)
  26. {
  27. $info = StudiesModel::insert($data);
  28. return $info;
  29. }
  30. public function insertPatient($data)
  31. {
  32. $info = PatientModel::insert($data);
  33. return $info;
  34. }
  35. public function insertExam($data)
  36. {
  37. $info = ExamModel::insert($data);
  38. return $info;
  39. }
  40. public function updateStatus($where,$status)
  41. {
  42. $info = $this->where($where)
  43. ->update(['exam_status'=>$status]);
  44. return $info;
  45. }
  46. public function getXzData($id)
  47. {
  48. $info = $this->where('exam_id',$id)
  49. ->find();
  50. return $info;
  51. }
  52. public function getReport($id)
  53. {
  54. $info = ReportModel::where('exam_id',$id)
  55. ->where('type',1)
  56. ->find();
  57. return $info;
  58. }
  59. public function getDoctorName($id)
  60. {
  61. $name = DoctorModel::where('id',$id)->value('realname');
  62. return $name;
  63. }
  64. public function updateStudies($id,$examId)
  65. {
  66. StudiesModel::where('id',$id)->update(['exam_id'=>$examId]);
  67. }
  68. public function updateXz($where,$updateXz)
  69. {
  70. $this->where($where)->update($updateXz);
  71. }
  72. public function getUid($id)
  73. {
  74. $uid = StudiesModel::where('exam_id',$id)->value('studyuid');
  75. return $uid;
  76. }
  77. public function getAccession($id)
  78. {
  79. $info = ExamModel::where('id',$id)->value('accession_num');
  80. return $info;
  81. }
  82. public function check($studyId)
  83. {
  84. $id = ExamModel::where('study_id',$studyId)->find();
  85. return $id;
  86. }
  87. public function updateExam($data,$id)
  88. {
  89. $info = ExamModel::where('id',$id)->update($data);
  90. return $info;
  91. }
  92. public function checkDoctor($name)
  93. {
  94. $id = DoctorModel::where('realname',$name)->value('id');
  95. return $id;
  96. }
  97. public function getApi($id)
  98. {
  99. $apiIds = InstitutionModel::where('id',$id)->value('api_ids');
  100. return $apiIds;
  101. }
  102. public function getInterface($ids)
  103. {
  104. $info = ApiModel::whereIn('id',$ids)->select();
  105. return $info;
  106. }
  107. }