打印表格。

main
鹿和sa0ChunLuyu 5 days ago
parent 168ac266be
commit bfd22a923c

@ -210,7 +210,24 @@ public function GetList(Request $request)
$count = $list; $count = $list;
$count = $count->count(); $count = $count->count();
$list=$list->orderBy('id', 'desc')->limit($pageSize)->skip(($page - 1) * $pageSize) // 跳过前9999条记录
//动态排序
$orderField = $searchInfo['orderField'] ?? '';
$orderDirection = ($searchInfo['orderDirection'] ?? '') == 'ascending' ? 'asc' : 'desc';
$allowedFields = ['reg_num', 'episodeid', 'user_name', 'user_sex', 'user_brithday', 'entrust', 'is_pay', 'list_status', 'reservation_department', 'user_phone', 'reservation_time', 'entrust_date_time'];
if (!empty($orderField) && in_array($orderField, $allowedFields)) {
if ($orderField === 'reservation_time') {
$list = $list->orderByRaw("CONCAT(IFNULL(s_list.reservation_date,''), ' ', IFNULL(s_period.period_begin_time,'')) $orderDirection");
} elseif ($orderField === 'entrust_date_time') {
$list = $list->orderByRaw("CONCAT(IFNULL(s_list.entrust_date,''), ' ', IFNULL(s_list.entrust_time,'')) $orderDirection");
} else {
$list = $list->orderBy('s_list.' . $orderField, $orderDirection);
}
} else {
$list = $list->orderBy('s_list.id', 'desc');
}
$list=$list->limit($pageSize)->skip(($page - 1) * $pageSize)
->take($pageSize)->get(); ->take($pageSize)->get();
//匹配设备(服务组) //匹配设备(服务组)

