bug338:门诊划价新增时未校验当前就诊记录及诊断记录,未接诊患者也可新增划价项目。

bug339:【库存商品明细查询报表】“药房”筛选条件失效,查询结果中包含非选中药房的数据
This commit is contained in:
2026-04-09 18:15:26 +08:00
parent d8511ecb1b
commit 8deefd2cb1
7 changed files with 131 additions and 18 deletions

View File

@@ -68,6 +68,9 @@ public class InventoryProductReportAppServiceImpl implements IInventoryProductRe
// 库存范围 // 库存范围
Integer inventoryScope = inventoryProductReportSearchParam.getInventoryScope(); Integer inventoryScope = inventoryProductReportSearchParam.getInventoryScope();
inventoryProductReportSearchParam.setInventoryScope(null); inventoryProductReportSearchParam.setInventoryScope(null);
// 药房:在 XML 内层按 wor_inventory_item.location_id 过滤,不能走外层 ew子查询结果列不含 location_id
Long purposeLocationId = inventoryProductReportSearchParam.getPurposeLocationId();
inventoryProductReportSearchParam.setPurposeLocationId(null);
// 设置模糊查询的字段名 // 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>(); HashSet<String> searchFields = new HashSet<>();
@@ -80,7 +83,7 @@ public class InventoryProductReportAppServiceImpl implements IInventoryProductRe
// 查询库存商品明细分页列表 // 查询库存商品明细分页列表
Page<InventoryProductReportPageDto> productReportPage = inventoryProductReportMapper.selectProductReportPage( Page<InventoryProductReportPageDto> productReportPage = inventoryProductReportMapper.selectProductReportPage(
new Page<>(pageNo, pageSize), queryWrapper, ConditionCode.LOT_NUMBER_COST.getValue().toString(), new Page<>(pageNo, pageSize), queryWrapper, ConditionCode.LOT_NUMBER_COST.getValue().toString(),
inventoryScope); inventoryScope, purposeLocationId);
productReportPage.getRecords().forEach(e -> { productReportPage.getRecords().forEach(e -> {
// 药品类型 // 药品类型
@@ -110,6 +113,8 @@ public class InventoryProductReportAppServiceImpl implements IInventoryProductRe
// 库存范围 // 库存范围
Integer inventoryScope = inventoryProductReportSearchParam.getInventoryScope(); Integer inventoryScope = inventoryProductReportSearchParam.getInventoryScope();
inventoryProductReportSearchParam.setInventoryScope(null); inventoryProductReportSearchParam.setInventoryScope(null);
Long purposeLocationId = inventoryProductReportSearchParam.getPurposeLocationId();
inventoryProductReportSearchParam.setPurposeLocationId(null);
// 设置模糊查询的字段名 // 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>(); HashSet<String> searchFields = new HashSet<>();
@@ -122,7 +127,7 @@ public class InventoryProductReportAppServiceImpl implements IInventoryProductRe
// 查询库存商品明细分页列表 // 查询库存商品明细分页列表
Page<InventoryProductReportPageDto> productReportPage = inventoryProductReportMapper.selectProductReportPage( Page<InventoryProductReportPageDto> productReportPage = inventoryProductReportMapper.selectProductReportPage(
new Page<>(pageNo, pageSize), queryWrapper, ConditionCode.LOT_NUMBER_COST.getValue().toString(), new Page<>(pageNo, pageSize), queryWrapper, ConditionCode.LOT_NUMBER_COST.getValue().toString(),
inventoryScope); inventoryScope, purposeLocationId);
productReportPage.getRecords().forEach(e -> { productReportPage.getRecords().forEach(e -> {
// 药品类型 // 药品类型

View File

@@ -33,6 +33,9 @@ public class InventoryProductReportSearchParam {
/** 药房类型 */ /** 药房类型 */
private Integer purposeTypeEnum; private Integer purposeTypeEnum;
/** 药房/库房位置(对应 wor_inventory_item.location_id、adm_location.id */
private Long purposeLocationId;
/** 库存范围 */ /** 库存范围 */
private Integer inventoryScope; private Integer inventoryScope;

View File

@@ -32,5 +32,6 @@ public interface InventoryProductReportMapper {
Page<InventoryProductReportPageDto> selectProductReportPage(@Param("page") Page<InventoryProductReportPageDto> page, Page<InventoryProductReportPageDto> selectProductReportPage(@Param("page") Page<InventoryProductReportPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<InventoryProductReportSearchParam> queryWrapper, @Param(Constants.WRAPPER) QueryWrapper<InventoryProductReportSearchParam> queryWrapper,
@Param("lotNumber") String lotNumber, @Param("lotNumber") String lotNumber,
@Param("inventoryScope") Integer inventoryScope); @Param("inventoryScope") Integer inventoryScope,
@Param("purposeLocationId") Long purposeLocationId);
} }

View File

@@ -66,7 +66,11 @@
LEFT JOIN adm_location T7 LEFT JOIN adm_location T7
ON T1.location_store_id = T7.id ON T1.location_store_id = T7.id
AND T7.delete_flag = '0' AND T7.delete_flag = '0'
WHERE T1.delete_flag = '0') AS T8 WHERE T1.delete_flag = '0'
<if test="purposeLocationId != null">
AND T1.location_id = #{purposeLocationId}
</if>
) AS T8
UNION UNION
SELECT T10.id, --ID SELECT T10.id, --ID
T10.bus_no, --器材编码 T10.bus_no, --器材编码
@@ -129,7 +133,11 @@
LEFT JOIN adm_location T7 LEFT JOIN adm_location T7
ON T1.location_store_id = T7.id ON T1.location_store_id = T7.id
AND T7.delete_flag = '0' AND T7.delete_flag = '0'
WHERE T1.delete_flag = '0') AS T10 WHERE T1.delete_flag = '0'
<if test="purposeLocationId != null">
AND T1.location_id = #{purposeLocationId}
</if>
) AS T10
) AS combined_result ) AS combined_result
<where> <where>
<if test="inventoryScope != null"> <if test="inventoryScope != null">

View File

@@ -61,6 +61,26 @@ export function getPrescriptionList(encounterId) {
method: 'get', method: 'get',
}) })
} }
/**
* 门诊病历详情(与医生站一致,无记录时 data 为 null
*/
export function getEmrDetail(encounterId) {
return request({
url: '/doctor-station/emr/emr-detail?encounterId=' + encounterId,
method: 'get',
})
}
/**
* 当前就诊诊断列表
*/
export function getEncounterDiagnosis(encounterId) {
return request({
url: '/doctor-station/diagnosis/get-encounter-diagnosis?encounterId=' + encounterId,
method: 'get',
})
}
/** /**
* 获取科室列表 * 获取科室列表
*/ */

