yanzai 1 year ago
parent cc59eb387d
commit 0f704da056

@ -77,6 +77,7 @@ class EntrustController extends Controller
public function CreateRecordXml(Request $request) public function CreateRecordXml(Request $request)
{ {
$xmlString = $request->getContent(); // 获取请求的原始内容XML $xmlString = $request->getContent(); // 获取请求的原始内容XML
$res = explode('<soap:Body>', $xmlString)[1]; $res = explode('<soap:Body>', $xmlString)[1];
$res = explode('</soap:Body>', $res)[0]; $res = explode('</soap:Body>', $res)[0];
$xmlData = simplexml_load_string($res); $xmlData = simplexml_load_string($res);

@ -40,6 +40,7 @@ class XmlLog
} }
public function RequestLog($arr,$id) public function RequestLog($arr,$id)
{ //记录请求日志 { //记录请求日志
date_default_timezone_set('PRC');
LogService::CheckTableName(); LogService::CheckTableName();
$table_name = 'zz_request_log_' . date('ym'); $table_name = 'zz_request_log_' . date('ym');
$response_data = isset($arr['response_data']) ? self::JsonEncode($arr['response_data']) : ''; $response_data = isset($arr['response_data']) ? self::JsonEncode($arr['response_data']) : '';

@ -1,52 +1,53 @@
<?php <?php
namespace App\Services\Xml; namespace App\Services\Xml;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ShenQingDanService class ShenQingDanService
{ {
public function Save($result,$jsonData) public function Save($result, $jsonData)
{ {
$Body= $result['message']['Request']["Body"]; $Body = $result['message']['Request']["Body"];
$Header=$result['message']['Request']["Header"]; $Header = $result['message']['Request']["Header"];
$orderList=isset($Body['AddRisAppBillRt']['OrderList'])?$Body['AddRisAppBillRt']['OrderList']:[]; $orderList = isset($Body['AddRisAppBillRt']['OrderList']) ? $Body['AddRisAppBillRt']['OrderList'] : [];
if (!empty($orderList) && !isset($orderList[0])) { if (!empty($orderList) && !isset($orderList[0])) {
// 如果OrderList当前不是数组的数组则将其转换为单元素数组 // 如果OrderList当前不是数组的数组则将其转换为单元素数组
$orderList = array($orderList); $orderList = array($orderList);
} }
$insert_count=0;//成功插入数量 $insert_count = 0;//成功插入数量
DB::beginTransaction(); DB::beginTransaction();
foreach ($orderList as $key => $order){ foreach ($orderList as $key => $order) {
$patient_type=null; $patient_type = null;
if(isset($Body["PATAdmInfo"]["PAADMTypeCode"])){ if (isset($Body["PATAdmInfo"]["PAADMTypeCode"])) {
$p=$Body["PATAdmInfo"]["PAADMTypeCode"]; $p = $Body["PATAdmInfo"]["PAADMTypeCode"];
if($p=='O') $patient_type=1; if ($p == 'O') $patient_type = 1;
if($p=='H') $patient_type=3; if ($p == 'H') $patient_type = 3;
if($p=='E') $patient_type=2; if ($p == 'E') $patient_type = 2;
if($p=='I') $patient_type=0; if ($p == 'I') $patient_type = 0;
} }
$params = [ $params = [
'list_status' => 0, 'list_status' => 0,
'reg_num' => $Body["PATPatientInfo"]["PATPatientID"] ?$Body["PATPatientInfo"]["PATPatientID"]: null, 'reg_num' => $Body["PATPatientInfo"]["PATPatientID"] ? $Body["PATPatientInfo"]["PATPatientID"] : null,
'user_name' => $Body["PATPatientInfo"]["PATName"] ?$Body["PATPatientInfo"]["PATName"]: null, 'user_name' => $Body["PATPatientInfo"]["PATName"] ? $Body["PATPatientInfo"]["PATName"] : null,
'user_sex' => $Body["PATPatientInfo"]["PATName"]=='男'?1: 2, 'user_sex' => $Body["PATPatientInfo"]["PATName"] == '男' ? 1 : 2,
'entrust_code' => $order["RISRCode"] ?$order["RISRCode"]: null, 'entrust_code' => $order["RISRCode"] ? $order["RISRCode"] : null,
'entrust' => $order["RISRDesc"] ?$order["RISRDesc"]: null, 'entrust' => $order["RISRDesc"] ? $order["RISRDesc"] : null,
'is_pay' => $order["OrdBillStatus"]=='已收费' ? 1: 0, 'is_pay' => $order["OrdBillStatus"] == '已收费' ? 1 : 0,
'reservation_department' => $order["AppDeptDesc"] ?$order["AppDeptDesc"]: null, 'reservation_department' => $order["AppDeptDesc"] ? $order["AppDeptDesc"] : null,
'entrust_date' =>$order["RISRSubmitTime"] ?substr($order["RISRSubmitTime"], 0, 10): null, 'entrust_date' => $order["RISRSubmitTime"] ? substr($order["RISRSubmitTime"], 0, 10) : null,
'entrust_time' => $order["RISRSubmitTime"] ?substr($order["RISRSubmitTime"], 11, 8): null, 'entrust_time' => $order["RISRSubmitTime"] ? substr($order["RISRSubmitTime"], 11, 8) : null,
'user_brithday' =>$Body["PATPatientInfo"]["PATDob"] ?$Body["PATPatientInfo"]["PATDob"]: null, 'user_brithday' => $Body["PATPatientInfo"]["PATDob"] ? $Body["PATPatientInfo"]["PATDob"] : null,
'docotr' => $Body["PATAdmInfo"]["PAADMDocDesc"] ?$Body["PATAdmInfo"]["PAADMDocDesc"]: null, 'docotr' => $Body["PATAdmInfo"]["PAADMDocDesc"] ? $Body["PATAdmInfo"]["PAADMDocDesc"] : null,
'patient_type' =>$patient_type, 'patient_type' => $patient_type,
'user_phone' => $Body["PATPatientInfo"]["PATTelephone"] ? $Body["PATPatientInfo"]["PATTelephone"]: null, 'user_phone' => $Body["PATPatientInfo"]["PATTelephone"] ? $Body["PATPatientInfo"]["PATTelephone"] : null,
'implement_department' => $order["RISRAcceptDeptDesc"] ?$order["RISRAcceptDeptDesc"]: null, 'implement_department' => $order["RISRAcceptDeptDesc"] ? $order["RISRAcceptDeptDesc"] : null,
'entrust_id' => $order["OEORIOrderItemID"] ?$order["OEORIOrderItemID"]: null,//his传过来的本地医嘱id 'entrust_id' => $order["OEORIOrderItemID"] ? $order["OEORIOrderItemID"] : null,//his传过来的本地医嘱id
'episodeid' => $Body["PATAdmInfo"]["PAADMVisitNumber"] ?$Body["PATAdmInfo"]["PAADMVisitNumber"]: null, //就诊号 'episodeid' => $Body["PATAdmInfo"]["PAADMVisitNumber"] ? $Body["PATAdmInfo"]["PAADMVisitNumber"] : null, //就诊号
'RISRExamID' =>$order["RISRExamID"] ?$order["RISRExamID"]: null, //检查号 'RISRExamID' => $order["RISRExamID"] ? $order["RISRExamID"] : null, //检查号
'RISRAcceptDeptCode' => $order["RISRAcceptDeptCode"] ?$order["RISRAcceptDeptCode"]: null, //接收科室代码 'RISRAcceptDeptCode' => $order["RISRAcceptDeptCode"] ? $order["RISRAcceptDeptCode"] : null, //接收科室代码
'warddesc' => $Body["PATAdmInfo"]["PAADMAdmWardDesc"]? $Body["PATAdmInfo"]["PAADMAdmWardDesc"] :null, //病区 'warddesc' => $Body["PATAdmInfo"]["PAADMAdmWardDesc"] ? $Body["PATAdmInfo"]["PAADMAdmWardDesc"] : null, //病区
'beddesc' => $Body["PATAdmInfo"]["PAADMCurBedNo"]? $Body["PATAdmInfo"]["PAADMCurBedNo"] :null, //病床号 'beddesc' => $Body["PATAdmInfo"]["PAADMCurBedNo"] ? $Body["PATAdmInfo"]["PAADMCurBedNo"] : null, //病床号
]; ];
$requiredFields = [ $requiredFields = [
'reg_num', 'user_name', 'user_sex', 'entrust', 'is_pay', 'reg_num', 'user_name', 'user_sex', 'entrust', 'is_pay',
@ -79,21 +80,23 @@ class ShenQingDanService
} else { } else {
DB::rollBack(); DB::rollBack();
return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], -1, '失败');
} }
}else { } else {
DB::rollBack(); DB::rollBack();
return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], -1, '失败');
} }
} }
if(count($orderList)==$insert_count){ if (count($orderList) == $insert_count) {
DB::commit(); DB::commit();
return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],0,'成功'); return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], 0, '成功');
}else{ } else {
DB::rollBack(); DB::rollBack();
return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], -1, '失败');
} }
} }
} }

Loading…
Cancel
Save