|
@@ -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);
|