main
yanzai 1 year ago
parent ffaf379ab3
commit 7ced139ed2

@ -125,13 +125,30 @@ class PlanListController extends Controller
]);
if (!$i_c) {
DB::rollBack();
return \Yz::echoError1('创建失败');
return \Yz::echoError1('渠道数量创建失败');
}
}
} else {
DB::rollBack();
return \Yz::echoError1('模板数量信息异常,请重新选择!异常模板Id:' . $model->id);
}
if(isset($model->device_id)){
$device_ids =explode(",", $model->device_id);
foreach ($device_ids as $dv_key=>$dv_value){
$i_dev = DB::table('s_source_roster_detail_device')->insert([
'roster_detail_id' => $plan_id,
'device_id' => $dv_value,
]);
if (!$i_dev) {
DB::rollBack();
return \Yz::echoError1('设备关联创建失败');
}
}
}else{
DB::rollBack();
return \Yz::echoError1('模板未关联设备,请重新选择!异常模板Id:' . $model->id);
}
}
}
@ -297,10 +314,19 @@ class PlanListController extends Controller
$episodeid = request('episodeid');
$appointment_type = request('appointment_type'); //预约类型
$appointment_date = request('date'); //预约日期
$service = new PlanListService();
return $service->GetEnablePlan($regnum,$entrustid,$episodeid,$appointment_type,$appointment_date);
}
//获取最近可用的,计划 日期
public function EnablePlanDate()
{
$regnum = request('regnum');
$entrustid = request('entrustid');
$episodeid = request('episodeid');
$appointment_type = request('appointment_type'); //预约类型
$appointment_date = request('date'); //预约日期
}
//开始预约占用名额
public function YuYue()

@ -16,15 +16,59 @@ class WorkMainController extends Controller
{
date_default_timezone_set('PRC');
$regnum = request('regnum');
$entrustid = request('entrustid');
$entrustids = request('entrustid');
$episodeid = request('episodeid');
$info = DB::table('s_list')->where(['reg_num' => $regnum,'entrust_id'=>$entrustid,'episodeid'=>$episodeid])->first();
$appointment_type=request('appointment_type');
$arrayEntrustids = explode(",", $entrustids);
$info = DB::table('s_list as a')->where(['a.reg_num' => $regnum, 'a.episodeid'=>$episodeid,'a.is_nullify'=>0])
->select('a.*','c.period_begin_time','c.period_end_time')
->leftJoin('s_period as c','a.reservation_time','=','c.id')
->whereIn('a.entrust_id',$arrayEntrustids)
->get();
if (!$info) return \Yz::echoError1('没有找到对应医嘱信息');
$itemInfo=[];
foreach ($info as $value){
$ii = DB::table('s_check_item as a')
->leftJoin('s_check_item_device as b','a.id','=','b.item_id')
->where(['a.item_name' => $value->entrust,'a.status'=>1,"a.is_del"=>0])->get();
$msg='';
if(count($ii)==0){
$msg="检查项目不可用";
}
if(count($ii)>0 ){
if(empty($ii[0]->device_id)){
$msg="检查项目未关联服务组";
}
$qudaos = explode(',', $ii[0]->reservation_method);
if (!in_array($appointment_type, $qudaos)){
$msg=$msg.',该项目不支持在此渠道预约';
}
if(isset($ii[0]->check_begin_time)){ //判断开医嘱后多久能预约
$entrust_time = $value->entrust_date . ' ' . $value->entrust_time; //医嘱时间
$date = new DateTime($entrust_time);
$date->modify("+" . $ii[0]->check_begin_time . " minutes");
$enableCheckTime = $date;//到此时间后可进行预约
$current_time = new DateTime();
if ($current_time < $enableCheckTime){
$msg=$msg.",请于" . $enableCheckTime->format("Y-m-d H:i:s") . "后进行预约";
}
}
$itemInfo = DB::table('s_check_item')->where(['item_name' => $info->entrust,'status'=>1,"is_del"=>0])->get();
if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息');
$itemInfo=$itemInfo[0];
return \Yz::Return(true,'查询完成',['today_date'=>date("Y-m-d"),'mainInfo'=>$info,'itemInfo'=>$itemInfo]);
}
$itemInfo[]=[
'maininfo'=>$value,
'msg'=>$msg
];
}
// $itemInfo = DB::table('s_check_item')
// ->whereIn('item_name',)
// ->where(['item_name' => $info->entrust,'status'=>1,"is_del"=>0])->get();
// if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息');
// $itemInfo=$itemInfo[0];
return \Yz::Return(true,'查询完成',['today_date'=>date("Y-m-d"),'info'=>$itemInfo]);
}
public function GetList(Request $request)
{
@ -98,5 +142,79 @@ class WorkMainController extends Controller
return \Yz::Return(true,'查询完成',$List);
}
//批量检查医嘱检查项目是否可以同时预约如果关联的是同一个服务组则可以同时预约返回可同时预约的row_id
public function CheckEntrstItemGroup()
{
$list=[];
$itemNames=[];
$items= request('items');
if(!empty($items)){
$FirstItemDevices=[];
foreach ($items as $key=>$val){
if($val['first']==1){
//获取点击的检查项目关联的设备id
$FirstItemDevices= DB::table('s_check_item as a')
->leftJoin('s_check_item_device as b','a.id','=','b.item_id')
->select('b.device_id')
->where(['a.item_name'=>$val['name'],'a.is_del'=>0,'a.status'=>1])
->whereNotNull('b.device_id')
->pluck('b.device_id')->toArray();
}
$itemNames[]=$val['name'];
}
//获取所有传过来的检查项目关联的设备
$ItemsDevices= DB::table('s_check_item as a')
->leftJoin('s_check_item_device as b','a.id','=','b.item_id')
->whereIn('a.item_name',$itemNames)->where(['a.is_del'=>0,'a.status'=>1])->get();
//按照第一个勾选的检查项目关联的设备进行分组,能在一个设备上进行检查的分在一组
if(!empty($FirstItemDevices)){
$group=[];
foreach ($FirstItemDevices as $value){
$lg=[];
foreach ($ItemsDevices as $v){
if($v->device_id==$value){
foreach ($items as $item){
if($item['name']==$v->item_name){
$v->rowid=$item['rowid'];
}
}
$lg[]=$v;
}
}
$group[]=$lg;
}
return \Yz::Return(true,'查询完成',['group'=>$group]);
}else{
return \Yz::echoError1('当前勾选检查项目不可用');
}
}else{
return \Yz::echoError1('检查项目不能为空');
}
}
//检查当前时段是否有存在已经预约的待检查项目
public function CheckIsDaiJian()
{
$reg_num= request('reg_num');
$planid=request('planid');
$query=DB::table('s_list')->where(['reg_num'=>$reg_num,'list_status'=>1,'is_nullify'=>0])
->select('s_list.*','s_period.period_begin_time','s_period.period_end_time')
->leftJoin('s_period','s_list.reservation_time','=','s_period.id')
->get();
if(count($query)>0){
$plan=DB::table('s_source_roster_detail')->where(['id'=>$planid])->first();
foreach ($query as $key=>$value){
$entrustTime=[$value->reservation_date.' '.$value->period_begin_time,$value->reservation_date.' '.$value->period_end_time];
$planTime=[$plan->date.' '.$plan->begin_time,$plan->date.' '.$plan->end_time];
if ($entrustTime[0] <= $planTime[1] && $planTime[0] <= $entrustTime[1]) {
return \Yz::echoError1('当前时段存在待检项目:'.$value->entrust.'时间:'.$value->reservation_date.' '.substr($value->period_begin_time, 0, 5).'-'.substr($value->period_end_time, 0, 5).' 请确认是否继续预约');
}
}
}
return \Yz::Return(true,'可以预约',[]);
}
}

