Compare commits
5 Commits
03d980e0cf
...
d20a95c3c4
| Author | SHA1 | Date | |
|---|---|---|---|
| d20a95c3c4 | |||
| 1f84a641ea | |||
| c542b057b5 | |||
| 8fa0a239b5 | |||
| ee51ab2960 |
@@ -557,16 +557,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 药品
|
// 药品(前端adviceType=1)
|
||||||
List<AdviceSaveDto> medicineList = adviceSaveList.stream()
|
List<AdviceSaveDto> medicineList = adviceSaveList.stream()
|
||||||
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())
|
||||||
// 耗材
|
|| e.getAdviceType() == 1).collect(Collectors.toList());
|
||||||
|
// 耗材(前端adviceType=4,后端ItemType.DEVICE=2)
|
||||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||||
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
|
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())
|
||||||
// 诊疗活动(包括普通诊疗和会诊:前端会诊类型值为5)
|
|| e.getAdviceType() == 4) // 🔧 BugFix: 前端耗材类型值为4
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// 诊疗活动(包括普通诊疗:前端adviceType=3,会诊:前端adviceType=5)
|
||||||
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
||||||
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|
||||||
|| e.getAdviceType() == 5) // 🔧 BugFix: 会诊类型值为5,也归类到诊疗活动
|
|| e.getAdviceType() == 3 // 🔧 BugFix: 前端诊疗类型值为3
|
||||||
|
|| e.getAdviceType() == 5) // 🔧 BugFix: 前端会诊类型值为5
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 🔍 Debug日志: 记录分类结果
|
// 🔍 Debug日志: 记录分类结果
|
||||||
@@ -1393,7 +1397,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> signOffAdvice(List<Long> requestIdList) {
|
public R<?> signOffAdvice(List<Long> requestIdList) {
|
||||||
// 根据请求编号列表查询收费项目信息
|
log.info("BugFix#219: signOffAdvice - requestIdList={}", requestIdList);
|
||||||
|
|
||||||
|
// 🔧 BugFix: 直接对所有requestId进行作废操作,不再先查询分类
|
||||||
|
// 药品、耗材、诊疗请求都尝试作废,只有存在的才会被更新
|
||||||
|
|
||||||
|
// 根据请求编号列表查询收费项目信息(用于检查是否已收费)
|
||||||
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(requestIdList);
|
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(requestIdList);
|
||||||
|
|
||||||
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
||||||
@@ -1402,39 +1411,24 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
throw new ServiceException("已收费的项目无法签退,请刷新页面后重试");
|
throw new ServiceException("已收费的项目无法签退,请刷新页面后重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 分别获取各个请求id列表
|
|
||||||
List<Long> medReqIdList = new ArrayList<>();
|
|
||||||
List<Long> devReqIdList = new ArrayList<>();
|
|
||||||
List<Long> serReqIdList = new ArrayList<>();
|
|
||||||
|
|
||||||
chargeItemList.forEach(item -> {
|
|
||||||
switch (item.getServiceTable()) {
|
|
||||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
|
|
||||||
medReqIdList.add(item.getServiceId());
|
|
||||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST ->
|
|
||||||
devReqIdList.add(item.getServiceId());
|
|
||||||
case CommonConstants.TableName.WOR_SERVICE_REQUEST ->
|
|
||||||
serReqIdList.add(item.getServiceId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
List<Long> chargeItemIdList = chargeItemList.stream().map(ChargeItem::getId).collect(Collectors.toList());
|
List<Long> chargeItemIdList = chargeItemList.stream().map(ChargeItem::getId).collect(Collectors.toList());
|
||||||
// 根据id更新收费项目状态
|
// 根据id更新收费项目状态
|
||||||
iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue());// 撤回后需要更新为草稿
|
iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue());
|
||||||
if (!medReqIdList.isEmpty()) {
|
|
||||||
// 根据请求id更新请求状态
|
|
||||||
iMedicationRequestService.updateDraftStatusBatch(medReqIdList, null, null);
|
|
||||||
}
|
|
||||||
if (!devReqIdList.isEmpty()) {
|
|
||||||
// 根据请求id更新请求状态
|
|
||||||
iDeviceRequestService.updateDraftStatusBatch(devReqIdList);
|
|
||||||
}
|
|
||||||
if (!serReqIdList.isEmpty()) {
|
|
||||||
// 根据请求id更新请求状态
|
|
||||||
iServiceRequestService.updateDraftStatusBatch(serReqIdList);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔧 BugFix: 直接对所有requestId进行作废操作
|
||||||
|
log.info("BugFix#219: signOffAdvice - 作废所有请求, requestIdList={}", requestIdList);
|
||||||
|
|
||||||
|
// 尝试作废药品请求(只有存在的才会更新)
|
||||||
|
iMedicationRequestService.updateCancelledStatusBatch(requestIdList, null, null);
|
||||||
|
// 尝试作废耗材请求(只有存在的才会更新)
|
||||||
|
iDeviceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||||
|
// 尝试作废诊疗请求(只有存在的才会更新)
|
||||||
|
iServiceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||||
|
|
||||||
|
log.info("BugFix#219: signOffAdvice - 所有请求作废完成");
|
||||||
|
|
||||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 医生站-医嘱/处方 controller
|
* 医生站-医嘱/处方 controller
|
||||||
@@ -91,12 +92,16 @@ public class DoctorStationAdviceController {
|
|||||||
/**
|
/**
|
||||||
* 门诊签退医嘱
|
* 门诊签退医嘱
|
||||||
*
|
*
|
||||||
* @param requestIdList 请求id列表
|
* @param requestIdList 请求id列表(字符串类型,避免前端大整数精度丢失)
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/sign-off")
|
@PostMapping(value = "/sign-off")
|
||||||
public R<?> signOffAdvice(@RequestBody List<Long> requestIdList) {
|
public R<?> signOffAdvice(@RequestBody List<String> requestIdList) {
|
||||||
return iDoctorStationAdviceAppService.signOffAdvice(requestIdList);
|
// 🔧 BugFix: 将字符串转换为Long
|
||||||
|
List<Long> ids = requestIdList.stream()
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return iDoctorStationAdviceAppService.signOffAdvice(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -102,6 +102,13 @@ public interface IServiceRequestService extends IService<ServiceRequest> {
|
|||||||
*/
|
*/
|
||||||
void updateDraftStatusBatch(List<Long> serReqIdList);
|
void updateDraftStatusBatch(List<Long> serReqIdList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 🔧 BugFix#219: 更新服务状态:已作废
|
||||||
|
*
|
||||||
|
* @param serReqIdList 请求id列表
|
||||||
|
*/
|
||||||
|
void updateCancelledStatusBatch(List<Long> serReqIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新服务申请里的打印次数字段
|
* 更新服务申请里的打印次数字段
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -191,6 +191,18 @@ public class ServiceRequestServiceImpl extends ServiceImpl<ServiceRequestMapper,
|
|||||||
.in(ServiceRequest::getId, serReqIdList));
|
.in(ServiceRequest::getId, serReqIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 🔧 BugFix#219: 更新服务状态:已作废
|
||||||
|
*
|
||||||
|
* @param serReqIdList 请求id列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateCancelledStatusBatch(List<Long> serReqIdList) {
|
||||||
|
baseMapper.update(null,
|
||||||
|
new LambdaUpdateWrapper<ServiceRequest>().set(ServiceRequest::getStatusEnum, RequestStatus.CANCELLED.getValue())
|
||||||
|
.in(ServiceRequest::getId, serReqIdList));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新服务申请里的打印次数字段
|
* 更新服务申请里的打印次数字段
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -529,7 +529,13 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column type="selection" align="center" width="60" />
|
<el-table-column type="selection" align="center" width="60"
|
||||||
|
:selectable="(row) => {
|
||||||
|
// 🔧 BugFix: 已收费的医嘱(statusEnum=3或其他)不能勾选
|
||||||
|
// 只有草稿(1)、待签发/已签发(2)、已作废(5)状态的医嘱可以勾选
|
||||||
|
const canSelect = row.statusEnum == 1 || row.statusEnum == 2 || row.statusEnum == 5;
|
||||||
|
return canSelect;
|
||||||
|
}" />
|
||||||
<el-table-column label="组" align="center" width="60" prop="groupIcon" />
|
<el-table-column label="组" align="center" width="60" prop="groupIcon" />
|
||||||
<el-table-column label="医嘱类型" align="center" prop="productName" width="130">
|
<el-table-column label="医嘱类型" align="center" prop="productName" width="130">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -1554,7 +1560,32 @@ function getListInfo(addNewRow) {
|
|||||||
isAdding.value = false;
|
isAdding.value = false;
|
||||||
const res = await getPrescriptionList(props.patientInfo.encounterId);
|
const res = await getPrescriptionList(props.patientInfo.encounterId);
|
||||||
|
|
||||||
prescriptionList.value = res.data.map((item) => {
|
// 🔧 BugFix: 过滤掉已作废(statusEnum=5)的会诊医嘱
|
||||||
|
const filteredData = res.data.filter(item => {
|
||||||
|
// 防止 contentJson 为空或 undefined 导致 JSON.parse 报错
|
||||||
|
let contentJson = {};
|
||||||
|
try {
|
||||||
|
contentJson = item.contentJson ? JSON.parse(item.contentJson) : {};
|
||||||
|
} catch (e) {
|
||||||
|
contentJson = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否为会诊医嘱
|
||||||
|
const categoryEnum = contentJson?.categoryEnum || contentJson?.category_enum || item.category_enum;
|
||||||
|
const isConsultation = categoryEnum === 31 || categoryEnum === '31' ||
|
||||||
|
contentJson?.consultationType ||
|
||||||
|
contentJson?.consultationId ||
|
||||||
|
contentJson?.consultationRequestId;
|
||||||
|
|
||||||
|
// 如果是会诊医嘱且状态为已作废(5),则过滤掉
|
||||||
|
if (isConsultation && item.statusEnum === 5) {
|
||||||
|
console.log('BugFix#219: 过滤掉已作废的会诊医嘱, requestId=', item.requestId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
prescriptionList.value = filteredData.map((item) => {
|
||||||
// 防止 contentJson 为空或 undefined 导致 JSON.parse 报错
|
// 防止 contentJson 为空或 undefined 导致 JSON.parse 报错
|
||||||
let contentJson = {};
|
let contentJson = {};
|
||||||
try {
|
try {
|
||||||
@@ -2005,10 +2036,30 @@ function handleDelete() {
|
|||||||
hasRequestId: !!item.requestId
|
hasRequestId: !!item.requestId
|
||||||
})));
|
})));
|
||||||
|
|
||||||
if (draftConsultations.length > 0) {
|
// 🔧 BugFix: 分离不同状态的会诊医嘱
|
||||||
console.log('BugFix#219: 开始作废草稿状态会诊医嘱');
|
let cancelledConsultations = draftConsultations.filter(item => item.statusEnum == 5); // 已作废
|
||||||
|
let normalDraftConsultations = draftConsultations.filter(item => item.statusEnum != 5); // 其他状态
|
||||||
|
|
||||||
|
console.log('BugFix#219: cancelledConsultations=', cancelledConsultations.length, 'normalDraftConsultations=', normalDraftConsultations.length);
|
||||||
|
|
||||||
|
// 处理已作废的会诊医嘱(直接从前端列表移除)
|
||||||
|
if (cancelledConsultations.length > 0) {
|
||||||
|
console.log('BugFix#219: 已作废的会诊医嘱直接从前端移除');
|
||||||
|
cancelledConsultations.forEach(item => {
|
||||||
|
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
||||||
|
if (index !== -1) {
|
||||||
|
console.log('BugFix#219: 从列表中移除已作废会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
||||||
|
prescriptionList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
proxy.$modal.msgSuccess('会诊申请已删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理草稿/已提交的会诊医嘱(需要调用后端API)
|
||||||
|
if (normalDraftConsultations.length > 0) {
|
||||||
|
console.log('BugFix#219: 开始作废草稿/已提交状态会诊医嘱');
|
||||||
// 草稿状态的会诊直接作废
|
// 草稿状态的会诊直接作废
|
||||||
let deletePromises = draftConsultations.map(item => {
|
let deletePromises = normalDraftConsultations.map(item => {
|
||||||
// 🔧 BugFix: 从contentJson中解析consultationId
|
// 🔧 BugFix: 从contentJson中解析consultationId
|
||||||
let consultationId = item.requestId;
|
let consultationId = item.requestId;
|
||||||
try {
|
try {
|
||||||
@@ -2044,7 +2095,7 @@ function handleDelete() {
|
|||||||
if (successCount > 0) {
|
if (successCount > 0) {
|
||||||
console.log('BugFix#219: 作废成功', successCount, '条,从列表中移除');
|
console.log('BugFix#219: 作废成功', successCount, '条,从列表中移除');
|
||||||
// 从 prescriptionList 中移除已作废的会诊医嘱
|
// 从 prescriptionList 中移除已作废的会诊医嘱
|
||||||
draftConsultations.forEach(item => {
|
normalDraftConsultations.forEach(item => {
|
||||||
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
console.log('BugFix#219: 从列表中移除会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
console.log('BugFix#219: 从列表中移除会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
||||||
@@ -2054,7 +2105,10 @@ function handleDelete() {
|
|||||||
}
|
}
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// 如果没有草稿/已提交的会诊,且没有已作废的会诊,提示不可删除
|
||||||
|
if (normalDraftConsultations.length == 0 && cancelledConsultations.length == 0) {
|
||||||
console.log('BugFix#219: 没有符合条件的会诊医嘱可删除');
|
console.log('BugFix#219: 没有符合条件的会诊医嘱可删除');
|
||||||
proxy.$modal.msgWarning('所选会诊医嘱不可删除');
|
proxy.$modal.msgWarning('所选会诊医嘱不可删除');
|
||||||
}
|
}
|
||||||
@@ -2070,14 +2124,40 @@ function handleDelete() {
|
|||||||
|
|
||||||
let deleteList = [];
|
let deleteList = [];
|
||||||
let sum = 0; // 未保存总数量
|
let sum = 0; // 未保存总数量
|
||||||
|
|
||||||
|
// 🔧 BugFix: 添加调试日志
|
||||||
|
console.log('BugFix#219: 普通医嘱删除处理, normalRows=', normalRows.map(item => ({
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
statusEnum: item.statusEnum,
|
||||||
|
requestId: item.requestId,
|
||||||
|
adviceName: item.adviceName,
|
||||||
|
uniqueKey: item.uniqueKey
|
||||||
|
})));
|
||||||
|
|
||||||
|
console.log('BugFix#219: prescriptionList 中的所有医嘱=', prescriptionList.value.map(item => ({
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
statusEnum: item.statusEnum,
|
||||||
|
adviceName: item.adviceName,
|
||||||
|
uniqueKey: item.uniqueKey
|
||||||
|
})));
|
||||||
|
|
||||||
for (let i = prescriptionList.value.length - 1; i >= 0; i--) {
|
for (let i = prescriptionList.value.length - 1; i >= 0; i--) {
|
||||||
let deleteItem = prescriptionList.value[i];
|
let deleteItem = prescriptionList.value[i];
|
||||||
let index = normalRows.findIndex((item) => item.uniqueKey === deleteItem.uniqueKey);
|
let index = normalRows.findIndex((item) => item.uniqueKey === deleteItem.uniqueKey);
|
||||||
|
// 🔧 BugFix: 添加调试日志
|
||||||
|
if (index != -1) {
|
||||||
|
console.log('BugFix#219: 找到匹配的医嘱, i=', i, 'uniqueKey=', deleteItem.uniqueKey,
|
||||||
|
'statusEnum=', deleteItem.statusEnum, 'requestId=', deleteItem.requestId);
|
||||||
|
}
|
||||||
// 通过requestId判断是否已保存,如果选中项未保存 直接从数组中移除,如果已保存,调接口删除
|
// 通过requestId判断是否已保存,如果选中项未保存 直接从数组中移除,如果已保存,调接口删除
|
||||||
if (index != -1 && deleteItem.statusEnum == 1 && !deleteItem.requestId) {
|
// 🔧 BugFix: 支持 statusEnum 为 1(草稿)、2(待签发/已签发)、5(已作废) 的医嘱都可以删除
|
||||||
|
const canDelete = deleteItem.statusEnum == 1 || deleteItem.statusEnum == 2 || deleteItem.statusEnum == 5;
|
||||||
|
if (index != -1 && canDelete && !deleteItem.requestId) {
|
||||||
|
console.log('BugFix#219: 删除未保存的医嘱, i=', i);
|
||||||
prescriptionList.value.splice(i, 1);
|
prescriptionList.value.splice(i, 1);
|
||||||
sum++;
|
sum++;
|
||||||
} else if (index != -1 && deleteItem.statusEnum == 1 && deleteItem.requestId) {
|
} else if (index != -1 && canDelete && deleteItem.requestId) {
|
||||||
|
console.log('BugFix#219: 添加到删除列表, requestId=', deleteItem.requestId, 'statusEnum=', deleteItem.statusEnum);
|
||||||
deleteList.push({
|
deleteList.push({
|
||||||
requestId: deleteItem.requestId,
|
requestId: deleteItem.requestId,
|
||||||
dbOpType: '3',
|
dbOpType: '3',
|
||||||
@@ -2085,8 +2165,13 @@ function handleDelete() {
|
|||||||
encounterId: deleteItem.encounterId, // 🔧 BugFix#219: 添加就诊ID
|
encounterId: deleteItem.encounterId, // 🔧 BugFix#219: 添加就诊ID
|
||||||
patientId: deleteItem.patientId, // 🔧 BugFix#219: 添加患者ID
|
patientId: deleteItem.patientId, // 🔧 BugFix#219: 添加患者ID
|
||||||
});
|
});
|
||||||
|
} else if (index != -1) {
|
||||||
|
console.log('BugFix#219: 该医嘱不能删除, statusEnum=', deleteItem.statusEnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('BugFix#219: 普通医嘱删除列表, deleteList=', deleteList.length, 'sum=', sum);
|
||||||
|
|
||||||
handleEmrTreatment();
|
handleEmrTreatment();
|
||||||
updateExpandOrder([]);
|
updateExpandOrder([]);
|
||||||
isAdding.value = false;
|
isAdding.value = false;
|
||||||
@@ -3410,6 +3495,13 @@ function escKeyListener(e) {
|
|||||||
function handleSingOut() {
|
function handleSingOut() {
|
||||||
let selectRows = prescriptionRef.value.getSelectionRows();
|
let selectRows = prescriptionRef.value.getSelectionRows();
|
||||||
console.log('BugFix#219: handleSingOut called, selectRows=', selectRows);
|
console.log('BugFix#219: handleSingOut called, selectRows=', selectRows);
|
||||||
|
console.log('BugFix#219: 选中行详情:', selectRows.map(item => ({
|
||||||
|
adviceName: item.adviceName,
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
statusEnum: item.statusEnum,
|
||||||
|
statusEnumType: typeof item.statusEnum,
|
||||||
|
requestId: item.requestId
|
||||||
|
})));
|
||||||
|
|
||||||
if (selectRows.length == 0) {
|
if (selectRows.length == 0) {
|
||||||
proxy.$modal.msgWarning('请选择要撤回的医嘱');
|
proxy.$modal.msgWarning('请选择要撤回的医嘱');
|
||||||
@@ -3421,6 +3513,12 @@ function handleSingOut() {
|
|||||||
let normalRows = selectRows.filter(item => item.adviceType !== 5);
|
let normalRows = selectRows.filter(item => item.adviceType !== 5);
|
||||||
|
|
||||||
console.log('BugFix#219: consultationRows=', consultationRows.length, 'normalRows=', normalRows.length);
|
console.log('BugFix#219: consultationRows=', consultationRows.length, 'normalRows=', normalRows.length);
|
||||||
|
console.log('BugFix#219: normalRows详情:', normalRows.map(item => ({
|
||||||
|
adviceName: item.adviceName,
|
||||||
|
statusEnum: item.statusEnum,
|
||||||
|
statusEnumType: typeof item.statusEnum,
|
||||||
|
requestId: item.requestId
|
||||||
|
})));
|
||||||
|
|
||||||
// 处理会诊医嘱撤回
|
// 处理会诊医嘱撤回
|
||||||
if (consultationRows.length > 0) {
|
if (consultationRows.length > 0) {
|
||||||
@@ -3436,10 +3534,29 @@ function handleSingOut() {
|
|||||||
let submittedConsultations = consultationRows.filter(item => item.requestId);
|
let submittedConsultations = consultationRows.filter(item => item.requestId);
|
||||||
console.log('BugFix#219: 可处理的会诊医嘱=', submittedConsultations.length);
|
console.log('BugFix#219: 可处理的会诊医嘱=', submittedConsultations.length);
|
||||||
|
|
||||||
// 处理草稿状态的会诊(直接作废)
|
// 🔧 BugFix: 分离已作废的会诊医嘱
|
||||||
if (submittedConsultations.length > 0) {
|
let cancelledConsultations = submittedConsultations.filter(item => item.statusEnum == 5); // 已作废
|
||||||
console.log('BugFix#219: 开始处理会诊医嘱, 数量=', submittedConsultations.length);
|
let normalConsultations = submittedConsultations.filter(item => item.statusEnum != 5); // 其他状态
|
||||||
let processPromises = submittedConsultations.map(item => {
|
|
||||||
|
console.log('BugFix#219: cancelledConsultations=', cancelledConsultations.length, 'normalConsultations=', normalConsultations.length);
|
||||||
|
|
||||||
|
// 处理已作废的会诊医嘱(直接从前端列表移除)
|
||||||
|
if (cancelledConsultations.length > 0) {
|
||||||
|
console.log('BugFix#219: 已作废的会诊医嘱直接从前端移除');
|
||||||
|
cancelledConsultations.forEach(item => {
|
||||||
|
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
||||||
|
if (index !== -1) {
|
||||||
|
console.log('BugFix#219: 从列表中移除已作废会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
||||||
|
prescriptionList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
proxy.$modal.msgSuccess('会诊申请已移除');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理草稿/已提交的会诊医嘱(需要调用后端API)
|
||||||
|
if (normalConsultations.length > 0) {
|
||||||
|
console.log('BugFix#219: 开始处理会诊医嘱, 数量=', normalConsultations.length);
|
||||||
|
let processPromises = normalConsultations.map(item => {
|
||||||
// 🔧 BugFix: 从contentJson中解析consultationId
|
// 🔧 BugFix: 从contentJson中解析consultationId
|
||||||
let consultationId = item.requestId;
|
let consultationId = item.requestId;
|
||||||
try {
|
try {
|
||||||
@@ -3481,7 +3598,7 @@ function handleSingOut() {
|
|||||||
if (successCount > 0) {
|
if (successCount > 0) {
|
||||||
console.log('BugFix#219: 会诊医嘱处理成功', successCount, '条,从列表中移除');
|
console.log('BugFix#219: 会诊医嘱处理成功', successCount, '条,从列表中移除');
|
||||||
// 从 prescriptionList 中移除已处理的会诊医嘱
|
// 从 prescriptionList 中移除已处理的会诊医嘱
|
||||||
submittedConsultations.forEach(item => {
|
normalConsultations.forEach(item => {
|
||||||
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
console.log('BugFix#219: 从列表中移除会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
console.log('BugFix#219: 从列表中移除会诊医嘱, index=', index, 'adviceName=', item.adviceName);
|
||||||
@@ -3491,7 +3608,10 @@ function handleSingOut() {
|
|||||||
}
|
}
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// 如果没有可处理的会诊,且没有已作废的会诊,提示不可撤回
|
||||||
|
if (normalConsultations.length == 0 && cancelledConsultations.length == 0) {
|
||||||
console.log('BugFix#219: 没有可处理的会诊医嘱');
|
console.log('BugFix#219: 没有可处理的会诊医嘱');
|
||||||
proxy.$modal.msgWarning('所选会诊医嘱不可撤回');
|
proxy.$modal.msgWarning('所选会诊医嘱不可撤回');
|
||||||
}
|
}
|
||||||
@@ -3505,20 +3625,52 @@ function handleSingOut() {
|
|||||||
|
|
||||||
// 处理普通医嘱撤回
|
// 处理普通医嘱撤回
|
||||||
if (normalRows.length > 0) {
|
if (normalRows.length > 0) {
|
||||||
|
// 🔧 BugFix: 添加调试日志
|
||||||
|
console.log('BugFix#219: 普通医嘱撤回处理, normalRows=', normalRows.map(item => ({
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
statusEnum: item.statusEnum,
|
||||||
|
requestId: item.requestId,
|
||||||
|
adviceName: item.adviceName
|
||||||
|
})));
|
||||||
|
|
||||||
|
// 🔧 BugFix: 将requestId转换为数字类型
|
||||||
let requestIdList = normalRows
|
let requestIdList = normalRows
|
||||||
.filter((item) => item.statusEnum == 2)
|
.filter((item) => {
|
||||||
.map((item) => item.requestId);
|
// 🔧 BugFix: 只有 statusEnum 为 1(草稿)、2(已签发) 的医嘱可以撤回
|
||||||
|
// 已作废(5)的医嘱不能撤回,只能删除
|
||||||
|
const canRecall = item.statusEnum == 1 || item.statusEnum == 2;
|
||||||
|
console.log('BugFix#219: 检查撤回条件, adviceName=', item.adviceName,
|
||||||
|
'statusEnum=', item.statusEnum, 'canRecall=', canRecall);
|
||||||
|
return canRecall;
|
||||||
|
})
|
||||||
|
.map((item) => {
|
||||||
|
// 🔧 BugFix: 保持requestId为字符串,避免JavaScript大整数精度丢失
|
||||||
|
// JavaScript Number只能精确表示2^53-1(9007199254740991)以内的整数
|
||||||
|
// requestId如2034267613248606210会丢失精度变成2034267613248606200
|
||||||
|
console.log('BugFix#219: 使用requestId字符串, 值=', item.requestId, '类型=', typeof item.requestId);
|
||||||
|
return item.requestId; // 保持原始字符串类型
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('BugFix#219: 可撤回的普通医嘱, requestIdList=', requestIdList);
|
||||||
|
|
||||||
if (requestIdList.length == 0) {
|
if (requestIdList.length == 0) {
|
||||||
proxy.$modal.msgWarning('所选普通医嘱无可撤回项');
|
proxy.$modal.msgWarning('所选普通医嘱无可撤回项');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('BugFix#219: 调用singOut接口, requestIdList=', requestIdList, '请求体=', JSON.stringify(requestIdList));
|
||||||
|
|
||||||
singOut(requestIdList).then((res) => {
|
singOut(requestIdList).then((res) => {
|
||||||
|
console.log('BugFix#219: singOut接口返回, res=', res);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
proxy.$modal.msgSuccess('操作成功');
|
proxy.$modal.msgSuccess('操作成功');
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('撤回失败: ' + (res.msg || '未知错误'));
|
||||||
}
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error('BugFix#219: singOut接口错误, err=', err);
|
||||||
|
proxy.$modal.msgError('撤回失败: ' + (err.message || '网络错误'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user