Compare commits
13 Commits
bug463-fix
...
683ce749f3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
683ce749f3 | ||
|
|
0c74e66c91 | ||
|
|
0209e8ae99 | ||
|
|
9c75858afc | ||
|
|
b849d4c605 | ||
|
|
a4de88a6f9 | ||
|
|
ad21c566f0 | ||
|
|
21ac9e80f2 | ||
|
|
9cfaa7dc41 | ||
|
|
eb18a2c800 | ||
| cf5431cbbf | |||
|
|
a429f77113 | ||
|
|
ffa709cf4e |
@@ -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()) {
|
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.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
||||||
sourceEnum, sourceBillNo);
|
sourceEnum, sourceBillNo);
|
||||||
// 手术计费场景:sourceBillNo 不为空时,过滤掉药品(1),保留耗材(2)和诊疗(3/6)
|
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
|
||||||
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
|
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
|
||||||
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
|
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
|
||||||
&& dto.getAdviceType() == 1);
|
|
||||||
}
|
|
||||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||||
// 请求状态
|
// 请求状态
|
||||||
requestBaseDto
|
requestBaseDto
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
EncounterDiagnosis encounterDiagnosis;
|
EncounterDiagnosis encounterDiagnosis;
|
||||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||||
encounterDiagnosis = new EncounterDiagnosis();
|
encounterDiagnosis = new EncounterDiagnosis();
|
||||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
|
||||||
|
// 如果设置旧的 ID,saveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
|
||||||
encounterDiagnosis.setEncounterId(encounterId);
|
encounterDiagnosis.setEncounterId(encounterId);
|
||||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||||
|
|||||||
@@ -81,36 +81,35 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
||||||
boolean isEdit = requestFormId != null && requestFormId != 0L;
|
boolean isEdit = requestFormId != null && requestFormId != 0L;
|
||||||
|
|
||||||
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
|
// 校验所有activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
||||||
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
||||||
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
||||||
if (activityOrganizationConfig.isEmpty()) {
|
if (activityList == null || activityList.isEmpty()) {
|
||||||
throw new ServiceException("请先配置当前时间段的执行科室");
|
throw new ServiceException("请选择检查项目");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 逐个校验activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
// 🔧 Bug #475: 查询诊疗执行科室配置
|
||||||
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
||||||
// 🔧 Bug #516: 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
||||||
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
|
||||||
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
|
// 缓存校验结果,先全部验证通过后再进行数据库操作
|
||||||
|
// 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
||||||
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
||||||
if (activityList != null && !activityList.isEmpty()) {
|
for (ActivitySaveDto activitySaveDto : activityList) {
|
||||||
for (ActivitySaveDto activitySaveDto : activityList) {
|
// 优先使用前端传入的positionId(用户手动选择的科室)
|
||||||
// 优先使用前端传入的positionId(用户手动选择的科室)
|
Long frontendPositionId = activitySaveDto.getPositionId();
|
||||||
Long frontendPositionId = activitySaveDto.getPositionId();
|
if (frontendPositionId != null) {
|
||||||
if (frontendPositionId != null) {
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
|
||||||
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 前端未传入时,使用配置的执行科室
|
|
||||||
Long configPositionId = activityOrganizationConfig.stream()
|
|
||||||
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
|
||||||
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
|
||||||
if (configPositionId == null) {
|
|
||||||
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
|
||||||
}
|
|
||||||
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
|
||||||
}
|
}
|
||||||
|
// 前端未传入时,使用配置的执行科室
|
||||||
|
Long configPositionId = activityOrganizationConfig.stream()
|
||||||
|
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
||||||
|
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
||||||
|
if (configPositionId == null) {
|
||||||
|
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
||||||
|
}
|
||||||
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 诊疗处方号
|
// 诊疗处方号
|
||||||
|
|||||||
@@ -91,13 +91,15 @@
|
|||||||
os.surgery_nature AS surgeryType,
|
os.surgery_nature AS surgeryType,
|
||||||
cs.incision_level AS incisionLevel,
|
cs.incision_level AS incisionLevel,
|
||||||
fc.contract_name AS feeType,
|
fc.contract_name AS feeType,
|
||||||
os.fee_type AS feeType,
|
|
||||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||||
FROM op_schedule os
|
FROM op_schedule os
|
||||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
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'
|
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 adm_organization o ON cs.org_id = o.id
|
||||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
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 (
|
LEFT JOIN (
|
||||||
SELECT patient_id, identifier_no
|
SELECT patient_id, identifier_no
|
||||||
FROM (
|
FROM (
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
T5.package_name,
|
T5.package_name,
|
||||||
T6.name as sub_item_name
|
T6.name as sub_item_name
|
||||||
FROM wor_activity_definition T1
|
FROM wor_activity_definition T1
|
||||||
/* 只JOIN必要的价格表,使用INNER JOIN避免笛卡尔积 */
|
/* 价格表使用LEFT JOIN,避免因缺少价格记录导致搜索不到项目 */
|
||||||
INNER JOIN adm_charge_item_definition T2
|
LEFT JOIN adm_charge_item_definition T2
|
||||||
ON T1.id = T2.instance_id
|
ON T1.id = T2.instance_id
|
||||||
AND T2.instance_table = 'wor_activity_definition'
|
AND T2.instance_table = 'wor_activity_definition'
|
||||||
/* 检验类型关联 */
|
/* 检验类型关联 */
|
||||||
|
|||||||
@@ -45,18 +45,6 @@
|
|||||||
<if test="endDate != null and endDate != ''">
|
<if test="endDate != null and endDate != ''">
|
||||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||||
</if>
|
</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 != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||||
OR EXISTS (
|
OR EXISTS (
|
||||||
@@ -72,6 +60,19 @@
|
|||||||
</if>
|
</if>
|
||||||
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||||
drf.requester_id, drf.create_time, ap.name
|
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>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
|
|||||||
@@ -1362,8 +1362,9 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
existingItem.isPackage = true;
|
existingItem.isPackage = true;
|
||||||
existingItem.packageId = method.packageId;
|
existingItem.packageId = method.packageId;
|
||||||
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
||||||
|
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
|
||||||
// 预加载套餐明细
|
// 预加载套餐明细
|
||||||
loadPackageDetailsForItem(existingItem);
|
await loadPackageDetailsForItem(existingItem);
|
||||||
}
|
}
|
||||||
updateMethodDisplay();
|
updateMethodDisplay();
|
||||||
return;
|
return;
|
||||||
@@ -1399,9 +1400,10 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
};
|
};
|
||||||
selectedItems.value.push(newItem);
|
selectedItems.value.push(newItem);
|
||||||
|
|
||||||
// 如果是套餐,预加载套餐明细
|
// 如果是套餐,预加载套餐明细并默认展开
|
||||||
if (newItem.isPackage && newItem.packageId) {
|
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修复: 展开/收起项目卡片
|
// Bug #384修复 + #426修复: 展开/收起项目卡片
|
||||||
async function toggleItemExpand(item) {
|
async function toggleItemExpand(item) {
|
||||||
item.expanded = !item.expanded;
|
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);
|
await loadPackageDetailsForItem(item);
|
||||||
}
|
}
|
||||||
if (item.expanded && shouldShowPackageBody(item)) {
|
if (item.expanded && shouldShowPackageBody(item)) {
|
||||||
@@ -1577,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
|
|||||||
const packageId = packages[0].id;
|
const packageId = packages[0].id;
|
||||||
// 查询套餐明细
|
// 查询套餐明细
|
||||||
const detailRes = await request({
|
const detailRes = await request({
|
||||||
url: `/system/package/${packageId}/details`,
|
url: `/system/check-type/package/${packageId}/details`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
if (detailRes.code === 200 && detailRes.data) {
|
if (detailRes.code === 200 && detailRes.data) {
|
||||||
|
|||||||
@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return found.label;
|
return found.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
|
||||||
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||||
if (type === 6) return '手术';
|
if (type === 6) return '手术';
|
||||||
if (type === 4) return '手术';
|
if (type === 4) return '手术';
|
||||||
@@ -1036,6 +1036,15 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return '诊疗';
|
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 '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1658,12 +1667,16 @@ function getListInfo(addNewRow) {
|
|||||||
contentJson?.consultationRequestId;
|
contentJson?.consultationRequestId;
|
||||||
|
|
||||||
let adviceType = item.adviceType;
|
let adviceType = item.adviceType;
|
||||||
|
|
||||||
// 🔧 Bug Fix: 后端保存时将耗材(4)转换为中成药(2),显示时需要转换回来
|
// 🔧 Bug Fix: 后端保存时将耗材(4)转换为中成药(2),显示时需要转换回来
|
||||||
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
||||||
const adviceTableName = contentJson?.adviceTableName || item.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) {
|
if (isConsultation) {
|
||||||
|
|||||||
@@ -636,12 +636,11 @@ function getList() {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
surgeryList.value = res.data?.records || []
|
surgeryList.value = res.data?.records || []
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
|
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取手术列表失败:', error)
|
console.warn('手术列表请求异常:', error)
|
||||||
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -1142,8 +1141,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList() // 提交成功后直接刷新列表
|
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
|
||||||
emit('saved') // 通知父组件刷新医嘱列表
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
@@ -1159,8 +1158,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList() // 修改成功后直接刷新列表
|
// 由父组件 @saved 事件负责刷新列表
|
||||||
emit('saved') // 通知父组件刷新医嘱列表
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="手术申请" name="surgery">
|
<el-tab-pane label="手术申请" name="surgery">
|
||||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
<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>
|
||||||
<el-tab-pane label="电子处方" name="eprescription">
|
<el-tab-pane label="电子处方" name="eprescription">
|
||||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||||
|
|||||||
@@ -289,43 +289,62 @@ function getList() {
|
|||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
form.value.diagnosisList = datas;
|
form.value.diagnosisList = datas;
|
||||||
// form.value.diagnosisList = res.data;
|
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
|
||||||
|
deduplicateDiagnosisList();
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
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.code == 200 && res.data?.illness?.length > 0) {
|
||||||
if (res.data.illness.length > 0) {
|
diagnosisNetDatas.value = res.data.illness;
|
||||||
diagnosisNetDatas.value = res.data.illness;
|
res.data.illness.forEach((item, index) => {
|
||||||
res.data.illness.forEach((item, index) => {
|
newList.push({
|
||||||
newList.push({
|
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
|
||||||
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
|
ybNo: item.ybNo,
|
||||||
ybNo: item.ybNo,
|
medTypeCode: item.medTypeCode,
|
||||||
medTypeCode: item.medTypeCode,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
// 将新数据添加到现有列表中
|
|
||||||
form.value.diagnosisList.push(...newList);
|
// 将新数据添加到现有列表中
|
||||||
|
form.value.diagnosisList.push(...newList);
|
||||||
// 重新排序整个列表
|
|
||||||
form.value.diagnosisList.sort((a, b) => {
|
// 重新排序整个列表
|
||||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
form.value.diagnosisList.sort((a, b) => {
|
||||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||||
return aNo - bNo;
|
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||||
});
|
return aNo - bNo;
|
||||||
}
|
});
|
||||||
emits('diagnosisSave', false);
|
// TCM 数据添加后也去重
|
||||||
|
deduplicateDiagnosisList();
|
||||||
}
|
}
|
||||||
|
emits('diagnosisSave', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
getTree();
|
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();
|
init();
|
||||||
function init() {
|
function init() {
|
||||||
diagnosisInit().then((res) => {
|
diagnosisInit().then((res) => {
|
||||||
@@ -603,6 +622,18 @@ function handleSaveDiagnosis() {
|
|||||||
return aNo - bNo;
|
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开始)
|
// 步骤2:重新分配连续的序号(从1开始)
|
||||||
sortedList.forEach((item, index) => {
|
sortedList.forEach((item, index) => {
|
||||||
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||||
|
|||||||
@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
const list = res.data || [];
|
const list = res.data || [];
|
||||||
const d = pickBestOrgQuantityRow(list);
|
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);
|
applyFromDto(d, false);
|
||||||
if (Number(r.totalQuantity) <= 0) {
|
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
|
||||||
}
|
|
||||||
persistStore();
|
persistStore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
|
||||||
if (lotTrimmed) {
|
if (lotTrimmed) {
|
||||||
return runGet(false).then((res2) => {
|
return runGet(false).then((res2) => {
|
||||||
const list2 = res2.data || [];
|
const list2 = res2.data || [];
|
||||||
@@ -1157,6 +1157,8 @@ function handleLocationClick(item, row, index) {
|
|||||||
persistStore();
|
persistStore();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 没有指定批号,直接提示
|
||||||
r.totalQuantity = 0;
|
r.totalQuantity = 0;
|
||||||
r.price = 0;
|
r.price = 0;
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
|
|||||||
@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
|
|||||||
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
|
|
||||||
// 调用计费接口获取数据
|
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
|
||||||
getPrescriptionList(row.visitId).then((res) => {
|
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
|
||||||
console.log('=== 拉取计费数据返回结果 ===', res)
|
console.log('=== 拉取计费数据返回结果 ===', res)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
||||||
@@ -1741,27 +1741,39 @@ function handleTemporaryMedicalSubmit(data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
|
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
|
||||||
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
|
// 匹配键:优先使用 chargeItemId(后端费用项目ID,最可靠),其次使用 名称+规格+数量 组合
|
||||||
const submittedKeys = new Set(
|
const submittedKeys = new Set()
|
||||||
(data.temporaryAdvices || [])
|
const submittedChargeIds = new Set()
|
||||||
.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') // 过滤掉空项
|
|
||||||
)
|
|
||||||
|
|
||||||
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 => {
|
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)
|
return !submittedKeys.has(key)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
|
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user