Compare commits
8 Commits
2b6b00b6c2
...
guanyu
| Author | SHA1 | Date | |
|---|---|---|---|
| 7adb3b3ea4 | |||
| 1e6704928a | |||
| 75e49f0237 | |||
| 798c5e19e2 | |||
| fa18e94cd9 | |||
| 69bb887d19 | |||
| b89f41048b | |||
| e13e328627 |
@@ -169,7 +169,7 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
||||
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
|
||||
orgLoc.getStartTime(), orgLoc.getEndTime())) {
|
||||
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
|
||||
String organizationName = org != null ? org.getName() : "未知科室";
|
||||
String organizationName = org != null ? org.getName() : ("科室[" + organizationLocation.getOrganizationId() + "]已删除");
|
||||
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
|
||||
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + organizationName + "时间冲突");
|
||||
}
|
||||
|
||||
@@ -244,6 +244,8 @@ const getList = async () => {
|
||||
const handleSearch = () => {
|
||||
// 搜索时保持已选中的项目不受影响
|
||||
};
|
||||
// 编辑初始化标志:避免 applyEditTransferSelection 设置 transferValue 时触发 projectWithDepartment 覆盖 descJson 中的科室值
|
||||
const isInitializing = ref(false);
|
||||
const transferValue = ref([]);
|
||||
const form = reactive({
|
||||
// categoryType: '', // 项目类别
|
||||
@@ -341,6 +343,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
||||
watch(
|
||||
() => transferValue.value,
|
||||
(newValue) => {
|
||||
if (isInitializing.value) return;
|
||||
projectWithDepartment(newValue, 1);
|
||||
}
|
||||
);
|
||||
@@ -377,7 +380,10 @@ const applyEditTransferSelection = () => {
|
||||
}
|
||||
}
|
||||
const uniq = [...new Set(selectedIds)]
|
||||
// 设置初始化标志,防止 transferValue 变化触发 projectWithDepartment 覆盖 descJson 中的科室值
|
||||
isInitializing.value = true
|
||||
transferValue.value = uniq
|
||||
isInitializing.value = false
|
||||
if (newData.requestFormDetailList.length && uniq.length === 0) {
|
||||
console.warn(
|
||||
'[LaboratoryTests] 申请单明细未能在项目字典中匹配到项,请核对 activityId / 项目名称',
|
||||
@@ -427,7 +433,9 @@ watch(
|
||||
selectedIds.push(matched.adviceDefinitionId);
|
||||
}
|
||||
});
|
||||
isInitializing.value = true;
|
||||
transferValue.value = selectedIds;
|
||||
isInitializing.value = false;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -348,7 +348,8 @@ const adviceTypeList = computed(() => {
|
||||
return val === 3 || val === 4;
|
||||
}).map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value)
|
||||
// drord_doctor_type 中耗材是 4,但 /advice-base-info 后端耗材类型是 2
|
||||
value: parseInt(item.value) === 4 ? 2 : parseInt(item.value)
|
||||
}));
|
||||
return [...filtered, { label: '全部', value: '' }];
|
||||
}
|
||||
@@ -483,8 +484,9 @@ watch(
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss');
|
||||
// 弹窗打开时重新加载科室和位置选项,确保数据最新
|
||||
// 弹窗打开时按当前患者科室重新加载,避免复用上一次患者/登录科室的结果
|
||||
loadDepartmentOptions();
|
||||
getAdviceBaseInfos();
|
||||
getDiseaseInitLoc(16);
|
||||
} else {
|
||||
resetData();
|
||||
@@ -565,6 +567,8 @@ function getAdviceBaseInfos() {
|
||||
queryParams.value.adviceTypes = [1, 2, 3];
|
||||
}
|
||||
queryParams.value.organizationId = orgId.value;
|
||||
queryParams.value.adviceTypes = normalizeAdviceTypesForQuery(adviceType.value);
|
||||
queryParams.value.organizationId = props.patientInfo.organizationId || orgId.value;
|
||||
queryParams.value.pricingFlag = 1; // 划价标记
|
||||
getAdviceBaseInfo(queryParams.value)
|
||||
.then((res) => {
|
||||
@@ -620,6 +624,12 @@ function getItemType_Text(type) {
|
||||
const map = { 2: '耗材', 3: '诊疗' };
|
||||
return map[type] || '其他';
|
||||
}
|
||||
function normalizeAdviceTypesForQuery(type) {
|
||||
if (type === '' || type === undefined || type === null) {
|
||||
return '2,3';
|
||||
}
|
||||
return Number(type) === 4 ? 2 : type;
|
||||
}
|
||||
function getUnitCodeOptions(row) {
|
||||
const unitCodes = [];
|
||||
// 大单位:优先用 code,code 缺失时用字典文本兜底
|
||||
|
||||
@@ -1854,6 +1854,21 @@ function handleTemporaryMedicalRefresh() {
|
||||
function handleQuoteBilling() {
|
||||
// 重新拉取计费药品数据
|
||||
if (temporaryPatientInfo.value.visitId) {
|
||||
// 🔧 修复 Bug #445: 在清空之前提取已提交项目的复合匹配键
|
||||
// 原因:后续的 ID 匹配过滤依赖 temporaryAdvices,但 temporaryAdvices 会被先清空
|
||||
// 新医嘱没有 requestId/chargeItemId,需用名称+规格+数量的复合键匹配
|
||||
const submittedKeys = new Set(
|
||||
(temporaryAdvices.value || [])
|
||||
.map(a => {
|
||||
const om = a.originalMedicine || {}
|
||||
const name = om.medicineName || om.adviceName || a.adviceName || ''
|
||||
const spec = om.specification || om.volume || ''
|
||||
const qty = om.quantity ?? 0
|
||||
return `${name}|||${spec}|||${qty}`
|
||||
})
|
||||
.filter(k => k !== '|||0')
|
||||
)
|
||||
|
||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => {
|
||||
if (res.code === 200 && res.data) {
|
||||
@@ -1993,27 +2008,57 @@ function handleQuoteBilling() {
|
||||
})
|
||||
|
||||
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表
|
||||
// 原因:后端返回的计费数据中,已生成医嘱的项目可能没有 requestId 字段
|
||||
// 方案:用 chargeItemId/requestId/id 与已有的 temporaryAdvices 做匹配,排除已生成项目
|
||||
if (temporaryAdvices.value.length > 0) {
|
||||
const existingAdviceIds = new Set()
|
||||
temporaryAdvices.value.forEach(a => {
|
||||
const om = a.originalMedicine || {}
|
||||
if (om.requestId) existingAdviceIds.add(String(om.requestId))
|
||||
if (om.chargeItemId) existingAdviceIds.add(String(om.chargeItemId))
|
||||
if (om.id) existingAdviceIds.add(String(om.id))
|
||||
// 使用清空前提取的 submittedKeys(名称|||规格|||数量复合键)进行匹配
|
||||
if (submittedKeys.size > 0) {
|
||||
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
|
||||
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity ?? 0}`
|
||||
return !submittedKeys.has(key)
|
||||
})
|
||||
// 同步更新 temporaryAdvices,保持两份数据一致
|
||||
temporaryAdvices.value = temporaryBillingMedicines.value.map((medicine, index) => {
|
||||
const specMatch = medicine.specification ? medicine.specification.match(/(\d+)(\D+)/) : null
|
||||
const specValue = specMatch ? parseInt(specMatch[1]) : 1
|
||||
const specUnit = specMatch ? specMatch[2] : 'ml'
|
||||
const dosage = specValue * (medicine.quantity || 1)
|
||||
let usageCode = 'iv'
|
||||
let usageLabel = '静脉注射'
|
||||
try {
|
||||
const jsonContent = medicine.contentJson || medicine.content_json;
|
||||
if (jsonContent) {
|
||||
const contentData = JSON.parse(jsonContent);
|
||||
if (contentData.methodCode) {
|
||||
usageCode = contentData.methodCode;
|
||||
usageLabel = getUsageLabel(contentData.methodCode);
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
if (!usageCode || usageCode === 'iv') {
|
||||
if (medicine.medicineName && medicine.medicineName.includes('注射液')) {
|
||||
usageCode = 'iv'; usageLabel = '静脉注射';
|
||||
} else if (medicine.medicineName && medicine.medicineName.includes('片')) {
|
||||
usageCode = 'po'; usageLabel = '口服';
|
||||
} else if (medicine.medicineName && medicine.medicineName.includes('胶囊')) {
|
||||
usageCode = 'po'; usageLabel = '口服';
|
||||
}
|
||||
}
|
||||
return {
|
||||
id: index + 1,
|
||||
adviceName: medicine.medicineName || '',
|
||||
dosage,
|
||||
unit: specUnit,
|
||||
usage: usageCode,
|
||||
usageLabel,
|
||||
frequency: '临时',
|
||||
executeTime: new Date().toLocaleString('zh-CN'),
|
||||
originalMedicine: {
|
||||
...medicine,
|
||||
medicineName: medicine.medicineName,
|
||||
specification: medicine.specification,
|
||||
quantity: medicine.quantity,
|
||||
encounterId: temporaryPatientInfo.value.visitId
|
||||
}
|
||||
}
|
||||
})
|
||||
if (existingAdviceIds.size > 0) {
|
||||
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
|
||||
const mRequestId = m.requestId != null ? String(m.requestId) : null
|
||||
const mChargeItemId = m.chargeItemId != null ? String(m.chargeItemId) : null
|
||||
const mId = m.id != null ? String(m.id) : null
|
||||
if (mRequestId && existingAdviceIds.has(mRequestId)) return false
|
||||
if (mChargeItemId && existingAdviceIds.has(mChargeItemId)) return false
|
||||
if (mId && existingAdviceIds.has(mId)) return false
|
||||
return true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
temporaryMedicalLoading.value = false // 🔧 新增:加载完成
|
||||
|
||||
Reference in New Issue
Block a user