门诊输液记录 更新

This commit is contained in:
liuhongrui
2025-03-18 20:11:39 +08:00
parent 134b228b80
commit 1bf7841fdd
8 changed files with 194 additions and 259 deletions

View File

@@ -3,8 +3,6 @@ package com.openhis.web.outpatientmanage.appservice;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.domain.PractitionerRole;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
@@ -45,15 +43,6 @@ public interface IOutpatientInfusionRecordService {
List<OutpatientInfusionRecordDto> List<OutpatientInfusionRecordDto>
getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto); getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto);
/**
* 执行单个患者门诊输液
*
* @param exeCount 执行记录数
* @param outpatientInfusionRecordDto 患者输液信息
* @return 修改成功/失败
*/
boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto, Long exeCount);
/** /**
* 执行单个患者门诊输液 * 执行单个患者门诊输液
* *
@@ -71,12 +60,13 @@ public interface IOutpatientInfusionRecordService {
boolean editPatientInfusionTime(OutpatientInfusionRecordDto outpatientInfusionRecordDto); boolean editPatientInfusionTime(OutpatientInfusionRecordDto outpatientInfusionRecordDto);
/** /**
* 显示门诊输液执行记录查询 * 门诊输液执行历史记录查询
* *
* @param beginTime 开始时间 * @param beginTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param historyFlag 查询的是否为执行履历
* @return 门诊输液记录列表 * @return 门诊输液记录列表
*/ */
List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime); List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag);
} }

View File

