14 Commits

Author SHA1 Message Date
赵云
6940c3861d Fix Bug #458: 门诊医生站:诊疗类医嘱保存成功后,列表"医嘱类型"列显示为空值
增强 mapAdviceTypeLabel 函数的兜底映射:在原有表名匹配兜底的基础上,
新增不依赖表名的最终兜底映射(1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=手术),
确保即使字典缺失或表名不匹配也能正确显示类型标签。

同时修复 getListInfo 中 adviceType_dictText 的空字符串判断逻辑,
使用显式 trim() 检查替代 || 运算符,避免后端返回空字符串时未被重新计算。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 21:13:26 +08:00
赵云
6e975bf9c4 Fix Bug #451: 门诊医生站-提交新增手术申请后列表刷新失败
根因:子组件 submitForm 成功后同时调用 getList() 和 emit('saved'),
父组件 @saved 也调用 getList(),导致两个并发请求产生竞态条件;
若后端事务尚未完全提交,getList() 查询可能失败并弹出 msgError。

修复:
1. 子组件移除直接 getList() 调用,统一由父组件 @saved 刷新
2. 父组件添加 500ms 延迟确保后端事务已提交
3. getList() 错误处理改为 console.warn 优雅降级,避免阻断弹窗

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:20:27 +08:00
荀彧
3360cccaa5 Fix Bug #463: [目录管理-诊疗目录] 新增/编辑弹窗中"诊疗子项"检索功能失效,无法搜到已维护的项目
根因:ActivityDefinitionManageMapper.xml 中 getDiseaseTreatmentPage 查询使用 INNER JOIN
关联 adm_charge_item_definition 价格表,导致 55 个没有价格记录的诊疗项目被完全排除
在搜索结果之外。改为 LEFT JOIN 后,即使项目暂无价格记录也能被搜索到。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:16:15 +08:00
荀彧
fe138589a5 Fix Bug #445: 门诊手术安排-已生成医嘱的计费项目未从待生成列表剔除
根因:submit后本地过滤逻辑中submittedKeys的字段名不匹配
- originalMedicine中的名称字段是adviceName而非medicineName,导致
  名称+规格+数量的匹配键无法正确匹配已提交项
- 修复:增加chargeItemId作为首选匹配标识(后端唯一ID最可靠),
  名称匹配增加adviceName字段兜底

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:13:49 +08:00
荀彧
270475adb9 Fix Bug #444: 门诊手术医嘱界面"已引用计费药品"列表未正常显示药品名称
根因分析:
1. 前端 handleMedicalAdvice 调用 getPrescriptionList 时只传 encounterId,
   未传 generateSourceEnum=6 和 sourceBillNo(手术单号),
   后端默认查询 generateSourceEnum=1(医生开立),漏掉了手术计费创建的药品记录
2. 后端 getRequestBaseInfo 在 sourceBillNo 存在时会过滤掉药品(adviceType=1),
   进一步阻断了手术计费药品的返回

修复方案:
- 前端:handleMedicalAdvice 传参 (visitId, 6, operCode) 匹配手术计费记录
- 后端:移除手术计费场景的药品过滤,前端各组件已按 adviceType 自行过滤

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:10:17 +08:00
关羽
7d0c93b9a1 Fix Bug #452: 领用出库模块选择药品时提示"仓库数量为0,无法调用",与实际库存数据不符
严格批号查询返回记录但 orgQuantity=0 时,原代码直接调用 applyFromDto 并弹出警告,
未回退到非严格查询(不含 lotNumber)获取同仓库其他有库存的批号。
修复:在 applyFromDto 之前检查 orgQuantity > 0,数量为0时回退到非严格查询。
2026-05-14 19:24:03 +08:00
荀彧
87f5135ddc Fix Bug #426: 门诊医生站-检查开立:已选择列表应支持树形展开,显示套餐明细(项目/数量/单价)
修复 loadMethodPackageDetails 函数中套餐明细 API 地址错误(/system/package/ → /system/check-type/package/),导致套餐明细加载失败返回 404

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 19:06:33 +08:00
关羽
e6c0d03dc1 Fix Bug #443: 手术计费:点击"签发"耗材时异常报错
根因:签发耗材时 handDevice 方法会重复调用 saveOrUpdate 更新已有的 DeviceRequest 记录,
仅设置了部分字段(可能为 null),导致关键字段 performLocation(发放库房)被覆盖为空。
随后 handleDeviceDispense 创建 DeviceDispense 时 locationId 为 null,触发报错。

修复:签发操作(SIGN_ADVICE)跳过 handDevice 处理。因为耗材请求在保存时已创建完成,
签发只需更新状态(下方批量更新逻辑已处理),无需重新走 insert/update 流程。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:15:50 +08:00
赵云
5f7b75667a Fix Bug #402: 住院医生站诊断录入:点击保存诊断后,列表出现重复记录且部分条目元数据缺失
根因:后端 saveDoctorDiagnosis 先删除所有 tcm_flag=0 的记录,再用旧 encounterDiagnosisId
调用 saveOrUpdate,由于记录已删除,UPDATE 失败后 fallback 到 INSERT 导致重复记录。

