lgy 1 month ago
parent
commit
d22180cfc3
2 changed files with 46 additions and 12 deletions
  1. 3 2
      jcjyhr/app/zskk/servies/CommonServies.php
  2. 43 10
      jcjyhr/app/zskk/servies/PatientServies.php

+ 3 - 2
jcjyhr/app/zskk/servies/CommonServies.php

@@ -259,7 +259,7 @@ class CommonServies
             if(!empty($HR_ITEMNAME_CODE) && $HR_ITEMNAME_CODE !='-')
             {
                 $DICT_DATA = $this->patientModel->getExamDict(['XM_CODE'=>$HR_ITEMNAME_CODE],'XM');
-                if($DICT_DATA['XM'] == $HR_ITEMNAME)
+                if(($DICT_DATA['XM'] ?? '') == $HR_ITEMNAME)
                 {
                     $RECOG_STATUS = '*';
                 }
@@ -314,7 +314,8 @@ class CommonServies
                 'create_time' => date('Y-m-d H:i:s'),
                 'STUDYUID' => $STUDYUID,
                 'ACCESSION_NUM' => $ACCESSION_NUM,
-                'STUDY_ID'=>$STUDY_ID
+                'STUDY_ID'=>$STUDY_ID,
+                'HOS_EMPI'=>$MEDICAL_INFORMATION['HOS_EMPI'] ?? ''
 
             
             ];        

+ 43 - 10
jcjyhr/app/zskk/servies/PatientServies.php

@@ -790,23 +790,45 @@ class PatientServies
         if($hr == 1)
         {
             $examWhere = ['RECOG_STATUS'=>'*'];
-            $inspectWhere = ['RECOG_STATUS'=>'*'];
         }
         $exam = $this->patientModel->getExam($patient['PATIENT_CODE'],$examWhere);
         $inspect = $this->patientModel->getInspect($patient['PATIENT_CODE'],$inspectWhere);
-
+        $inspectArr = [];
         unset($patient['PATIENT_CODE']);
         foreach ($inspect as $k=>$v)
         {
+            $recog = '0';
             $lab = $this->patientModel->getLab($v['INSPECT_REPORT_CODE']);
             $inspect[$k]['INSPECT_REPORT_ITEMS'] = $lab;
             unset($inspect[$k]['INSPECT_REPORT_CODE']);
+            if($hr == 1)
+            {
+                if($v['RECOG_STATUS'] == '*')
+                {
+                    $inspectArr[] = $inspect[$k];
+                    continue;
+                }else{
+                    foreach ($lab as $value)
+                    {
+                        if($value['RECOG_STATUS'] == '*')
+                        {
+                            $recog = '1';
+                        }
+                    }
+                    if($recog == '0')
+                    {
+                        unset($inspect[$k]);
+                        continue;
+                    }
+                }
+                $inspectArr[] = $inspect[$k];
+            }
         }
         $data = [
             'PATIENT'=>$patient,
             'MEDICAL_INFORMATION'=>$medical,
             'EXAM_REPORTS'=>$exam,
-            'INSPECT_REPORTS'=>$inspect
+            'INSPECT_REPORTS'=>$inspectArr
         ];
         return $data;
     }
@@ -931,14 +953,25 @@ class PatientServies
 
     public function postExamReport($params): string
     {
-        $information = $this->patientModel->getMedicalData(['HOS_EMPI'=>$params['MEDICAL_INFORMATION']['HOS_EMPI']],'*');
-        if(empty($information))
+        $hosEmpi = $params['MEDICAL_INFORMATION']['HOS_EMPI'] ?? '';
+        if(!empty($hosEmpi))
         {
-            return '';
+            $hosEmpi = explode(';',$hosEmpi);
+        }
+        if(!empty($hosEmpi))
+        {
+            foreach ($hosEmpi as $v)
+            {
+                $information = $this->patientModel->getMedicalData(['HOS_EMPI'=>$v,'ORGCODE'=>$params['MEDICAL_INFORMATION']['ORGCODE']],'*');
+                if(empty($information))
+                {
+                    return '';
+                }
+                $EXAM_REPORTS = $this->makeExamData($params['EXAM_REPORTS']);
+                $report = $this->patientModel->getExamReport(['PATIENT_CODE'=>$information['PATIENT_CODE'],'HOS_EMPI'=>$v],'*');
+                $report->save($EXAM_REPORTS);
+            }
         }
-        $EXAM_REPORTS = $this->makeExamData($params['EXAM_REPORTS']);
-        $report = $this->patientModel->getExamReport(['PATIENT_CODE'=>$information['PATIENT_CODE']],'*');
-        $report->save($EXAM_REPORTS);
         return 'success';
     }
 
@@ -963,7 +996,7 @@ class PatientServies
         $EXAM_REPORTS_INSERT = [];
         foreach ($EXAM_REPORTS as $k=>$v)
         {
-            $report = $this->patientModel->getExamReport(['EXAM_REPORT_CODE'=>$v['EXAM_REPORT_CODE']],'*');
+            $report = $this->patientModel->getExamReport(['EXAM_REPORT_CODE'=>$v['EXAM_REPORT_CODE'],'HOS_EMPI'=>$v['HOS_EMPI']],'*');
             if(!empty($report))
             {
                 $this->patientModel->saveRepeatReport($report);