@@ -1,11 +1,7 @@
package com.openhis.web.outpatientmanage.appservice.impl; package com.openhis.web.outpatientmanage.appservice.impl;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -80,39 +76,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
OutpatientInfusionInitDto initDto = new OutpatientInfusionInitDto(); OutpatientInfusionInitDto initDto = new OutpatientInfusionInitDto();
// 获取皮试结果 // 获取皮试结果
List<OutpatientInfusionInitDto.statusEnumOption> statusEnumOptions2 = Stream.of(ClinicalStatus.values()) List<OutpatientInfusionInitDto.statusEnumOption> statusEnumOptions = Stream.of(ClinicalStatus.values())
.map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo())) .map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList()); .collect(Collectors.toList());
initDto.setClinicalStatus(statusEnumOptions2); initDto.setClinicalStatus(statusEnumOptions);
// 获取当天日期
LocalDateTime beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true);
LocalDateTime endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false);
// 创建查询包装器
LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ge(OutpatientInfusionRecordDto::getOccurrenceStartTime, beginTime);
queryWrapper.le(OutpatientInfusionRecordDto::getOccurrenceEndTime, endTime);
// 从数据库获取输液记录列表
List<OutpatientInfusionRecordDto> infusionList =
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
// 遍历列表并处理每个记录
infusionList.forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 药品状态
e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum()));
// 皮试标志
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
// 只有皮试药品才显示皮试结果
if (e.getSkinTestFlag() == Whether.YES.getValue()) {
// 皮试结果
e.setMedicationStatusEnum_enumText(
EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
}
});
initDto.setInfusionList(infusionList);
return initDto; return initDto;
} }
@@ -154,13 +121,14 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)), CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)),
null); null);
// based_on_id 是为空的 // based_on_id 是为空的
queryWrapper.eq("based_on_id", null); queryWrapper.eq(CommonConstants.FieldName.basedOnId, null);
// 状态是未完成的 // 状态是未完成的
queryWrapper.in("service_status", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue()); queryWrapper.in(CommonConstants.FieldName.requestStatus, EventStatus.IN_PROGRESS.getValue(),
EventStatus.NOT_DONE.getValue());
// 添加时间段查询条件 // 添加时间段查询条件
if (beginTime != null && endTime != null) { if (beginTime != null && endTime != null) {
queryWrapper.ge("create_time", beginTime); queryWrapper.ge(CommonConstants.FieldName.createTime, beginTime);
queryWrapper.le("create_time", endTime); queryWrapper.le(CommonConstants.FieldName.createTime, endTime);
} }
IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientDto = IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientDto =
@@ -177,10 +145,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
} }
/** /**
* 查询单个患者门诊输液记录查询 * 查询单个患者门诊输液待执行记录
* *
* @param outpatientInfusionPatientDto 患者输液信息 * @param outpatientInfusionPatientDto 患者输液信息
* @return 门诊输液记录列表 * @return 患者待输液记录列表
*/ */
@Override @Override
public List<OutpatientInfusionRecordDto> public List<OutpatientInfusionRecordDto>
@@ -195,7 +163,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
// based_on_id 是为空的 // based_on_id 是为空的
queryWrapper.eq(OutpatientInfusionRecordDto::getBasedOnId, null); queryWrapper.eq(OutpatientInfusionRecordDto::getBasedOnId, null);
// 状态是未完成的 // 状态是未完成的
queryWrapper.in(OutpatientInfusionRecordDto::getServiceStatus, EventStatus.IN_PROGRESS.getValue(), queryWrapper.in(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue(),
EventStatus.NOT_DONE.getValue()); EventStatus.NOT_DONE.getValue());
// 从数据库获取输液记录列表 // 从数据库获取输液记录列表
List<OutpatientInfusionRecordDto> infusionList = List<OutpatientInfusionRecordDto> infusionList =
@@ -204,91 +172,18 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
return infusionList; return infusionList;
} }
/**
* 执行单个患者门诊输液
*
* @param exeCount 执行记录数
* @param outpatientInfusionRecordDto 患者输液信息
* @return 门诊输液记录列表
*/
@Override
public boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto, Long exeCount) {
// 根据执行人ID通过登录userId获取
Practitioner practitioner =
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
// 以执行人ID获取执行人的身份类别
PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId());
if (practitioner == null || practitionerRole == null) {
return false;
}
String busNo = AssignSeqUtil.formatString(outpatientInfusionRecordDto.getBusNo(), exeCount, 3);
// 当输液未被全部执行时,可以修改继续执行,生成一条执行记录
if ((BigDecimal.valueOf(exeCount)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) < 0) {
// 当 exeCount 小于 medicationAntity 时,执行这里的代码
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setPrescriptionNo(outpatientInfusionRecordDto.getPrescriptionNo())
// 设置busNo原来的服务请求编码为基础.执行次数
.setBusNo(busNo)
// 基于service_request的id
.setBasedOnId(outpatientInfusionRecordDto.getServiceId())
// 设置状态完成
.setStatusEnum(EventStatus.COMPLETED.getValue())
// 设置请求code 和原来一致
.setActivityId(outpatientInfusionRecordDto.getActivityId())
// 患者id
.setPatientId(outpatientInfusionRecordDto.getPatientId())
// 就诊id
.setEncounterId(outpatientInfusionRecordDto.getEncounterId())
// 执行人id通过登录userId获取
.setPerformerId(practitioner.getId())
// 设置执行人身份类别
.setPerformerTypeCode(practitionerRole.getRoleCode())
// 设置执行日期为当前时间
.setOccurrenceStartTime(DateUtils.getNowDate())
// 默认执行时间加30min结束
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
boolean result = serviceRequestService.save(serviceRequest);
if (!result) {
return false;
}
// 判断如果是执行该患者最后一次记录,更新原来的服请求状态
if ((BigDecimal.valueOf(exeCount + 1)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) == 0) {
// 以id为主条件更新服务申请管理表
LambdaUpdateWrapper<ServiceRequest> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(ServiceRequest::getId, outpatientInfusionRecordDto.getServiceId())
.set(ServiceRequest::getStatusEnum, EventStatus.COMPLETED.getValue())
.set(ServiceRequest::getPerformerTypeCode, practitionerRole.getRoleCode())
.set(ServiceRequest::getPerformerId, practitioner.getId())
.set(ServiceRequest::getOccurrenceStartTime, DateUtils.getNowDate())
.set(ServiceRequest::getOccurrenceEndTime, DateUtils.getNowDate());
int countUpdate = serviceRequestMapper.update(null, updateWrapper);
if (countUpdate < 0) {
return false;
}
}
return true;
}
return false;
}
/** /**
* 执行患者门诊输液 * 执行患者门诊输液
* *
* @param outpatientInfusionRecordDtoList 输液记录 * @param outpatientInfusionRecordDtoList 输液记录列表
* @return 修改成功/失败 * @return 执行成功/失败
*/ */
@Override @Override
public boolean batchEditPatientInfusionRecord(List<OutpatientInfusionRecordDto> outpatientInfusionRecordDtoList) { public boolean batchEditPatientInfusionRecord(List<OutpatientInfusionRecordDto> outpatientInfusionRecordDtoList) {
// 根据执行人ID通过登录userId获取 // 根据执行人ID通过登录userId获取
Practitioner practitioner = Practitioner practitioner =
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
// 根执行人ID获取执行人身份类型 // 根执行人ID获取执行人身份类型
PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId()); PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId());
if (practitioner == null || practitionerRole == null) { if (practitioner == null || practitionerRole == null) {
return false; return false;
@@ -300,60 +195,58 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
// 遍历每个分组 // 遍历每个分组
for (Map.Entry<Long, List<OutpatientInfusionRecordDto>> entry : groupedRecords.entrySet()) { for (Map.Entry<Long, List<OutpatientInfusionRecordDto>> entry : groupedRecords.entrySet()) {
// Long groupId = entry.getKey();
List<OutpatientInfusionRecordDto> groupRecords = entry.getValue(); List<OutpatientInfusionRecordDto> groupRecords = entry.getValue();
// 获取执行次 // 获取组内药品个
Long exeCount = serviceRequestService.countServiceRequestByBasedOnId(groupRecords.get(0).getBasedOnId()); Long groupCount = outpatientManageMapper.countMedicationExecuteNum(groupRecords.get(0).getServiceId(), null,
groupRecords.get(0).getGroupId(), false);
// 检查组内药品是否全部选中
if (groupCount != groupRecords.size()) {
return false;
}
// 批量处理每个分组中的记录 // 构造批量插入的 ServiceRequest 列表
List<ServiceRequest> serviceRequests = new ArrayList<>();
for (OutpatientInfusionRecordDto record : groupRecords) { for (OutpatientInfusionRecordDto record : groupRecords) {
boolean result = editSingleRecord(record, exeCount, practitioner, practitionerRole); String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId();
if (!result) { // 获取执行次数
return false; // 如果某个记录执行失败,返回 false Long exeCount =
} outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true);
}
if (exeCount < record.getExecuteNum()) {
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setPrescriptionNo(record.getPrescriptionNo())
.setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount, 3))
.setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue())
.setActivityId(record.getActivityId()).setPatientId(record.getPatientId())
.setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId())
.setPerformerTypeCode(practitionerRole.getRoleCode())
.setOccurrenceStartTime(DateUtils.getNowDate())
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
serviceRequests.add(serviceRequest);
}
}
// 使用 MyBatis-Plus 的 saveBatch 方法批量插入
if (!serviceRequestService.saveBatch(serviceRequests)) {
return false; // 如果批量插入失败,返回 false
}
// 更新分组中每个记录的状态 // 更新分组中每个记录的状态
for (OutpatientInfusionRecordDto record : groupRecords) { for (OutpatientInfusionRecordDto record : groupRecords) {
String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId();
// 获取执行次数
Long exeCount =
outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true);
if (!updateRecordStatus(record.getServiceId(), practitioner, practitionerRole)) { // 执行完毕后,更新执行服务请求表的状态
if (exeCount.equals(record.getExecuteNum())) {
if (!updateRecordStatus(record.getServiceId())) {
return false; // 如果更新状态失败,返回 false return false; // 如果更新状态失败,返回 false
} }
} }
} }
return true; // 所有分组都执行成功
} }
// 所有分组都执行成功
/**
* 处理单个记录的执行逻辑
*
* @param record 输液记录
* @param practitioner 执行人
* @param practitionerRole 执行人身份类型
* @return 执行成功/失败
*/
public boolean editSingleRecord(OutpatientInfusionRecordDto record, Long exeCount, Practitioner practitioner,
PractitionerRole practitionerRole) {
String busNo = AssignSeqUtil.formatString(record.getBusNo(), exeCount, 3);
if ((BigDecimal.valueOf(exeCount)).compareTo(record.getMedicationAntity()) < 0) {
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setPrescriptionNo(record.getPrescriptionNo()).setBusNo(busNo)
.setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue())
.setActivityId(record.getActivityId()).setPatientId(record.getPatientId())
.setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId())
.setPerformerTypeCode(practitionerRole.getRoleCode()).setOccurrenceStartTime(DateUtils.getNowDate())
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
boolean result = serviceRequestService.save(serviceRequest);
if (!result) {
return false;
}
}
return true; return true;
} }
@@ -361,18 +254,12 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
* 更新执行状态 * 更新执行状态
* *
* @param serviceId 服务请求ID * @param serviceId 服务请求ID
* @param practitioner 执行人
* @param practitionerRole 执行人身份类型
* @return 修改成功/失败 * @return 修改成功/失败
*/ */
public boolean updateRecordStatus(Long serviceId, Practitioner practitioner, PractitionerRole practitionerRole) { public boolean updateRecordStatus(Long serviceId) {
LambdaUpdateWrapper<ServiceRequest> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<ServiceRequest> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(ServiceRequest::getId, serviceId) updateWrapper.eq(ServiceRequest::getId, serviceId).set(ServiceRequest::getStatusEnum,
.set(ServiceRequest::getStatusEnum, EventStatus.COMPLETED.getValue()) EventStatus.COMPLETED.getValue());
.set(ServiceRequest::getPerformerTypeCode, practitionerRole.getRoleCode())
.set(ServiceRequest::getPerformerId, practitioner.getId())
.set(ServiceRequest::getOccurrenceStartTime, DateUtils.getNowDate())
.set(ServiceRequest::getOccurrenceEndTime, DateUtils.getNowDate());
int countUpdate = serviceRequestMapper.update(null, updateWrapper); int countUpdate = serviceRequestMapper.update(null, updateWrapper);
return countUpdate > 0; return countUpdate > 0;
@@ -402,10 +289,11 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
* *
* @param beginTime 开始时间 * @param beginTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param historyFlag 查询的是否为执行履历
* @return 门诊输液执行记录查询 * @return 门诊输液执行记录查询
*/ */
@Override @Override
public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime) { public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag) {
LocalDateTime beginDateTime; LocalDateTime beginDateTime;
LocalDateTime endDateTime; LocalDateTime endDateTime;
@@ -420,10 +308,20 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
// 创建查询包装器 // 创建查询包装器
LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new LambdaQueryWrapper<>();
// based_on_id 不为空 //执行历史查询的条件
if(historyFlag){
// based_on_id 不为空,此条件筛选出执行履历
queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId); queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId);
// 状态是已完成 // 状态是已完成
queryWrapper.eq(OutpatientInfusionRecordDto::getServiceStatus, EventStatus.COMPLETED.getValue()); queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.COMPLETED.getValue());
//门诊输液待执行记录查询
}else{
// based_on_id 为空,此条件筛选控制不显示执行履历
queryWrapper.isNull(OutpatientInfusionRecordDto::getBasedOnId);
// 状态是进行中
queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue());
}
// 时间筛选 // 时间筛选
queryWrapper.ge(OutpatientInfusionRecordDto::getCreateTime, beginDateTime); queryWrapper.ge(OutpatientInfusionRecordDto::getCreateTime, beginDateTime);
queryWrapper.le(OutpatientInfusionRecordDto::getCreateTime, endDateTime); queryWrapper.le(OutpatientInfusionRecordDto::getCreateTime, endDateTime);
@@ -432,6 +330,22 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
List<OutpatientInfusionRecordDto> infusionPerformList = List<OutpatientInfusionRecordDto> infusionPerformList =
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
// 遍历列表并处理每个记录
infusionPerformList.forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 药品状态
e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum()));
// 皮试标志
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
// 只有皮试药品才显示皮试结果
if (e.getSkinTestFlag() == Whether.YES.getValue()) {
// 皮试结果
e.setMedicationStatusEnum_enumText(
EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
}
});
return infusionPerformList; return infusionPerformList;
} }