@ -597,4 +597,164 @@ public function GenerateGroupedCheckPdf()
return $pdf->inline('GenerateGroupedCheckPdf.pdf'); return $pdf->inline('GenerateGroupedCheckPdf.pdf');
} }
//打印主表列表
public function PrintMainList()
{
$searchInfo = request('searchInfo');
if (is_string($searchInfo)) {
$searchInfo = json_decode($searchInfo, true);
}
$dev = request('Dev', '0');
//用户权限过滤(复用 GetList 逻辑)
$userid = request('userid');
$userInfo = DB::table('users')->where(['id' => $userid])->first();
if(!$userInfo){
return \Yz::JsonReturn(false, '用户信息不存在');
}
$department = DB::table('s_department')->where(['id' => $userInfo->department_id,'is_del'=>0])->first();
if(!$department){
return \Yz::JsonReturn(false, '用户所属科室信息不存在');
}
//复用 GetList 筛选逻辑(去分页,查全部)
$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','s_department_resources.department_resources_addr')
->where(['s_list.is_del'=>0,'s_list.is_nullify'=>0]);
if($userInfo->group==2){
$list=$list->where(['wardcode'=> $department->department_number]);
}elseif($userInfo->group==7){
$list=$list->where(['reservation_department'=>$department->department_name]);
}else{
$deptQuery = DB::table('s_department')
->where('is_del', 0)
->where(function($q) use ($userInfo) {
$q->where('id', $userInfo->department_id)
->orWhere('pid', $userInfo->department_id);
});
$deptNumbers = clone $deptQuery;
$deptNumbers = $deptNumbers->pluck('department_number');
$deptIds = $deptQuery->pluck('id');
if ($department->is_workbench == 1) {
$linkedIds = json_decode($department->linked_departments, true);
if (!empty($linkedIds) && is_array($linkedIds)) {
$linkedQuery = DB::table('s_department')
->where('is_del', 0)
->where(function($q) use ($linkedIds) {
$q->whereIn('id', $linkedIds)
->orWhereIn('pid', $linkedIds);
});
$linkedDeptNumbers = clone $linkedQuery;
$deptNumbers = $deptNumbers->merge($linkedDeptNumbers->pluck('department_number'));
$linkedDeptIds = $linkedQuery->pluck('id');
$deptIds = $deptIds->merge($linkedDeptIds);
}
}
$list = $list->where(function ($q) use($deptNumbers, $deptIds) {
$q->whereIn('RISRAcceptDeptCode', $deptNumbers)
->orWhereIn('reservation_department_code', $deptNumbers)
->orWhereIn('s_department_resources.department_id', $deptIds);
});
}
$dateType = $searchInfo['dateType'] ?? 'reservation_date';
if ($searchInfo['dateRange']!=null and count($searchInfo['dateRange']) == 2) {
if ($dateType === 'both') {
$list = $list->where(function ($q) use($searchInfo) {
$q->whereBetween('s_list.entrust_date', $searchInfo['dateRange'])
->orWhereBetween('s_list.reservation_date', $searchInfo['dateRange']);
});
} elseif ($dateType === 'entrust_date') {
$list = $list->whereBetween('s_list.entrust_date', $searchInfo['dateRange']);
} else {
$list = $list->whereBetween('s_list.reservation_date', $searchInfo['dateRange']);
}
}
if (isset($searchInfo['list_status'])) {
$list = $list->where('s_list.list_status', $searchInfo['list_status']);
}
if (isset($searchInfo['patient_type'])) {
$list = $list->where('s_list.patient_type', $searchInfo['patient_type']);
}
if (!empty($searchInfo['resources'])) {
$list = $list->whereIn('s_list.reservation_sources', $searchInfo['resources']);
}
if (isset($searchInfo['services_group'])) {
$list = $list->whereRaw("FIND_IN_SET(?, s_list.services_group)", [$searchInfo['services_group']]);
}
if (isset($searchInfo['reg_num'])) {
$list = $list->where('s_list.reg_num', $searchInfo['reg_num']);
}
if (isset($searchInfo['user_name'])) {
$list = $list->where('s_list.user_name', 'like','%'.$searchInfo['user_name'].'%');
}
if (isset($searchInfo['doctor'])) {
$list = $list->where('s_list.docotr', 'like','%'.$searchInfo['doctor'].'%');
}
if (isset($searchInfo['apply_department'])) {
$list = $list->where('s_list.reservation_department', 'like','%'.$searchInfo['apply_department'].'%');
}
//动态排序
$orderField = $searchInfo['orderField'] ?? '';
$orderDirection = ($searchInfo['orderDirection'] ?? '') == 'ascending' ? 'asc' : 'desc';
$allowedFields = ['reg_num', 'episodeid', 'user_name', 'user_sex', 'user_brithday', 'entrust', 'is_pay', 'list_status', 'reservation_department', 'user_phone', 'reservation_time', 'entrust_date_time'];
if (!empty($orderField) && in_array($orderField, $allowedFields)) {
if ($orderField === 'reservation_time') {
$list = $list->orderByRaw("CONCAT(IFNULL(s_list.reservation_date,''), ' ', IFNULL(s_period.period_begin_time,'')) $orderDirection");
} elseif ($orderField === 'entrust_date_time') {
$list = $list->orderByRaw("CONCAT(IFNULL(s_list.entrust_date,''), ' ', IFNULL(s_list.entrust_time,'')) $orderDirection");
} else {
$list = $list->orderBy('s_list.' . $orderField, $orderDirection);
}
} else {
$list = $list->orderBy('s_list.id', 'desc');
}
if ($dev == '2') {
$debugList = clone $list;
return \Yz::JsonReturn(true, '调试', [
'count' => $debugList->count(),
'sql' => $list->toSql(),
'bindings' => $list->getBindings(),
'group' => $userInfo->group,
'department_id' => $userInfo->department_id,
'department_name' => $department->department_name,
'department_number' => $department->department_number,
'is_workbench' => $department->is_workbench,
]);
}
$list = $list->get();
//按25行分页
$perPage = 50;
$pages = $list->chunk($perPage);
$totalPages = $pages->count();
if ($dev == '1') {
$pdf = SnappyPdf::loadView('pdf.MainListPrint', [
'pages' => $pages,
'totalPages' => $totalPages,
'perPage' => $perPage,
])
->setOption('page-width', '210mm')
->setOption('page-height', '297mm')
->setOption('margin-top', '5mm')
->setOption('margin-bottom', '5mm')
->setOption('margin-left', '5mm')
->setOption('margin-right', '5mm')
->setOption('header-spacing', '0')
->setOption('footer-spacing', '0');
return $pdf->inline('MainListPrint.pdf');
}
return \Yz::JsonReturn(true, '功能开发中', ['count' => $list->count(), 'totalPages' => $totalPages]);
}
} }

