فهرست منبع

保存联调完成

liudan 3 ماه پیش
والد
کامیت
b0214402f0

+ 77 - 11
src/pages/entryWrite/page/Entry/prescription/addPrescription/customDiagnostics/western/western.vue

@@ -124,7 +124,7 @@
 				<text class="ie-footer__num">{{ totalSelected }}</text>
 				<text> 项</text>
 			</view>
-			<view class="ie-footer__btn" :class="{ 'ie-footer__btn--loading': saving }" @tap="saveAll">
+			<view class="ie-footer__btn" :class="{ 'ie-footer__btn--loading': saving, 'ie-footer__btn--disabled': !totalSelected }" @tap="onSaveClick">
 				<view v-if="saving" class="ie-footer__loading" />
 				<text>{{ saving ? '保存中…' : '保存' }}</text>
 			</view>
@@ -164,6 +164,16 @@
 						</view>
 					</view>
 				</scroll-view>
+				<!-- 弹窗底部:确认保存 -->
+				<view class="wa-sheet__footer">
+					<view
+						class="wa-sheet__footer-btn"
+						:class="{ 'wa-sheet__footer-btn--disabled': !totalSelected }"
+						@tap="confirmSave"
+					>
+						<text>确认保存</text>
+					</view>
+				</view>
 			</view>
 		</view>
 