View File

@@ -12,8 +12,6 @@ import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService; import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam;
import com.openhis.workflow.service.IServiceRequestService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -33,9 +31,6 @@ public class OutpatientInfusionRecordController {
@Autowired @Autowired
IOutpatientInfusionRecordService outpatientInfusionRecordService; IOutpatientInfusionRecordService outpatientInfusionRecordService;
@Autowired
IServiceRequestService serviceRequestService;
/** /**
* 门诊输液记录初期数据 * 门诊输液记录初期数据
* *
@@ -48,24 +43,7 @@ public class OutpatientInfusionRecordController {
} }
/** /**
* 查询门诊输液患者列表 * 查询单个患者的门诊输液记录
*
* @param outpatientInfusionSearchParam 查询参数
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 就诊患者信息
*/
@GetMapping(value = "/patients")
public R<?> getOutpatientInfusionPatient(OutpatientInfusionSearchParam outpatientInfusionSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return R.ok(outpatientInfusionRecordService.getOutpatientInfusionPatient(outpatientInfusionSearchParam, pageNo,
pageSize));
}
/**
* 查询单个患者门诊输液记录查询
* *
* @param outpatientInfusionPatientDto 患者输液信息 * @param outpatientInfusionPatientDto 患者输液信息
* @return 门诊输液记录列表 * @return 门诊输液记录列表
@@ -76,25 +54,6 @@ public class OutpatientInfusionRecordController {
return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto)); return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto));
} }
// /**
// * 执行单个患者门诊输液
// *
// * @param outpatientInfusionRecordDto 患者输液信息
// * @return 门诊输液记录列表
// */
// @PutMapping("/infusion-perform")
// public R<?>
// editPatientInfusionRecord(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
// // 获取执行次数
// Long exeCount =
// serviceRequestService.countServiceRequestByBasedOnId(outpatientInfusionRecordDto.getServiceId());
// boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(outpatientInfusionRecordDto, exeCount);
// if (!res) {
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
// }
// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
// }
/** /**
* 批量执行患者门诊输液 * 批量执行患者门诊输液
* *
@@ -104,14 +63,11 @@ public class OutpatientInfusionRecordController {
@PutMapping("/infusion-perform/batch") @PutMapping("/infusion-perform/batch")
public R<?> batchEditPatientInfusionRecord( public R<?> batchEditPatientInfusionRecord(
@Validated @RequestBody List<OutpatientInfusionRecordDto> outpatientInfusionRecordDtoList) { @Validated @RequestBody List<OutpatientInfusionRecordDto> outpatientInfusionRecordDtoList) {
// 获取执行次数
for (OutpatientInfusionRecordDto dto : outpatientInfusionRecordDtoList) { if (!outpatientInfusionRecordService.batchEditPatientInfusionRecord(outpatientInfusionRecordDtoList)) {
Long exeCount = serviceRequestService.countServiceRequestByBasedOnId(dto.getServiceId());
boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(dto, exeCount);
if (!res) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} }
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"})); return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
} }
@@ -131,17 +87,31 @@ public class OutpatientInfusionRecordController {
} }
/** /**
* 显示门诊输液执行记录查询 * 门诊输液执行记录查询
* *
* @param beginTime 开始时间 * @param beginTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @return 门诊输液记录列表 * @return 门诊输液待执行记录列表
*/ */
@GetMapping(value = "/infusion-perform-Record") @GetMapping(value = "/infusion-wait-perform-record")
public R<?> getPatientInfusionRecords(@RequestParam(required = false) String beginTime,
@RequestParam(required = false) String endTime) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, false));
}
/**
* 门诊输液执行历史记录查询
*
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 门诊输液执行历史记录列表
*/
@GetMapping(value = "/infusion-perform-record")
public R<?> getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime, public R<?> getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime,
@RequestParam(required = false) String endTime) { @RequestParam(required = false) String endTime) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime,endTime)); return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, true));
} }
} }