@ -55,8 +55,8 @@ public function SaveApply($orderNo)
'visitSqNo' => $entrust->episodeid, 'visitSqNo' => $entrust->episodeid,
'requestNo' => $entrust->app_num, 'requestNo' => $entrust->app_num,
'visitTypeCode' => $patientHisTypeMap[$entrust->patient_type], 'visitTypeCode' => $patientHisTypeMap[$entrust->patient_type],
'orderStatus'=>1 // 'orderStatus'=>1
//'feeFlag' => $entrust->is_pay == 0 ? 0 : 1, // 住院=0其他=1 'feeFlag' => $entrust->is_pay == 0 ? 0 : 1, // 住院=0其他=1
]; ];
$hisInfo=[]; $hisInfo=[];
$His = new HisController(); $His = new HisController();

@ -0,0 +1,143 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>预约信息明细</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Microsoft YaHei', '微软雅黑', 'SimHei', '黑体', sans-serif;
font-size: 12px;
color: #333;
}
.page {
page-break-after: always;
}
.page:last-child {
page-break-after: auto;
}
table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
border: none;
}
td, th {
border: none;
border-bottom: 1px solid #333;
padding: 4px 6px;
text-align: center;
white-space: nowrap;
overflow: visible;
line-height: 1.4;
}
.col-no {
width: 40px;
}
tbody td.col-no {
border-right: 1px solid #333;
}
.col-episode { width: 90px; }
.col-bed { width: 40px; }
.col-name { width: 25px; }
.col-ward { width: 140px; }
.col-item { width: auto; }
.col-date { width: 55px; }
.col-period { width: 70px; }
.col-res { width: 130px; }
td.col-episode, td.col-bed, td.col-name, td.col-ward, td.col-item, td.col-date, td.col-period, td.col-res {
text-align: left;
}
.title-cell {
font-size: 24px;
font-weight: bold;
letter-spacing: 2px;
}
.page-info {
font-size: 11px;
font-weight: normal;
}
.empty-row td {
border-bottom: none;
}
.empty-row td.col-no {
border-right: none;
}
</style>
</head>
<body>
@php
$serialBase = 0;
@endphp
@foreach ($pages as $pageIndex => $pageItems)
@php
$currentPage = $pageIndex + 1;
@endphp
<div class="page">
<table>
<colgroup>
<col style="width:40px">
<col style="width:90px">
<col style="width:40px">
<col style="width:60px">
<col style="width:160px">
<col style="width:auto">
<col style="width:80px">
<col style="width:90px">
<col style="width:130px">
</colgroup>
<thead>
<tr>
<td class="col-no">序号</td>
<td class="col-episode">&nbsp;</td>
<td class="col-bed">床号</td>
<td colspan="5" class="title-cell">秦皇岛中医医院 预约信息明细</td>
<td class="col-res page-info">共{{ $totalPages }}页/第{{ $currentPage }}页</td>
</tr>
</thead>
<tbody>
@foreach ($pageItems as $index => $item)
@php
$serial = $pageIndex * $perPage + $loop->iteration;
$isInpatient = $item->patient_type == 0;
$entrustText = $item->entrust;
if (!empty($item->requestComment)) {
$entrustText .= '' . $item->requestComment . '';
}
$periodText = '';
if (!empty($item->period_begin_time) && !empty($item->period_end_time)) {
$periodText = substr($item->period_begin_time, 0, 5) . '~' . substr($item->period_end_time, 0, 5);
}
@endphp
<tr>
<td class="col-no">{{ $serial }}</td>
<td class="col-episode">{{ $isInpatient ? substr($item->episodeid, -10) : '' }}</td>
<td class="col-bed">{{ $isInpatient ? $item->bedno : '' }}</td>
<td class="col-name">{{ $item->user_name }}</td>
<td class="col-ward">{{ $isInpatient ? $item->warddesc : '' }}</td>
<td class="col-item">{{ $entrustText }}</td>
<td class="col-date">{{ $item->reservation_date }}</td>
<td class="col-period">{{ $periodText }}</td>
<td class="col-res">{{ $item->department_resources_addr }}</td>
</tr>
@endforeach
{{-- 不足25行补空行 --}}
@for ($i = count($pageItems); $i < $perPage; $i++)
<tr class="empty-row">
<td class="col-no">&nbsp;</td>
<td class="col-episode">&nbsp;</td>
<td class="col-bed">&nbsp;</td>
<td class="col-name">&nbsp;</td>
<td class="col-ward">&nbsp;</td>
<td class="col-item">&nbsp;</td>
<td class="col-date">&nbsp;</td>
<td class="col-period">&nbsp;</td>
<td class="col-res">&nbsp;</td>
</tr>
@endfor
</tbody>
</table>
</div>
@endforeach
</body>
</html>

