From a6f64303f88508d1c4d6ce53ff46be6b745cfb93 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 14 十月 2025 15:21:59 +0800
Subject: [PATCH] 完成营养师管理

---
 src/views/tongji/index.vue |  184 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 180 insertions(+), 4 deletions(-)

diff --git a/src/views/tongji/index.vue b/src/views/tongji/index.vue
index 8fc503c..79a3a4b 100644
--- a/src/views/tongji/index.vue
+++ b/src/views/tongji/index.vue
@@ -17,16 +17,20 @@
 			<el-form-item>
 				<el-button type="primary" @click="onSubmit">查询</el-button>
 			</el-form-item>
+			<el-form-item>
+				<el-button type="success" @click="daochuExcel">导出</el-button>
+			</el-form-item>
 		</el-form>
 
-		<div>
+		<div class="scrollable-table" :style="{maxHeight:tableHe}">
 			<table id="tabledome" class="gridtable">
+				<thead>
 				<tr>
-					<th colspan="22">健康管理服务明显表</th>
+					<th colspan="22">健康管理服务明细表</th>
 				</tr>
 				<tr>
 					<td colspan="10">服务单位:{{clientName}}</td>
-					<td colspan="22">服务期({{state.formInline.date[0]}}到{{state.formInline.date[2]}})</td>
+					<td colspan="22">服务期({{state.formInline.date[0]}}到{{state.formInline.date[1]}})</td>
 				</tr>
 				<tr>
 					<th rowspan="2">序号</th>
@@ -62,6 +66,7 @@
 					
 					
 				</tr>
+			</thead>
 				<tbody>
 
 					<tr v-for="(row,index)  in state.tableData" :key="index">
@@ -88,7 +93,33 @@
 						<td></td>
 						<td></td>
 					</tr>
+					
 				</tbody>
+				<tfoot>
+					<tr>
+						<td colspan="3">合计</td>
+						<td>{{HJcheckIsData}}</td>
+						<td>{{HJNRS}}</td>
+						<td>{{HJSGA}}</td>
+						<td>{{HJMIS}}</td>
+						<td>{{HJGNRI}}</td>
+						<td>{{HJPEW}}</td>
+
+						<td>{{HJ膳食生活调查表}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td>{{HJ营养饮食指导方案}}</td>
+						<td></td>
+						<td>{{HJ随访记录}}</td>
+						<td></td>
+						<td></td> 
+					</tr>
+				</tfoot>
 			</table>
 		</div>
 	</div>
@@ -102,6 +133,7 @@
 import {nutritionalSummary} from '/@/api/Patients'
 import {editUserInfo} from '/@/api/login'
 import { ElLoading } from 'element-plus';
+import * as XLSX from 'xlsx';
 import {formatDate} from '/@/utils/formatTime'
 const stores = useUserInfo();
 const { userInfos } = storeToRefs(stores);
@@ -137,6 +169,106 @@
 const clientName=computed(()=>{
 	return userInfos.value.clientName
 })
+const HJcheckIsData=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row.checkIsData){
+				x++
+			}
+		});
+	}
+	return x
+})
+
+const HJNRS=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['NRS-2002']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJSGA=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['SGA']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJMIS=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['MIS']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJGNRI=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['GNRI']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJPEW=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['PEW']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJ膳食生活调查表=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['膳食生活调查表']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJ营养饮食指导方案=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['营养饮食指导方案']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
+const HJ随访记录=computed(()=>{
+	let x=0
+	if(state.tableData.length>0){
+		state.tableData.forEach(row => {
+			if(row?.surveryTimeMap?.['随访记录']?.id){
+				x++
+			}
+		});
+	}
+	return x
+})
 const tableHe = computed(() => {
 	let height = document.documentElement.clientHeight;
     console.log('窗口高度')
@@ -144,7 +276,7 @@
     if (navDom) {
         height -= navDom.scrollHeight;
     }
-	return height+'px'
+	return height-60+'px'
 })
 // 当前时间提示语
 const end = new Date()
@@ -161,6 +293,15 @@
     },
     dialogTableVisible:false
 })
+const daochuExcel=()=>{
+	let table = document.getElementById('tabledome');
+      if (table) {
+		const wb = XLSX.utils.table_to_book(table, { sheet: "Sheet1" });
+      	XLSX.writeFile(wb, "患者健康服务统计.xlsx"); // 文件名和扩展名可以根据需要更改
+      } else {
+        console.error("找不到指定的表格");
+      }
+}
 const onSubmit=()=>{
 	const pasm={
 		startTime:state.formInline.date[0]+ ' 00:00:00',
@@ -169,9 +310,16 @@
 		queryValue:''
 	}
 	console.log(pasm)
+	const loading = ElLoading.service({
+		lock: true,
+		text: 'Loading',
+		background: 'rgba(0, 0, 0, 0.7)',
+	})
 	nutritionalSummary(pasm).then(re=>{
 		console.log(re.data)
 		state.tableData=re.data
+	}).finally(()=>{
+		loading.close()
 	})
 
 }
@@ -181,6 +329,34 @@
 </script>
 
 <style scoped lang="scss">
+.scrollable-table {
+    width: 100%;
+    overflow-y: auto;
+    display: block;
+  }
+  table {
+    width: 100%;
+    border-collapse: collapse;
+  }
+  thead, tfoot {
+    background-color: #f5f5f5;
+    position: sticky;
+    left: 0;
+    right: 0;
+    z-index: 2;
+  }
+  thead {
+    top: 0;
+  }
+  tfoot {
+    bottom: 0;
+  }
+  th, td {
+    padding: 8px 12px;
+    text-align: left;
+    border: 1px solid #ddd;
+  }
+
 .gridtable {
 	width: 100%;
     font-family: verdana, arial, sans-serif;

--
Gitblit v1.8.0