待解决
This commit is contained in:
liuhongrui
2025-03-24 10:06:02 +08:00
parent a8429f8f04
commit 986c162e10
2 changed files with 23 additions and 8 deletions

View File

@@ -201,7 +201,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
if (exeCount < record.getExecuteNum()) {
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setPrescriptionNo(record.getPrescriptionNo())
.setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount, 3))
.setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount + 1, 3))
.setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue())
.setActivityId(record.getActivityId()).setPatientId(record.getPatientId())
.setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId())
@@ -219,7 +219,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
return false; // 如果批量插入失败,返回 false
}
// 批量更新执行状态
List<Long> serviceIds = checkServiceRequestIsCompleted(serviceRecords);
List<Long> serviceIds = checkServiceRequestIsCompleted();
int updateRes = batchUpdateRecordStatus(serviceIds);
// 如果更新失败,返回 false
@@ -234,23 +234,28 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
/**
* 检查该条服务申请的所有输液信息都完成
*
* @param serviceRecords 同一个服务请求的输液信息列表
* @return 更新的ID集合
*/
public List<Long> checkServiceRequestIsCompleted(Map<Long, List<OutpatientInfusionRecordDto>> serviceRecords) {
public List<Long> checkServiceRequestIsCompleted() {
//获取全部执行输液记录
List<OutpatientInfusionRecordDto> patientInfusionList =getPatientInfusionPerformRecord(null,false);
// 按 serviceId 分组
Map<Long, List<OutpatientInfusionRecordDto>> servicePatientInfusionList = patientInfusionList.stream()
.collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getServiceId));
// 存储更新的serviceId
List<Long> serviceIds = new ArrayList<>();
// 遍历每个分组
for (Map.Entry<Long, List<OutpatientInfusionRecordDto>> entry : serviceRecords.entrySet()) {
for (Map.Entry<Long, List<OutpatientInfusionRecordDto>> entry : servicePatientInfusionList.entrySet()) {
// 获取当前分组的 serviceId
Long serviceId = entry.getKey();
// 获取当前分组的记录列表
List<OutpatientInfusionRecordDto> groupRecords = entry.getValue();
// 创建一个数组来记录每个记录是否满足条件
int[] flags = new int[serviceRecords.size()];
int[] flags = new int[groupRecords.size()];
int index = 0; // 用于记录当前索引
for (OutpatientInfusionRecordDto record : groupRecords) {
@@ -260,7 +265,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
Long exeCount = outpatientManageMapper.countExecuteNumOrGroupNum(serviceId, prefixBusNo, null, true);
// 判断是否满足条件
if (exeCount.equals(record.getExecuteNum())) {
if (exeCount != null && exeCount.longValue() == record.getExecuteNum().longValue()) {
flags[index] = 1; // 如果满足条件,设置为 1
} else {
flags[index] = 0; // 如果不满足条件,设置为 0

View File

@@ -233,8 +233,15 @@
mr.status_enum AS medication_status_enum, --药品状态
mr.rate_code, --药品状态
mr.execute_num, -- 总执行次数
(select count (*) from wor_service_request wor where wor.based_on_id = sr.id) as done_num ,-- 已执行次数
mr.group_id, --注射药品组号
(SELECT COUNT(*)
FROM wor_service_request wor
WHERE wor.based_on_id = sr.id
AND CAST(md.id AS CHAR) = LEFT(split_part(wor.bus_no, '-', 3), POSITION('.' IN split_part(wor.bus_no, '-', 3)) - 1) --药品ID
-- AND CAST(mr.group_id AS CHAR) = split_part(wor.bus_no, '-', 2) -- 组号ID
AND wor.bus_no LIKE '%-%'
) AS done_num ,-- 已执行次数
mr.perform_org,--执行科室
CASE mr.skin_test_flag
WHEN 1 THEN 1
@@ -289,7 +296,10 @@
<if test="flag and paramId != null and paramId != '' and prefixBusNo != null and prefixBusNo != '' ">
AND sr.based_on_id = #{paramId}
AND sr.bus_no LIKE CONCAT(#{prefixBusNo}, '%')
AND CAST(md.id AS CHAR) = LEFT(split_part(sr.bus_no, '-', 3), POSITION('.' IN split_part(sr.bus_no, '-', 3)) - 1) --药品ID
-- AND CAST(mr.group_id AS CHAR) = split_part(sr.bus_no, '-', 2) -- 组号ID
AND sr.status_enum = 6 --服务状态是已完成
</if>
<!-- 同组内药品数量 条件筛选 -->