123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <?php
- namespace app\api\model\dict;
- use app\api\model\constant\ConstantModel;
- use app\api\model\department\DepartmentModel;
- use app\api\model\device\DeviceModel;
- use app\api\model\dicticd\DicticdModel;
- use app\api\model\doctor\DoctorModel;
- use app\api\model\exam\ExamModel;
- use app\api\model\newpart\NewpartModel;
- use app\api\model\project\ProjectModel;
- use app\api\model\qc\QcModel;
- use app\api\model\qcause\QcauseModel;
- use app\api\model\qf\QfModel;
- use app\api\model\report\ReportModel;
- use app\api\model\subclass\SubclassModel;
- use app\api\model\ZskkDefaultModel;
- use think\facade\Log;
- class DictModel extends ZskkDefaultModel {
- protected $table= 'dict';
- protected $logName = "DictModel";
- public function getDevice($id)
- {
- // $device = DeviceModel::where('id','in',$id)->field('id, name, exam_class_id')->select();
- $device = DeviceModel::field('id, name, exam_class_id')->select();
- return $device;
- }
- public function getSubclass()
- {
- $info = SubclassModel::select();
- return $info;
- }
- public function getClass($id)
- {
- $info = SubclassModel::where('exam_class_id',$id)->select();
- return $info;
- }
- public function Project($id)
- {
- $info = ProjectModel::where('exam_class_id',$id)->select();
- return $info;
- }
- public function getProject()
- {
- $info = ProjectModel::field('status',true)
- ->select();
- return $info;
- }
- public function getIllness()
- {
- $data = ConstantModel::where('parent_id','illness')
- ->cache('illness',43200)
- ->field('constant_value AS name')
- ->select();
- return $data;
- }
- public function getFamilyIll()
- {
- $data = ConstantModel::where('parent_id','family_ill')
- ->cache('family_ill',43200)
- ->field('constant_value AS name')
- ->select();
- return $data;
- }
- public function getIcd()
- {
- $data = DicticdModel::where('pid',0)
- ->cache(true)
- ->select();
- return $data;
- }
- public function getIcdList($class_where, $name_where, $last_id)
- {
- $id_where = $last_id ? [
- ['id','>', $last_id]
- ] : false;
- $data = DicticdModel::whereOr($name_where)
- ->where($class_where)
- ->where($id_where)
- ->where('valid',1)
- ->field('id,code,name,pname')
- ->limit(1,50)
- ->select();
- return $data ? $data->toArray() : $data;
- }
- public function getDictChild($id)
- {
- $data = DicticdModel::whereIn('pid', $id)
- ->cache(true)
- ->select();
- return $data;
- }
- public function getExamClass()
- {
- $data = ConstantModel::where('parent_id','exam_class')
- ->cache('exam_class',43200)
- ->field('constant_value AS name')
- ->select();
- return $data;
- }
- public function getDepartment($institution)
- {
- $data = DepartmentModel::where('institution_id',$institution)->field('department_name')->select();
- return $data;
- }
- public function getDoctors($institution)
- {
- $data = DoctorModel::where('institution_id',$institution)->field('id,realname')->select();
- return $data;
- }
- public function saveQuality($data)
- {
- $info = QcModel::insert($data);
- return $info;
- }
- public function delpic($id,$type)
- {
- $data = QcauseModel::where('control_id',$id)->where('type',$type)->delete();
- return $data;
- }
- public function updateQuality($id,$data)
- {
- $info = QcModel::where('id',$id)->update($data);
- return $info;
- }
- public function savePic($data)
- {
- $info = QcauseModel::insert($data);
- return $info;
- }
- public function getQuality($id,$user)
- {
- $info = QcModel::where('report_id',$id)->where('comment_user_id',$user['id'])->field('id,report_id,pic_quality,pic_evaluate,report_quality,report_evaluate')->find();
- return $info;
- }
- public function getQualityById($id)
- {
- $info = QcModel::where('id',$id)->find();
- return $info;
- }
- public function getReportDoctor($id)
- {
- $doctor = ReportModel::where('id',$id)->value('report_doctor_id');
- return $doctor;
- }
- public function getqualityFactorPic()
- {
- $info = QfModel::where('type','1')->field('id,description')->select();
- return $info;
- }
- public function getqualityFactorReport()
- {
- $info = QfModel::where('type','2')->field('id,description')->select();
- return $info;
- }
- public function getApplicationDepartment($id)
- {
- $data = ExamModel::where('institution_id',$id)
- ->where("application_department is not null and application_department != ''")
- ->field("count(*) AS c,application_department")
- ->cache($id.'_depart',43200)
- ->group('application_department')
- ->having('count(*)>1')
- ->order('count(*) desc')
- ->select();
- return $data;
- }
- public function getNewPart()
- {
- $data = NewpartModel::select();
- return $data;
- }
- }
|