@ -3,6 +3,7 @@
namespace App\Http\Controllers\API\Third;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@ -12,26 +13,25 @@ class EntrustController extends Controller
public function CreateRecord()
{
$Info = request('info');
$params=[
'list_status'=>0,
'reg_num'=>$Info['reg_num'] ?? null,
'user_name'=>$Info['user_name'] ?? null,
'user_sex'=>$Info['user_sex'] ?? null,
'entrust'=>$Info['entrust'] ?? null,
'is_pay'=>$Info['is_pay'] ?? null,
'reservation_department'=>$Info['reservation_department'] ?? null,
'entrust_date'=>$Info['entrust_date'] ?? null,
'entrust_time'=>$Info['entrust_time'] ?? null,
'user_brithday'=>$Info['user_brithday'] ?? null,
'docotr'=>$Info['docotr'] ?? null,
'patient_type'=>$Info['patient_type'] ?? null,
'user_phone'=>$Info['user_phone'] ?? null,
'implement_department'=>$Info['implement_department'] ?? null,
'entrust_id'=>$Info['entrust_id'] ?? null,//his传过来的本地医嘱id
'episodeid'=>$Info['episodeid'] ?? null, //就诊号
'RISRExamID'=>$Info['RISRExamID'] ?? null, //检查号
'RISRAcceptDeptCode'=>$Info['RISRAcceptDeptCode'] ?? null, //接收科室代码
$params = [
'list_status' => 0,
'reg_num' => $Info['reg_num'] ?? null,
'user_name' => $Info['user_name'] ?? null,
'user_sex' => $Info['user_sex'] ?? null,
'entrust' => $Info['entrust'] ?? null,
'is_pay' => $Info['is_pay'] ?? null,
'reservation_department' => $Info['reservation_department'] ?? null,
'entrust_date' => $Info['entrust_date'] ?? null,
'entrust_time' => $Info['entrust_time'] ?? null,
'user_brithday' => $Info['user_brithday'] ?? null,
'docotr' => $Info['docotr'] ?? null,
'patient_type' => $Info['patient_type'] ?? null,
'user_phone' => $Info['user_phone'] ?? null,
'implement_department' => $Info['implement_department'] ?? null,
'entrust_id' => $Info['entrust_id'] ?? null,//his传过来的本地医嘱id
'episodeid' => $Info['episodeid'] ?? null, //就诊号
'RISRExamID' => $Info['RISRExamID'] ?? null, //检查号
'RISRAcceptDeptCode' => $Info['RISRAcceptDeptCode'] ?? null, //接收科室代码
];
$requiredFields = [
'reg_num', 'user_name', 'user_sex', 'entrust', 'is_pay',
@ -44,32 +44,62 @@ class EntrustController extends Controller
// 判断是否为空
foreach ($requiredFields as $field) {
if (!isset($params[$field]) || $params[$field] === null) {
return \Yz::echoError1('参数'.$field.'不能为空');
return \Yz::echoError1('参数' . $field . '不能为空');
}
}
DB::beginTransaction();
$insertListId=DB::table('s_list')->insertGetId($params);
if($insertListId){
$data=[
'list_id'=>$insertListId,
'reg_num'=>$Info['reg_num'],
'new_status'=>0,
'create_user'=>'接口',
'note'=>'创建记录',
'data'=>json_encode($Info,JSON_UNESCAPED_UNICODE),//原始数据
$insertListId = DB::table('s_list')->insertGetId($params);
if ($insertListId) {
$data = [
'list_id' => $insertListId,
'reg_num' => $Info['reg_num'],
'new_status' => 0,
'create_user' => '接口',
'note' => '创建记录',
'data' => json_encode($Info, JSON_UNESCAPED_UNICODE),//原始数据
];
$insertLog=DB::table('s_list_log')->insert($data);
if($insertLog){
$insertLog = DB::table('s_list_log')->insert($data);
if ($insertLog) {
DB::commit();
return \Yz::Return(true,'保存成功',[]);
}else{
return \Yz::Return(true, '保存成功', []);
} else {
DB::rollBack();
return \Yz::echoError1('保存失败');
}
}else{
} else {
DB::rollBack();
return \Yz::echoError1('保存失败');
}
}
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, // 或者使用空数组 []
],
],
];
// 将数据转换为 XML
$xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?>' . "\n<root/>");
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');
}
}

@ -66,5 +66,6 @@ class Kernel extends HttpKernel
'checktoken' => \App\Http\Middleware\CheckToken::class,
'log' => \App\Http\Middleware\Log::class,
'check.sign' => \App\Http\Middleware\CheckSign::class,
'check.sign.xml' => \App\Http\Middleware\CheckSignXMl::class,
];
}

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class CheckSignXMl
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$Authorization= $_SERVER['HTTP_AUTHORIZATION'];
if($Authorization=="hR9pQFeD3cGqbXW4rvE2LNJUi57DyFZ0"){
return $next($request);
}else{
return response(['code'=>'-1','msg'=>"验证token失败"]);
}
}
}