@@ -362,6 +372,7 @@ export default {
 			ordFreqID: '',
 			ordUsageID: '',
 			ordAdmReasonID: '',
+			ordPriorityID: '', // 03050020 返回的默认医嘱优先级
 			hospID: null,
 			admID: null,
 			patID: null,
@@ -879,6 +890,23 @@ export default {
 		closeSelectedSheet() {
 			this.setData({ showSelectedSheet: false });
 		},
+		// 底部「保存」:无已选项目时提示禁用,有则弹出已选医嘱弹窗
+		onSaveClick() {
+			if (this.saving) return;
+			if (!this.totalSelected) {
+				uni.showToast({ title: '请先选择医嘱', icon: 'none' });
+				return;
+			}
+			this.openSelectedSheet();
+		},
+		// 已选医嘱弹窗「确认保存」:关闭弹窗并执行保存
+		confirmSave() {
+			if (this.saving) return;
+			if (!this.totalSelected) return;
+			this.setData({ showSelectedSheet: false }, () => {
+				this.saveAll();
+			});
+		},
 		formatMedDesc(it) {
 			const parts = [];
 			// 数量 + 数量单位
@@ -1104,14 +1132,28 @@ export default {
 		},
 
 		/* ============ 保存 ============ */
+		// 格式化当前日期时间(开医嘱/医嘱开始默认当前时间)
+		formatDateTime() {
+			const now = new Date();
+			const pad = (n) => (n < 10 ? '0' + n : '' + n);
+			const date = now.getFullYear() + '-' + pad(now.getMonth() + 1) + '-' + pad(now.getDate());
+			const time = pad(now.getHours()) + ':' + pad(now.getMinutes()) + ':' + pad(now.getSeconds());
+			return { date, time };
+		},
 		// 仅组装保存数据(参考 docs/文档.md),不走接口保存
 		saveAll() {
 			if (this.saving) return; // 防止重复点击
+			if (!this.totalSelected) {
+				uni.showToast({ title: '请先选择医嘱', icon: 'none' });
+				return;
+			}
 			this.setData({ saving: true }, () => {
 				const patientData = Cache.get('patientData');
 				const userData = Cache.get('userData');
 				const { admID } = patientData;
 				const { userID, locID, hospID, groupID } = userData;
+				// 开医嘱日期时间 / 医嘱开始日期时间(默认为当前日期时间)
+				const { date, time } = this.formatDateTime();
 
 				// ============ 1. 西药(03100050) ============
 				const westOrders = [];
@@ -1120,13 +1162,13 @@ export default {
 					westOrders.push({
 						ordSeqNo: item.xh || '',                          // 序号
 						ordLinkSeqNo: '',                                 // 关联序号
-						ordDate: '',                                      // 开医嘱日期
-						ordTime: '',                                      // 开医嘱时间
-						ordStartDate: '',                                 // 医嘱开始日期
-						ordStartTime: '',                                 // 医嘱开始时间
+						ordDate: date,                                    // 开医嘱日期
+						ordTime: time,                                    // 开医嘱时间
+						ordStartDate: date,                               // 医嘱开始日期(默认当前日期)
+						ordStartTime: time,                               // 医嘱开始时间(默认当前时间)
 						ordEndDate: '',                                   // 医嘱结束日期
 						ordEndTime: '',                                   // 医嘱结束时间
-						ordPriorityID: item.ordPriorityID || '',          // 医嘱优先级10
+						ordPriorityID: item.ordPriorityID || this.ordPriorityID || '10', // 医嘱优先级(默认取 03050020 返回的 defaultData.ordPriorityID)
 						ordAdmReasonID: this.listId('selectData1', 'picakIndex1', 'id'), // 结算类型
 						medID: item.medID || '',                          // 医嘱项id
 						ordFirstDayNum: '',                               // 首日次数
@@ -1219,6 +1261,8 @@ export default {
 		// mainCode: E=检查 L=检验 O=治疗 -> ordTypeCode: C / L / T
 		buildCheckTreatOrders(keys, defaultMap, locID) {
 			const typeMap = { E: 'C', L: 'L', O: 'T' };
+			// 开医嘱日期时间 / 医嘱开始日期时间(默认为当前日期时间)
+			const { date, time } = this.formatDateTime();
 			const checkOrders = [];
 			const lisOrders = [];
 			const treatOrders = [];
@@ -1236,10 +1280,10 @@ export default {
 					ordPrice: def.ordPrice || 0,
 					ordQty: isTreat ? (this.treatQtyMap[k] || item.qty || 1) : (def.ordQty || 1),
 					ordDose: def.ordDose || 1,
-					ordDate: '',
-					ordTime: '',
-					ordStartDate: '',
-					ordStartTime: '',
+					ordDate: date,                       // 开医嘱日期
+					ordTime: time,                       // 开医嘱时间
+					ordStartDate: date,                  // 医嘱开始日期(默认当前日期)
+					ordStartTime: time,                  // 医嘱开始时间(默认当前时间)
 					ordSpecID: def.ordSpecID || '',
 					ordEMFlag: def.ordEMFlag || '',
 					ordPriorityID: def.ordPriorityID || '10',
@@ -1451,6 +1495,7 @@ export default {
 					this.ordFreqID = defaultData.ordFreqID || '';
 					this.ordUsageID = defaultData.ordUsageID || '';
 					this.ordAdmReasonID = defaultData.ordAdmReasonID || '';
+					this.ordPriorityID = defaultData.ordPriorityID || '';
 					this.ordDoseUnitID = defaultData.ordDoseUnitID || '';
 					this.ordQtyUomID = defaultData.ordQtyUomID || '';
 					this.ordSkinTestUsageID = defaultData.ordSkinTestUsageID || '';
@@ -1995,6 +2040,9 @@ export default {
 .ie-footer__btn--loading {
 	background: #a5c9f5;
 }
+.ie-footer__btn--disabled {
+	background: #c0c4cc;
+}
 .ie-footer__loading {
 	width: 28rpx;
 	height: 28rpx;
@@ -2066,6 +2114,25 @@ export default {
 	padding: 8rpx 28rpx 20rpx;
 	overflow: auto;
 }
+.wa-sheet__footer {
+	flex-shrink: 0;
+	padding: 16rpx 28rpx calc(16rpx + env(safe-area-inset-bottom));
+	border-top: 1rpx solid #f3f4f6;
+}
+.wa-sheet__footer-btn {
+	padding: 20rpx 0;
+	background: #1890ff;
+	color: #fff;
+	font-size: 30rpx;
+	font-weight: 600;
+	border-radius: 40rpx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+.wa-sheet__footer-btn--disabled {
+	background: #c0c4cc;
+}
 .wa-medcard {
 	display: flex;
 	align-items: center;
@@ -2274,7 +2341,6 @@ export default {
 	margin-right: 20rpx;
 }
 .sel-item__name {
-	display: flex;
 	align-items: center;
 	font-size: 30rpx;
 	font-weight: 600;

+ 1 - 0
src/pages/entryWrite/page/Entry/prescription/prescription.vue

@@ -2117,6 +2117,7 @@ export default {
     border-top: 0;
     padding: 12rpx 0 0;
     margin-top: 0;
+    width: 100%;
 }
 
 .boxBtm button {