修改自动预约,完善细节

main
yanzai 1 year ago
parent 5855d9b98c
commit 440b436c76

@ -10,13 +10,13 @@ class Yz{
$result=array();
$result['status']='no';
$result['msg']=$msg;
return response()->json($result)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
return $result;
}
public static function echoError1($msg){
$result=array();
$result['status']=false;
$result['msg']=$msg;
return response()->json($result)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
return $result;
}
public static function Return($status,$msg,$data=[]){
@ -38,18 +38,35 @@ class Yz{
'Body' => [
'ResultCode' => $code,
'ResultContent' => $msg,
'SuccessIDList' => null, // 或者使用空数组 []
'SuccessIDList' => [1,2,4], // 或者使用空数组 []
],
],
];
// 将数据转换为 XML
$xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?>' . "<root/>");
array_walk_recursive($data, function($value, $key) use ($xml) {
$child = $xml->addChild($key, $value);
});
// array_walk_recursive($data, function($value, $key) use ($xml) {
// $child = $xml->addChild($key, $value);
// });
// 递归添加数据到 XML
self::addNode($xml, $data);
$xmlString = $xml->asXML();
// 设置响应头为 XML 并返回
return response($xmlString)->header('Content-Type', 'text/xml');
}
private static function addNode(SimpleXMLElement $xml, array $data)
{
foreach ($data as $key => $value) {
if (is_array($value)) {
// 如果值是一个数组,则创建一个新节点并递归调用
$node = $xml->addChild($key);
self::addNode($node, $value);
} else {
// 否则直接添加节点
$xml->addChild($key, $value);
}
}
}
}

@ -212,7 +212,7 @@ WHERE
$enableCheckTime = $date;//到此时间后可进行预约
$plan_dateTime = $planInfo->date . ' ' . $planInfo->end_time;
$plan_dateTime = new DateTime($plan_dateTime);
if ($plan_dateTime < $enableCheckTime) return \Yz::echoError1($item->item_name . " 已设置只能预约医嘱开具后" . $item->check_begin_time . "分钟后的时间,请预约" . $enableCheckTime->format("Y-m-d H:i:s") . "之后的时间");
if ($plan_dateTime < $enableCheckTime and $item->check_begin_time>0) return \Yz::echoError1($item->item_name . " 已设置只能预约医嘱开具后" . $item->check_begin_time . "分钟后的时间,请预约" . $enableCheckTime->format("Y-m-d H:i:s") . "之后的时间");
//检测是否空腹
$configs = DB::table('configs')->where('label', '开启空腹')->first();
@ -333,6 +333,59 @@ WHERE
}
public function AutoYuYue($regnum,$entrustids,$episodeid,$appointment_type)
{
$dateRange=config('app.globals.可用号源查询范围');
// $regnum = request('regnum');
// $entrustids = request('entrustid');
// $episodeid = request('episodeid');
// $appointment_type = request('appointment_type'); //预约类型
$TodayDateTime = date("Y-m-d H:i:s");
$startDate = new DateTime();
// 设定结束日期为当前日期加7天
$endDate = new DateTime();
$endDate->modify('+' . $dateRange . ' day');
// 循环遍历每一天
$currentDate = $startDate;
$enable_plan=false;
while ($currentDate <= $endDate) {
$nowdate = $currentDate->format('Y-m-d');
$s = $this->GetEnablePlan($regnum, $entrustids, $episodeid, $appointment_type, $nowdate);
if ($s['status']) {
$list = $s['data']['plan_list'];
if (count($list) > 0) {
foreach ($list as $k => $v) {
if($v->count-$v->used_count>0 and $TodayDateTime< $v->date.' '.$v->end_reservation_time){
$enable_plan=$v;
break;
}
}
if(!!$enable_plan){
break;
}
}
}
// 每次循环增加一天
$currentDate->modify('+1 day');
}
if(!!$enable_plan){
$mainlistids=DB::table('s_list')->whereIn('entrust_id',$entrustids)->pluck('id')->toArray();
$yuyue=$this->YuYue($enable_plan->id, $appointment_type, $mainlistids, 1);
if($yuyue['status']==false){
return \Yz::echoError1($yuyue['msg']);
}
if($yuyue['status']===true){
return \Yz::Return(true,"预约成功",['entrust_id'=>$entrustids,'date'=>$enable_plan->date,'begin_time'=>$enable_plan->begin_time,'end_time'=>$enable_plan->end_time]);
}
}else{
return \Yz::echoError1('最近'.$dateRange.'日无可用号源');
}
}
public function CancelYuYue($MainListId, $reg_num)
{

@ -2,6 +2,8 @@
namespace App\Services\Xml;
use App\Http\Controllers\API\Admin\YeWu\PlanListController;
use App\Services\Admin\YeWu\PlanListService;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@ -18,6 +20,7 @@ class ShenQingDanService
$orderList = array($orderList);
}
$insert_count = 0;//成功插入数量
$yuyueInfo=false;//自动预约信息
DB::beginTransaction();
foreach ($orderList as $key => $order) {
$patient_type = null;
@ -71,6 +74,17 @@ class ShenQingDanService
$insertListId = DB::table('s_list')->insertGetId($params);
if ($insertListId) {
if(config('app.globals.自动预约')==1){
$planser=new PlanListService();
$yuyue= $planser->AutoYuYue($params['reg_num'],[$params['entrust_id']],$params['episodeid'],1);
if($yuyue['status']==false){
DB::rollBack();
return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], -1, '自动预约失败,'.$yuyue['msg'].',推送失败');
}
if($yuyue['status']===true){
$yuyueInfo[]=$yuyue['data'];
}
}
$data = [
'list_id' => $insertListId,
'reg_num' => $Body["PATPatientInfo"]["PATPatientID"],
@ -95,7 +109,8 @@ class ShenQingDanService
}
if (count($orderList) == $insert_count) {
DB::commit();
return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], 0, '成功');
return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], 0, ['SendStatus'=>true,"YuyueInfo"=>$yuyueInfo]);
} else {
DB::rollBack();
return \Yz::XMLReturn($Header['SourceSystem'], $Header['MessageID'], -1, '失败');

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>测试医院-医技预约</title>
<title>演示医院-医技预约</title>
</head>
<body>
<div id="app"></div>

@ -6,7 +6,7 @@
<el-col :span="3" class="logo" style="min-width: 250px;">
<div><img :src="configInfo.站点图片"/></div>
<div>
<div style="font-size: 16px;">医技预约</div>
<div style="font-size: 16px;">演示医院</div>
<div>{{configInfo.站点名称}}</div>
</div>
</el-col>
@ -54,7 +54,7 @@
<el-aside>
<el-menu class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :default-active="activeMenu"
:collapse="isCollapse" >
<el-menu-item index="2-222" @click="to('dashboard')">
<el-menu-item index="2-222" @click="to('dashboard')" style="display: none;">
<el-icon>
<Menu />
</el-icon>
@ -199,12 +199,16 @@ watch(()=>router.currentRoute.value,(newVal,oldVal)=>{
console.log(route.path)
let BingQu=[2]; //
let QiTa=[3]; //
let Guanli=[1,5];//
if(QiTa.includes(res.info[0].group) && route.path=='/dashboard'){
window.location.href = "./#/yewu/mainList"
}
if(BingQu.includes(res.info[0].group) && route.path=='/dashboard'){
window.location.href = "./#/yewu/MainList_ZhuYuan"
}
if(Guanli.includes(res.info[0].group) && route.path=='/dashboard'){
window.location.href = "./#/yewu/departmentResources"
}
})
}
let configInfo=ref('');