@ -2,6 +2,7 @@
namespace App\Services\Admin\YeWu;
use DateInterval;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use DateTime;
@ -9,7 +10,7 @@ use Tools;
class PlanListService
{
public function GetEnablePlan($regnum, $entrustid, $episodeid, $appointment_type, $appointment_date)
public function GetEnablePlan($regnum, $entrustids, $episodeid, $appointment_type, $appointment_date)
{
date_default_timezone_set('PRC');
// $regnum = request('regnum');
@ -17,68 +18,114 @@ class PlanListService
// $episodeid = request('episodeid');
// $appointment_type = request('appointment_type'); //预约类型
// $appointment_date = request('date'); //预约日期
$allDevice=[];
foreach ($entrustids as $key=>$entrustid){
$info = DB::table('s_list')->where(['reg_num' => $regnum, 'entrust_id' => $entrustid, 'episodeid' => $episodeid,'is_nullify'=>0])->first();
if (!$info) return \Yz::echoError1('没有找到对应医嘱信息');
$itemInfo = DB::table('s_check_item')->where(['item_name' => $info->entrust, 'status' => 1, "is_del" => 0])->get();
if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息');
$info = DB::table('s_list')->where(['reg_num' => $regnum, 'entrust_id' => $entrustid, 'episodeid' => $episodeid])->first();
if (!$info) return \Yz::echoError1('没有找到对应医嘱信息');
$itemInfo = $itemInfo[0];
$qudaos = explode(',', $itemInfo->reservation_method);
if (!in_array($appointment_type, $qudaos)) return \Yz::echoError1('此检查项目不支持在当前渠道预约');
$itemInfo = DB::table('s_check_item')->where(['item_name' => $info->entrust, 'status' => 1, "is_del" => 0])->get();
if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息');
$entrust_time = $info->entrust_date . ' ' . $info->entrust_time; //医嘱时间
$date = new DateTime($entrust_time);
$date->modify("+" . $itemInfo->check_begin_time . " minutes");
$enableCheckTime = $date;//到此时间后可进行预约
$current_time = new DateTime();
if ($current_time < $enableCheckTime) return \Yz::echoError1("请于" . $enableCheckTime->format("Y-m-d H:i:s") . "后进行预约");
$itemInfo = $itemInfo[0];
$qudaos = explode(',', $itemInfo->reservation_method);
if (!in_array($appointment_type, $qudaos)) return \Yz::echoError1('此检查项目不支持在当前渠道预约');
$entrust_time = $info->entrust_date . ' ' . $info->entrust_time; //医嘱时间
$date = new DateTime($entrust_time);
$date->modify("+" . $itemInfo->check_begin_time . " minutes");
$enableCheckTime = $date;//到此时间后可进行预约
$current_time = new DateTime();
if ($current_time < $enableCheckTime) return \Yz::echoError1("请于" . $enableCheckTime->format("Y-m-d H:i:s") . "后进行预约");
//获取检查项目绑定的服务组(设备),判断状态正常的
$devices = DB::table('s_check_item_device')
->leftJoin("s_devices", "s_check_item_device.device_id", "=", "s_devices.id")
->where(['s_check_item_device.item_id' => $itemInfo->id])
->where(['s_devices.status' => 1, 'is_del' => 0])->pluck('s_devices.id')->toArray();
$allDevice[]=$devices;
}
//获取检查项目绑定的服务组(设备),判断状态正常的
$devices = DB::table('s_check_item_device')
->leftJoin("s_devices", "s_check_item_device.device_id", "=", "s_devices.id")
->where(['s_check_item_device.item_id' => $itemInfo->id])
->where(['s_devices.status' => 1, 'is_del' => 0])->pluck('s_devices.id')->toArray();
$commonDevice=[]; //多个检查项目共同的设备id
foreach($allDevice as $set) {
if(count($commonDevice) == 0) {
// 如果$intersection为空直接将第一个子数组的元素放入
$commonDevice = $set;
} else {
// 使用array_intersect()函数求当前子数组与已有交集的交集
$commonDevice = array_intersect($commonDevice, $set);
}
}
// dd($commonDevice);
//获取主表检查项目绑定的科室id
$department_id = DB::table('s_department')->where(['department_number' => $info->RISRAcceptDeptCode])->first();
if (!$department_id) return \Yz::echoError1('获取医嘱检查项目科室信息失败');
// // 获取当前日期
// $startDate = date('Y-m-d');
// // 创建一个空数组来存储日期
// $datesArray = [];
// // 循环获取今天及之后7天的日期
// for ($i = 0; $i <7; $i++) {
// // 使用DateTime对象方便地进行日期操作
// $dateObject = new DateTime($startDate);
// $dateObject->add(new DateInterval('P'.$i.'D')); // P1D表示增加一天
// // 将日期格式化后存入数组
// $datesArray[] = $dateObject->format('Y-m-d');
// }
//获取对应日期的计划明细
$plan = DB::table('s_source_roster_detail as a')
->select('a.*', 'b.department_resources_name', 'c.roster_detail_id', 'c.count', 'c.used_count')
->leftJoin('s_department_resources as b', 'a.resources_id', '=', 'b.id')
->leftJoin('s_source_roster_detail_count as c', 'a.id', '=', 'c.roster_detail_id')
->where(['a.department_id' => $department_id->id, 'a.date' => $appointment_date, 'a.status' => 1, 'a.is_del' => 0, 'b.is_del' => 0, 'c.appointment_type_id' => $appointment_type])->get();
$plan_enable = [];
foreach ($plan as $key => $value) {
if (array_intersect($devices, array_map('intval', explode(',', $value->device_id)))) {
$plan_enable[] = $value;
}
}
// $plan = DB::table('s_source_roster_detail as a')
// ->select('a.*', 'b.department_resources_name', 'c.roster_detail_id', 'c.count', 'c.used_count','e.device_name as devices')
// ->leftJoin('s_department_resources as b', 'a.resources_id', '=', 'b.id')
// ->leftJoin('s_source_roster_detail_count as c', 'a.id', '=', 'c.roster_detail_id')
// ->leftJoin('s_source_roster_detail_device as d','a.id','=','d.roster_detail_id')
// ->leftJoin('s_devices as e','d.device_id','=','e.id')
// ->where(['a.department_id' => $department_id->id])
// ->where('a.date',$appointment_date)
// ->where(['a.status' => 1, 'a.is_del' => 0, 'b.is_del' => 0, 'c.appointment_type_id' => $appointment_type])
// ->whereIn('d.device_id',$commonDevice)
// ->orderBy('a.date')
// ->get();
$placeholders = implode(',', array_fill(0, count($commonDevice), '?'));
$canshu=array_merge($commonDevice,[$department_id->id,$appointment_date,$appointment_type]);
$plan=DB::select("SELECT
a.*,
dd.devices,
b.department_resources_name,
c.roster_detail_id,
c.count,
c.used_count
FROM
s_source_roster_detail AS a
LEFT JOIN s_department_resources AS b ON a.resources_id = b.id
LEFT JOIN s_source_roster_detail_count AS c ON a.id = c.roster_detail_id
JOIN (
SELECT
roster_detail_id,
GROUP_CONCAT( e.device_name SEPARATOR ', ' ) AS devices
FROM
s_source_roster_detail_device AS d
LEFT JOIN s_devices AS e ON d.device_id = e.id
WHERE
d.device_id IN ($placeholders)
GROUP BY
d.roster_detail_id
) AS dd ON a.id = dd.roster_detail_id
WHERE
a.department_id = ?
AND a.date = ?
AND a.STATUS = 1
AND a.is_del = 0
AND b.is_del = 0
AND c.appointment_type_id =?",$canshu);
//匹配设备(服务组)
$devices = DB::table('s_devices')->get();
foreach ($plan_enable as $key => $value){
// dd($value);
$plan_enable[$key]->devices = [];
$array_device_id = explode(",", $value->device_id);
$names='';
foreach ($devices as $k => $v) {
if (in_array($v->id, $array_device_id)) {
$names=$names. $v->device_name.' ';
}
}
$plan_enable[$key]->devices =$names;
}
return \Yz::Return(true, '查询完成', ['today_date' => date("Y-m-d"), 'appointment_date' => $appointment_date, 'weekname' => Tools::GetWeekName($appointment_date), 'mainInfo' => $info, 'plan_list' => $plan_enable]);
return \Yz::Return(true, '查询完成', ['today_date' => date("Y-m-d"), 'appointment_date' => $appointment_date, 'weekname' => Tools::GetWeekName($appointment_date), 'mainInfo' => $info, 'plan_list' => $plan]);
}
//开始预约占用名额
public function YuYue($planid, $appointment_type, $mainlistid, $do_type)
public function YuYue($planid, $appointment_type, $mainlistids, $do_type)
{
date_default_timezone_set('PRC');
$nowdatetime = date("Y-m-d H:i:s");
@ -88,71 +135,83 @@ class PlanListService
// $do_type = request('dotype');//操作类型,1预约2改约
// if (!isset($do_type)) return \Yz::echoError1('参数:操作类型 不能为空');
$mainInfo = DB::table('s_list')->where(['id' => $mainlistid])->first();
if (!$mainInfo) return \Yz::echoError1('医嘱不存在');
//判断状态
if ($do_type == 1 && $mainInfo->list_status <> 0) return \Yz::echoError1('该信息状态不允许预约,当前状态:' . $mainInfo->list_status);
if ($do_type == 2 && $mainInfo->list_status <> 1) return \Yz::echoError1('该信息状态不允许改约操作,当前状态:' . $mainInfo->list_status);
$planInfo = DB::table('s_source_roster_detail')->where(['id' => $planid, 'status' => 1, 'is_del' => 0])->first();
if (!$planInfo) return \Yz::echoError1('当前时段不可用');
if ($nowdatetime > $planInfo->date . ' ' . $planInfo->end_reservation_time) return \Yz::echoError1('已经超过预约截止时间');
$planCount = DB::table('s_source_roster_detail_count')->where(['roster_detail_id' => $planid,
'appointment_type_id' => $appointment_type])->first();
if ($planCount->count <= $planCount->used_count) return \Yz::echoError1('当前预约时间已无名额');
//判断互斥暂时根据reg_num判断身份
//查询想要预约的项目 其自身code
$item = DB::table('s_check_item')->where(['item_name' => $mainInfo->entrust, 'status' => 1, 'is_del' => 0])->first();
if (!$item) return \Yz::echoError1('此检查项目不可用');
//查询当前检查项目是否存在互斥
$cha_hc = DB::table('s_huchi')->where('is_del', 0)
->where(function ($q) use ($item) {
$q->where(['code1' => $item->item_code])->orWhere('code2', $item->item_code);
})->get();
if (count($cha_hc) > 0) {
//查询用户预约中的医嘱
$status_1 = DB::table('s_list')
->select('s_check_item.item_code', 's_list.entrust', 's_list.reservation_date', 's_list.reservation_time')
->leftJoin('s_check_item', 's_list.entrust', '=', 's_check_item.item_name')
->where(['s_list.reg_num' => $mainInfo->reg_num, 's_list.list_status' => 1, 's_list.is_del' => 0, 's_list.is_nullify' => 0])->get();
if (count($status_1) > 0) {
foreach ($status_1 as $key => $value) {
foreach ($cha_hc as $k => $v) {
if ($v->code1 == $value->item_code or $v->code2 == $value->item_code) {
if ($v->time == 0) {
//如果是永久互斥,直接拒绝
return \Yz::Return(false, '当前预约项目与' . $value->entrust . '互斥,暂不可预约', ['name' => $value->entrust]);
}
if ($v->time > 0) {
//如果设置互斥时间,则判断预约时间是否超过 正在预约的最后时间段+互斥时间
$period = DB::table('s_period')->where(['id' => $value->reservation_time])->first();
$endTime = $period->period_end_time;
$periodEndDateTime = $value->reservation_date . ' ' . $endTime;
$date = new DateTime($periodEndDateTime);
// 添加互斥时间/小时
$date->add(new \DateInterval('PT' . $v->time . 'H')); // PTXH 表示X小时的时间间隔
$HuChi_EndDateTime = $date->format('Y-m-d H:i:s');//已经预约的项目结束互斥时间
$YuYueDateTime = substr($planInfo->date, 0, 10) . ' ' . $planInfo->begin_time;
if ($HuChi_EndDateTime > $YuYueDateTime) {
return \Yz::Return(false, '当前预约项目与' . $value->entrust . '互斥,暂不可预约,请预约' . $HuChi_EndDateTime . '后的日期', ['name' => $value->entrust]);
if ($planCount->count <= ($planCount->used_count+count($mainlistids))) return \Yz::echoError1('当前预约时间名额不足');
$oldMainInfos=[];//临时存储原来的主表信息,用于改约
//遍历多个s_list表id,前端多选,一次预约多个检查项目
foreach ($mainlistids as $key_m=>$mainlistid ){
$mainInfo = DB::table('s_list')->where(['id' => $mainlistid])->first();
$oldMainInfos[]=$mainInfo;
if (!$mainInfo) return \Yz::echoError1('医嘱不存在');
//判断状态
if ($do_type == 1 && $mainInfo->list_status <> 0) return \Yz::echoError1($mainInfo->entrust.' 该医嘱状态不允许预约,当前状态:' . $mainInfo->list_status);
if ($do_type == 2 && $mainInfo->list_status <> 1) return \Yz::echoError1($mainInfo->entrust.' 该医嘱状态不允许改约操作,当前状态:' . $mainInfo->list_status);
//判断互斥暂时根据reg_num判断身份
//查询想要预约的项目 其自身code
$item = DB::table('s_check_item')->where(['item_name' => $mainInfo->entrust, 'status' => 1, 'is_del' => 0])->first();
if (!$item) return \Yz::echoError1('此检查项目不可用');
//查询当前检查项目是否存在互斥
$cha_hc = DB::table('s_huchi')->where('is_del', 0)
->where(function ($q) use ($item) {
$q->where(['code1' => $item->item_code])->orWhere('code2', $item->item_code);
})->get();
if (count($cha_hc) > 0) {
//查询用户预约中的医嘱
$status_1 = DB::table('s_list')
->select('s_check_item.item_code', 's_list.entrust', 's_list.reservation_date', 's_list.reservation_time')
->leftJoin('s_check_item', 's_list.entrust', '=', 's_check_item.item_name')
->where(['s_list.reg_num' => $mainInfo->reg_num, 's_list.list_status' => 1, 's_list.is_del' => 0, 's_list.is_nullify' => 0])->get();
if (count($status_1) > 0) {
foreach ($status_1 as $key => $value) {
foreach ($cha_hc as $k => $v) {
if ($v->code1 == $value->item_code or $v->code2 == $value->item_code) {
if ($v->time == 0) {
//如果是永久互斥,直接拒绝
return \Yz::Return(false, '当前预约项目与' . $value->entrust . '互斥,暂不可预约', ['name' => $value->entrust]);
}
if ($v->time > 0) {
//如果设置互斥时间,则判断预约时间是否超过 正在预约的最后时间段+互斥时间
$period = DB::table('s_period')->where(['id' => $value->reservation_time])->first();
$endTime = $period->period_end_time;
$periodEndDateTime = $value->reservation_date . ' ' . $endTime;
$date = new DateTime($periodEndDateTime);
// 添加互斥时间/小时
$date->add(new \DateInterval('PT' . $v->time . 'H')); // PTXH 表示X小时的时间间隔
$HuChi_EndDateTime = $date->format('Y-m-d H:i:s');//已经预约的项目结束互斥时间
$YuYueDateTime = substr($planInfo->date, 0, 10) . ' ' . $planInfo->begin_time;
if ($HuChi_EndDateTime > $YuYueDateTime) {
return \Yz::Return(false, '当前预约项目与' . $value->entrust . '互斥,暂不可预约,请预约' . $HuChi_EndDateTime . '后的日期', ['name' => $value->entrust]);
}
}
}
}
}
}
}
}
}
DB::beginTransaction();
try {
//更新计划明细表使用数量
$u = DB::table('s_source_roster_detail_count')->where(['id' => $planCount->id])->where('count', '>', 'used_count')->increment('used_count');
$u = DB::table('s_source_roster_detail_count')->where(['id' => $planCount->id]) ->whereRaw('count > (used_count + ?)', [count($mainlistids)])
->increment('used_count',count($mainlistids));
if ($u) {
$cha = DB::table('s_source_roster_detail_count')->where(['id' => $planCount->id])->first();
if ($cha->count >= $cha->used_count) {
if ($cha->count >= ($cha->used_count+count($mainlistids))) {
//更新主表信息
$u_data=[
'list_status' => 1,
@ -165,22 +224,28 @@ class PlanListService
'xuhao' => 0,
'appointment_type_id' => $appointment_type,
];
$u_mainList = DB::table('s_list')->where(['id' => $mainlistid])->update($u_data);
$u_mainList = DB::table('s_list')->whereIn('id' , $mainlistids)->update($u_data);
$note="预约";
if ($do_type == 2) {
$note="改约";
//如果是改约,则恢复原来的数量
$u_old = DB::table('s_source_roster_detail_count')->where(['roster_detail_id' => $mainInfo->roster_id, 'appointment_type_id' => $mainInfo->appointment_type_id])->decrement('used_count');
foreach ($oldMainInfos as $key =>$oldMainInfo){
if ($do_type == 2) {
// if(count($mainlistids)>1) return \Yz::echoError1('请选择1条医嘱改约暂不支持批量');
$note="改约";
//如果是改约,则恢复原来的数量
$u_old = DB::table('s_source_roster_detail_count')->where(['roster_detail_id' => $oldMainInfo->roster_id, 'appointment_type_id' => $oldMainInfo->appointment_type_id,['used_count','>',0]])->decrement('used_count');
}
$i_log=DB::table('s_list_log')->insert([
'list_id'=>$oldMainInfo->id,
'reg_num'=>$oldMainInfo->reg_num,
'old_status'=>$oldMainInfo->list_status,
'new_status'=>1,
'create_user'=>null,
'note'=>$note,
'data'=>json_encode($u_data)
]);
}
$i_log=DB::table('s_list_log')->insert([
'list_id'=>$mainlistid,
'reg_num'=>$mainInfo->reg_num,
'old_status'=>$mainInfo->list_status,
'new_status'=>1,
'create_user'=>null,
'note'=>$note,
'data'=>json_encode($u_data)
]);
if ($u_mainList) {
DB::commit();
return \Yz::Return(true, '预约成功', []);
@ -191,7 +256,7 @@ class PlanListService
} else {
DB::rollBack();
return \Yz::echoError1('当前预约时间已无名额');
return \Yz::echoError1('当前预约时间名额不足');
}
} else {
@ -200,7 +265,7 @@ class PlanListService
} catch (\Exception $e) {
DB::rollBack();
return \Yz::echoError1('预约异常');
return \Yz::echoError1('预约异常'.$e);
}

@ -7,12 +7,19 @@
<link rel="stylesheet" href="css/bootstrap.min.css" crossorigin="anonymous">
<script src="js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src="js/bootstrap-datetimepicker.min.js"></script>
<!-- <script src="js/jquery.freezeheader.js"></script> -->
<script src="js/jquery.jqprint-0.3.js"></script>
<script src="js/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css">
</head>
<body>
<script>
let BaseUrl='http://yijiyuyue'
let entrust_ids=[]; //选中的entrust_id
let today_date=''
let tomorrowDate=''
let MainInfo_ids=[];//选中的检查项目对应的mainid
//获取url参数
function getParameterByName(name, url) {
if (!url) url = decodeURIComponent(window.location.href)
@ -34,78 +41,73 @@
// 构建格式化后的日期字符串
return year + '-' + month + '-' + day
}
let MainInfo='';
//获取基本信息
function GetMainInfo() {
$('#loadingModal').modal('show');
$.post(BaseUrl+'/api/admin/getMainDetail', {
regnum: getParameterByName('regnum'),
entrustid: getParameterByName('entrustid'),
episodeid: getParameterByName('episodeid')
}, function(data) {
$('#loadingModal').modal('hide');
console.log(data)
if (data.status) {
MainInfo=data.data.mainInfo
$('.yizhu').html(data.data.mainInfo.entrust);
$('.kongfu').html(function(){
if(data.data.itemInfo.limosis===1){
return "是"
}else{
return "否"
}
});
$('.keshi').html(data.data.mainInfo.reservation_department)
$('.yisheng').html(data.data.mainInfo.docotr)
$('.time').html(data.data.mainInfo.entrust_date+' '+data.data.mainInfo.entrust_time)
$('.zhuangtai').html(function(){
switch(data.data.mainInfo.list_status) {
function GetStatus(a){
switch(a) {
case 0:
return "正在申请"
break;
case 1:
return "预约"
return "已预约"
break;
case 2:
return "登记"
return "已登记"
break;
case 3:
return "结束"
break;
case 4:
return "预约取消"
break;
case 5:
return ".取消登记"
break;
}
}
//获取基本信息
function GetMainInfo() {
$('#yizhulist').html('');
$('#loadingModal').modal('show');
$.post(BaseUrl+'/api/admin/getMainDetail', {
regnum: getParameterByName('regnum'),
entrustid: getParameterByName('entrustid'),
episodeid: getParameterByName('episodeid'),
appointment_type:getParameterByName('appointment_type')
}, function(data) {
$('#loadingModal').modal('hide');
console.log(data)
if (data.status) {
MainInfoList=data.data.info
MainInfoList.forEach(function(item,key){
let zhuangtai =GetStatus(item.maininfo.list_status)
let msg=item.msg==''?"":'<div style="color:#fff">不可预约:<span>'+item.msg+'</span></div>'
let yuyueshijian=item.maininfo.list_status==1?'<div>预约时间:<span>'+item.maininfo.reservation_date+' '+item.maininfo.period_begin_time.substring(0,5) +'-'+ item.maininfo.period_end_time.substring(0,5) +'</span></div>' :''
let bj_color=item.msg==''?"":"hongse_bg"
$('#yizhulist').append(
'<div class="yiyuInfo '+ bj_color+' "data-entrustid='+ item.maininfo.entrust_id +' data-id='+ key +' data-mainid='+ item.maininfo.id +' data-name='+ item.maininfo.entrust +'>' +
'<div>医嘱项:<span >'+item.maininfo.entrust +'</span></div>' +
'<div>当前状态:<span >'+zhuangtai+'</span></div>' +msg+
yuyueshijian+
'</div>'
);
})
$('.b_name').html(data.data.mainInfo.user_name);
$('.b_id').html(data.data.mainInfo.reg_num);
$('.b_name').html(MainInfoList[0].maininfo.user_name);
$('.b_id').html(MainInfoList[0].maininfo.reg_num);
$('.b_sex').html(function(){
if(data.data.mainInfo.user_sex==1){
if(MainInfoList[0].maininfo.user_sex==1){
return "男"
}
if(data.data.mainInfo.user_sex==2){
if(MainInfoList[0].maininfo.user_sex==2){
return "女"
}
});
$('.b_tel').html(data.data.mainInfo.user_phone);
$('.b_yun').html(data.data.mainInfo.RISRPatDiag);
$('#input_appointment_item').val(data.data.itemInfo.item_name);
$('.b_tel').html(MainInfoList[0].maininfo.user_phone);
$('.b_yun').html(MainInfoList[0].maininfo.RISRPatDiag);
today_date=data.data.today_date
var currentDate = new Date(data.data.today_date)
currentDate.setDate(currentDate.getDate() + 1)
var tomorrowDate = currentDate.toISOString().split('T')[0]
$('#datetimepicker1 input').val(data.data.today_date)
$('#datetimepicker2 input').val(tomorrowDate)
// $("table").first().attr("id", data.data.today_date);
// $("table:eq(1)").attr("id", tomorrowDate);
getPlanList(data.data.today_date)
getPlanList(tomorrowDate)
tomorrowDate = currentDate.toISOString().split('T')[0]
} else {
alert(data.msg)
MsgAlert(data.msg)
}
}, 'json')
}
@ -116,7 +118,7 @@
//查询检查项目预约计划
$.post(BaseUrl+'/api/admin/GetEnablePlan', {
regnum: getParameterByName('regnum'),
entrustid: getParameterByName('entrustid'),
entrustid: entrust_ids,
episodeid: getParameterByName('episodeid'),
appointment_type: getParameterByName('appointment_type'),
date: date
@ -170,14 +172,33 @@
$('#input_appointment_date').val($(this).data('date'));
$('#input_appointment_timerange').val($(this).data('timerange'));
$('#input_appointment_resource').val($(this).data('resource')) ;
IsDaiJian(getParameterByName('regnum'),selectedId);
}
})
} else {
alert(data.msg)
MsgAlert(data.msg)
}
// $("#table2").freezeHeader({ 'height': '100px' });
}, 'json')
}
//检查待预约时段是否有待检项目
function IsDaiJian(reg_num,planid){
$('#loadingModal').modal('show');
$.post(BaseUrl+'/api/admin/CheckIsDaiJian', {
reg_num:reg_num,
planid: planid,
}, function(data) {
$('#loadingModal').modal('hide');
if (data.status) {
}else{
MsgAlert(data.msg)
}
})
}
let selectedId = 0
@ -186,25 +207,25 @@
if (selectedId == 0) return false
$('#loadingModal').modal('show');
$.post(BaseUrl+'/api/admin/PlanYuYue', {
mainlistid:MainInfo.id,
mainlistid:MainInfo_ids,
planid: selectedId,
appointment_type:getParameterByName('appointment_type'),
dotype:getParameterByName('dotype'),//1预约2改约
}, function(data) {
$('#loadingModal').modal('hide');
if (data.status) {
$('#tishi .tishineirong').html('操作成功');
$('#tishi').modal('show');
MsgAlert("操作成功")
getPlanList($('#datetimepicker1 input').val())
getPlanList($('#datetimepicker2 input').val())
GetMainInfo()
}else{
alert(data.msg)
MsgAlert(data.msg)
}
})
}
$(function() {
console.log(getParameterByName('regnum'))
console.log(getParameterByName('entrustid'))
console.log(getParameterByName('episodeid'))
@ -245,7 +266,9 @@
GetMainInfo()
$('#yuyue_button').click(function() {
if (selectedId == 0) return false
if (selectedId == 0) {
return false
}
if (confirm("你确定要继续吗?")) {
start_yuyue()
}else{
@ -257,10 +280,106 @@
$('.model_button').on('click',function(){
$('#tishi').modal('hide');
})
// var elementDistanceToBottom = $(window).height() - $('#table2_head').offset().top - $('#table2_head').outerHeight();
// console.log("元素到页面底部的距离为: " + elementDistanceToBottom + "px");
$('.table_k').css("height",400+'px');
//点击左侧的检查项目,调用接口查询可同时预约的项目
$("#yizhulist").on('click','.yiyuInfo:not(.yiyuInfo.hongse_bg)',function(){
//如果点击的项目本身已经被选中,再次点击则取消
if( $(this).hasClass('lanse_bg')){
$(this).removeClass('lanse_bg');
insertInto_appointmenText()
return false;
}
//如果点击的项目还没被选中,则清空所有已经选中的
if(!$(this).hasClass('lanse_bg')){
$(".lanse_bg").removeClass('lanse_bg');
insertInto_appointmenText()
}
let first=$(this).data('id')
let items=[]
$('.yiyuInfo:not(.yiyuInfo.hongse_bg)').each(function(){
let isfirst=0
if($(this).data('id')==first){
isfirst=1
}
items.push({name:$(this).data('name'),rowid:$(this).data('id'),first:isfirst})
})
$('#loadingModal').modal('show');
$.post(BaseUrl+'/api/admin/CheckEntrstItemGroup', {
items:items
}, function(data) {
$('#loadingModal').modal('hide');
if (data.status) {
data.data.group[0].forEach(function(v,i){
//遍历所有 不是红色的检查项目。匹配接口返回的可同时预约的项目 ,勾选
$('.yiyuInfo:not(.yiyuInfo.hongse_bg)').each(function(){
if($(this).data('id')==v.rowid){
$(this).addClass('lanse_bg');
}
})
})
insertInto_appointmenText()
}else{
MsgAlert(data.msg)
}
})
})
function insertInto_appointmenText(){ //向检查项目输入框 填写内容
MainInfo_ids=[]
entrust_ids=[]
let input_itemname=""
$('.lanse_bg').each(function(){
input_itemname=input_itemname+" "+$(this).data('name')
entrust_ids.push($(this).data('entrustid'))
MainInfo_ids.push($(this).data('mainid'))
})
$('#input_appointment_item').val(input_itemname);
console.log(entrust_ids);
if($(".lanse_bg").length>0){
//日历设置日期,支持查询计划
$('#datetimepicker1 input').val(today_date)
$('#datetimepicker2 input').val(tomorrowDate)
getPlanList(today_date)
getPlanList(tomorrowDate)
}else{
//清空
$('#datetimepicker1 input').val('')
$('#datetimepicker2 input').val('')
$('#table1 tbody').html('<tr><td>请先选择检查项目</td></tr>')
$('#table2 tbody').html('<tr><td>请先选择检查项目</td></tr>')
}
}
$('#dayin_button').on('click',function(){
if($(".lanse_bg").length==0){
MsgAlert('请选择要打印的申请单');
return false;
}
$("#shenqingdan").show();
$("#shenqingdan").jqprint();
$("#shenqingdan").hide();
})
$('#shuaxin_button').on('click',function(){
window.location.reload()
})
})
</script>
function MsgAlert(msg){
$('#tishi .tishineirong').html(msg);
$('#tishi').modal('show');
}
</script>
<!-- 加载状态 -->
<div class="modal" id="loadingModal" tabindex="-1">
<div class="modal-dialog">
@ -291,15 +410,19 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-3" style="border-right: 1px solid #eee">
<div class="yiyuInfo">
<div class="col-md-3 ">
<div style="margin-top: 8px;"> 医嘱列表</div>
<div id="yizhulist"></div>
<!-- <div class="yiyuInfo">
<div>医嘱项:<span class="yizhu"></span></div>
<div>是否空腹:<span class="kongfu"></span></div>
<div>开单科室:<span class="keshi"></span></div>
<div>开单医生:<span class="yisheng"></span></div>
<div>开医嘱时间:<span class="time"></span></div>
<div>当前状态:<span class="zhuangtai"></span></div>
</div>
</div> -->
</div>
<div class="col-md-9">
<div class="b_info">姓名: <span class="b_name"></span> 患者id: <span class="b_id"></span> 性别: <span class="b_sex"></span>
@ -337,106 +460,111 @@
<div class="row" style="margin-top: 20px">
<div class="col-md-12">
<button type="button" id="yuyue_button" class="btn btn-info" style="width: 130px">预 约</button>
<button type="button" id="shuaxin_button" class="btn btn-info" style="width: 130px;margin-left: 8px;">刷 新</button>
<button type="button" id="dayin_button" class="btn btn-info" style="width: 130px;margin-left: 8px;">打印申请单</button>
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-6">
<hr>
<div class="row">
<div class="col-md-1" style="text-align: right; line-height: 36px">日期</div>
<div class="col-md-4">
<div class="form-group">
<div class='input-group date' id='datetimepicker1' data-date-format="yyyy-mm-dd"
data-link-format="yyyy-mm-dd">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<div class="col-md-6">
<div class="row">
<div class="col-md-1" style="text-align: right; line-height: 36px">日期</div>
<div class="col-md-4">
<div class="form-group">
<div class='input-group date' id='datetimepicker1' data-date-format="yyyy-mm-dd"
data-link-format="yyyy-mm-dd">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="col-md-4" style="line-height: 36px" id="xingqi1"></div>
</div>
<table id="table1_head">
<thead>
<tr>
<th>日期</th>
<th>星期</th>
<th>资源</th>
<th>服务组</th>
<th>时间段</th>
<th>已用/总数</th>
</tr>
</thead>
</table>
<div class="table_k" style=" overflow-y: scroll;">
<table id="table1">
<tbody>
<tr><td>请先选择检查项目</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4" style="line-height: 36px" id="xingqi1"></div>
</div>
<table id="table1">
<thead>
<tr>
<th>日期</th>
<th>星期</th>
<th>资源</th>
<th>服务组</th>
<th>时间段</th>
<th>剩余</th>
</tr>
</thead>
<tbody>
<!-- <tr>-->
<!-- <td>22</td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- </tr>-->
</tbody>
</table>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-1" style="text-align: right; line-height: 36px">日期</div>
<div class="col-md-4">
<div class="form-group">
<div class='input-group date' id='datetimepicker2' data-date-format="yyyy-mm-dd"
data-link-format="yyyy-mm-dd">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<div class="col-md-6">
<div class="row">
<div class="col-md-1" style="text-align: right; line-height: 36px">日期</div>
<div class="col-md-4">
<div class="form-group">
<div class='input-group date' id='datetimepicker2' data-date-format="yyyy-mm-dd"
data-link-format="yyyy-mm-dd">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="col-md-4" style="line-height: 36px" id="xingqi2"></div>
</div>
<table id="table2_head">
<thead>
<tr>
<th>日期</th>
<th>星期</th>
<th>资源</th>
<th>服务组</th>
<th>时间段</th>
<th>已用/总数</th>
</tr>
</thead>
</table>
<div class="table_k" style=" overflow-y: scroll;">
<table id="table2" >
<tbody >
<tr><td>请先选择检查项目</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4" style="line-height: 36px" id="xingqi2"></div>
</div>
<table id="table2">
<thead>
<tr>
<th>日期</th>
<th>星期</th>
<th>资源</th>
<th>服务组</th>
<th>时间段</th>
<th>剩余</th>
</tr>
</thead>
<tbody>
<!-- <tr>-->
<!-- <td>22</td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- <td></td>-->
<!-- </tr>-->
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-3" style="border-right: 1px solid #eee">
</div>
<div class="col-md-9">
</div>
</div>
<div>
<div id="shenqingdan">
fds
</div>
</div>
</div>
<style>
.table_select {
display: flex;
justify-content: space-between;
width: 100%;
}
table {
width: 100%;
@ -448,6 +576,11 @@
text-align: center;
white-space: nowrap;
}
td ,th{
width: 100px !important;
white-space: normal; /* 保留空白符序列,但是正常换行 */
word-break: break-all; /* 允许在单词内换行 */
}
tbody tr td {
padding: 8px;
@ -467,10 +600,15 @@
color: #666;
}
.yiyuInfo{
background-color: #31b0d5;
padding: 18px;
background-color: #fff;
border: 1px solid #31b0d5;
padding: 8px 18px;
margin-top: 8px;
}
.yiyuInfo:not(.yiyuInfo.hongse_bg):hover{
cursor: pointer;
}
.yiyuInfo div{
margin-top: 8px;
}
@ -481,6 +619,14 @@
font-weight: 700;
color: #31b0d5;
}
.hongse_bg{
background-color: rgb(183, 169, 169);
}
.lanse_bg{
background-color: #31b0d5;
}
</style>
</body>
</html>

File diff suppressed because one or more lines are too long

@ -0,0 +1,161 @@
/* ------------------------------------------------------------------------
Class: freezeHeader
Use:freeze header row in html table
Example 1: $('#tableid').freezeHeader();
Example 2: $("#tableid").freezeHeader({ 'height': '300px' });
Example 3: $("table").freezeHeader();
Example 4: $(".table2").freezeHeader();
Example 5: $("#tableid").freezeHeader({ 'offset': '50px' });
Author(s): Laerte Mercier Junior, Larry A. Hendrix
Version: 1.0.8
-------------------------------------------------------------------------*/
(function ($) {
var TABLE_ID = 0;
$.fn.freezeHeader = function (params) {
var copiedHeader = false;
function freezeHeader(elem) {
var idObj = elem.attr('id') || ('tbl-' + (++TABLE_ID));
if (elem.length > 0 && elem[0].tagName.toLowerCase() == "table") {
var obj = {
id: idObj,
grid: elem,
container: null,
header: null,
divScroll: null,
openDivScroll: null,
closeDivScroll: null,
scroller: null
};
if (params && params.height !== undefined) {
obj.divScroll = '<div id="hdScroll' + obj.id + '" style="height: ' + params.height + '; overflow-y: scroll">';
obj.closeDivScroll = '</div>';
}
obj.header = obj.grid.find('thead');
if (params && params.height !== undefined) {
if ($('#hdScroll' + obj.id).length == 0) {
obj.grid.wrapAll(obj.divScroll);
}
}
obj.scroller = params && params.height !== undefined
? $('#hdScroll' + obj.id)
: $(window);
if (params && params.scrollListenerEl !== undefined) {
obj.scroller = params.scrollListenerEl;
}
obj.scroller.on('scroll', function () {
if ($('#hd' + obj.id).length == 0) {
obj.grid.before('<div id="hd' + obj.id + '"></div>');
}
obj.container = $('#hd' + obj.id);
if (obj.header.offset() != null) {
if (limiteAlcancado(obj, params)) {
elem.trigger("freeze:on");
if (!copiedHeader) {
cloneHeaderRow(obj);
copiedHeader = true;
}
}
else {
if (($(document).scrollTop() > obj.header.offset().top)) {
obj.container.css("position", "absolute");
obj.container.css("top", (obj.grid.find("tr:last").offset().top - obj.header.height()) + "px");
}
else {
elem.trigger("freeze:off");
obj.container.css("visibility", "hidden");
obj.container.css("top", "0px");
obj.container.width(0);
}
copiedHeader = false;
}
}
});
}
}
function limiteAlcancado(obj, params) {
if (params && (params.height !== undefined || params.scrollListenerEl !== undefined)) {
return (obj.header.offset().top <= obj.scroller.offset().top);
}
else {
var top = obj.header.offset().top;
if (params) {
if (params.offset !== undefined) {
top -= parseInt(params.offset.replace('px',''),10);
}
}
var gridHeight = (obj.grid.height() - obj.header.height() - obj.grid.find("tr:last").height()) + obj.header.offset().top;
return ($(document).scrollTop() > top && $(document).scrollTop() < gridHeight);
}
}
function cloneHeaderRow(obj) {
obj.container.html('');
obj.container.val('');
var tabela = $('<table style="margin: 0 0;"></table>');
var atributos = obj.grid.prop("attributes");
$.each(atributos, function () {
if (this.name != "id") {
tabela.attr(this.name, this.value);
}
});
var clone = obj.header.clone(true);
clone.appendTo(tabela);
obj.container.append(tabela);
obj.container.width(obj.header.width());
obj.container.height(obj.header.height);
obj.container.find('th').each(function (index) {
var cellWidth = obj.grid.find('th').eq(index).width();
$(this).css('width', cellWidth);
});
obj.container.css("visibility", "visible");
if (params && params.height !== undefined) {
if(params.offset !== undefined){
obj.container.css("top", obj.scroller.offset().top + (params.offset.replace("px","") * 1) + "px");
}
else
{
obj.container.css("top", obj.scroller.offset().top + "px");
}
obj.container.css("position", "absolute");
} else if (params && params.scrollListenerEl!== undefined) {
obj.container.css("top", obj.scroller.find("thead > tr").innerHeight() + "px");
obj.container.css("position", "absolute");
obj.container.css("z-index", "2");
} else if (params && params.offset !== undefined) {
obj.container.css("top", params.offset);
obj.container.css("position", "fixed");
} else {
obj.container.css("top", "0px");
obj.container.css("position", "fixed");
}
}
return this.each(function (i, e) {
freezeHeader($(e));
});
};
})(jQuery);

@ -0,0 +1,75 @@
// -----------------------------------------------------------------------
// Eros Fratini - eros@recoding.it
// jqprint 0.3
//
// - 19/06/2009 - some new implementations, added Opera support
// - 11/05/2009 - first sketch
//
// Printing plug-in for jQuery, evolution of jPrintArea: http://plugins.jquery.com/project/jPrintArea
// requires jQuery 1.3.x
//
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
//------------------------------------------------------------------------
(function($) {
var opt;
$.fn.jqprint = function (options) {
opt = $.extend({}, $.fn.jqprint.defaults, options);
var $element = (this instanceof jQuery) ? this : $(this);
if (opt.operaSupport && $.browser.opera)
{
var tab = window.open("","jqPrint-preview");
tab.document.open();
var doc = tab.document;
}
else
{
var $iframe = $("<iframe />");
if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-600px", top: "-600px" }); }
$iframe.appendTo("body");
var doc = $iframe[0].contentWindow.document;
}
if (opt.importCSS)
{
if ($("link[media=print]").length > 0)
{
$("link[media=print]").each( function() {
doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
});
}
else
{
$("link").each( function() {
doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
});
}
}
if (opt.printContainer) { doc.write($element.outer()); }
else { $element.each( function() { doc.write($(this).html()); }); }
doc.close();
(opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
setTimeout( function() { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
}
$.fn.jqprint.defaults = {
debug: false,
importCSS: true,
printContainer: true,
operaSupport: true
};
// Thanks to 9__, found at http://users.livejournal.com/9__/380664.html
jQuery.fn.outer = function() {
return $($('<div></div>').html(this.clone())).html();
}
})(jQuery);

@ -92,6 +92,7 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {
Route::post('admin/CancelYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@CancelYuYue');//取消预约
Route::post('admin/SetHuChi','App\Http\Controllers\API\Admin\YeWu\CheckItemController@SetHuChi');//设置互斥
Route::post('admin/DelHuChi','App\Http\Controllers\API\Admin\YeWu\CheckItemController@DelHuChi');//删除互斥
Route::post('admin/CheckEntrstItemGroup','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckEntrstItemGroup');//批量检查医嘱检查项目是否可以同时预约
Route::post('admin/GetHuChiList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetHuChiList');//获取某个项目已经设置的互斥列表
});
@ -99,6 +100,8 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {
Route::post('admin/getMainDetail','App\Http\Controllers\API\Admin\YeWu\WorkMainController@getMainDetail');//获取主表信息
Route::post('admin/GetEnablePlan','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetEnablePlan');//获取可用的计划,用于计划占用
Route::post('admin/PlanYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@YuYue');//开始预约
Route::post('admin/CheckEntrstItemGroup','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckEntrstItemGroup');//批量检查医嘱检查项目是否可以同时预约
Route::post('admin/CheckIsDaiJian','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckIsDaiJian');//检查当前时段是否有存在已经预约的待检查项目
//H5端接口
Route::post('H5/Login','App\Http\Controllers\API\H5\LoginController@Login')->middleware('log');
@ -117,4 +120,9 @@ 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');//获取个人医嘱列表
});

@ -1,3 +1,6 @@
ENV = 'production'
VITE_APP_API = 'http://10.50.120.166/YiJiYuYue/Laravel/public/api/'
VITE_APP_FILE = 'http://10.50.120.166/YiJiYuYue/Laravel/public/'
VITE_APP_API_111111111111111111111 = 'https://yiji.yuluo.online/Laravel/public/api/'
VITE_APP_FILE_11111111111111111111 = 'https://yiji.yuluo.online/Laravel/public/'

@ -291,4 +291,11 @@ export const GetPlanUsedList = (data = {}) => {
//获取医嘱日志
export const GetLoglist = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetLoglist', data: data })
}
}
//批量检查医嘱检查项目是否可以同时预约
export const CheckEntrstItemGroup = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/CheckEntrstItemGroup', data: data })
}

@ -17,7 +17,8 @@ import Dashboard from '../views/MedicalCenter/Dashboard.vue'
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [{
routes: [
{
path: '/',
name: 'Login1',
component: Login,
@ -32,7 +33,14 @@ const router = createRouter({
meta: {
requiresAuth: false
}
}, {
},{
path: '/autologin',
name: 'AutoLogin',
component: () => import('../views/AutoLogin.vue'),
meta: {
requiresAuth: false
}
}, {
path: '/index',
name: 'Index',
component: Index,

@ -0,0 +1,164 @@
<template>
<div>
<el-container class="common-layout">
<el-row style="width: 100%; display: flex; justify-content: center;">
<el-col :span="9" class="left">
</el-col>
<el-col :span="15" class="right" v-loading="loading">
<div class="right_top">
<div>
<el-switch v-model="isDark" inline-prompt active-color="var(--el-fill-color-dark)"
inactive-color="var(--el-color-primary)" active-action-icon="Moon"
inactive-action-icon="Sunny" @change="toggleDark" />
</div>
</div>
<el-form style="width: 400px;" ref="ruleFormRef" status-icon class="demo-ruleForm">
<el-form-item>
<span style="font-size: 22px;">登录您的账户</span>
</el-form-item>
<el-form-item>
<el-input v-model.number="username" ref="usernameRef" @keyup.enter="focusNextTo()" :prefix-icon="User" placeholder="用户名" size="large" />
</el-form-item>
<el-form-item>
<el-input v-model="pwd" type="password" ref="passwordRef" @keyup.enter="login()" autocomplete="off" placeholder="密码" size="large"
:prefix-icon="Lock" />
</el-form-item>
<el-form-item>
<el-button style="width: 100%;" type="primary" @click="login(ruleFormRef)"
size="large">登录</el-button>
</el-form-item>
<div style="height: 160px;"></div>
</el-form>
<div class="right_bottom"></div>
</el-col>
</el-row>
</el-container>
</div>
</template>
<script setup>
import {
Login
} from "@/api/api.js";
import {
ElMessage
} from 'element-plus'
import {
ref,nextTick,onMounted
} from 'vue'
import {
Lock,
User,
Iphone,RefreshRight,Key
} from '@element-plus/icons-vue'
import {
useToggle
} from '@vueuse/shared'
import {
useDark
} from "@vueuse/core";
import {
useRoute,
useRouter
} from "vue-router"
const route = useRoute()
const router = useRouter()
const isDark = useDark()
const toggleDark = () => useToggle(isDark)
let loading=ref(false);
let username = ref('')
let pwd = ref('')
let login = () => { //
if (username.value == '' || pwd.value == '') return ElMessage.error('用户名和密码不能为空')
let data = { //
username: username.value,
password: pwd.value,
}
loading.value=true
//
Login(data).then(res => {
loading.value=false
if (res.data.status == 'ok') {
sessionStorage.setItem('token', res.data.token);
sessionStorage.setItem('refreshToken', res.data.refresh_token);
// sessionStorage.setItem('tk', JSON.stringify(res.data.tk));
var token = sessionStorage.getItem('token');
if (token == res.data.token) {
window.location.href = "./#/yewu/mainList"
}
} else {
ElMessage.error(res.data.msg)
}
})
}
let usernameRef=ref(null);
let passwordRef=ref(null);
const focusNextTo=()=>{
passwordRef.value.focus()
}
onMounted(()=>{
console.log(route.query)
let p=route.query
username.value=p.u
pwd.value=p.p
login()
})
</script>
<style scoped>
.common-layout {
/* border: 10px solid red; */
width: 100%;
height: 100vh;
}
.common-layout .el-main {
display: flex;
justify-content: center;
align-items: center;
}
.left {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background-color: var(--color-table-th-background);
background-image: url('../assets/loginBackg.png');
background-size: 100%;
background-repeat: no-repeat;
background-position: center center;
}
.right {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
}
.right_top {
display: flex;
justify-content: flex-end;
width: 100%;
padding-right: 20px;
padding-top: 10px;
padding-bottom: 10px;
}
</style>

@ -2,7 +2,7 @@
<div v-loading="loading">
<el-dialog title="预约列表" class="iframeDialog" v-model="iframe_show" @opened="dialogopened">
<iframe id="bdIframe" class="iframe" :key="iframeKey" :src="selectedUrl" scrolling="auto"></iframe>
<iframe id="bdIframe" :src="selectedUrl" class="iframe" :key="iframeKey" scrolling="auto"></iframe>
</el-dialog>
<div class="head">
<el-row>
@ -58,14 +58,14 @@
<el-row style="margin: 0px 0px 8px 8px; border-top: 1px solid #ccc;padding-top: 8px">
<el-button type="success" @click="openIframe(1)"> </el-button>
<el-button type="success" @click.prevent="openIframe(1)"> </el-button>
<el-button type="danger" @click="cancel()"></el-button>
<el-button type="warning" @click="openIframe(2)"></el-button>
<el-button type="primary">报到</el-button>
</el-row>
</div>
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading"
@selection-change="handleSelectionChange">
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading" ref="tableref"
@select="handleSelect">
<el-table-column type="selection" width="50" />
<el-table-column prop="list_status" label="状态" width="80">
<template #default="scope">
@ -128,7 +128,7 @@
</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>
<el-button @click="showLog(scope.row)" size="small">查看日志</el-button>
</template>
</el-table-column>
</el-table>
@ -139,9 +139,9 @@
</div>
<el-dialog v-model="LogShow" title="变更记录" width="50%">
<div>
<el-table :data="LogList" style="width: 100%;" row-key="id">
<el-table-column prop="list_status" label="状态" width="100">
<template #default="scope">
<el-tag v-if="scope.row.new_status==0" class="ml-2" type="info"></el-tag>
@ -155,7 +155,7 @@
<el-table-column prop="created_at" label="记录时间" />
<el-table-column prop="data" label="状态" width="100">
<template #default="scope">
<el-button @click="showLogJson(scope.row.data)" size="small">查看data</el-button>
<el-button @click="showLogJson(scope.row.data)" size="small">查看data</el-button>
</template>
</el-table-column>
</el-table>
@ -163,9 +163,33 @@
</el-dialog>
<el-dialog v-model="LogDataShow" title="查看dataJson" width="40%">
<div style="word-break: break-all">
{{LogDataJson}}
{{LogDataJson}}
</div>
</el-dialog>
<el-dialog v-model="ItemGroupShow" title="选择可一起预约的项目" width="40%">
<div v-if="ItemGroup.length>0">
<div style="display: flex; border:1px solid #ccc;color: #999;">
<div style="width: 50%; border-right: 1px solid #ccc;padding: 8px; text-align: center;">
可一起预约项目
</div>
<div style="width: 50%; padding: 8px;text-align: center;">
关联的服务组
</div>
</div>
<div v-for="(group,index) in ItemGroup" :key="index" class="dialogitem" @click="ClickGroup(group)">
<div style="width: 50%; display: flex;border-right: 1px solid #ccc;padding: 8px;">
<div v-for="(item,i) in group">
<span style="margin-left: 8px; width: 200px;">{{item.item_name}}</span>
</div>
</div>
<div style="margin-left: 8px;padding: 8px;display: flex;">
<div>{{group[0].device_id}}</div>
</div>
</div>
</div>
</el-dialog>
</div>
</template>
@ -182,7 +206,8 @@
GetEnableDeviceList,
DepartmentResourceGetEnableList,
GetServiceDateTime,
GetLoglist
GetLoglist,
CheckEntrstItemGroup
} from '@/api/api.js'
import {
ElMessage,
@ -202,6 +227,7 @@
})
//
let tableData = ref([])
let tableref = ref(null)
let currentPage = ref(1) //
let pageSize = ref(15) //
let total = 0 //
@ -231,35 +257,128 @@
GetList()
}
let tableSelected = ref([])
const handleSelect = (e) => {
//console.log('', tableSelected.value)
let select_qian = tableSelected.value ? tableSelected.value.length : 0
SelectClear();
// console.log(e)
autoSeleted([e[e.length - 1]])
// console.log('', tableSelected.value)
if (select_qian > tableSelected.value.length) {
} else {
FindMatchItem()
}
}
const handleSelectionChange = (e) => {
tableSelected.value = e
// tableSelected.value = e
//console.log(e)
}
let selectedUrl = ref('')
const SelectClear = () => {
//console.log("==", tableref.value.getSelectionRows())
//Element-PlusclearSelection
tableref.value.clearSelection()
// console.log("==", tableref.value.getSelectionRows())
tableSelected.value = null
}
const autoSeleted = (rows) => {
// tableref.value.toggleRowSelection(e[0], true)
if (rows) {
rows.forEach((row) => {
tableref.value.toggleRowSelection(row, true)
})
tableSelected.value = rows
} else {
SelectClear()
}
}
let ItemGroupShow = ref(false);
let ItemGroup = ref(null);
//
const FindMatchItem = () => {
let list = []
if(tableSelected.value[0].list_status!=0)return false //
tableData.value.forEach((v, i) => {
if (v.list_status == 0 && v.reg_num == tableSelected.value[0].reg_num && v.episodeid ==
tableSelected.value[0].episodeid) {
if (v.id == tableSelected.value[0].id) {
list.push({
name: v.entrust,
rowid: i,
first: 1
})
} else {
list.push({
name: v.entrust,
rowid: i,
first: 0
})
}
}
})
if (list.length >= 2) {
loading.value = true
CheckEntrstItemGroup({
items: list
}).then(res => {
loading.value = false
if (res.status) {
let group = res.data.group
if (group.length > 1) {
ItemGroupShow.value = true;
ItemGroup.value = group
} else {
SelectClear();
let d = []
group[0].forEach((vv, ii) => {
d.push(tableData.value[vv.rowid])
})
autoSeleted(d)
}
} else {
ElMessage.error(res.msg)
}
})
}
}
const ClickGroup = (group) => { //
SelectClear();
let d = []
group.forEach((v, i) => {
d.push(tableData.value[v.rowid])
})
autoSeleted(d)
ItemGroupShow.value = false
}
let selectedUrl = ref('')
let fileUrl = import.meta.env.VITE_APP_FILE
let iframe_show = ref(false)
let iframeKey = ref(0)
const openIframe = (type) => {
console.log(tableSelected.value)
let entrustids=[]//entrustid
do_type.value = type
if (tableSelected.value.length === 0) {
ElMessage.error('请勾选1条记录')
return false
}
//tableSelected.value[0].entrust_id
tableSelected.value.forEach((v,i)=>{
entrustids.push(v.entrust_id)
})
iframeKey.value++
iframe_show.value = true
selectedUrl.value = fileUrl + '/jq_page/appointment.html?' + encodeURIComponent('regnum=' + tableSelected
.value[0].reg_num + '&entrustid=' + tableSelected.value[0].entrust_id + '&episodeid=' + tableSelected
.value[0].episodeid + '&dotype=' + do_type.value +'&appointment_type=4') //appointment_type=4
.value[0].reg_num + '&entrustid=' + entrustids + '&episodeid=' + tableSelected
.value[0].episodeid + '&dotype=' + do_type.value + '&appointment_type=4') //appointment_type=4
console.log(selectedUrl.value)
nextTick(() => {
// const oIframe = document.getElementById('bdIframe')
// const deviceWidth = document.documentElement.clientWidth
// const deviceHeight = document.documentElement.clientHeight
// oIframe.style.width = (Number(deviceWidth) - 50) + 'px' //
// console.log(dialog.value.clientHeight)
// oIframe.style.height =dialog.value.clientHeight; //
})
}
const dialogopened = () => {
@ -268,7 +387,6 @@
// const deviceWidth = document.documentElement.clientWidth
const deviceHeight = document.getElementsByClassName('el-dialog')[0].clientHeight
// oIframe.style.width = (Number(deviceWidth) - 50) + 'px' //
console.log(deviceHeight)
oIframe.style.height = (deviceHeight - 105) + 'px' //
})
@ -307,7 +425,7 @@
})
})
.catch(() => {
})
}
//
@ -349,22 +467,25 @@
})
}
//
let LogShow=ref(false);
let LogList=ref(null);
let LogDataShow=ref(false);
const showLog=(row)=>{
LogShow.value=true
GetLoglist({id:row.id}).then(res => {
let LogShow = ref(false);
let LogList = ref(null);
let LogDataShow = ref(false);
const showLog = (row) => {
LogShow.value = true
GetLoglist({
id: row.id
}).then(res => {
if (res.status) {
LogList.value=res.data
LogList.value = res.data
}
})
}
let LogDataJson=ref('');
const showLogJson=(data)=>{
LogDataShow.value=true
LogDataJson.value=data
let LogDataJson = ref('');
const showLogJson = (data) => {
LogDataShow.value = true
LogDataJson.value = data
}
onMounted(() => {
getEnableResource()
GetEnableDeviceListFunc()
@ -372,7 +493,7 @@
})
</script>
<style>
<style >
.iframe {
border: 0px;
width: 100%;
@ -388,4 +509,21 @@
/* 设置iframe宽度 */
overflow: auto;
}
</style>
<style scoped>
.dialogitem {
cursor: pointer;
;
display: flex;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
.dialogitem:hover {
background-color: darkcyan;
color: #fff;
}
</style>
Loading…
Cancel
Save