|
@@ -12,6 +12,7 @@ use think\db\exception\DbException;
|
|
|
use think\db\exception\ModelNotFoundException;
|
|
|
use think\Exception;
|
|
|
use think\facade\Config;
|
|
|
+use think\facade\Log;
|
|
|
use Throwable;
|
|
|
use app\common\controller\ZskkApi;
|
|
|
use app\zskk\model\BiInspectReport;
|
|
@@ -780,10 +781,14 @@ class PatientServies
|
|
|
$patient = $this->patientModel->getPatient($where);
|
|
|
if(empty($patient))
|
|
|
{
|
|
|
- return '无法找到患者信息';
|
|
|
+ return [];
|
|
|
}
|
|
|
$patient = $patient->toArray();
|
|
|
$medical = $this->patientModel->getMedical($patient['PATIENT_CODE'],$medicalWhere);
|
|
|
+ if(empty($medical))
|
|
|
+ {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
$medical = empty($medical) ? $medical : $medical->toArray();
|
|
|
$examWhere = [];
|
|
|
$inspectWhere = [];
|
|
@@ -799,30 +804,36 @@ class PatientServies
|
|
|
{
|
|
|
$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'] == '*')
|
|
|
+ $labArr = [];
|
|
|
+ foreach ($lab as $value)
|
|
|
{
|
|
|
- $inspectArr[] = $inspect[$k];
|
|
|
- continue;
|
|
|
- }else{
|
|
|
- foreach ($lab as $value)
|
|
|
- {
|
|
|
- if($value['RECOG_STATUS'] == '*')
|
|
|
- {
|
|
|
- $recog = '1';
|
|
|
- }
|
|
|
- }
|
|
|
- if($recog == '0')
|
|
|
+ if($value['RECOG_STATUS'] == '*')
|
|
|
{
|
|
|
- unset($inspect[$k]);
|
|
|
- continue;
|
|
|
+ $recog = '1';
|
|
|
+ $labArr[] = $value;
|
|
|
}
|
|
|
}
|
|
|
+ if($recog == '0')
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $inspect[$k]['INSPECT_REPORT_ITEMS'] = $labArr;
|
|
|
+ $inspectArr[] = $inspect[$k];
|
|
|
+ }else{
|
|
|
+ $inspect[$k]['INSPECT_REPORT_ITEMS'] = $lab;
|
|
|
$inspectArr[] = $inspect[$k];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ if(empty($exam) && empty($inspectArr))
|
|
|
+ {
|
|
|
+ return [];
|
|
|
}
|
|
|
$data = [
|
|
|
'PATIENT'=>$patient,
|
|
@@ -873,7 +884,7 @@ class PatientServies
|
|
|
|
|
|
public function checkPostExamReport($params): array {
|
|
|
|
|
|
- $PATIENT = $this->commonServies->handlePATIENT($params['PATIENT'], $params['MEDICAL_INFORMATION']);
|
|
|
+ $PATIENT = $this->commonServies->handlePATIENT($params['PATIENT'], $params['MEDICAL_INFORMATION'],$params['MEDICAL_INFORMATION']['HOS_EMPI']);
|
|
|
$MEDICAL_INFORMATION = $this->commonServies->handleMEDICAL_INFORMATION($params['MEDICAL_INFORMATION'], $PATIENT);
|
|
|
|
|
|
$EXAM = $this->commonServies->handleEXAM($params['EXAM_REPORTS'], $MEDICAL_INFORMATION);
|
|
@@ -897,7 +908,7 @@ class PatientServies
|
|
|
|
|
|
public function checkPostLisReport($params): array {
|
|
|
|
|
|
- $PATIENT = $this->commonServies->handlePATIENT($params['PATIENT'], $params['MEDICAL_INFORMATION']);
|
|
|
+ $PATIENT = $this->commonServies->handlePATIENT($params['PATIENT'], $params['MEDICAL_INFORMATION'],$params['INSPECT_REPORTS']['REPORTID']);
|
|
|
$MEDICAL_INFORMATION = $this->commonServies->handleMEDICAL_INFORMATION($params['MEDICAL_INFORMATION'], $PATIENT);
|
|
|
|
|
|
$reportModel = $this->commonServies->handleINSPECT_REPORTS($params, $MEDICAL_INFORMATION);
|
|
@@ -954,6 +965,10 @@ class PatientServies
|
|
|
public function postExamReport($params): string
|
|
|
{
|
|
|
$hosEmpi = $params['MEDICAL_INFORMATION']['HOS_EMPI'] ?? '';
|
|
|
+ if($params['MEDICAL_INFORMATION']['ORGCODE'] == '121403004061412685')
|
|
|
+ {
|
|
|
+ Log::record('阳泉一院的检验报告信息参数'.json_encode($params));
|
|
|
+ }
|
|
|
if(!empty($hosEmpi))
|
|
|
{
|
|
|
$hosEmpi = explode(';',$hosEmpi);
|
|
@@ -968,7 +983,13 @@ class PatientServies
|
|
|
return '';
|
|
|
}
|
|
|
$EXAM_REPORTS = $this->makeExamData($params['EXAM_REPORTS']);
|
|
|
+// Log::record('检查报告的hosempi为'.$v);
|
|
|
+// Log::record('患者code为'.$information['PATIENT_CODE']);
|
|
|
$report = $this->patientModel->getExamReport(['PATIENT_CODE'=>$information['PATIENT_CODE'],'HOS_EMPI'=>$v],'*');
|
|
|
+ if(empty($report))
|
|
|
+ {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
$report->save($EXAM_REPORTS);
|
|
|
}
|
|
|
}
|
|
@@ -996,7 +1017,7 @@ class PatientServies
|
|
|
$EXAM_REPORTS_INSERT = [];
|
|
|
foreach ($EXAM_REPORTS as $k=>$v)
|
|
|
{
|
|
|
- $report = $this->patientModel->getExamReport(['EXAM_REPORT_CODE'=>$v['EXAM_REPORT_CODE'],'HOS_EMPI'=>$v['HOS_EMPI']],'*');
|
|
|
+ $report = $this->patientModel->getExamReport(['EXAM_REPORT_CODE'=>$v['EXAM_REPORT_CODE']],'*');
|
|
|
if(!empty($report))
|
|
|
{
|
|
|
$this->patientModel->saveRepeatReport($report);
|