修复:
1. 后端:不再设置 encounterDiagnosisId,确保 saveOrUpdate 始终执行 INSERT
2. 前端:getList() 后对诊断列表按 ybNo/name 去重,防止重复显示
3. 前端:保存前补全 diagnosisDoctor 和 diagnosisTime 元数据
4. 前端:修复 getTcmDiagnosis 的空值安全访问(res.data?.illness?.length)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:37 +08:00
赵云
2cdda279a4 Fix Bug #435: 门诊手术安排:编辑弹窗中"费用类别"字段数据未回显
根因:getSurgeryScheduleDetail 的 SQL 查询中引用了 fc.contract_name 但
未 JOIN fin_contract 表(以及关联的 adm_encounter、adm_account),导致
PostgreSQL 报错 "missing FROM-clause entry for table fc",接口返回失败,
前端费用类别字段无法获取数据。

修复:添加缺失的三表 JOIN(adm_encounter → adm_account → fin_contract),
并移除重复的 os.fee_type AS feeType 别名。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:08 +08:00
bc595e3843 bug499 【住院医生工作站-检查申请】检查申请列表缺失查询过滤功能,不符合临床高效检索要求 数据库语句报错修复 2026-05-14 18:10:46 +08:00
荀彧
53e5ee331b Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
1. handleMethodSelect 中新增/更新已选项时,设置 expanded=true 使套餐明细自动展开
2. toggleItemExpand 中改用 packageDetailsDisplay/carrier.packageDetails 判断是否已加载明细
   (原代码检查非响应式的 item.packageDetails,导致重复加载或加载判断失效)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:09:16 +08:00
关羽
571f254d0e Fix Bug #408: 门诊医生站:检查标签页:选中检查申请记录后,“检查明细”标签页显示“暂无数据”
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:19:52 +08:00
关羽
560813d009 Fix Bug #412: 门诊医生站:传染病报告卡保存失败,提示报错
BeanUtils.copyProperties 不支持 DTO 中 LocalDate/LocalDateTime 到实体中 java.util.Date 的类型转换,导致 onsetDate、diagDate、reportDate、deathDate 等日期字段在拷贝后为 null。新增手动类型转换逻辑确保日期字段正确保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:16:39 +08:00
12 changed files with 178 additions and 88 deletions

View File

@@ -728,8 +728,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理耗材请求
* 🔧 BugFix #443: 签发时跳过 handDevice避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
*/
this.handDevice(deviceList, curDate, adviceOpType);
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
this.handDevice(deviceList, curDate, adviceOpType);
}
// 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
@@ -2103,11 +2107,9 @@ 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);
// 手术计费场景sourceBillNo 不为空时过滤掉药品1保留耗材2和诊疗3/6
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
&& dto.getAdviceType() == 1);
}
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto

View File

