fix(prescription): 解决处方列表中手术类型和其他医嘱类型的问题
- 更新 lodash.template 修复脚本以处理 assignWith 函数的自定义器参数 - 在多个处方组件中引入 drord_doctor_type 字典用于动态生成医嘱类型列表 - 修复手术类型(adviceType=6)的特殊处理逻辑,包括类型映射和字段过滤 - 调整后端医嘱保存服务中的类型分类逻辑,正确处理手术类型 - 更新数据库查询映射以支持手术类型的正确显示和数据传输 - 修复费用对话框和订单表单中的相关类型显示问题
This commit is contained in:
@@ -564,13 +564,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 耗材(前端adviceType=4,后端ItemType.DEVICE=2)
|
||||
List<AdviceSaveDto> deviceList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())
|
||||
|| e.getAdviceType() == 4) // 🔧 BugFix: 前端耗材类型值为4
|
||||
|| e.getAdviceType() == 4) // 前端耗材类型值为4
|
||||
.collect(Collectors.toList());
|
||||
// 诊疗活动(包括普通诊疗:前端adviceType=3,会诊:前端adviceType=5)
|
||||
|
||||
// 诊疗活动(前端adviceType=3诊疗、adviceType=5会诊、adviceType=6手术)
|
||||
List<AdviceSaveDto> activityList = adviceSaveList.stream()
|
||||
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|
||||
|| e.getAdviceType() == 3 // 🔧 BugFix: 前端诊疗类型值为3
|
||||
|| e.getAdviceType() == 5) // 🔧 BugFix: 前端会诊类型值为5
|
||||
|| e.getAdviceType() == 3 // 前端诊疗类型值为3
|
||||
|| e.getAdviceType() == 5 // 前端会诊类型值为5
|
||||
|| ItemType.SURGERY.getValue().equals(e.getAdviceType())) // 🔧 BugFix#318: 手术类型值为6
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 🔍 Debug日志: 记录分类结果
|
||||
@@ -599,11 +601,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId());
|
||||
}
|
||||
|
||||
// 🔧 Bug Fix: 跳过耗材的库存校验(耗材的库存校验逻辑不同)
|
||||
// 🔧 Bug Fix: 跳过耗材、诊疗、手术的库存校验
|
||||
List<AdviceSaveDto> needCheckList = adviceSaveList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())
|
||||
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|
||||
&& !ItemType.DEVICE.getValue().equals(e.getAdviceType())) // 排除耗材
|
||||
&& !ItemType.DEVICE.getValue().equals(e.getAdviceType())
|
||||
&& !ItemType.SURGERY.getValue().equals(e.getAdviceType())) // 🔧 BugFix#318: 排除手术类型
|
||||
.collect(Collectors.toList());
|
||||
// 校验库存
|
||||
String tipRes = adviceUtils.checkInventory(needCheckList);
|
||||
|
||||
@@ -161,6 +161,11 @@ public class RequestBaseDto {
|
||||
private String doseUnitCode;
|
||||
private String doseUnitCode_dictText;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@@ -215,4 +220,16 @@ public class RequestBaseDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long basedOnId;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
surgeryChargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(surgeryServiceRequest.getBusNo()));
|
||||
surgeryChargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue());
|
||||
surgeryChargeItem.setPatientId(patientId);
|
||||
surgeryChargeItem.setContextEnum(3); // 3-诊疗
|
||||
surgeryChargeItem.setContextEnum(6); // 6-手术
|
||||
surgeryChargeItem.setEncounterId(encounterId);
|
||||
surgeryChargeItem.setEntererId(practitionerId);
|
||||
surgeryChargeItem.setEnteredDate(curDate);
|
||||
|
||||
@@ -468,6 +468,7 @@
|
||||
T1.dose AS dose,
|
||||
T1.dose_unit_code AS dose_unit_code,
|
||||
T4.id AS charge_item_id,
|
||||
T4.unit_price AS unit_price,
|
||||
T4.total_price AS total_price,
|
||||
T4.status_enum AS charge_status,
|
||||
al.id AS position_id,
|
||||
@@ -477,7 +478,9 @@
|
||||
ccd.name AS condition_definition_name,
|
||||
T1.sort_number AS sort_number,
|
||||
T1.based_on_id AS based_on_id,
|
||||
T1.category_enum AS category_enum
|
||||
T1.category_enum AS category_enum,
|
||||
T1.encounter_id AS encounter_id,
|
||||
T1.patient_id AS patient_id
|
||||
FROM med_medication_request AS T1
|
||||
LEFT JOIN med_medication_definition AS T2 ON T2.ID = T1.medication_id
|
||||
AND T2.delete_flag = '0'
|
||||
@@ -520,6 +523,7 @@
|
||||
NULL AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T3.id AS charge_item_id,
|
||||
T3.unit_price AS unit_price,
|
||||
T3.total_price AS total_price,
|
||||
T3.status_enum AS charge_status,
|
||||
al.id AS position_id,
|
||||
@@ -529,7 +533,9 @@
|
||||
'' AS condition_definition_name,
|
||||
99 AS sort_number,
|
||||
T1.based_on_id AS based_on_id,
|
||||
T1.category_enum AS category_enum
|
||||
T1.category_enum AS category_enum,
|
||||
T1.encounter_id AS encounter_id,
|
||||
T1.patient_id AS patient_id
|
||||
FROM wor_device_request AS T1
|
||||
LEFT JOIN adm_device_definition AS T2 ON T2.ID = T1.device_def_id
|
||||
AND T2.delete_flag = '0'
|
||||
@@ -547,7 +553,7 @@
|
||||
AND T1.refund_device_id IS NULL
|
||||
ORDER BY T1.status_enum)
|
||||
UNION ALL
|
||||
(SELECT COALESCE(T1.category_enum, 3) AS advice_type,
|
||||
(SELECT CASE WHEN T1.category_enum = 4 THEN 6 ELSE COALESCE(T1.category_enum, 3) END AS advice_type,
|
||||
T1.id AS request_id,
|
||||
T1.id || '-3' AS unique_key,
|
||||
'' AS prescription_no,
|
||||
@@ -561,15 +567,16 @@
|
||||
COALESCE(T2.NAME, T1.content_json::jsonb->>'surgeryName', T1.content_json::jsonb->>'adviceName') AS advice_name,
|
||||
'' AS volume,
|
||||
'' AS lot_number,
|
||||
T1.quantity AS quantity,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.status_enum AS status_enum,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
NULL AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T3.id AS charge_item_id,
|
||||
T3.total_price AS total_price,
|
||||
T1.quantity AS quantity,
|
||||
T1.unit_code AS unit_code,
|
||||
T1.status_enum AS status_enum,
|
||||
'' AS method_code,
|
||||
'' AS rate_code,
|
||||
NULL AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T3.id AS charge_item_id,
|
||||
T3.unit_price AS unit_price,
|
||||
T3.total_price AS total_price,
|
||||
T3.status_enum AS charge_status,
|
||||
ao.id AS position_id,
|
||||
ao.name AS position_name,
|
||||
@@ -577,9 +584,11 @@
|
||||
1 AS part_percent,
|
||||
'' AS condition_definition_name,
|
||||
99 AS sort_number,
|
||||
T1.based_on_id AS based_on_id,
|
||||
T1.category_enum AS category_enum
|
||||
FROM wor_service_request AS T1
|
||||
T1.based_on_id AS based_on_id,
|
||||
T1.category_enum AS category_enum,
|
||||
T1.encounter_id AS encounter_id,
|
||||
T1.patient_id AS patient_id
|
||||
FROM wor_service_request AS T1
|
||||
LEFT JOIN wor_activity_definition AS T2
|
||||
ON T2.ID = T1.activity_id
|
||||
AND T2.delete_flag = '0'
|
||||
|
||||
@@ -203,6 +203,7 @@
|
||||
T1.dose AS dose,
|
||||
T1.dose_unit_code AS dose_unit_code,
|
||||
T4.id AS charge_item_id,
|
||||
T4.unit_price AS unit_price,
|
||||
T4.total_price AS total_price,
|
||||
T4.status_enum AS charge_status,
|
||||
al.id AS position_id,
|
||||
@@ -254,6 +255,7 @@
|
||||
NULL AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T3.id AS charge_item_id,
|
||||
T3.unit_price AS unit_price,
|
||||
T3.total_price AS total_price,
|
||||
T3.status_enum AS charge_status,
|
||||
al.id AS position_id,
|
||||
@@ -281,7 +283,7 @@
|
||||
AND T1.refund_device_id IS NULL
|
||||
ORDER BY T1.status_enum)
|
||||
UNION ALL
|
||||
(SELECT COALESCE(T1.category_enum, 3) AS advice_type,
|
||||
(SELECT CASE WHEN T1.category_enum = 4 THEN 6 ELSE COALESCE(T1.category_enum, 3) END AS advice_type,
|
||||
T1.id AS request_id,
|
||||
T1.id || '-3' AS unique_key,
|
||||
T1.requester_id AS requester_id,
|
||||
@@ -302,6 +304,7 @@
|
||||
NULL AS dose,
|
||||
'' AS dose_unit_code,
|
||||
T3.id AS charge_item_id,
|
||||
T3.unit_price AS unit_price,
|
||||
T3.total_price AS total_price,
|
||||
T3.status_enum AS charge_status,
|
||||
ao.id AS position_id,
|
||||
|
||||
@@ -26,12 +26,13 @@
|
||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||
SELECT wsr.quantity,
|
||||
wsr.unit_code,
|
||||
wad.NAME AS advice_name,
|
||||
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
|
||||
aci.total_price
|
||||
FROM wor_service_request AS wsr
|
||||
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
|
||||
AND wad.delete_flag = '0'
|
||||
LEFT JOIN adm_charge_item AS aci ON aci.service_id = wsr.ID
|
||||
AND aci.service_table = 'wor_service_request'
|
||||
AND aci.delete_flag = '0'
|
||||
WHERE wsr.delete_flag = '0'
|
||||
AND wsr.prescription_no = #{prescriptionNo}
|
||||
|
||||
@@ -23,14 +23,19 @@ public enum ItemType implements HisEnumInterface {
|
||||
MEDICINE(1, "1", "药品"),
|
||||
|
||||
/**
|
||||
* 耗材
|
||||
* 医疗活动
|
||||
*/
|
||||
ACTIVITY(3, "3", "医疗活动"),
|
||||
|
||||
/**
|
||||
* 耗材(前端使用值2)
|
||||
*/
|
||||
DEVICE(2, "2", "耗材"),
|
||||
|
||||
/**
|
||||
* 医疗活动
|
||||
* 手术(前端使用值6,避免与耗材冲突)
|
||||
*/
|
||||
ACTIVITY(3, "3", "医疗活动");
|
||||
SURGERY(6, "6", "手术");
|
||||
|
||||
@EnumValue
|
||||
private Integer value;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Fix lodash.template assignWith issue - Manual fix script
|
||||
* Run this after npm/yarn install and before build
|
||||
@@ -18,34 +17,35 @@ if (!fs.existsSync(lodashTemplatePath)) {
|
||||
|
||||
let content = fs.readFileSync(lodashTemplatePath, 'utf8');
|
||||
|
||||
// Check if already patched
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED */')) {
|
||||
console.log('✓ lodash.template already patched');
|
||||
// Check if already patched with new version
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED_V2 */')) {
|
||||
console.log('✓ lodash.template already patched with v2');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Check if assignWith is actually missing
|
||||
if (content.includes('assignWith')) {
|
||||
// Check if it's used but not defined
|
||||
const hasFunctionDefinition = /function\s+assignWith|var\s+assignWith\s*=/.test(content);
|
||||
if (hasFunctionDefinition) {
|
||||
console.log('✓ assignWith is already defined in lodash.template');
|
||||
process.exit(0);
|
||||
}
|
||||
// Remove old patch if exists
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED */')) {
|
||||
console.log('🔄 Removing old patch...');
|
||||
content = content.replace(/\/\* LODASH_TEMPLATE_PATCHED \*\/\n.*assignWith[\s\S]*?^\}/m, '');
|
||||
}
|
||||
|
||||
console.log('🔧 Patching lodash.template...');
|
||||
console.log('🔧 Patching lodash.template with v2...');
|
||||
|
||||
// Simple assignWith implementation
|
||||
const assignWithImpl = `/* LODASH_TEMPLATE_PATCHED */
|
||||
// assignWith polyfill for lodash.template
|
||||
// Correct assignWith implementation that handles undefined customizer
|
||||
const assignWithImpl = `/* LODASH_TEMPLATE_PATCHED_V2 */
|
||||
// assignWith polyfill for lodash.template - Fixed version
|
||||
function assignWith(object, source, customizer) {
|
||||
if (object == null) return object;
|
||||
if (typeof customizer !== 'function') {
|
||||
customizer = function(objValue, srcValue) {
|
||||
return srcValue;
|
||||
};
|
||||
}
|
||||
var props = Object.keys(Object(source));
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var key = props[i];
|
||||
var value = source[key];
|
||||
var assignedValue = customizer ? customizer(object[key], value, key, object, source) : value;
|
||||
var assignedValue = customizer(object[key], value, key, object, source);
|
||||
if (assignedValue !== undefined) {
|
||||
object[key] = assignedValue;
|
||||
}
|
||||
@@ -74,5 +74,5 @@ const after = content.substring(insertPos);
|
||||
content = before + '\n' + assignWithImpl + after;
|
||||
|
||||
fs.writeFileSync(lodashTemplatePath, content);
|
||||
console.log('✅ Successfully patched lodash.template with assignWith function');
|
||||
console.log('✅ Successfully patched lodash.template with assignWith function (v2)');
|
||||
console.log(' File:', lodashTemplatePath);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Fix lodash.template assignWith issue for Linux/Mac servers
|
||||
# Fix lodash.template assignWith issue for Linux/Mac servers - V2
|
||||
# Run this script after npm/yarn install
|
||||
|
||||
LODGASH_TEMPLATE="node_modules/lodash.template/index.js"
|
||||
@@ -9,34 +9,43 @@ if [ ! -f "$LODGASH_TEMPLATE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if already patched
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED" "$LODGASH_TEMPLATE"; then
|
||||
echo "✓ lodash.template already patched"
|
||||
# Check if already patched with v2
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED_V2" "$LODGASH_TEMPLATE"; then
|
||||
echo "✓ lodash.template already patched with v2"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔧 Patching lodash.template..."
|
||||
# Remove old patch if exists
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED" "$LODGASH_TEMPLATE"; then
|
||||
echo "🔄 Removing old patch..."
|
||||
# Use sed to remove old patch (multi-line)
|
||||
sed -i '/\/\* LODASH_TEMPLATE_PATCHED \*\//,/^}$/d' "$LODGASH_TEMPLATE"
|
||||
fi
|
||||
|
||||
echo "🔧 Patching lodash.template with v2..."
|
||||
|
||||
# Create a temporary file with the patch
|
||||
PATCH=$(cat <<'EOF'
|
||||
/* LODASH_TEMPLATE_PATCHED */
|
||||
// assignWith polyfill for lodash.template
|
||||
PATCH='/* LODASH_TEMPLATE_PATCHED_V2 */
|
||||
// assignWith polyfill for lodash.template - Fixed version
|
||||
function assignWith(object, source, customizer) {
|
||||
if (object == null) return object;
|
||||
if (typeof customizer !== "function") {
|
||||
customizer = function(objValue, srcValue) {
|
||||
return srcValue;
|
||||
};
|
||||
}
|
||||
var props = Object.keys(Object(source));
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var key = props[i];
|
||||
var value = source[key];
|
||||
var assignedValue = customizer ? customizer(object[key], value, key, object, source) : value;
|
||||
var assignedValue = customizer(object[key], value, key, object, source);
|
||||
if (assignedValue !== undefined) {
|
||||
object[key] = assignedValue;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
EOF
|
||||
)
|
||||
'
|
||||
|
||||
# Insert after the first line (license comment)
|
||||
{
|
||||
@@ -45,4 +54,4 @@ EOF
|
||||
tail -n +2 "$LODGASH_TEMPLATE"
|
||||
} > "$LODGASH_TEMPLATE.tmp" && mv "$LODGASH_TEMPLATE.tmp" "$LODGASH_TEMPLATE"
|
||||
|
||||
echo "✅ Successfully patched lodash.template with assignWith function"
|
||||
echo "✅ Successfully patched lodash.template with assignWith function (v2)"
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
"predev": "node utils/check.js dev && vdoing",
|
||||
"prebuild": "node utils/check.js build && vdoing",
|
||||
"updateTheme": "yarn remove vuepress-theme-vdoing && rm -rf node_modules && yarn && yarn add vuepress-theme-vdoing -D",
|
||||
"editFm": "node utils/editFrontmatter.js"
|
||||
"editFm": "node utils/editFrontmatter.js",
|
||||
"fix-lodash": "node fix-lodash-manual.js",
|
||||
"build:fixed": "npm run fix-lodash && npm run build",
|
||||
"build:win:fixed": "npm run fix-lodash && npm run build:win"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -23,6 +26,7 @@
|
||||
"inquirer": "^7.1.0",
|
||||
"json2yaml": "^1.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.assignwith": "^4.2.0",
|
||||
"vuepress": "1.9.9",
|
||||
"vuepress-plugin-baidu-tongji": "^1.0.1",
|
||||
"vuepress-plugin-demo-block": "^0.7.2",
|
||||
@@ -33,5 +37,13 @@
|
||||
"vuepress-theme-vdoing": "^1.12.9",
|
||||
"yamljs": "^0.3.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {},
|
||||
"resolutions": {
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.template": "^4.5.0"
|
||||
},
|
||||
"overrides": {
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.template": "^4.5.0"
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@
|
||||
<script setup>
|
||||
import {getOrgTree, saveOrderGroup} from './api';
|
||||
import adviceBaseList from './adviceBaseList';
|
||||
import {getCurrentInstance, nextTick, watch} from 'vue';
|
||||
import {computed, getCurrentInstance, nextTick, ref, watch} from 'vue';
|
||||
import {calculateQuantityByDays, formatNumber} from '@/utils/his';
|
||||
|
||||
const emit = defineEmits(['selectDiagnosis']);
|
||||
@@ -620,31 +620,31 @@ const stockList = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const inputRefs = ref({}); // 存储输入框实例
|
||||
const requiredProps = ref([]); // 存储必填项 prop 顺序
|
||||
const { method_code, unit_code, rate_code, distribution_category_code } = proxy.useDict(
|
||||
const { method_code, unit_code, rate_code, distribution_category_code, drord_doctor_type } = proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
'rate_code',
|
||||
'distribution_category_code'
|
||||
'distribution_category_code',
|
||||
'drord_doctor_type'
|
||||
);
|
||||
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '西药中成药',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '耗材',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: undefined,
|
||||
},
|
||||
]);
|
||||
// 使用 drord_doctor_type 字典
|
||||
const adviceTypeList = computed(() => {
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
const list = drord_doctor_type.value.map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value) || item.value
|
||||
}));
|
||||
return [...list, { label: '全部', value: undefined }];
|
||||
}
|
||||
// 默认值
|
||||
return [
|
||||
{ label: '西药中成药', value: 1 },
|
||||
{ label: '耗材', value: 4 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '全部', value: undefined },
|
||||
];
|
||||
});
|
||||
onMounted(() => {
|
||||
document.addEventListener('keydown', escKeyListener);
|
||||
});
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
<script setup>
|
||||
import {getOrgTree, getPrescriptionList, savePrescription, savePrescriptionSign, singOut,} from './api';
|
||||
import adviceBaseList from './adviceBaseList';
|
||||
import {getCurrentInstance, nextTick, ref, watch} from 'vue';
|
||||
import {computed, getCurrentInstance, nextTick, ref, watch} from 'vue';
|
||||
|
||||
const emit = defineEmits(['selectDiagnosis']);
|
||||
const prescriptionList = ref([]);
|
||||
@@ -334,28 +334,35 @@ const groupList = ref([])
|
||||
const { proxy } = getCurrentInstance();
|
||||
const inputRefs = ref({}); // 存储输入框实例
|
||||
const requiredProps = ref([]); // 存储必填项 prop 顺序
|
||||
const { method_code, unit_code, rate_code, distribution_category_code } = proxy.useDict(
|
||||
const { method_code, unit_code, rate_code, distribution_category_code, drord_doctor_type } = proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
'rate_code',
|
||||
'distribution_category_code'
|
||||
'distribution_category_code',
|
||||
'drord_doctor_type'
|
||||
);
|
||||
const handleSaveDisabled = ref(false) //签发状态
|
||||
const handleSingOutDisabled = ref(false) //签退状态
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '耗材',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: undefined,
|
||||
},
|
||||
]);
|
||||
// 使用 drord_doctor_type 字典
|
||||
const adviceTypeList = computed(() => {
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
// 只保留耗材(4)和诊疗(3)类型,并添加全部选项
|
||||
const filtered = drord_doctor_type.value.filter(item => {
|
||||
const val = parseInt(item.value);
|
||||
return val === 3 || val === 4; // 诊疗和耗材
|
||||
}).map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value)
|
||||
}));
|
||||
return [...filtered, { label: '全部', value: undefined }];
|
||||
}
|
||||
// 默认值
|
||||
return [
|
||||
{ label: '耗材', value: 4 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '全部', value: undefined },
|
||||
];
|
||||
});
|
||||
watch(
|
||||
() => expandOrder.value,
|
||||
(newValue) => {
|
||||
|
||||
@@ -957,34 +957,26 @@ const { method_code, unit_code, rate_code, distribution_category_code, drord_doc
|
||||
'drord_doctor_type'
|
||||
);
|
||||
|
||||
// 删除硬编码的adviceTypeList,直接使用drord_doctor_type字典
|
||||
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '西药',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '中成药',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '耗材',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '会诊',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
]);
|
||||
// 使用 drord_doctor_type 字典,不再硬编码
|
||||
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=手术
|
||||
const adviceTypeList = computed(() => {
|
||||
// 如果字典已加载,使用字典数据;否则使用默认值
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
return drord_doctor_type.value.map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value) || item.value
|
||||
}));
|
||||
}
|
||||
// 默认返回值,确保页面正常显示
|
||||
return [
|
||||
{ label: '西药', value: 1 },
|
||||
{ label: '中成药', value: 2 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '耗材', value: 4 },
|
||||
{ label: '会诊', value: 5 },
|
||||
{ label: '手术', value: 6 },
|
||||
];
|
||||
});
|
||||
|
||||
// 根据类型值获取显示标签,避免非编辑态出现空标签
|
||||
const mapAdviceTypeLabel = (type) => {
|
||||
@@ -2394,6 +2386,8 @@ function handleSave(prescriptionId) {
|
||||
saveAdviceType = 1; // 中成药:前端2 -> 后端1
|
||||
} else if (item.adviceType == 5) {
|
||||
saveAdviceType = 3; // 会诊:前端5 -> 后端3(诊疗类)
|
||||
} else if (item.adviceType == 6) {
|
||||
saveAdviceType = 6; // 🔧 BugFix#318: 手术类型保持为6
|
||||
}
|
||||
|
||||
// 🔧 Bug Fix: Validate and fix NaN values before sending to backend
|
||||
@@ -2403,6 +2397,21 @@ function handleSave(prescriptionId) {
|
||||
console.warn('Fixed NaN totalPrice for item:', item.adviceName);
|
||||
}
|
||||
|
||||
// 🔧 BugFix#318: 从 parsedContent 提取标准医嘱字段,排除手术特有字段
|
||||
const standardFields = [
|
||||
'accountId', 'chargeItemId', 'conditionDefinitionId', 'conditionId',
|
||||
'contentJson', 'definitionDetailId', 'definitionId', 'diagnosisName',
|
||||
'dosageInstruction', 'effectiveOrgId', 'encounterDiagnosisId',
|
||||
'encounterId', 'lotNumber', 'patientId', 'practitionerId',
|
||||
'prescriptionNo', 'skinTestFlag', 'unitPrice', 'volume', 'ybClassEnum'
|
||||
];
|
||||
let filteredContent = {};
|
||||
standardFields.forEach(field => {
|
||||
if (parsedContent[field] !== undefined) {
|
||||
filteredContent[field] = parsedContent[field];
|
||||
}
|
||||
});
|
||||
|
||||
// 构造请求参数
|
||||
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
|
||||
// 耗材使用 adm_device_definition 表
|
||||
@@ -2427,10 +2436,12 @@ function handleSave(prescriptionId) {
|
||||
});
|
||||
|
||||
return {
|
||||
...parsedContent,
|
||||
...filteredContent, // 🔧 BugFix#318: 使用过滤后的字段,排除手术特有字段
|
||||
adviceType: saveAdviceType, // 使用转换后的类型
|
||||
requestId: item.requestId,
|
||||
dbOpType: '1',
|
||||
dbOpType: item.requestId ? '2' : '1', // 🔧 BugFix: 根据requestId判断是新增还是修改
|
||||
encounterId: item.encounterId || props.patientInfo.encounterId, // 🔧 BugFix: 确保encounterId
|
||||
patientId: item.patientId || props.patientInfo.patientId, // 🔧 BugFix: 确保patientId
|
||||
groupId: item.groupId,
|
||||
uniqueKey: undefined,
|
||||
// 使用转换后的数量和单位
|
||||
@@ -2723,28 +2734,32 @@ function handleSaveSign(row, index, prescriptionId) {
|
||||
|
||||
formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (row.adviceType != 2) {
|
||||
// 🔧 BugFix#318: 手术类型(adviceType=6)不需要检查绑定耗材/药品
|
||||
if (row.adviceType != 2 && row.adviceType != 6) {
|
||||
// 1:用法绑东西 2:诊疗绑东西
|
||||
let typeCode = row.adviceType == 1 ? '1' : '2';
|
||||
// 用法字典值/诊疗定义id
|
||||
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
|
||||
getBindDevice({ typeCode: typeCode, itemNo: itemNo }).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
// 是否需要打开弹窗
|
||||
let openBindDialog = localStorage.getItem('doctor' + userStore.id);
|
||||
if (!JSON.parse(openBindDialog)) {
|
||||
proxy.$refs['orderBindInfoRef'].open(res.data);
|
||||
} else {
|
||||
// 如果弹窗不提示带出的项目,自动带出
|
||||
// 如果有未签发的项目,并且当前的项目没有带出过绑定项目,则自动带出
|
||||
if (!bindMethod.value[itemNo]) {
|
||||
handleOrderBindInfo(res.data, row.methodCode);
|
||||
bindMethod.value[itemNo] = true;
|
||||
// 🔧 确保 itemNo 有值才调用接口
|
||||
if (itemNo) {
|
||||
getBindDevice({ typeCode: typeCode, itemNo: itemNo }).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 是否需要打开弹窗
|
||||
let openBindDialog = localStorage.getItem('doctor' + userStore.id);
|
||||
if (!JSON.parse(openBindDialog)) {
|
||||
proxy.$refs['orderBindInfoRef'].open(res.data);
|
||||
} else {
|
||||
// 如果弹窗不提示带出的项目,自动带出
|
||||
// 如果有未签发的项目,并且当前的项目没有带出过绑定项目,则自动带出
|
||||
if (!bindMethod.value[itemNo]) {
|
||||
handleOrderBindInfo(res.data, row.methodCode);
|
||||
bindMethod.value[itemNo] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
row.isEdit = false;
|
||||
isAdding.value = false;
|
||||
@@ -2766,15 +2781,20 @@ function handleSaveSign(row, index, prescriptionId) {
|
||||
|
||||
row.conditionId = conditionId.value;
|
||||
// 处理总量为小单位情况,需要把单价也保存成小单位的
|
||||
if (row.unitCodeList.find((item) => item.value == row.unitCode).type == 'unit') {
|
||||
if (row.adviceType != 3) {
|
||||
row.unitPrice = row.unitTempPrice;
|
||||
// 🔧 BugFix#318: 手术类型(adviceType=6)可能没有unitCodeList,需要判断
|
||||
if (row.unitCodeList && row.unitCodeList.length > 0) {
|
||||
const foundUnit = row.unitCodeList.find((item) => item.value == row.unitCode);
|
||||
if (foundUnit && foundUnit.type == 'unit') {
|
||||
if (row.adviceType != 3) {
|
||||
row.unitPrice = row.unitTempPrice;
|
||||
}
|
||||
} else {
|
||||
const minUnitItem = row.unitCodeList.find((item) => item.value == row.minUnitCode);
|
||||
if (minUnitItem) {
|
||||
row.unitCode_dictText = minUnitItem.label;
|
||||
}
|
||||
row.unitPrice = row.minUnitPrice;
|
||||
}
|
||||
} else {
|
||||
row.unitCode_dictText = row.unitCodeList.find(
|
||||
(item) => item.value == row.minUnitCode
|
||||
).label;
|
||||
row.unitPrice = row.minUnitPrice;
|
||||
}
|
||||
row.conditionDefinitionId = conditionDefinitionId.value;
|
||||
row.encounterDiagnosisId = encounterDiagnosisId.value;
|
||||
@@ -2956,8 +2976,27 @@ function handleSaveBatch(prescriptionId) {
|
||||
saveAdviceType = 1; // 中成药前端2 -> 后端1
|
||||
} else if (item.adviceType == 5) {
|
||||
saveAdviceType = 3; // 会诊前端5 -> 后端3(诊疗类)
|
||||
} else if (item.adviceType == 6) {
|
||||
saveAdviceType = 6; // 🔧 BugFix#318: 手术类型保持为6
|
||||
}
|
||||
|
||||
// 🔧 BugFix#318: 过滤掉手术特有字段,只保留标准医嘱字段
|
||||
const standardItemFields = [
|
||||
'adviceDefinitionId', 'adviceName', 'adviceTableName', 'adviceType',
|
||||
'basedOnId', 'chargeItemId', 'chargeStatus', 'conditionDefinitionId',
|
||||
'conditionId', 'contentJson', 'dose', 'doseUnitCode', 'encounterDiagnosisId',
|
||||
'encounterId', 'groupId', 'injectFlag', 'lotNumber', 'methodCode', 'partPercent',
|
||||
'patientId', 'positionId', 'positionName', 'prescriptionNo', 'quantity', 'rateCode',
|
||||
'requestId', 'skinTestFlag', 'sortNumber', 'statusEnum', 'totalPrice',
|
||||
'unitCode', 'unitPrice', 'volume', 'ybClassEnum'
|
||||
];
|
||||
let filteredItem = {};
|
||||
standardItemFields.forEach(field => {
|
||||
if (item[field] !== undefined) {
|
||||
filteredItem[field] = item[field];
|
||||
}
|
||||
});
|
||||
|
||||
// 构造 contentJson (保持前端UI原始数据)
|
||||
const itemToSave = {
|
||||
...item,
|
||||
@@ -3003,7 +3042,7 @@ function handleSaveBatch(prescriptionId) {
|
||||
});
|
||||
|
||||
return {
|
||||
...item,
|
||||
...filteredItem, // 🔧 BugFix#318: 使用过滤后的字段
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
adviceType: saveAdviceType,
|
||||
|
||||
@@ -371,7 +371,7 @@
|
||||
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px">
|
||||
<span style="font-size: 16px; font-weight: 600">
|
||||
{{ row.adviceName }}
|
||||
{{ row.unitPrice ? Number(row.unitPrice).toFixed(2) + '/次' : '-' + '元' }}
|
||||
{{ row.unitPrice ? ' -' + Number(row.unitPrice).toFixed(2) + '元' : ' -元' }}
|
||||
</span>
|
||||
<div class="form-group">
|
||||
<el-form-item
|
||||
|
||||
@@ -426,38 +426,35 @@ const inputRefs = ref({}); // 存储输入框实例
|
||||
const requiredProps = ref([]); // 存储必填项 prop 顺序
|
||||
const totalAmount = ref(0);
|
||||
const therapyEnum = ref('');
|
||||
const { method_code, unit_code, rate_code, distribution_category_code } = proxy.useDict(
|
||||
const { method_code, unit_code, rate_code, distribution_category_code, drord_doctor_type } = proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
'rate_code',
|
||||
'distribution_category_code'
|
||||
'distribution_category_code',
|
||||
'drord_doctor_type'
|
||||
);
|
||||
const openDrawer = ref(false);
|
||||
const orderClassCode = ref('');
|
||||
const orderStatus = ref('');
|
||||
// 医嘱类型
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '西药中成药',
|
||||
value: 1,
|
||||
},
|
||||
// {
|
||||
// label: '耗材',
|
||||
// value: 2,
|
||||
// },
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '手术',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
]);
|
||||
// 医嘱类型 - 使用 drord_doctor_type 字典
|
||||
const adviceTypeList = computed(() => {
|
||||
// 如果字典已加载,使用字典数据(过滤掉全部选项)
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
const list = drord_doctor_type.value.map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value) || item.value
|
||||
}));
|
||||
// 添加全部选项
|
||||
return [...list, { label: '全部', value: '' }];
|
||||
}
|
||||
// 默认返回值
|
||||
return [
|
||||
{ label: '西药中成药', value: 1 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '手术', value: 6 },
|
||||
{ label: '全部', value: '' },
|
||||
];
|
||||
});
|
||||
// 医嘱状态
|
||||
const statusOption = [
|
||||
{
|
||||
|
||||
@@ -250,12 +250,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, onMounted, reactive, ref, watch} from 'vue';
|
||||
import {computed, getCurrentInstance, onMounted, reactive, ref, watch} from 'vue';
|
||||
import {ElMessage} from 'element-plus';
|
||||
import {formatDateStr} from '@/utils/index';
|
||||
import {getAdviceBaseInfo, getDiseaseTreatmentInitLoc, getOrgList} from './api.js';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { drord_doctor_type } = proxy.useDict('drord_doctor_type');
|
||||
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -280,11 +283,26 @@ const dialogVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: (value) => emit('update:visible', value),
|
||||
});
|
||||
const adviceTypeList = ref([
|
||||
{ label: '耗材', value: 2 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '全部', value: '' },
|
||||
]);
|
||||
// 使用 drord_doctor_type 字典
|
||||
const adviceTypeList = computed(() => {
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
// 只保留耗材(4)和诊疗(3)类型,并添加全部选项
|
||||
const filtered = drord_doctor_type.value.filter(item => {
|
||||
const val = parseInt(item.value);
|
||||
return val === 3 || val === 4;
|
||||
}).map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value)
|
||||
}));
|
||||
return [...filtered, { label: '全部', value: '' }];
|
||||
}
|
||||
// 默认值
|
||||
return [
|
||||
{ label: '耗材', value: 4 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '全部', value: '' },
|
||||
];
|
||||
});
|
||||
const adviceType = ref('');
|
||||
const feeItemsList = ref([]);
|
||||
const executeTime = ref('');
|
||||
|
||||
Reference in New Issue
Block a user