@ -112,6 +112,16 @@
v-if="scope.row.period_begin_time && scope.row.period_end_time ">{{scope.row.period_begin_time.substring(0, 5)}}~{{scope.row.period_end_time.substring(0, 5)}}</span>
</template>
</el-table-column>
<el-table-column prop="department_resources_name" label="预约资源" width="120" />
<el-table-column prop="devices" label="服务组">
<template #default="scope">
<div style="white-space: nowrap;">
<span v-for="(item,index) in scope.row.devices" :key="index">
{{ item.device_name+ ' ' }}
</span>
</div>
</template>
</el-table-column>
<el-table-column prop="reservation_department" label="申请科室" width="120" />
<el-table-column prop="" label="医嘱时间" width="160">
<template #default="scope">
@ -127,19 +137,8 @@
<span v-if="scope.row.patient_type==3"></span>
</template>
</el-table-column>
<el-table-column prop="department_resources_name" label="预约资源" width="120" />
<el-table-column prop="user_phone" label="电话" width="120" />
<!-- <el-table-column prop="implement_department" label="执行科室" width="120" /> -->
<el-table-column prop="devices" label="服务组">
<template #default="scope">
<div style="white-space: nowrap;">
<span v-for="(item,index) in scope.row.devices" :key="index">
{{ item.device_name+ ' ' }}
</span>
</div>
</template>
</el-table-column>
<el-table-column prop="department_resources_name" label="操作" width="120">
<template #default="scope">
<el-button @click="showLog(scope.row)" size="small">查看日志</el-button>
@ -203,7 +202,7 @@
</el-dialog>
<div id="shenqingdan" v-if="shenqingdan_show">
<div v-for="(item,index) in shenqingdan_list" :key="index">
<div style="width: 100%;text-align: center;font-size: 14px;">深圳市南山区妇幼保健</div>
<div style="width: 100%;text-align: center;font-size: 14px;">演示医</div>
<div style="width: 100%;text-align: center;font-size: 18px;font-weight: bold;">检查申请单</div>
<div style="width: 100%; border: 1px solid #ccc;padding: 20px;">
<div>检查项目{{item.maininfo.entrust}}</div>

Loading…
Cancel
Save