Compare commits
1 Commits
bug463-fix
...
develop-赵云
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77374a5889 |
@@ -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()) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,无法调用!');
|
||||
|
||||
Reference in New Issue
Block a user