View File

@@ -19,8 +19,6 @@ public class OutpatientInfusionInitDto {
//皮试结果 //皮试结果
private List<statusEnumOption> clinicalStatus; private List<statusEnumOption> clinicalStatus;
//当天位执行的输液记录
private List<OutpatientInfusionRecordDto> infusionList;
/** /**
* 状态 * 状态

View File

@@ -1,15 +1,15 @@
package com.openhis.web.outpatientmanage.dto; package com.openhis.web.outpatientmanage.dto;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict; import com.openhis.common.annotation.Dict;
import com.sun.jna.platform.win32.OaIdl;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* 门诊输液记录Dto * 门诊输液记录Dto
* *
@@ -25,7 +25,7 @@ public class OutpatientInfusionRecordDto {
private Long serviceId; private Long serviceId;
/** 服务申请状态 */ /** 服务申请状态 */
private Integer serviceStatus; private Integer requestStatus;
/** 请求基于什么的ID */ /** 请求基于什么的ID */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@@ -61,7 +61,7 @@ public class OutpatientInfusionRecordDto {
private Integer genderEnum; private Integer genderEnum;
private String genderEnum_enumText; private String genderEnum_enumText;
/** 已执行数量 */ /** 住院执行次数 */
private Integer executeNum; private Integer executeNum;
/** 分组id */ /** 分组id */

View File

@@ -63,4 +63,16 @@ public interface OutpatientManageMapper {
List<OutpatientInfusionRecordDto> getOutpatientInfusionRecord( List<OutpatientInfusionRecordDto> getOutpatientInfusionRecord(
@Param(Constants.WRAPPER) LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper); @Param(Constants.WRAPPER) LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper);
/**
* 查询药品已执行数量/查询同组内药品数量
*
* @param paramId baseOnId/服务请求ID
* @param prefixBusNo 服务请求编码
* @param groupId 分组ID
* @param flag 控制查询条件
* @return 查询个数
*/
long countMedicationExecuteNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo,
@Param("groupId") Long groupId, @Param("flag") boolean flag);
} }