@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.*;
@@ -243,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
EncounterDiagnosis encounterDiagnosis;
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
encounterDiagnosis = new EncounterDiagnosis();
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
// 如果设置旧的 IDsaveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
encounterDiagnosis.setEncounterId(encounterId);
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
@@ -598,6 +602,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport);
// BeanUtils.copyProperties 不支持 LocalDate/LocalDateTime 到 java.util.Date 的类型转换,需手动处理
if (infectiousDiseaseReportDto.getOnsetDate() != null) {
infectiousDiseaseReport.setOnsetDate(
Date.from(infectiousDiseaseReportDto.getOnsetDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getDiagDate() != null) {
infectiousDiseaseReport.setDiagDate(
Date.from(infectiousDiseaseReportDto.getDiagDate().atZone(ZoneId.systemDefault()).toInstant()));
}
// deathDate / reportDate 同理
if (infectiousDiseaseReportDto.getDeathDate() != null) {
infectiousDiseaseReport.setDeathDate(
Date.from(infectiousDiseaseReportDto.getDeathDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getReportDate() != null) {
infectiousDiseaseReport.setReportDate(
Date.from(infectiousDiseaseReportDto.getReportDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
/**
* 设置创建人、删除状态、租户ID
*/

View File

@@ -91,13 +91,15 @@
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 (

View File

@@ -42,8 +42,8 @@
T5.package_name,
T6.name as sub_item_name
FROM wor_activity_definition T1
/* 只JOIN必要的价格表使用INNER JOIN避免笛卡尔积 */
INNER JOIN adm_charge_item_definition T2
/* 价格表使用LEFT JOIN避免因缺少价格记录导致搜索不到项目 */
LEFT JOIN adm_charge_item_definition T2
ON T1.id = T2.instance_id
AND T2.instance_table = 'wor_activity_definition'
/* 检验类型关联 */

View File

@@ -45,18 +45,6 @@
<if test="endDate != null and endDate != ''">
AND drf.create_time &lt;= (#{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 (
@@ -72,6 +60,19 @@
</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">

View File

@@ -1362,8 +1362,9 @@ async function handleMethodSelect(checked, method, cat) {
existingItem.isPackage = true;
existingItem.packageId = method.packageId;
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
// 预加载套餐明细
loadPackageDetailsForItem(existingItem);
await loadPackageDetailsForItem(existingItem);
}
updateMethodDisplay();
return;
@@ -1399,9 +1400,10 @@ async function handleMethodSelect(checked, method, cat) {
};
selectedItems.value.push(newItem);
// 如果是套餐,预加载套餐明细
// 如果是套餐,预加载套餐明细并默认展开
if (newItem.isPackage && newItem.packageId) {
loadPackageDetailsForItem(newItem);
newItem.expanded = true;
await loadPackageDetailsForItem(newItem);
}
// 自动回填执行科室
@@ -1523,7 +1525,10 @@ async function handleItemSelect(checked, item, cat) {
// Bug #384修复 + #426修复: 展开/收起项目卡片
async function toggleItemExpand(item) {
item.expanded = !item.expanded;
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) {
const carrier = getPackageCarrier(item);
const hasDetails = Array.isArray(item.packageDetailsDisplay) && item.packageDetailsDisplay.length > 0
|| Array.isArray(carrier?.packageDetails) && carrier.packageDetails.length > 0;
if (item.expanded && (item.isPackage || item.packageName) && !hasDetails && !item.packageDetailsLoading) {
await loadPackageDetailsForItem(item);
}
if (item.expanded && shouldShowPackageBody(item)) {
@@ -1577,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/package/${packageId}/details`,
url: `/system/check-type/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {

View File

@@ -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,6 +1036,15 @@ 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 '';
};
@@ -1658,12 +1667,16 @@ function getListInfo(addNewRow) {
contentJson?.consultationRequestId;
let adviceType = item.adviceType;
// 🔧 Bug Fix: 后端保存时将耗材(4)转换为中成药(2),显示时需要转换回来
// 检查 adviceTableName如果是耗材表则应该是耗材类型
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText需重新计算
const backendDictText = item.adviceType_dictText;
let adviceType_dictText = (backendDictText && backendDictText.trim())
? backendDictText
: mapAdviceTypeLabel(adviceType, adviceTableName);
// 如果是会诊类型,设置为会诊类型
if (isConsultation) {

View File

@@ -636,12 +636,11 @@ function getList() {
if (res.code === 200) {
surgeryList.value = res.data?.records || []
} else {
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
surgeryList.value = []
}
}).catch(error => {
console.error('获取手术列表失败:', error)
proxy.$modal.msgError('数据加载失败,请稍后重试')
console.warn('手术列表请求异常:', error)
surgeryList.value = []
}).finally(() => {
loading.value = false
@@ -1142,8 +1141,8 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
getList() // 提交成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
emit('saved')
} else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
}
@@ -1159,8 +1158,8 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
getList() // 修改成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
// 由父组件 @saved 事件负责刷新列表
emit('saved')
} else {
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
}

View File

@@ -153,7 +153,7 @@
</el-tab-pane>
<el-tab-pane label="手术申请" name="surgery">
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
</el-tab-pane>
<el-tab-pane label="电子处方" name="eprescription">
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />

View File

@@ -289,43 +289,62 @@ function getList() {
return obj;
});
form.value.diagnosisList = datas;
// form.value.diagnosisList = res.data;
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
deduplicateDiagnosisList();
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) {
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')
});
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')
});
// 将新数据添加到现有列表中
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);
});
// 将新数据添加到现有列表中
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();
}
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) => {
@@ -603,6 +622,18 @@ 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; // 这里是关键!把”诊断排序”改成新顺序

View File

@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
// 严格批号查询有库存orgQuantity > 0
if (d && Number(d.orgQuantity ?? 0) > 0) {
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,6 +1157,8 @@ function handleLocationClick(item, row, index) {
persistStore();
});
}
// 没有指定批号,直接提示
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');

View File

@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
// 调用计费接口获取数据
getPrescriptionList(row.visitId).then((res) => {
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
console.log('=== 拉取计费数据返回结果 ===', res)
if (res.code === 200 && res.data) {
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
@@ -1741,27 +1741,39 @@ function handleTemporaryMedicalSubmit(data) {
}
})
// 🔧 修复 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') // 过滤掉空项
)
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
// 匹配键:优先使用 chargeItemId后端费用项目ID最可靠其次使用 名称+规格+数量 组合
const submittedKeys = new Set()
const submittedChargeIds = new Set()
if (submittedKeys.size > 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) {
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
// 优先用 chargeItemId 匹配
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
return false
}
// 兜底用 名称+规格+数量 匹配
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
return !submittedKeys.has(key)
})
} else {
// 如果没有任何匹配,清空待生成列表(所有项目都已提交)
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
temporaryBillingMedicines.value = []
}