diff --git a/Laravel.zip b/Laravel.zip index 7a0adac..e4bc4a8 100644 Binary files a/Laravel.zip and b/Laravel.zip differ diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php index ed3168f..1dc7177 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php @@ -80,14 +80,18 @@ class WorkMainController extends Controller $userInfo = DB::table('users')->where(['id' => $userid])->get(); $department_id = $userInfo[0]->department_id; $department = DB::table('s_department')->where(['id' => $department_id,'is_del'=>0])->first(); - if(!$department) return \Yz::echoError1('科室信息不存在'); + // if(!$department) return \Yz::echoError1('科室信息不存在'); $list=DB::table('s_list') ->leftJoin('s_period','s_list.reservation_time','=','s_period.id') ->leftJoin('s_department_resources','s_list.reservation_sources','=','s_department_resources.id') - ->select('s_list.*','s_period.period_begin_time','s_period.period_end_time','s_department_resources.department_resources_name') - ->where(['RISRAcceptDeptCode'=>$department->department_number]); + ->select('s_list.*','s_period.period_begin_time','s_period.period_end_time','s_department_resources.department_resources_name'); + if($userInfo[0]->group==2){ + $list=$list->whereIn('warddesc', explode(",", $userInfo[0]->ward)); + }else{ + $list=$list->where(['RISRAcceptDeptCode'=>$department->department_number]); + } if ($searchInfo['dateRange']!=null and count($searchInfo['dateRange']) == 2) { $list = $list->where(function ($q) use($searchInfo) { $q->whereBetween('s_list.entrust_date', $searchInfo['dateRange']) diff --git a/Laravel/app/Http/Controllers/API/Third/EntrustController.php b/Laravel/app/Http/Controllers/API/Third/EntrustController.php index eeb9e08..a3234d4 100644 --- a/Laravel/app/Http/Controllers/API/Third/EntrustController.php +++ b/Laravel/app/Http/Controllers/API/Third/EntrustController.php @@ -6,6 +6,7 @@ use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Log; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +use App\Services\Xml\ShenQingDanService; class EntrustController extends Controller { @@ -76,30 +77,18 @@ class EntrustController extends Controller public function CreateRecordXml(Request $request) { $xmlString = $request->getContent(); // 获取请求的原始内容(XML) - $xmlData = simplexml_load_string($xmlString); - $jsonData = json_encode($xmlData); - Log::info($jsonData); - - // 准备数据 - $data = [ - 'Response' => [ - 'Body' => [ - 'ResultCode' => '0', - 'ResultContent' => '成功', - 'SuccessIDList' => null, // 或者使用空数组 [] - ], - ], - ]; + $res = explode('', $xmlString)[1]; + $res = explode('', $res)[0]; + $xmlData = simplexml_load_string($res); + $jsonData = json_encode($xmlData,JSON_UNESCAPED_UNICODE); + $result = json_decode($jsonData, true); + //如果是推送的检查申请单 + if($result['action']=='T0002'){ + $service = new ShenQingDanService(); + return $service->Save($result,$jsonData); + } - // 将数据转换为 XML - $xml = simplexml_load_string('' . "\n"); - array_walk_recursive($data, function($value, $key) use ($xml) { - $child = $xml->addChild($key, $value); - }); - $xmlString = $xml->asXML(); + } - // 设置响应头为 XML 并返回 - return response($xmlString)->header('Content-Type', 'text/xml'); - } } diff --git a/Laravel/app/Http/Kernel.php b/Laravel/app/Http/Kernel.php index 36c175a..528aa34 100644 --- a/Laravel/app/Http/Kernel.php +++ b/Laravel/app/Http/Kernel.php @@ -67,5 +67,6 @@ class Kernel extends HttpKernel 'log' => \App\Http\Middleware\Log::class, 'check.sign' => \App\Http\Middleware\CheckSign::class, 'check.sign.xml' => \App\Http\Middleware\CheckSignXMl::class, + 'xmllog' => \App\Http\Middleware\XmlLog::class, ]; } diff --git a/Laravel/app/Http/Middleware/XmlLog.php b/Laravel/app/Http/Middleware/XmlLog.php new file mode 100644 index 0000000..e100ac9 --- /dev/null +++ b/Laravel/app/Http/Middleware/XmlLog.php @@ -0,0 +1,82 @@ +getContent()); + $routers=[ + "接收申请单"=>'/api/v1/T/CreateEntrustRecordXml', + ]; + + $insertid=0; + $data=[ + 'mark'=>array_search($request->getPathInfo(), $routers), + 'ip'=>Log::getTrustedProxiesIp(), + 'request_header'=>$request->header(), + 'post_data'=>$request->getContent(), + 'get_data'=>[], + 'request_url'=>$request->getPathInfo() + ]; + $insertid= self::RequestLog($data,$insertid); + + $response= $next($request); + self::RequestLog(['response_data'=>self::JsonEncode($response->getContent())],$insertid); + return $response; + } + public function RequestLog($arr,$id) + { //记录请求日志 + LogService::CheckTableName(); + $table_name = 'zz_request_log_' . date('ym'); + $response_data = isset($arr['response_data']) ? self::JsonEncode($arr['response_data']) : ''; + $header_data = isset($arr['request_header']) ?self::JsonEncode($arr['request_header']):''; + $post_data = isset($arr['post_data'])?self::JsonEncode($arr['post_data']):''; + $get_data = isset($arr['get_data'])?self::JsonEncode($arr['get_data'], JSON_UNESCAPED_UNICODE):''; + $milliseconds = round(microtime(true) * 1000); + $date = date("Y-m-d H:i:s", $milliseconds / 1000); + $formatted_date = sprintf("%s.%03d", $date, $milliseconds % 1000); + + // $i=DB::insert("insert into ".$table_name." (request_ip, response_data,header_data,post_data,get_data,request_url,create_time,update_time) + // values (?,?,?,?,?,?,?,?)",[$arr['ip'],$response_data,$header_data,$post_data,$get_data,$arr['request_url'],$formatted_date,$formatted_date]); + // var_dump($i); + if ($id > 0) { + return DB::table($table_name)->where('id', $id)->update([ + 'response_data' => $response_data, + ]); + } else { + return DB::table($table_name)->insertGetId([ + 'mark'=>$arr['mark'], + 'request_ip' => $arr['ip'], + 'response_data' => $response_data, + 'header_data' => $header_data, + 'post_data' => $post_data, + 'get_data' => $get_data, + 'request_url' => $arr['request_url'], + 'create_time' => $formatted_date, + 'update_time' => $formatted_date + ]); + } + } + public static function JsonEncode($data){ //格式化数据,转json + $post_data =$data; + $post_data = json_encode($post_data, JSON_UNESCAPED_UNICODE); + $str_len = mb_strlen($post_data); + $str_size = $str_len / 1024; + if ($str_size > 40) $post_data = '{"data":"Row size too large"}'; + return $post_data; + } +} diff --git a/Laravel/app/Lib/Yz.php b/Laravel/app/Lib/Yz.php index 2bb8947..7dcb3ad 100644 --- a/Laravel/app/Lib/Yz.php +++ b/Laravel/app/Lib/Yz.php @@ -26,5 +26,30 @@ class Yz{ $result['data']=$data; return $result; } + public static function XMLReturn($SourceSystem,$MessageID,$code,$msg) + { + // 准备数据 + $data = [ + 'Response' => [ + 'Header'=>[ + 'SourceSystem'=>$SourceSystem, + 'MessageID'=>$MessageID, + ], + 'Body' => [ + 'ResultCode' => $code, + 'ResultContent' => $msg, + 'SuccessIDList' => null, // 或者使用空数组 [] + ], + ], + ]; + // 将数据转换为 XML + $xml = simplexml_load_string('' . "\n"); + array_walk_recursive($data, function($value, $key) use ($xml) { + $child = $xml->addChild($key, $value); + }); + $xmlString = $xml->asXML(); + // 设置响应头为 XML 并返回 + return response($xmlString)->header('Content-Type', 'text/xml'); + } } diff --git a/Laravel/app/Providers/SoapServiceProvider.php b/Laravel/app/Providers/SoapServiceProvider.php new file mode 100644 index 0000000..1f62528 --- /dev/null +++ b/Laravel/app/Providers/SoapServiceProvider.php @@ -0,0 +1,33 @@ +app->singleton(SoapService::class, function () { + // 这里替换为你的SOAP服务的WSDL地址 + $wsdlUrl = 'http://yijiyuyue//aa.wsdl'; + return new SoapService($wsdlUrl); + }); + } + + /** + * Bootstrap services. + * + * @return void + */ + public function boot() + { + // + } +} diff --git a/Laravel/app/Services/Admin/UserService.php b/Laravel/app/Services/Admin/UserService.php index 803c6c4..98dbad0 100644 --- a/Laravel/app/Services/Admin/UserService.php +++ b/Laravel/app/Services/Admin/UserService.php @@ -7,7 +7,7 @@ class UserService { public function GetInfoList($arr){ $list=DB::table('users as a') - ->select( 'a.id', 'a.cn_name as cname','a.username as uname','a.status','a.created_at','b.group_name','c.department_name') + ->select( 'a.id', 'a.cn_name as cname','a.username as uname','a.status','a.created_at','b.group_name','c.department_name','a.ward') ->leftJoin('group as b','a.group','=','b.id') ->leftJoin('s_department as c','a.department_id','=','c.id'); if(isset($arr['status'])){ diff --git a/Laravel/app/Services/LogService.php b/Laravel/app/Services/LogService.php index 03879b3..acc1b16 100644 --- a/Laravel/app/Services/LogService.php +++ b/Laravel/app/Services/LogService.php @@ -49,6 +49,7 @@ class LogService }else{ Schema::create($table_name, function (Blueprint $table) { $table->id(); + $table->string('mark', 100)->nullable(); $table->string('request_ip', 15); $table->text('post_data'); $table->text('get_data'); diff --git a/Laravel/app/Services/SoapService.php b/Laravel/app/Services/SoapService.php new file mode 100644 index 0000000..3fbe9f9 --- /dev/null +++ b/Laravel/app/Services/SoapService.php @@ -0,0 +1,28 @@ + 1, + 'exceptions' => true, + ]; + + $this->client = new SoapClient($wsdlUrl, $options); + } + + public function callSoapMethod($methodName, array $params = []) + { + try { + return $this->client->__soapCall($methodName, $params); + } catch (\SoapFault $e) { + // 处理错误 + \Log::error('SOAP Fault: ' . $e->getMessage()); + throw $e; + } + } +} diff --git a/Laravel/app/Services/Xml/ShenQingDanService.php b/Laravel/app/Services/Xml/ShenQingDanService.php new file mode 100644 index 0000000..27b0ff5 --- /dev/null +++ b/Laravel/app/Services/Xml/ShenQingDanService.php @@ -0,0 +1,99 @@ + $order){ + $patient_type=null; + if(isset($Body["PATAdmInfo"]["PAADMTypeCode"])){ + $p=$Body["PATAdmInfo"]["PAADMTypeCode"]; + if($p=='O') $patient_type=1; + if($p=='H') $patient_type=3; + if($p=='E') $patient_type=2; + if($p=='I') $patient_type=0; + } + $params = [ + 'list_status' => 0, + 'reg_num' => $Body["PATPatientInfo"]["PATPatientID"] ?$Body["PATPatientInfo"]["PATPatientID"]: null, + 'user_name' => $Body["PATPatientInfo"]["PATName"] ?$Body["PATPatientInfo"]["PATName"]: null, + 'user_sex' => $Body["PATPatientInfo"]["PATName"]=='男'?1: 2, + 'entrust_code' => $order["RISRCode"] ?$order["RISRCode"]: null, + 'entrust' => $order["RISRDesc"] ?$order["RISRDesc"]: null, + 'is_pay' => $order["OrdBillStatus"]=='已收费' ? 1: 0, + 'reservation_department' => $order["AppDeptDesc"] ?$order["AppDeptDesc"]: null, + 'entrust_date' =>$order["RISRSubmitTime"] ?substr($order["RISRSubmitTime"], 0, 10): null, + 'entrust_time' => $order["RISRSubmitTime"] ?substr($order["RISRSubmitTime"], 11, 8): null, + 'user_brithday' =>$Body["PATPatientInfo"]["PATDob"] ?$Body["PATPatientInfo"]["PATDob"]: null, + 'docotr' => $Body["PATAdmInfo"]["PAADMDocDesc"] ?$Body["PATAdmInfo"]["PAADMDocDesc"]: null, + 'patient_type' =>$patient_type, + 'user_phone' => $Body["PATPatientInfo"]["PATTelephone"] ? $Body["PATPatientInfo"]["PATTelephone"]: null, + 'implement_department' => $order["RISRAcceptDeptDesc"] ?$order["RISRAcceptDeptDesc"]: null, + 'entrust_id' => $order["OEORIOrderItemID"] ?$order["OEORIOrderItemID"]: null,//his传过来的本地医嘱id + 'episodeid' => $Body["PATAdmInfo"]["PAADMVisitNumber"] ?$Body["PATAdmInfo"]["PAADMVisitNumber"]: null, //就诊号 + 'RISRExamID' =>$order["RISRExamID"] ?$order["RISRExamID"]: null, //检查号 + 'RISRAcceptDeptCode' => $order["RISRAcceptDeptCode"] ?$order["RISRAcceptDeptCode"]: null, //接收科室代码 + 'warddesc' => $Body["PATAdmInfo"]["PAADMAdmWardDesc"]? $Body["PATAdmInfo"]["PAADMAdmWardDesc"] :null, //病区 + 'beddesc' => $Body["PATAdmInfo"]["PAADMCurBedNo"]? $Body["PATAdmInfo"]["PAADMCurBedNo"] :null, //病床号 + ]; + $requiredFields = [ + 'reg_num', 'user_name', 'user_sex', 'entrust', 'is_pay', + 'reservation_department', 'entrust_date', 'entrust_time', + 'user_brithday', 'docotr', 'patient_type', 'user_phone', + 'implement_department', 'entrust_id', 'episodeid', + 'RISRExamID', 'RISRAcceptDeptCode' + ]; + + // 判断是否为空 + foreach ($requiredFields as $field) { + if (!isset($params[$field]) || $params[$field] === null) { + return \Yz::echoError1('参数' . $field . '不能为空'); + } + } + + $insertListId = DB::table('s_list')->insertGetId($params); + if ($insertListId) { + $data = [ + 'list_id' => $insertListId, + 'reg_num' => $Body["PATPatientInfo"]["PATPatientID"], + 'new_status' => 0, + 'create_user' => '接口', + 'note' => '创建记录', + 'data' => $jsonData,//原始数据 + ]; + $insertLog = DB::table('s_list_log')->insert($data); + if ($insertLog) { + $insert_count++; + + } else { + DB::rollBack(); + return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); + } + }else { + DB::rollBack(); + return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); + } + + } + if(count($orderList)==$insert_count){ + DB::commit(); + return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],0,'成功'); + }else{ + DB::rollBack(); + return \Yz::XMLReturn($Header['SourceSystem'],$Header['MessageID'],-1,'失败'); + } + } + +} diff --git a/Laravel/config/app.php b/Laravel/config/app.php index ef6ebfa..ec0baf4 100644 --- a/Laravel/config/app.php +++ b/Laravel/config/app.php @@ -188,7 +188,7 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - + App\Providers\SoapServiceProvider::class, ], /* diff --git a/Laravel/public/jq_page/appointment.html b/Laravel/public/jq_page/appointment.html index d0853d6..11e261a 100644 --- a/Laravel/public/jq_page/appointment.html +++ b/Laravel/public/jq_page/appointment.html @@ -20,6 +20,7 @@ let today_date='' let tomorrowDate='' let MainInfo_ids=[];//选中的检查项目对应的mainid + let PrintInfo=null;//打印信息 //获取url参数 function getParameterByName(name, url) { if (!url) url = decodeURIComponent(window.location.href) @@ -361,13 +362,57 @@ } $('#dayin_button').on('click',function(){ + PrintInfo=null + $("#shenqingdan").html('') if($(".lanse_bg").length==0){ MsgAlert('请选择要打印的申请单'); return false; } - $("#shenqingdan").show(); - $("#shenqingdan").jqprint(); - $("#shenqingdan").hide(); + let enids='' + $('.lanse_bg').each(function(){ + enids=enids+$(this).data('entrustid')+',' + }) + //调用接口查询项目详情 + $('#loadingModal').modal('show'); + $.post(BaseUrl+'/api/admin/getMainDetail', { + regnum: getParameterByName('regnum'), + entrustid: enids, + episodeid: getParameterByName('episodeid'), + appointment_type:getParameterByName('appointment_type') + }, function(data) { + $('#loadingModal').modal('hide'); + if (data.status) { + let info=data.data.info + let enable=true + info.forEach(function(v,i){ + if(v.maininfo.list_status!=1){ + MsgAlert(v.maininfo.entrust+" 不可打印,请重新选择"); + enable=false + } + }) + if(enable){ + PrintInfo=data.data.info + PrintInfo.forEach(function(v,i){ + console.log(i) + $("#shenqingdan").append( + '
' + + '
深圳市南山区妇幼保健院
'+ + '
检查申请单
'+ + '
'+ + '
检查项目:'+v.maininfo.entrust+'
'+ + '
'+ + '
' + ) + }) + + $("#shenqingdan").show(); + $("#shenqingdan").jqprint(); + $("#shenqingdan").hide(); + } + } + + }) + }) $('#shuaxin_button').on('click',function(){ window.location.reload() @@ -557,8 +602,15 @@
- fds -
+ + +
@@ -625,6 +677,10 @@ .lanse_bg{ background-color: #31b0d5; } + #yizhulist{ + height:100vh; + overflow-y: auto; + } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 8dc64f4..75296ea 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -121,8 +121,8 @@ Route::group(['middleware'=>['check.sign','log'],'prefix'=>'v1'],function () { }); //对外接口 -Route::group(['middleware'=>['check.sign.xml' ],'prefix'=>'v1'],function () { - Route::post('T/CreateEntrustRecordXml','App\Http\Controllers\API\Third\EntrustController@CreateRecordXml');//获取个人医嘱列表 +Route::group(['middleware'=>['xmllog'],'prefix'=>'v1'],function () { + Route::post('T/CreateRecordXml','App\Http\Controllers\API\Third\EntrustController@CreateRecordXml');//获取个人医嘱列表 }); diff --git a/YiJi-admin/dist.zip b/YiJi-admin/dist.zip index e0cd0e5..ea047e2 100644 Binary files a/YiJi-admin/dist.zip and b/YiJi-admin/dist.zip differ diff --git a/YiJi-admin/src/views/Index.vue b/YiJi-admin/src/views/Index.vue index 5c2bedf..ea1c04b 100644 --- a/YiJi-admin/src/views/Index.vue +++ b/YiJi-admin/src/views/Index.vue @@ -5,7 +5,11 @@ +