403 住院医生工作站:应用医嘱组套后,药品明细字段内容丢失未正确引入表格 521 [住院医生站-临床医嘱-检查申请] 手工选择执行科室后,保存仍提示“未找到项目执行的科室” 528 [住院医生工作站-检查申请] 修改申请单成功后,弹窗未自动关闭且列表数据未自动刷新 531 [住院医生站-临床医嘱-检查] 检查申请单打开数据没有正常加载
This commit is contained in:
@@ -147,4 +147,6 @@ public interface IDoctorStationAdviceAppService {
|
||||
*/
|
||||
IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
||||
|
||||
IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
||||
|
||||
}
|
||||
|
||||
@@ -2456,4 +2456,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
|
||||
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getExaminationPage(
|
||||
new Page<>(pageNo, pageSize),
|
||||
PublicationStatus.ACTIVE.getValue(),
|
||||
organizationId,
|
||||
searchKey);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -221,4 +221,13 @@ public class DoctorStationAdviceController {
|
||||
return R.ok(iDoctorStationAdviceAppService.getSurgeryPage(organizationId, pageNo, pageSize, searchKey));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/examination-page")
|
||||
public R<?> getExaminationPage(
|
||||
@RequestParam(value = "organizationId", required = false) Long organizationId,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
|
||||
return R.ok(iDoctorStationAdviceAppService.getExaminationPage(organizationId, pageNo, pageSize, searchKey));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -199,4 +199,9 @@ public interface DoctorStationAdviceAppMapper {
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("searchKey") String searchKey);
|
||||
|
||||
IPage<SurgeryItemDto> getExaminationPage(@Param("page") Page<SurgeryItemDto> page,
|
||||
@Param("statusEnum") Integer statusEnum,
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("searchKey") String searchKey);
|
||||
|
||||
}
|
||||
|
||||
@@ -836,4 +836,29 @@
|
||||
ORDER BY t1.name ASC
|
||||
</select>
|
||||
|
||||
<!-- 检查项目专用分页查询:仅查检查(23) + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
|
||||
<select id="getExaminationPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
|
||||
SELECT
|
||||
t1.ID AS advice_definition_id,
|
||||
t1.NAME AS advice_name,
|
||||
t1.org_id AS org_id,
|
||||
t1.org_id AS position_id,
|
||||
t2.ID AS charge_item_definition_id,
|
||||
t2.price AS price,
|
||||
t1.permitted_unit_code AS unit_code,
|
||||
t1.permitted_unit_code AS unit_code_dict_text
|
||||
FROM wor_activity_definition t1
|
||||
LEFT JOIN adm_charge_item_definition t2
|
||||
ON t2.instance_id = t1.ID
|
||||
AND t2.delete_flag = '0'
|
||||
AND t2.status_enum = #{statusEnum}
|
||||
AND t2.instance_table = 'wor_activity_definition'
|
||||
WHERE t1.delete_flag = '0'
|
||||
AND t1.category_code = '23'
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||
</if>
|
||||
ORDER BY t1.name ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -44,7 +44,9 @@
|
||||
sdd.dict_label AS unit_code_name,
|
||||
togpd.dose AS dose,
|
||||
togpd.rate_code AS rate_code,
|
||||
rate_d.dict_label AS rate_code_dictText,
|
||||
togpd.method_code AS method_code,
|
||||
method_d.dict_label AS method_code_dictText,
|
||||
togpd.dose_quantity AS dose_quantity,
|
||||
togpd.group_id,
|
||||
togpd.group_order AS group_order,
|
||||
@@ -67,8 +69,9 @@
|
||||
AND togpd.order_definition_id = adm.ID
|
||||
LEFT JOIN wor_activity_definition AS wor ON togpd.order_definition_table = 'wor_activity_definition'
|
||||
AND togpd.order_definition_id = wor.ID
|
||||
LEFT JOIN sys_dict_data AS sdd ON sdd.dict_value = togpd.unit_code AND sdd.dict_type = 'unit_code' AND
|
||||
sdd.status = '0'
|
||||
LEFT JOIN sys_dict_data AS sdd ON sdd.dict_value = togpd.unit_code AND sdd.dict_type = 'unit_code' AND sdd.status = '0'
|
||||
LEFT JOIN sys_dict_data AS rate_d ON rate_d.dict_value = togpd.rate_code AND rate_d.dict_type = 'rate_code' AND rate_d.status = '0'
|
||||
LEFT JOIN sys_dict_data AS method_d ON method_d.dict_value = togpd.method_code AND method_d.dict_type = 'method_code' AND method_d.status = '0'
|
||||
WHERE togpd.delete_flag = '0'
|
||||
<if test="groupPackageIds != null and !groupPackageIds.isEmpty()">
|
||||
AND togpd.group_package_id IN
|
||||
|
||||
@@ -564,22 +564,74 @@ function handleRemoveItem(index) {
|
||||
editingGroup.value.detailList.splice(index, 1);
|
||||
}
|
||||
|
||||
// 单击应用按钮
|
||||
function handleUseOrderGroup(row) {
|
||||
// 单击应用按钮(应用组套)
|
||||
async function handleUseOrderGroup(row) {
|
||||
if (!row.detailList || row.detailList.length === 0) {
|
||||
ElMessage.warning('该组套没有明细项');
|
||||
return;
|
||||
}
|
||||
|
||||
// 🔧 Bug 修复:组套保存时未持久化 orderDetailInfos,导致应用时缺失医嘱库信息。
|
||||
// 通过 API 批量查询补全,确保 setValue 能获取到 adviceType、inventoryList、priceList 等关键字段。
|
||||
const itemsMissingDetail = row.detailList.filter(
|
||||
item => !item.orderDetailInfos || Object.keys(item.orderDetailInfos).length === 0
|
||||
);
|
||||
const detailMap = {};
|
||||
if (itemsMissingDetail.length > 0) {
|
||||
const ids = itemsMissingDetail
|
||||
.map(item => item.orderDefinitionId)
|
||||
.filter(Boolean)
|
||||
.join(',');
|
||||
if (ids) {
|
||||
try {
|
||||
const res = await getAdviceBaseInfo({
|
||||
adviceDefinitionIdParamList: ids,
|
||||
organizationId: props.organizationId,
|
||||
});
|
||||
const records = res.data?.records || res.rows || [];
|
||||
records.forEach(rec => {
|
||||
if (rec.adviceDefinitionId) {
|
||||
detailMap[rec.adviceDefinitionId] = rec;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// 批量查询失败,使用原始 orderDetailInfos
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 🔧 辅助函数:根据字典 code 查找对应的 dictText
|
||||
const findDictText = (dictList, code) => {
|
||||
if (!code || !dictList?.value?.length) return '';
|
||||
const found = dictList.value.find(d => d.value === code);
|
||||
return found?.label || '';
|
||||
};
|
||||
|
||||
// 🔧 数据预处理:确保每个明细项都有完整的医嘱信息
|
||||
const processedDetailList = row.detailList.map(item => {
|
||||
const orderDetail = item.orderDetailInfos || {};
|
||||
// 优先使用组套中已带的 orderDetailInfos,否则使用 API 查询结果
|
||||
const orderDetail = (item.orderDetailInfos && Object.keys(item.orderDetailInfos).length > 0)
|
||||
? item.orderDetailInfos
|
||||
: (detailMap[item.orderDefinitionId] || {});
|
||||
|
||||
// 🔧 修复:组套明细只存了 methodCode/rateCode,没有 dictText。
|
||||
// 用字典查找补充 dictText,确保界面显示正确的用法/频次名称。
|
||||
const resolvedMethodCode = item.methodCode ?? orderDetail.methodCode;
|
||||
const resolvedRateCode = item.rateCode ?? orderDetail.rateCode;
|
||||
const methodCodeDictText = item.methodCode_dictText
|
||||
|| findDictText(method_code, resolvedMethodCode)
|
||||
|| orderDetail.methodCode_dictText
|
||||
|| '';
|
||||
const rateCodeDictText = item.rateCode_dictText
|
||||
|| findDictText(rate_code, resolvedRateCode)
|
||||
|| orderDetail.rateCode_dictText
|
||||
|| '';
|
||||
|
||||
return {
|
||||
// 组套明细字段
|
||||
...item,
|
||||
|
||||
// 医嘱库字段(可能为空,需要兜底)
|
||||
// 医嘱库字段
|
||||
adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目',
|
||||
adviceType: orderDetail.adviceType,
|
||||
adviceDefinitionId: item.orderDefinitionId || orderDetail.adviceDefinitionId,
|
||||
@@ -592,7 +644,6 @@ function handleUseOrderGroup(row) {
|
||||
partPercent: orderDetail.partPercent ?? 1,
|
||||
partAttributeEnum: orderDetail.partAttributeEnum,
|
||||
unitConversionRatio: orderDetail.unitConversionRatio,
|
||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||
positionId: item.positionId ?? orderDetail.positionId,
|
||||
defaultLotNumber: orderDetail.defaultLotNumber,
|
||||
|
||||
@@ -602,6 +653,10 @@ function handleUseOrderGroup(row) {
|
||||
unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText,
|
||||
minUnitCode: orderDetail.minUnitCode,
|
||||
doseUnitCode: orderDetail.doseUnitCode,
|
||||
|
||||
// 字典文本(传递到 item 层级,避免后续代码依赖 mergedDetail 再查一次)
|
||||
methodCode_dictText: methodCodeDictText,
|
||||
rateCode_dictText: rateCodeDictText,
|
||||
|
||||
// 合并后的完整对象(用于 setValue)
|
||||
// 先展开 orderDetail 获取所有药品基础字段(categoryCode、minUnitCode、doseUnitCode、
|
||||
@@ -616,19 +671,19 @@ function handleUseOrderGroup(row) {
|
||||
categoryCode: item.categoryCode ?? orderDetail.categoryCode,
|
||||
unitCodeName: item.unitCodeName,
|
||||
dose: item.dose ?? orderDetail.dose,
|
||||
rateCode: item.rateCode ?? orderDetail.rateCode,
|
||||
methodCode: item.methodCode ?? orderDetail.methodCode,
|
||||
rateCode: resolvedRateCode,
|
||||
rateCode_dictText: rateCodeDictText,
|
||||
methodCode: resolvedMethodCode,
|
||||
methodCode_dictText: methodCodeDictText,
|
||||
dispensePerDuration: item.dispensePerDuration ?? orderDetail.dispensePerDuration,
|
||||
doseQuantity: item.doseQuantity ?? orderDetail.doseQuantity,
|
||||
// 🔧 Bug #218 / #403 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||
positionId: item.positionId ?? orderDetail.positionId,
|
||||
// 执行科室:优先使用组套明细中保存的 orgId
|
||||
orgId: item.orgId ?? orderDetail.orgId,
|
||||
orgName: item.orgName ?? orderDetail.orgName,
|
||||
// 组号(保留组套中的分组信息)
|
||||
groupId: item.groupId,
|
||||
groupOrder: item.groupOrder,
|
||||
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '1',
|
||||
// 🔧 类型默认为临时医嘱(2=临时,1=长期)
|
||||
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '2',
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -645,9 +700,9 @@ function handlePreviewGroup(row) {
|
||||
}
|
||||
|
||||
// 确认应用组套(从预览对话框)
|
||||
function confirmUseGroup() {
|
||||
async function confirmUseGroup() {
|
||||
if (currentGroup.value) {
|
||||
handleUseOrderGroup(currentGroup.value);
|
||||
await handleUseOrderGroup(currentGroup.value);
|
||||
previewVisible.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3662,6 +3662,13 @@ function handleSaveGroup(orderGroupList) {
|
||||
defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
|
||||
};
|
||||
|
||||
// 🔧 Bug 修复:字典查找兜底,防止 mergedDetail 中 dictText 为空
|
||||
const findDictText = (dictList, code) => {
|
||||
if (!code || !dictList?.length) return '';
|
||||
const found = dictList.find(d => d.value === code);
|
||||
return found?.label || '';
|
||||
};
|
||||
|
||||
// 在 setValue 之前预初始化空行
|
||||
prescriptionList.value[rowIndex.value] = {
|
||||
uniqueKey: nextId.value++,
|
||||
@@ -3672,43 +3679,105 @@ function handleSaveGroup(orderGroupList) {
|
||||
// 使用医嘱项目详情设置值
|
||||
setValue(mergedDetail);
|
||||
|
||||
// 🔧 Bug 修复:使用 mergedDetail 优先,避免 item 中 undefined 覆盖 setValue 中已设置的字段
|
||||
const resolvedQuantity = mergedDetail.quantity ?? item.quantity ?? 1;
|
||||
const resolvedDose = mergedDetail.dose ?? item.dose;
|
||||
const resolvedMethodCode = mergedDetail.methodCode ?? item.methodCode;
|
||||
const resolvedRateCode = mergedDetail.rateCode ?? item.rateCode;
|
||||
const resolvedUnitCode = mergedDetail.unitCode ?? item.unitCode;
|
||||
|
||||
// 🔧 Bug 修复:setValue 可能因库存不足提前 return,导致 unitPrice/minUnitPrice 等字段未设置。
|
||||
// 从 mergedDetail 或 item 中获取兜底值,避免价格计算产生 NaN。
|
||||
const safePrice = (val) => {
|
||||
const n = Number(val);
|
||||
return (n !== undefined && n !== null && !isNaN(n) && isFinite(n)) ? n : 0;
|
||||
};
|
||||
const resolvedUnitPrice = safePrice(
|
||||
prescriptionList.value[rowIndex.value]?.unitPrice
|
||||
?? mergedDetail.unitPrice
|
||||
?? item.unitPrice
|
||||
?? 0
|
||||
);
|
||||
const resolvedMinUnitPrice = safePrice(
|
||||
prescriptionList.value[rowIndex.value]?.minUnitPrice
|
||||
?? mergedDetail.minUnitPrice
|
||||
?? item.minUnitPrice
|
||||
?? 0
|
||||
);
|
||||
const resolvedPartPercent = safePrice(
|
||||
item.orderDetailInfos?.partPercent
|
||||
?? mergedDetail.partPercent
|
||||
?? 1
|
||||
);
|
||||
|
||||
// 创建新的处方项目
|
||||
const newRow = {
|
||||
...prescriptionList.value[rowIndex.value],
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
accountId: accountId.value,
|
||||
quantity: item.quantity,
|
||||
methodCode: item.methodCode,
|
||||
rateCode: item.rateCode,
|
||||
dispensePerDuration: item.dispensePerDuration,
|
||||
dose: item.dose,
|
||||
doseQuantity: item.doseQuantity,
|
||||
quantity: resolvedQuantity,
|
||||
methodCode: resolvedMethodCode,
|
||||
methodCode_dictText: mergedDetail.methodCode_dictText
|
||||
|| findDictText(method_code.value, resolvedMethodCode)
|
||||
|| '',
|
||||
rateCode: resolvedRateCode,
|
||||
rateCode_dictText: mergedDetail.rateCode_dictText
|
||||
|| findDictText(rate_code.value, resolvedRateCode)
|
||||
|| '',
|
||||
dispensePerDuration: mergedDetail.dispensePerDuration ?? item.dispensePerDuration,
|
||||
dose: resolvedDose,
|
||||
doseQuantity: mergedDetail.doseQuantity ?? item.doseQuantity,
|
||||
executeNum: 1,
|
||||
unitCode: item.unitCode,
|
||||
unitCode_dictText: item.unitCodeName || '',
|
||||
unitCode: resolvedUnitCode,
|
||||
unitCode_dictText: item.unitCodeName
|
||||
|| mergedDetail.unitCodeName
|
||||
|| findDictText(unit_code.value, resolvedUnitCode)
|
||||
|| '',
|
||||
doseUnitCode: mergedDetail.doseUnitCode,
|
||||
doseUnitCode_dictText: mergedDetail.doseUnitCode_dictText || '',
|
||||
// 🔧 确保 price/adviceType 字段有安全默认值(避免 NaN 导致模板条件判断失效)
|
||||
unitPrice: resolvedUnitPrice,
|
||||
minUnitPrice: resolvedMinUnitPrice,
|
||||
unitTempPrice: resolvedUnitPrice,
|
||||
adviceType: prescriptionList.value[rowIndex.value]?.adviceType
|
||||
|| Number(mergedDetail.adviceType)
|
||||
|| Number(item.adviceType)
|
||||
|| 0,
|
||||
adviceType_dictText: prescriptionList.value[rowIndex.value]?.adviceType_dictText
|
||||
|| mergedDetail.adviceType_dictText
|
||||
|| item.adviceType_dictText
|
||||
|| '',
|
||||
statusEnum: 1,
|
||||
// 🔧 类型:组套应用默认为临时医嘱(2=临时,1=长期)
|
||||
therapyEnum: mergedDetail.therapyEnum ?? item.therapyEnum ?? '2',
|
||||
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
|
||||
// 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室,不使用目录配置的ID
|
||||
orgId: item.adviceType === 3
|
||||
? props.patientInfo?.orgId
|
||||
: (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId),
|
||||
positionName: prescriptionList.value[rowIndex.value]?.positionName
|
||||
|| mergedDetail.orgName
|
||||
|| mergedDetail.positionName
|
||||
|| findOrgNameById(mergedDetail.orgId || props.patientInfo?.orgId)
|
||||
|| '',
|
||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||
conditionId: conditionId.value,
|
||||
conditionDefinitionId: conditionDefinitionId.value,
|
||||
encounterDiagnosisId: encounterDiagnosisId.value,
|
||||
diagnosisName: diagnosisName.value,
|
||||
};
|
||||
|
||||
// 计算价格和总量
|
||||
const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode);
|
||||
// 计算价格和总量(使用安全值)
|
||||
const unitInfo = unitCodeList.value.find((k) => k.value == resolvedUnitCode);
|
||||
if (unitInfo && unitInfo.type == 'minUnit') {
|
||||
newRow.price = newRow.minUnitPrice;
|
||||
newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6);
|
||||
newRow.minUnitQuantity = item.quantity;
|
||||
newRow.price = resolvedMinUnitPrice;
|
||||
newRow.totalPrice = (resolvedQuantity * resolvedMinUnitPrice).toFixed(6);
|
||||
newRow.minUnitQuantity = resolvedQuantity;
|
||||
} else {
|
||||
newRow.price = newRow.unitPrice;
|
||||
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
|
||||
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
|
||||
newRow.price = resolvedUnitPrice;
|
||||
newRow.totalPrice = (resolvedQuantity * resolvedUnitPrice).toFixed(6);
|
||||
newRow.minUnitQuantity = resolvedQuantity * resolvedPartPercent;
|
||||
}
|
||||
|
||||
newRow.contentJson = JSON.stringify(newRow);
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
:is-edit-mode="true"
|
||||
:edit-data="editingRow"
|
||||
:external-patient-info="patientInfo"
|
||||
@submit-ok="handleEditSuccess"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="editDialogVisible = false">取消</el-button>
|
||||
@@ -967,12 +968,17 @@ const handleEdit = (row) => {
|
||||
|
||||
// 编辑弹窗确认提交
|
||||
const handleEditSubmit = () => {
|
||||
// 调用MedicalExaminations组件的submit方法
|
||||
if (editFormRef.value?.submit) {
|
||||
editFormRef.value.submit();
|
||||
}
|
||||
};
|
||||
|
||||
// 编辑保存成功回调:关闭弹窗并刷新列表
|
||||
const handleEditSuccess = () => {
|
||||
editDialogVisible.value = false;
|
||||
fetchData();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => patientInfo.value?.encounterId,
|
||||
(val) => {
|
||||
|
||||
@@ -10,6 +10,15 @@ export function getSurgeryPage(params) {
|
||||
});
|
||||
}
|
||||
|
||||
// 检查项目专用分页查询(仅检查(23) + 定价,绕过 AOP 校验提升加载速度)
|
||||
export function getExaminationPage(params) {
|
||||
return request({
|
||||
url: '/doctor-station/advice/examination-page',
|
||||
method: 'get',
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
|
||||
//医嘱大下拉
|
||||
export function getApplicationList(queryParams) {
|
||||
return request({
|
||||
|
||||
@@ -206,7 +206,7 @@ import dayjs from 'dayjs';
|
||||
import {patientInfo} from '../../../store/patient.js';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getEncounterDiagnosis} from '../../api.js';
|
||||
import {getApplicationList, saveCheckd} from './api';
|
||||
import {getExaminationPage, saveCheckd} from './api';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||
import {WarningFilled, Warning, Refresh, Files, Document, EditPen, Aim, DocumentCopy} from '@element-plus/icons-vue';
|
||||
|
||||
@@ -266,27 +266,23 @@ const isSevereAllergy = computed(() => {
|
||||
});
|
||||
|
||||
const getList = () => {
|
||||
console.log('getList called, effectivePatientInfo:', effectivePatientInfo.value);
|
||||
if (!effectivePatientInfo.value?.inHospitalOrgId) {
|
||||
console.log('inHospitalOrgId is missing, setting empty list');
|
||||
applicationList.value = [];
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
getApplicationList({
|
||||
pageSize: 5000,
|
||||
pageNum: 1,
|
||||
categoryCode: '23',
|
||||
getExaminationPage({
|
||||
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
||||
adviceTypes: [3],
|
||||
pageNo: 1,
|
||||
pageSize: 5000,
|
||||
searchKey: '',
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
if (res.code === 200 && res.data?.records) {
|
||||
applicationListAll.value = res.data.records;
|
||||
applicationList.value = res.data.records.map((item) => {
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCodeDictText || item.unitCode || '';
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId,
|
||||
orgId: item.orgId,
|
||||
@@ -299,7 +295,6 @@ const getList = () => {
|
||||
nextTick(() => {
|
||||
// 使用 adviceName 匹配
|
||||
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
|
||||
console.log('getList completed, selectedNames:', selectedNames);
|
||||
const selectedIds = [];
|
||||
applicationList.value?.forEach(app => {
|
||||
// 匹配时去掉价格部分,只比较名称
|
||||
@@ -308,7 +303,6 @@ const getList = () => {
|
||||
selectedIds.push(app.key);
|
||||
}
|
||||
});
|
||||
console.log('getList completed, matched selectedIds:', selectedIds);
|
||||
transferValue.value = selectedIds;
|
||||
});
|
||||
}
|
||||
@@ -404,13 +398,11 @@ const loadPatientAllergyHistory = () => {
|
||||
if (!effectivePatientInfo.value?.patientId) return;
|
||||
};
|
||||
|
||||
// 加载编辑数据
|
||||
// 加载编辑数据 — 只负责解析 descJson 填充表单字段
|
||||
// 已选项目的匹配由 getList 数据加载完成后统一处理
|
||||
const loadEditData = () => {
|
||||
if (!props.isEditMode || !props.editData?.requestFormId) return;
|
||||
|
||||
console.log('loadEditData called, editData:', props.editData);
|
||||
|
||||
// 解析已有的descJson填充表单
|
||||
if (props.editData.descJson) {
|
||||
try {
|
||||
const obj = JSON.parse(props.editData.descJson);
|
||||
@@ -431,91 +423,16 @@ const loadEditData = () => {
|
||||
console.error('解析descJson失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置已选项目(从requestFormDetailList获取)
|
||||
// 注意:后端返回的字段是 adviceName,不是 adviceDefinitionId
|
||||
console.log('requestFormDetailList:', props.editData.requestFormDetailList);
|
||||
if (props.editData.requestFormDetailList && props.editData.requestFormDetailList.length) {
|
||||
// 使用 adviceName 匹配
|
||||
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
|
||||
console.log('setting transferValue by adviceName to:', selectedNames);
|
||||
// 通过名称匹配找到对应的 key
|
||||
const selectedIds = [];
|
||||
applicationList.value?.forEach(app => {
|
||||
if (selectedNames.includes(app.label?.split(' (')[0])) {
|
||||
selectedIds.push(app.key);
|
||||
}
|
||||
});
|
||||
console.log('matched selectedIds:', selectedIds);
|
||||
transferValue.value = selectedIds;
|
||||
} else {
|
||||
console.log('requestFormDetailList is empty or undefined');
|
||||
}
|
||||
};
|
||||
|
||||
const projectWithDepartment = (selectProjectIds, type) => {
|
||||
let isRelease = true;
|
||||
const arr = [];
|
||||
// 确保 applicationList 存在
|
||||
if (!applicationList.value || !Array.isArray(applicationList.value)) {
|
||||
return true;
|
||||
}
|
||||
selectProjectIds.forEach((element) => {
|
||||
const searchData = applicationList.value.find((item) => {
|
||||
return element == item.adviceDefinitionId;
|
||||
});
|
||||
arr.push(searchData);
|
||||
});
|
||||
// 只有当选择了项目(arr 非空)时才设置 targetDepartment
|
||||
if (arr.length > 0) {
|
||||
const obj = arr[0];
|
||||
// 检查是否有未定义的项目(applicationList 中找不到)
|
||||
if (!obj) {
|
||||
console.warn('未找到项目定义,无法设置执行科室');
|
||||
return false;
|
||||
}
|
||||
const isCompare = arr.every((item) => item && item.orgId == obj.orgId);
|
||||
if (!isCompare) {
|
||||
ElMessage({ type: 'error', message: '执行科室不同' });
|
||||
isRelease = false;
|
||||
}
|
||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||
if (!findItem) {
|
||||
isRelease = false;
|
||||
ElMessage({ type: 'error', message: '未找到项目执行的科室' });
|
||||
}
|
||||
if (type == 1 && isRelease) {
|
||||
form.targetDepartment = findItem.id;
|
||||
console.log('targetDepartment 设置为:', form.targetDepartment, '科室名称:', findItem.name);
|
||||
}
|
||||
} else {
|
||||
// 清空选择时,也要清空 targetDepartment
|
||||
const projectWithDepartment = (selectProjectIds) => {
|
||||
if (!selectProjectIds || selectProjectIds.length === 0) {
|
||||
form.targetDepartment = '';
|
||||
}
|
||||
return isRelease;
|
||||
};
|
||||
|
||||
watch(() => transferValue.value, (newValue) => {
|
||||
console.log('transferValue changed:', newValue);
|
||||
console.log('applicationList length:', applicationList.value?.length);
|
||||
projectWithDepartment(newValue, 1);
|
||||
});
|
||||
|
||||
// 监听 applicationList 加载完成,重新设置已选项目
|
||||
watch(() => applicationList.value, (newList) => {
|
||||
if (newList && newList.length > 0 && props.isEditMode && props.editData?.requestFormDetailList?.length) {
|
||||
console.log('applicationList loaded, re-setting transferValue');
|
||||
// 使用 adviceName 匹配
|
||||
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
|
||||
const selectedIds = [];
|
||||
newList.forEach(app => {
|
||||
const appName = app.label?.split(' (')[0];
|
||||
if (selectedNames.includes(appName)) {
|
||||
selectedIds.push(app.key);
|
||||
}
|
||||
});
|
||||
transferValue.value = selectedIds;
|
||||
}
|
||||
projectWithDepartment(newValue);
|
||||
});
|
||||
|
||||
const getPriorityCode = () => {
|
||||
@@ -526,8 +443,8 @@ const submit = () => {
|
||||
if (transferValue.value.length == 0) {
|
||||
return proxy.$message.error('请选择检查项目');
|
||||
}
|
||||
if (!projectWithDepartment(transferValue.value, 2)) {
|
||||
return;
|
||||
if (!form.targetDepartment) {
|
||||
return proxy.$message.error('请选择发往科室');
|
||||
}
|
||||
if (!form.examinationPurpose) {
|
||||
return ElMessageBox.alert('请输入检查目的', '提示', { confirmButtonText: '确定', type: 'warning' });
|
||||
@@ -545,20 +462,22 @@ const submit = () => {
|
||||
// 从原始记录中提取检查项目名称,用于申请单名称字段
|
||||
const selectedNames = applicationListAllFilter.map(item => item.adviceName).join('+');
|
||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||
// 新接口 getExaminationPage 返回扁平字段(price/unitCode),兼容旧接口 priceList[0]
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId,
|
||||
adviceName: item.adviceName,
|
||||
quantity: 1,
|
||||
unitCode: item.priceList[0].unitCode,
|
||||
unitPrice: item.priceList[0].price,
|
||||
totalPrice: item.priceList[0].price,
|
||||
unitCode: item.unitCode || priceInfo.unitCode || '',
|
||||
unitPrice: item.price ?? priceInfo.price ?? 0,
|
||||
totalPrice: item.price ?? priceInfo.price ?? 0,
|
||||
positionId: item.positionId,
|
||||
ybClassEnum: item.ybClassEnum,
|
||||
conditionId: item.conditionId,
|
||||
encounterDiagnosisId: item.encounterDiagnosisId,
|
||||
adviceType: item.adviceType,
|
||||
definitionId: item.priceList[0].definitionId,
|
||||
definitionDetailId: item.priceList[0].definitionDetailId,
|
||||
definitionId: item.chargeItemDefinitionId || priceInfo.definitionId || '',
|
||||
definitionDetailId: item.definitionDetailId || priceInfo.definitionDetailId || '',
|
||||
accountId: effectivePatientInfo.value.accountId,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1668,18 +1668,27 @@ function handleSaveGroup(orderGroupList) {
|
||||
const baseRow = prescriptionList.value[rowIndex.value];
|
||||
const newRow = {
|
||||
...baseRow,
|
||||
isEdit: false,
|
||||
patientId: patientInfo.value.patientId,
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
accountId: accountId.value,
|
||||
executeNum: 1,
|
||||
statusEnum: 1,
|
||||
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
|
||||
// 🔧 修复:同时保存 orgName,确保树匹配不到时仍有中文名称可显示
|
||||
orgName: findOrgName(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || item.orderDetailInfos?.orgName || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '',
|
||||
orgId: resolveOrgId(
|
||||
(item.orderDetailInfos?.orgId || mergedDetail.orgId)
|
||||
? (item.orderDetailInfos?.orgId || mergedDetail.orgId)
|
||||
: patientInfo.value?.inHospitalOrgId
|
||||
) || '',
|
||||
orgName: findOrgName(
|
||||
(item.orderDetailInfos?.orgId || mergedDetail.orgId)
|
||||
? (item.orderDetailInfos?.orgId || mergedDetail.orgId)
|
||||
: patientInfo.value?.inHospitalOrgId
|
||||
) || item.orderDetailInfos?.orgName || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '',
|
||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||
conditionId: conditionId.value,
|
||||
conditionDefinitionId: conditionDefinitionId.value,
|
||||
encounterDiagnosisId: encounterDiagnosisId.value,
|
||||
diagnosisName: diagnosisName.value,
|
||||
therapyEnum: baseRow?.therapyEnum || '1',
|
||||
};
|
||||
// 覆盖关键字段:优先使用 item 的值,其次 mergedDetail(已由 setValue 填充),最后 baseRow
|
||||
@@ -1691,6 +1700,16 @@ function handleSaveGroup(orderGroupList) {
|
||||
newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity;
|
||||
newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode;
|
||||
newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || '';
|
||||
// 确保价格字段有兜底值(setValue 可能因库存不足提前 return 导致未设置)
|
||||
newRow.unitPrice = baseRow.unitPrice ?? mergedDetail.unitPrice ?? 0;
|
||||
newRow.minUnitPrice = baseRow.minUnitPrice ?? mergedDetail.minUnitPrice ?? 0;
|
||||
newRow.unitTempPrice = newRow.unitPrice;
|
||||
newRow.methodCode_dictText = mergedDetail.methodCode_dictText || item.methodCode_dictText || '';
|
||||
newRow.rateCode_dictText = mergedDetail.rateCode_dictText || item.rateCode_dictText || '';
|
||||
newRow.doseUnitCode = mergedDetail.doseUnitCode || item.doseUnitCode || baseRow.doseUnitCode;
|
||||
newRow.doseUnitCode_dictText = mergedDetail.doseUnitCode_dictText || item.doseUnitCode_dictText || '';
|
||||
newRow.orgId = mergedDetail.orgId || mergedDetail.positionId || baseRow.orgId || '';
|
||||
newRow.positionName = mergedDetail.orgName || mergedDetail.positionName || baseRow.positionName || '';
|
||||
|
||||
// 计算价格和总量
|
||||
// 🔧 Bug #403 修复:使用 newRow.unitCode(已由 setValue 填充)而非 item.unitCode
|
||||
|
||||
Reference in New Issue
Block a user