@ -244,5 +244,6 @@
Route::any('/PacsSaveApplyInfo','App\Http\Controllers\API\Third\CSharpController@PacsSaveApplyInfo' )->middleware('log');;//调用此接口给pacs推送检查申请单 Route::any('/PacsSaveApplyInfo','App\Http\Controllers\API\Third\CSharpController@PacsSaveApplyInfo' )->middleware('log');;//调用此接口给pacs推送检查申请单
Route::any('/PacsCancelApplyInfo','App\Http\Controllers\API\Third\CSharpController@PacsCancelApplyInfo' )->middleware('log');;//调用此接口给pacs推送取消检查申请单 Route::any('/PacsCancelApplyInfo','App\Http\Controllers\API\Third\CSharpController@PacsCancelApplyInfo' )->middleware('log');;//调用此接口给pacs推送取消检查申请单
Route::any('/PrintMainList','App\Http\Controllers\API\PdfController@PrintMainList' )->middleware('log');//打印主表列表

@ -96,16 +96,16 @@
<el-button v-if="false" type="danger" @click="CancelSignFunc()"></el-button> <el-button v-if="false" type="danger" @click="CancelSignFunc()"></el-button>
<el-button @click="print_shenqingdan()"></el-button> <el-button @click="print_shenqingdan()"></el-button>
<el-button @click="batchPrint()"></el-button> <el-button @click="batchPrint()"></el-button>
<el-button v-if="false" v-print="'#tablelist'" >打印表格</el-button> <el-button @click="printTable()" >打印表格</el-button>
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" id="tablelist" style="width: 100%;" row-key="id" v-loading="loading" ref="tableref" <el-table :data="tableData" id="tablelist" style="width: 100%;" row-key="id" v-loading="loading" ref="tableref"
@select="handleSelect"> @select="handleSelect" @sort-change="onSortChange">
<el-table-column type="selection" width="50"> <el-table-column type="selection" width="50" fixed="left">
<template #header><span></span></template> <template #header><span></span></template>
</el-table-column> </el-table-column>
<el-table-column prop="list_status" label="状态" width="80"> <el-table-column prop="list_status" label="状态" width="80" sortable="custom">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.list_status===0" class="ml-2" type="info"></el-tag> <el-tag v-if="scope.row.list_status===0" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.list_status===1" class="ml-2" type="success"></el-tag> <el-tag v-if="scope.row.list_status===1" class="ml-2" type="success"></el-tag>
@ -113,36 +113,44 @@
<el-tag v-if="scope.row.list_status===3" class="ml-2" type="warning"></el-tag> <el-tag v-if="scope.row.list_status===3" class="ml-2" type="warning"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="门诊号" width="120"> <el-table-column prop="reg_num" label="门诊号" width="120" sortable="custom">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.patient_type != 0">{{ scope.row.reg_num }}</span> <span v-if="scope.row.patient_type != 0">{{ scope.row.reg_num }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="住院号" width="120"> <el-table-column prop="episodeid" label="住院号" width="120" sortable="custom">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.patient_type == 0">{{ scope.row.episodeid?.slice(-10) }}</span> <span v-if="scope.row.patient_type == 0">{{ scope.row.episodeid?.slice(-10) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="user_name" label="姓名" /> <el-table-column prop="user_name" label="姓名" width="100" sortable="custom" />
<el-table-column prop="user_sex" label="性别" width="60"> <el-table-column prop="user_sex" label="性别" width="80" sortable="custom">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.user_sex==1"></span> <span v-if="scope.row.user_sex==1"></span>
<span v-if="scope.row.user_sex==2"></span> <span v-if="scope.row.user_sex==2"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="age" label="年龄" width="115" /> <el-table-column prop="user_brithday" label="年龄" width="115" sortable="custom">
<el-table-column label="医嘱" width="200" show-overflow-tooltip> <template #default="scope">
{{ scope.row.age }}
</template>
</el-table-column>
<el-table-column prop="entrust" label="医嘱" width="200" show-overflow-tooltip sortable="custom">
<template #default="scope"> <template #default="scope">
{{ scope.row.entrust }}{{ scope.row.requestComment ? '' + scope.row.requestComment + '' : '' }} {{ scope.row.entrust }}{{ scope.row.requestComment ? '' + scope.row.requestComment + '' : '' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="is_pay" label="是否交费" width="80"> <el-table-column prop="is_pay" label="是否交费" width="120" sortable="custom">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.is_pay==1"></span> <span v-if="scope.row.is_pay==1"></span>
<span v-if="scope.row.is_pay==0"></span> <span v-if="scope.row.is_pay==0"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="reservation_date" label="预约日期" width="120" /> <el-table-column prop="reservation_time" label="预约日期" width="120" sortable="custom">
<template #default="scope">
{{ scope.row.reservation_date }}
</template>
</el-table-column>
<el-table-column prop="check_begin_time" label="预约时间" width="120"> <el-table-column prop="check_begin_time" label="预约时间" width="120">
<template #default="scope"> <template #default="scope">
<span <span
@ -150,8 +158,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="department_resources_name" label="排班" width="120" /> <el-table-column prop="department_resources_name" label="排班" width="120" />
<el-table-column prop="reservation_department" label="申请科室" width="120" /> <el-table-column prop="reservation_department" label="申请科室" width="120" sortable="custom" />
<el-table-column prop="" label="医嘱时间" width="160"> <el-table-column prop="entrust_date_time" label="医嘱时间" width="180" sortable="custom">
<template #default="scope"> <template #default="scope">
{{scope.row.entrust_date}} {{scope.row.entrust_time}} {{scope.row.entrust_date}} {{scope.row.entrust_time}}
</template> </template>
@ -165,7 +173,7 @@
<span v-if="scope.row.patient_type==3"></span> <span v-if="scope.row.patient_type==3"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="user_phone" label="电话" width="120" /> <el-table-column prop="user_phone" label="电话" width="120" sortable="custom" />
<!-- <el-table-column prop="implement_department" label="执行科室" width="120" /> --> <!-- <el-table-column prop="implement_department" label="执行科室" width="120" /> -->
<el-table-column prop="department_resources_name" label="操作" width="120"> <el-table-column prop="department_resources_name" label="操作" width="120">
<template #default="scope"> <template #default="scope">
@ -367,7 +375,9 @@
services_group: null, services_group: null,
reg_num: null, reg_num: null,
user_name: null, user_name: null,
apply_department: null apply_department: null,
orderField: '',
orderDirection: ''
}) })
let loginType=ref(''); let loginType=ref('');
// //
@ -402,6 +412,27 @@
}) })
} }
const debouncedSearchDept = debounce(searchDept, 300) const debouncedSearchDept = debounce(searchDept, 300)
const onSortChange = ({ prop, order }) => {
searchInfo.value.orderField = prop || ''
searchInfo.value.orderDirection = order || ''
GetList()
}
const printTable = () => {
const url = import.meta.env.VITE_APP_API + 'PrintMainList?Dev=1&userid=' + loginUserinfo.value.id + '&searchInfo=' + encodeURIComponent(JSON.stringify(searchInfo.value))
fetch(url)
.then(res => res.blob())
.then(blob => {
const blobUrl = URL.createObjectURL(blob)
const iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = blobUrl
iframe.onload = () => {
iframe.contentWindow.print()
URL.revokeObjectURL(blobUrl)
}
document.body.appendChild(iframe)
})
}
const GetList = () => { const GetList = () => {
loading.value = true loading.value = true
GetMainList({ GetMainList({

Loading…
Cancel
Save