View File

@@ -335,7 +335,15 @@
</template> </template>
<script setup> <script setup>
import {getOrgTree, getPrescriptionList, savePrescription, savePrescriptionSign, singOut,} from './api'; import {
getOrgTree,
getPrescriptionList,
savePrescription,
savePrescriptionSign,
singOut,
getEmrDetail,
getEncounterDiagnosis,
} from './api';
import adviceBaseList from './adviceBaseList'; import adviceBaseList from './adviceBaseList';
import {getCurrentInstance, nextTick, ref, watch} from 'vue'; import {getCurrentInstance, nextTick, ref, watch} from 'vue';
@@ -488,19 +496,87 @@ function getRowDisabled(row) {
return row.isEdit; return row.isEdit;
} }
/**
* 是否已由医生接诊(非待诊)
* EncounterStatus: 1=待诊 2=在诊 3=暂离 …
*/
function assertEncounterReceived(patientInfo) {
const status = Number(patientInfo.statusEnum)
if (status === 1) {
proxy.$modal.msgWarning('当前就诊尚未接诊,不能进行门诊划价')
return false
}
return true
}
/** 是否存在有效就诊记录(门诊 doc_emr 或住院 doc_record与 emr-detail 一致) */
function assertHasEmrRecord(emrRes) {
if (!emrRes || emrRes.code !== 200) {
proxy.$modal.msgWarning(emrRes?.msg || '获取就诊记录失败,不能进行门诊划价')
return false
}
const row = emrRes.data
if (row == null || row === '') {
proxy.$modal.msgWarning('当前就诊无就诊记录,不能进行门诊划价')
return false
}
if (typeof row === 'object' && row.id == null && row.ID == null) {
proxy.$modal.msgWarning('当前就诊无就诊记录,不能进行门诊划价')
return false
}
return true
}
function assertHasDiagnosis(diagRes) {
if (!diagRes || diagRes.code !== 200) {
proxy.$modal.msgWarning(diagRes?.msg || '获取诊断失败,不能进行门诊划价')
return false
}
const raw = diagRes.data
const list = Array.isArray(raw) ? raw : []
if (list.length === 0) {
proxy.$modal.msgWarning('当前就诊无诊断记录,不能进行门诊划价')
return false
}
return true
}
// 新增医嘱 // 新增医嘱
function handleAddPrescription() { async function handleAddPrescription() {
// 验证是否已选择患者 // 验证是否已选择患者
if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) { if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) {
proxy.$modal.msgWarning('请先选择患者'); proxy.$modal.msgWarning('请先选择患者')
return; return
} }
if (!props.patientInfo.encounterId) {
proxy.$modal.msgWarning('当前就诊信息不完整,不能进行门诊划价')
return
}
if (!assertEncounterReceived(props.patientInfo)) {
return
}
try {
const emrRes = await getEmrDetail(props.patientInfo.encounterId)
if (!assertHasEmrRecord(emrRes)) {
return
}
const diagRes = await getEncounterDiagnosis(props.patientInfo.encounterId)
if (!assertHasDiagnosis(diagRes)) {
return
}
} catch (e) {
console.error(e)
proxy.$modal.msgError(e?.message || '校验失败,请稍后重试')
return
}
if (isAdding.value) { if (isAdding.value) {
proxy.$modal.msgWarning('请先保存当前医嘱'); proxy.$modal.msgWarning('请先保存当前医嘱')
return; return
} }
isAdding.value = true; isAdding.value = true
// 在数组最前方添加一行,让新增行显示在最上边 // 在数组最前方添加一行,让新增行显示在最上边
prescriptionList.value.unshift({ prescriptionList.value.unshift({
uniqueKey: nextId.value++, uniqueKey: nextId.value++,
@@ -512,10 +588,10 @@ function handleAddPrescription() {
adviceType: undefined, adviceType: undefined,
adviceType_dictText: '', adviceType_dictText: '',
categoryCode: '', categoryCode: '',
}); })
nextTick(() => { nextTick(() => {
proxy.$refs['adviceRef0'].focus(); proxy.$refs['adviceRef0'].focus()
}); })
} }
// 行双击打开编辑块,仅待发送的可编辑 // 行双击打开编辑块,仅待发送的可编辑

View File

@@ -81,8 +81,8 @@
style="width: 150px" style="width: 150px"
> >
<el-option <el-option
v-for="supplyStatus in locationIdList" v-for="supplyStatus in locationIdList"
:key="supplyStatus.value" :key="supplyStatus.id ?? supplyStatus.value"
:label="supplyStatus.name" :label="supplyStatus.name"
:value="supplyStatus.id" :value="supplyStatus.id"
/> />