fix: Bug #418 #419 #421 #424 检查申请发往科室未自动赋值/下拉无数据 - 修复科室数据源接口问题

主要修复:
- 4个申请单组件统一使用getDepartmentList()替代getOrgList()
- 使用/app-common/department-list接口替代分页接口,确保科室树完整加载
- 添加findTreeItem递归查找函数,支持树形结构科室匹配
- 优化分页大小:pageSize从10000降至500,提升加载性能
- #415 后端添加价格非负验证,防止单价显示负数

涉及文件:
- laboratoryTests.vue/medicalExaminations.vue/bloodTransfusion.vue/surgery.vue
- DoctorStationAdviceAppServiceImpl.java
This commit is contained in:
2026-04-24 15:15:15 +08:00
parent 091b6e83b6
commit 1242d41499
5 changed files with 84 additions and 29 deletions

View File

@@ -1144,7 +1144,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
// #415 价格非负验证
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
unitPrice = unitPrice.abs(); // 负数取绝对值
}
chargeItem.setUnitPrice(unitPrice); // 单价
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
// 显式设置tenantId、createBy和createTime字段防止自动填充机制失效
@@ -1616,7 +1621,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
// #415 价格非负验证
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
unitPrice = unitPrice.abs(); // 负数取绝对值
}
chargeItem.setUnitPrice(unitPrice); // 单价
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
// 显式设置审计字段,防止自动填充机制失效
@@ -1842,7 +1852,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
// #415 价格非负验证
BigDecimal unitPrice = adviceSaveDto.getUnitPrice();
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) < 0) {
unitPrice = unitPrice.abs(); // 负数取绝对值
}
chargeItem.setUnitPrice(unitPrice); // 单价
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
iChargeItemService.saveOrUpdate(chargeItem);

View File

@@ -80,11 +80,23 @@
<script setup name="BloodTransfusion">
import {getCurrentInstance, onBeforeMount, onMounted, reactive, ref} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveBloodTransfusio} from './api';
const { proxy } = getCurrentInstance();
// 递归查找树形科室节点
const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null;
for (const item of list) {
if (item.id == id) return item;
if (item.children && item.children.length > 0) {
const found = findTreeItem(item.children, id);
if (found) return found;
}
}
return null;
};
const emits = defineEmits(['submitOk']);
const props = defineProps({});
const state = reactive({});
@@ -175,9 +187,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
isRelease = false;
}
// 选中项目中的执行科室id与全部科室数据做匹配
const findItem = orgOptions.value.find((item) => {
return item.id == obj.orgId;
});
const findItem = findTreeItem(orgOptions.value, obj.orgId);
if (!findItem) {
isRelease = false;
@@ -249,8 +259,8 @@ const submit = () => {
};
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
orgOptions.value = res.data?.records[0]?.children;
getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
});
};
// 获取诊断目录

View File

@@ -81,11 +81,23 @@
import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getApplicationList, saveInspection} from './api';
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance();
// 递归查找树形科室节点
const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null;
for (const item of list) {
if (item.id == id) return item;
if (item.children && item.children.length > 0) {
const found = findTreeItem(item.children, id);
if (found) return found;
}
}
return null;
};
const emits = defineEmits(['submitOk']);
const props = defineProps({});
const state = reactive({});
@@ -100,7 +112,7 @@ const getList = () => {
}
loading.value = true;
getApplicationList({
pageSize: 10000,
pageSize: 500,
pageNum: 1,
categoryCode: '22',
organizationId: patientInfo.value.inHospitalOrgId,
@@ -177,9 +189,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
isRelease = false;
}
// 选中项目中的执行科室id与全部科室数据做匹配
const findItem = orgOptions.value.find((item) => {
return item.id == obj.orgId;
});
const findItem = findTreeItem(orgOptions.value, obj.orgId);
if (!findItem) {
isRelease = false;
ElMessage({
@@ -251,8 +261,8 @@ const submit = () => {
};
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
orgOptions.value = res.data?.records[0]?.children;
getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
console.log('科室========>', JSON.stringify(orgOptions.value));
});
};

View File

@@ -80,12 +80,24 @@
<script setup name="MedicalExaminations">
import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveCheckd} from './api';
import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance();
// 递归查找树形科室节点
const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null;
for (const item of list) {
if (item.id == id) return item;
if (item.children && item.children.length > 0) {
const found = findTreeItem(item.children, id);
if (found) return found;
}
}
return null;
};
const emits = defineEmits(['submitOk']);
const props = defineProps({});
const orgOptions = ref([]); // 科室选项
@@ -100,7 +112,7 @@ const getList = () => {
}
loading.value = true;
getApplicationList({
pageSize: 10000,
pageSize: 500,
pageNum: 1,
categoryCode: '23',
organizationId: patientInfo.value.inHospitalOrgId,
@@ -176,9 +188,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
isRelease = false;
}
// 选中项目中的执行科室id与全部科室数据做匹配
const findItem = orgOptions.value.find((item) => {
return item.id == obj.orgId;
});
const findItem = findTreeItem(orgOptions.value, obj.orgId);
if (!findItem) {
isRelease = false;
@@ -250,8 +260,8 @@ const submit = () => {
};
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
orgOptions.value = res.data?.records[0]?.children;
getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
});
};
// 获取诊断目录

View File

@@ -80,12 +80,24 @@
<script setup name="Surgery">
import {getCurrentInstance, onBeforeMount, onMounted, reactive} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getOrgList} from '../../../../../basicmanage/ward/components/api.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveSurgery} from './api';
import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance();
// 递归查找树形科室节点
const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null;
for (const item of list) {
if (item.id == id) return item;
if (item.children && item.children.length > 0) {
const found = findTreeItem(item.children, id);
if (found) return found;
}
}
return null;
};
const emits = defineEmits(['submitOk']);
const props = defineProps({});
const state = reactive({});
@@ -176,9 +188,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
isRelease = false;
}
// 选中项目中的执行科室id与全部科室数据做匹配
const findItem = orgOptions.value.find((item) => {
return item.id == obj.orgId;
});
const findItem = findTreeItem(orgOptions.value, obj.orgId);
if (!findItem) {
isRelease = false;
@@ -251,8 +261,8 @@ const submit = () => {
};
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
orgOptions.value = res.data?.records[0]?.children;
getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
});
};
// 获取诊断目录