Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ab046685c |
@@ -728,12 +728,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
|
||||
/**
|
||||
* 处理耗材请求
|
||||
* 🔧 BugFix #443: 签发时跳过 handDevice,避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation)
|
||||
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
|
||||
*/
|
||||
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
|
||||
this.handDevice(deviceList, curDate, adviceOpType);
|
||||
}
|
||||
this.handDevice(deviceList, curDate, adviceOpType);
|
||||
|
||||
// 签发时,把草稿状态的账单更新为待收费
|
||||
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
||||
@@ -2107,9 +2103,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
||||
sourceEnum, sourceBillNo);
|
||||
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
|
||||
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
|
||||
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
|
||||
// 手术计费场景:sourceBillNo 不为空时,过滤掉药品(1),保留耗材(2)和诊疗(3/6)
|
||||
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
|
||||
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
|
||||
&& dto.getAdviceType() == 1);
|
||||
}
|
||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||
// 请求状态
|
||||
requestBaseDto
|
||||
|
||||
@@ -246,8 +246,7 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
EncounterDiagnosis encounterDiagnosis;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
|
||||
// 如果设置旧的 ID,saveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
|
||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
|
||||
@@ -91,15 +91,13 @@
|
||||
os.surgery_nature AS surgeryType,
|
||||
cs.incision_level AS incisionLevel,
|
||||
fc.contract_name AS feeType,
|
||||
os.fee_type AS feeType,
|
||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
||||
LEFT JOIN adm_encounter ae ON ae.id = os.visit_id AND ae.delete_flag = '0'
|
||||
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
|
||||
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
|
||||
LEFT JOIN (
|
||||
SELECT patient_id, identifier_no
|
||||
FROM (
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
T5.package_name,
|
||||
T6.name as sub_item_name
|
||||
FROM wor_activity_definition T1
|
||||
/* 价格表使用LEFT JOIN,避免因缺少价格记录导致搜索不到项目 */
|
||||
LEFT JOIN adm_charge_item_definition T2
|
||||
/* 只JOIN必要的价格表,使用INNER JOIN避免笛卡尔积 */
|
||||
INNER JOIN adm_charge_item_definition T2
|
||||
ON T1.id = T2.instance_id
|
||||
AND T2.instance_table = 'wor_activity_definition'
|
||||
/* 检验类型关联 */
|
||||
|
||||
@@ -45,6 +45,18 @@
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND CASE
|
||||
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
||||
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
||||
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
||||
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
||||
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
||||
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
||||
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
||||
ELSE NULL
|
||||
END = #{status}::integer
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||
OR EXISTS (
|
||||
@@ -60,19 +72,6 @@
|
||||
</if>
|
||||
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||
drf.requester_id, drf.create_time, ap.name
|
||||
<if test="status != null and status != ''">
|
||||
HAVING CASE MIN(wsr.status_enum)
|
||||
WHEN 1 THEN 0
|
||||
WHEN 2 THEN 1
|
||||
WHEN 3 THEN 4
|
||||
WHEN 4 THEN 4
|
||||
WHEN 5 THEN 5
|
||||
WHEN 6 THEN 5
|
||||
WHEN 7 THEN 5
|
||||
WHEN 8 THEN 6
|
||||
ELSE NULL
|
||||
END = #{status}::integer
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||
|
||||
@@ -1582,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
|
||||
const packageId = packages[0].id;
|
||||
// 查询套餐明细
|
||||
const detailRes = await request({
|
||||
url: `/system/check-type/package/${packageId}/details`,
|
||||
url: `/system/package/${packageId}/details`,
|
||||
method: 'get'
|
||||
});
|
||||
if (detailRes.code === 200 && detailRes.data) {
|
||||
|
||||
@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
||||
return found.label;
|
||||
}
|
||||
|
||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
|
||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
||||
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||
if (type === 6) return '手术';
|
||||
if (type === 4) return '手术';
|
||||
@@ -1036,15 +1036,6 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
||||
return '诊疗';
|
||||
}
|
||||
|
||||
// 🔧 Bug #458 Fix: 兜底映射,确保所有有效 adviceType 都有显示标签
|
||||
// 不依赖字典数据和表名,直接返回标准类型名称
|
||||
if (type === 3) return '诊疗';
|
||||
if (type === 6) return '手术';
|
||||
if (type === 4) return '耗材';
|
||||
if (type === 1) return '西药';
|
||||
if (type === 2) return '中成药';
|
||||
if (type === 5) return '会诊';
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
@@ -1667,16 +1658,12 @@ function getListInfo(addNewRow) {
|
||||
contentJson?.consultationRequestId;
|
||||
|
||||
let adviceType = item.adviceType;
|
||||
|
||||
|
||||
// 🔧 Bug Fix: 后端保存时将耗材(4)转换为中成药(2),显示时需要转换回来
|
||||
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
||||
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
||||
|
||||
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText,需重新计算
|
||||
const backendDictText = item.adviceType_dictText;
|
||||
let adviceType_dictText = (backendDictText && backendDictText.trim())
|
||||
? backendDictText
|
||||
: mapAdviceTypeLabel(adviceType, adviceTableName);
|
||||
|
||||
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
|
||||
|
||||
// 如果是会诊类型,设置为会诊类型
|
||||
if (isConsultation) {
|
||||
|
||||
@@ -636,11 +636,12 @@ function getList() {
|
||||
if (res.code === 200) {
|
||||
surgeryList.value = res.data?.records || []
|
||||
} else {
|
||||
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
|
||||
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
|
||||
surgeryList.value = []
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn('手术列表请求异常:', error)
|
||||
console.error('获取手术列表失败:', error)
|
||||
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
||||
surgeryList.value = []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
@@ -1141,8 +1142,8 @@ function submitForm() {
|
||||
// 保存麻醉方式
|
||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||
open.value = false
|
||||
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
|
||||
emit('saved')
|
||||
getList() // 提交成功后直接刷新列表
|
||||
emit('saved') // 通知父组件刷新医嘱列表
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||
}
|
||||
@@ -1158,8 +1159,8 @@ function submitForm() {
|
||||
// 保存麻醉方式
|
||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||
open.value = false
|
||||
// 由父组件 @saved 事件负责刷新列表
|
||||
emit('saved')
|
||||
getList() // 修改成功后直接刷新列表
|
||||
emit('saved') // 通知父组件刷新医嘱列表
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="手术申请" name="surgery">
|
||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
||||
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
|
||||
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="电子处方" name="eprescription">
|
||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||
|
||||
@@ -289,62 +289,43 @@ function getList() {
|
||||
return obj;
|
||||
});
|
||||
form.value.diagnosisList = datas;
|
||||
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
|
||||
deduplicateDiagnosisList();
|
||||
// form.value.diagnosisList = res.data;
|
||||
emits('diagnosisSave', false);
|
||||
}
|
||||
});
|
||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data?.illness));
|
||||
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data.illness));
|
||||
|
||||
if (res.code == 200 && res.data?.illness?.length > 0) {
|
||||
diagnosisNetDatas.value = res.data.illness;
|
||||
res.data.illness.forEach((item, index) => {
|
||||
newList.push({
|
||||
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
|
||||
ybNo: item.ybNo,
|
||||
medTypeCode: item.medTypeCode,
|
||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||
if (res.code == 200) {
|
||||
if (res.data.illness.length > 0) {
|
||||
diagnosisNetDatas.value = res.data.illness;
|
||||
res.data.illness.forEach((item, index) => {
|
||||
newList.push({
|
||||
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
|
||||
ybNo: item.ybNo,
|
||||
medTypeCode: item.medTypeCode,
|
||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 将新数据添加到现有列表中
|
||||
form.value.diagnosisList.push(...newList);
|
||||
|
||||
// 重新排序整个列表
|
||||
form.value.diagnosisList.sort((a, b) => {
|
||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||
return aNo - bNo;
|
||||
});
|
||||
// TCM 数据添加后也去重
|
||||
deduplicateDiagnosisList();
|
||||
|
||||
// 将新数据添加到现有列表中
|
||||
form.value.diagnosisList.push(...newList);
|
||||
|
||||
// 重新排序整个列表
|
||||
form.value.diagnosisList.sort((a, b) => {
|
||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||
return aNo - bNo;
|
||||
});
|
||||
}
|
||||
emits('diagnosisSave', false);
|
||||
}
|
||||
emits('diagnosisSave', false);
|
||||
});
|
||||
|
||||
|
||||
getTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* 诊断列表去重:按 ybNo + name 组合去重,保留第一条记录
|
||||
* 防止后端 saveOrUpdate 在删除后误 INSERT 导致重复
|
||||
*/
|
||||
function deduplicateDiagnosisList() {
|
||||
const seen = new Set();
|
||||
const dedupedList = [];
|
||||
for (const item of form.value.diagnosisList) {
|
||||
// 使用 ybNo 和 name 组合作为唯一标识(中医诊断没有 ybNo,用 name 去重)
|
||||
const key = item.ybNo ? `${item.ybNo}` : `name_${item.name}`;
|
||||
if (!seen.has(key)) {
|
||||
seen.add(key);
|
||||
dedupedList.push(item);
|
||||
}
|
||||
}
|
||||
form.value.diagnosisList = dedupedList;
|
||||
}
|
||||
|
||||
init();
|
||||
function init() {
|
||||
diagnosisInit().then((res) => {
|
||||
@@ -622,18 +603,6 @@ function handleSaveDiagnosis() {
|
||||
return aNo - bNo;
|
||||
});
|
||||
|
||||
// 步骤1.5:确保每条诊断都有诊断医生和诊断时间(元数据补全)
|
||||
const doctorName = props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name;
|
||||
const now = new Date().toLocaleString('zh-CN');
|
||||
sortedList.forEach((item) => {
|
||||
if (!item.diagnosisDoctor) {
|
||||
item.diagnosisDoctor = doctorName;
|
||||
}
|
||||
if (!item.diagnosisTime) {
|
||||
item.diagnosisTime = now;
|
||||
}
|
||||
});
|
||||
|
||||
// 步骤2:重新分配连续的序号(从1开始)
|
||||
sortedList.forEach((item, index) => {
|
||||
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||
|
||||
@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
|
||||
.then((res) => {
|
||||
const list = res.data || [];
|
||||
const d = pickBestOrgQuantityRow(list);
|
||||
|
||||
// 严格批号查询有库存(orgQuantity > 0)
|
||||
if (d && Number(d.orgQuantity ?? 0) > 0) {
|
||||
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
|
||||
if (strictOk) {
|
||||
applyFromDto(d, false);
|
||||
if (Number(r.totalQuantity) <= 0) {
|
||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||
}
|
||||
persistStore();
|
||||
return;
|
||||
}
|
||||
|
||||
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
|
||||
if (lotTrimmed) {
|
||||
return runGet(false).then((res2) => {
|
||||
const list2 = res2.data || [];
|
||||
@@ -1157,8 +1157,6 @@ function handleLocationClick(item, row, index) {
|
||||
persistStore();
|
||||
});
|
||||
}
|
||||
|
||||
// 没有指定批号,直接提示
|
||||
r.totalQuantity = 0;
|
||||
r.price = 0;
|
||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||
|
||||
@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
|
||||
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||
|
||||
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
|
||||
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
|
||||
// 调用计费接口获取数据
|
||||
getPrescriptionList(row.visitId).then((res) => {
|
||||
console.log('=== 拉取计费数据返回结果 ===', res)
|
||||
if (res.code === 200 && res.data) {
|
||||
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
||||
@@ -1741,39 +1741,27 @@ function handleTemporaryMedicalSubmit(data) {
|
||||
}
|
||||
})
|
||||
|
||||
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
|
||||
// 匹配键:优先使用 chargeItemId(后端费用项目ID,最可靠),其次使用 名称+规格+数量 组合
|
||||
const submittedKeys = new Set()
|
||||
const submittedChargeIds = new Set()
|
||||
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
|
||||
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
|
||||
const submittedKeys = new Set(
|
||||
(data.temporaryAdvices || [])
|
||||
.map(a => {
|
||||
const om = a.originalMedicine || {}
|
||||
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
||||
const spec = om.specification || om.volume || ''
|
||||
const qty = om.quantity || 0
|
||||
return `${name}|||${spec}|||${qty}`
|
||||
})
|
||||
.filter(k => k !== '|||0') // 过滤掉空项
|
||||
)
|
||||
|
||||
;(data.temporaryAdvices || []).forEach(a => {
|
||||
const om = a.originalMedicine || {}
|
||||
// 收集 chargeItemId(最可靠的匹配标识)
|
||||
if (om.chargeItemId) {
|
||||
submittedChargeIds.add(om.chargeItemId)
|
||||
}
|
||||
// 构建名称+规格+数量的匹配键(用于无 chargeItemId 的兜底匹配)
|
||||
// 注意:originalMedicine 中的名称字段是 adviceName(来自 billingMedicines.map 时的字段)
|
||||
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
||||
const spec = om.specification || om.volume || ''
|
||||
const qty = om.quantity || 0
|
||||
if (name) {
|
||||
submittedKeys.add(`${name}|||${spec}|||${qty}`)
|
||||
}
|
||||
})
|
||||
|
||||
if (submittedChargeIds.size > 0 || submittedKeys.size > 0) {
|
||||
if (submittedKeys.size > 0) {
|
||||
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
||||
// 优先用 chargeItemId 匹配
|
||||
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
|
||||
return false
|
||||
}
|
||||
// 兜底用 名称+规格+数量 匹配
|
||||
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
|
||||
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
|
||||
return !submittedKeys.has(key)
|
||||
})
|
||||
} else {
|
||||
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
|
||||
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
|
||||
temporaryBillingMedicines.value = []
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user