View File

@@ -179,7 +179,7 @@
resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto"> resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto">
SELECT SELECT
T1.service_id, T1.service_id,
T1.service_status, T1.request_status,
T1.bus_no, T1.bus_no,
T1.execute_num, T1.execute_num,
T1.based_on_id, T1.based_on_id,
@@ -216,7 +216,7 @@
sr.prescription_no, --处方号 sr.prescription_no, --处方号
sr.encounter_id , --就诊ID sr.encounter_id , --就诊ID
sr.tenant_id, sr.tenant_id,
sr.status_enum AS service_status, --服务状态 sr.status_enum AS request_status, --服务请求状态
e.bus_no AS encounter_busNo, --就诊ID前台显示用 e.bus_no AS encounter_busNo, --就诊ID前台显示用
pt.name AS patient_name, --病人姓名 pt.name AS patient_name, --病人姓名
pt.bus_no AS patient_busNo, --病人ID前台显示用 pt.bus_no AS patient_busNo, --病人ID前台显示用
@@ -250,7 +250,7 @@
LEFT JOIN med_medication_definition md ON md.id = m.medication_def_id LEFT JOIN med_medication_definition md ON md.id = m.medication_def_id
LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id
<where> <where>
ad.bus_no = 'sy001' -- 皮试检查的编号todo编号未定后期修改 ad.bus_no = 'sy001' -- 输液检查的编号todo编号未定后期修改
AND mr.infusion_flag = 1 AND mr.infusion_flag = 1
AND md.infusion_flag = 1 AND md.infusion_flag = 1
@@ -261,4 +261,40 @@
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<!-- 查询药品已执行数量/查询同组内药品数量 -->
<select id="countMedicationExecuteNum" resultType="long">
SELECT COUNT(*)
FROM
wor_service_request sr
LEFT JOIN adm_encounter e ON e.id = sr.encounter_id
LEFT JOIN adm_patient pt ON pt.id = sr.patient_id
LEFT JOIN wor_activity_definition ad ON ad.id = sr.activity_id
LEFT JOIN med_medication_request mr ON mr.prescription_no = sr.prescription_no
LEFT JOIN med_medication m ON m.id = mr.medication_id
LEFT JOIN med_medication_definition md ON md.id = m.medication_def_id
LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id
<where>
ad.bus_no = 'sy001' -- 输液检查的编号todo编号未定后期修改
AND mr.infusion_flag = 1
AND md.infusion_flag = 1
<!-- 药品已执行数量 条件筛选 -->
<if test="flag and paramId != null and paramId != '' and prefixBusNo != null and prefixBusNo != '' ">
AND sr.base_on_id = #{paramId}
AND sr.bus_no LIKE CONCAT(#{prefixBusNo}, '%')
AND sr.status_enum = 6 --服务状态是已完成
</if>
<!-- 同组内药品数量 条件筛选 -->
<if test="!flag and paramId != null and paramId != '' and groupId != null and groupId != ''">
AND sr.id = #{paramId}
AND mr.group_id = #{groupId}
AND sr.status_enum = 2 --服务状态是进行中
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -112,6 +112,21 @@ public class CommonConstants {
* 患者姓名 * 患者姓名
*/ */
String PatientName = "patient_name"; String PatientName = "patient_name";
/**
* 请求状态
*/
String requestStatus = "request_status";
/**
* 创建时间
*/
String createTime = "create_time";
/**
* 请求基于什么的ID
*/
String basedOnId = "based_on_id";
} }
/** /**