门诊输液记录查询
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package com.openhis.web.outpatientmanage.appservice;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 门诊管理——输液实现类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
public interface IOutpatientInfusionRecordService {
|
||||
|
||||
/**
|
||||
* 获取门诊输液记录初期数据列表
|
||||
*
|
||||
* @return 门诊输液记录初期数据列表
|
||||
*/
|
||||
OutpatientInfusionInitDto getOutpatientInfusionInit();
|
||||
|
||||
|
||||
/**
|
||||
* 获取门诊输液记录的患者列表
|
||||
*
|
||||
* @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 分页查询
|
||||
*/
|
||||
IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatient(
|
||||
OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize);
|
||||
|
||||
|
||||
/**
|
||||
* 查询单个患者门诊输液记录查询
|
||||
*
|
||||
* @param outpatientInfusionPatientDto 患者输液信息
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
List<OutpatientInfusionRecordDto> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行单个患者门诊输液
|
||||
*
|
||||
* @param exeCount 执行记录数
|
||||
* @param outpatientInfusionRecordDto 患者输液信息
|
||||
* @return 修改成功/失败
|
||||
*/
|
||||
boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto,Long exeCount);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.openhis.web.outpatientmanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.ClinicalStatus;
|
||||
import com.openhis.common.enums.EventStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam;
|
||||
import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
|
||||
/**
|
||||
* 门诊管理——输液实现类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionRecordService {
|
||||
|
||||
@Resource
|
||||
OutpatientManageMapper outpatientManageMapper;
|
||||
|
||||
@Autowired
|
||||
IServiceRequestService serviceRequestService;
|
||||
|
||||
@Autowired
|
||||
IPractitionerService practitionerService;
|
||||
|
||||
@Override
|
||||
/**
|
||||
* 获取门诊输液记录初期数据列表
|
||||
*
|
||||
* @return 门诊输液记录初期数据列表
|
||||
*/
|
||||
public OutpatientInfusionInitDto getOutpatientInfusionInit() {
|
||||
OutpatientInfusionInitDto initDto = new OutpatientInfusionInitDto();
|
||||
// 获取药品状态
|
||||
List<OutpatientInfusionInitDto.statusEnumOption> statusEnumOptions = Stream.of(EventStatus.values())
|
||||
.map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setMedicationStatus(statusEnumOptions);
|
||||
|
||||
// 获取皮试结果
|
||||
List<OutpatientInfusionInitDto.statusEnumOption> statusEnumOptions2 = Stream.of(ClinicalStatus.values())
|
||||
.map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setClinicalStatus(statusEnumOptions2);
|
||||
|
||||
// 获取当天日期
|
||||
LocalDateTime beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true);
|
||||
LocalDateTime endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false);
|
||||
// 创建查询包装器
|
||||
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.ge("occurrence_start_time", beginTime);
|
||||
queryWrapper.le("occurrence_end_time", 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.setMedicationStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
|
||||
});
|
||||
|
||||
initDto.setInfusionList(infusionList);
|
||||
|
||||
return initDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门诊输液记录的患者列表
|
||||
*
|
||||
* @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 分页查询
|
||||
*/
|
||||
@Override
|
||||
public IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatient(
|
||||
OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize) {
|
||||
|
||||
String searchKey;
|
||||
LocalDateTime beginTime;
|
||||
LocalDateTime endTime;
|
||||
if (outpatientInfusionSearchParam == null) {
|
||||
searchKey = null;
|
||||
beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true);
|
||||
endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false);
|
||||
} else {
|
||||
searchKey = outpatientInfusionSearchParam.getSearchKey();
|
||||
beginTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getBeginTime(), true);
|
||||
endTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getEndTime(), false);
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OutpatientInfusionPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("patient_busNo", "encounter_busNo", "patient_name")), null);
|
||||
// 添加时间段查询条件
|
||||
if (beginTime != null && endTime != null) {
|
||||
queryWrapper.ge("begin_time", beginTime);
|
||||
queryWrapper.le("end_time", endTime);
|
||||
}
|
||||
|
||||
IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientDto =
|
||||
outpatientManageMapper.getOutpatientInfusionPatient(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
outpatientInfusionPatientDto.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 计算年龄
|
||||
e.setAgeString(AgeCalculatorUtil.getAge(e.getBirthDate()));
|
||||
});
|
||||
|
||||
return outpatientInfusionPatientDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个患者门诊输液记录查询
|
||||
*
|
||||
* @param outpatientInfusionPatientDto 患者输液信息
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<OutpatientInfusionRecordDto>
|
||||
getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) {
|
||||
|
||||
if (outpatientInfusionPatientDto == null && outpatientInfusionPatientDto.getPatientId() != null) {
|
||||
return null;
|
||||
}
|
||||
// 创建查询包装器
|
||||
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("patient_id", outpatientInfusionPatientDto.getPatientId());
|
||||
|
||||
// 从数据库获取输液记录列表
|
||||
List<OutpatientInfusionRecordDto> infusionList =
|
||||
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
|
||||
|
||||
return infusionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行单个患者门诊输液
|
||||
*
|
||||
* @param exeCount 执行记录数
|
||||
* @param outpatientInfusionRecordDto 患者输液信息
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
@Override
|
||||
public boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto, Long exeCount) {
|
||||
// 这里执行一次就insert 表 wor_service_request里一条数据,based_on_id一直,以mr.quantity来振分
|
||||
// 点击执行一次,生成一条执行记录,确认执行+1 ,直至所有药品打完,
|
||||
|
||||
// 根据执行人ID,通过登录userId获取
|
||||
Practitioner practitioner =
|
||||
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
if (practitioner == 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())
|
||||
// 设置执行日期为当前时间
|
||||
.setOccurrenceStartTime(DateUtils.getNowDate())
|
||||
// 默认30结束
|
||||
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
|
||||
boolean result = serviceRequestService.save(serviceRequest);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.openhis.web.outpatientmanage.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
|
||||
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.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊输液记录
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outpatientmanage/infusion")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientInfusionRecordController {
|
||||
|
||||
@Autowired
|
||||
IOutpatientInfusionRecordService outpatientInfusionRecordService;
|
||||
|
||||
@Autowired
|
||||
IServiceRequestService serviceRequestService;
|
||||
|
||||
/**
|
||||
* 门诊输液记录初期数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getOutpatientInfusionInit() {
|
||||
|
||||
return R.ok(outpatientInfusionRecordService.getOutpatientInfusionInit());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门诊输液患者列表
|
||||
*
|
||||
* @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 患者输液信息
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-infusion")
|
||||
public R<?> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) {
|
||||
|
||||
return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行单个患者门诊输液
|
||||
*
|
||||
* @param outpatientInfusionRecordDto 患者输液信息
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
@PutMapping("/outpatient-record-skintest")
|
||||
public R<?>
|
||||
editPatientInfusionRecord(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
|
||||
//获取执行次数
|
||||
Long exeCount =
|
||||
serviceRequestService.countServiceRequestByBasedOnId(outpatientInfusionRecordDto.getServiceId());
|
||||
outpatientInfusionRecordService.editPatientInfusionRecord(outpatientInfusionRecordDto,exeCount);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import com.openhis.common.enums.ClinicalStatus;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentInitDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊输液初期查询
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientInfusionInitDto {
|
||||
|
||||
//发药状态
|
||||
private List<statusEnumOption> medicationStatus;
|
||||
//皮试结果
|
||||
private List<statusEnumOption> clinicalStatus;
|
||||
//当天位执行的输液记录
|
||||
private List<OutpatientInfusionRecordDto> infusionList;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 门诊输液患者显示列表
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientInfusionPatientDto {
|
||||
|
||||
/** 服务申请管理表ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long serviceId;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 就诊号 */
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 病人ID(前台显示用) */
|
||||
private String patientBusNo;
|
||||
|
||||
/** 病人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 病人姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 病人性别 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 病人生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 病人年龄 */
|
||||
private String ageString;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 门诊输液记录Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientInfusionRecordDto {
|
||||
|
||||
/** 服务申请管理表ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long serviceId;
|
||||
|
||||
/** 请求基于什么的ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long basedOnId;
|
||||
|
||||
/** 服务请求编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 请求code,输液 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long activityId;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 就诊ID(前台显示用) */
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 就诊ID */
|
||||
private Long encounterId;
|
||||
|
||||
/** 病人ID(前台显示用) */
|
||||
private String patientBusNo;
|
||||
|
||||
/** 病人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 病人姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 病人性别 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 已执行数量 */
|
||||
private Integer executionCount;
|
||||
|
||||
/** 执行护士 */
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long performerId;
|
||||
private String performerId_dictText;
|
||||
|
||||
/** 开单医生 */
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long doctorId;
|
||||
private String doctorId_dictText;
|
||||
|
||||
/** 发放科室 */
|
||||
@Dict(dictCode = "id", dictTable = "adm_organization", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgId_dictText;
|
||||
|
||||
/** 预计执行时间 */
|
||||
private String occurrenceStartTime;
|
||||
|
||||
/** 预计结束时间 */
|
||||
private String occurrenceEndTime;
|
||||
|
||||
/** 药品信息 */
|
||||
private String medicationInformation;
|
||||
|
||||
/** 药品数量 */
|
||||
private BigDecimal medicationAntity;
|
||||
|
||||
/** 用药频次 */
|
||||
private String rateCode;
|
||||
|
||||
/** 单次剂量带剂量单位 */
|
||||
private String dose;
|
||||
|
||||
/** 输液速度 */
|
||||
private Integer speed;
|
||||
|
||||
/** 药品状态 */
|
||||
private Integer medicationStatusEnum;
|
||||
private String medicationStatusEnum_enumText;
|
||||
|
||||
/** 皮试标志(是/否) */
|
||||
private String flagText;
|
||||
|
||||
/** 皮试结果 */
|
||||
private Integer clinicalStatusEnum;
|
||||
private String clinicalStatusEnum_enumText;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.openhis.web.outpatientmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 门诊输液记录查询体体条件类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/12
|
||||
*/
|
||||
@Data
|
||||
public class OutpatientInfusionSearchParam {
|
||||
|
||||
/** 病人ID/门诊号/病人姓名 */
|
||||
private String searchKey;
|
||||
|
||||
/** 筛选开始时间 */
|
||||
private String beginTime;
|
||||
|
||||
/** 筛选结束时间 */
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,16 @@ package com.openhis.web.outpatientmanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
|
||||
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
|
||||
/**
|
||||
* 门诊管理
|
||||
@@ -37,4 +42,24 @@ public interface OutpatientManageMapper {
|
||||
long countOutpatientSkinTestRecords(
|
||||
@Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam);
|
||||
|
||||
/**
|
||||
* 门诊输液患者记录分页查询
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 门诊输液患者记录
|
||||
*/
|
||||
IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatient(
|
||||
@Param("page") Page<OutpatientInfusionPatientDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionPatientDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 门诊输液记录查询
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 门诊输液记录列表
|
||||
*/
|
||||
List<OutpatientInfusionRecordDto>
|
||||
getOutpatientInfusionRecord(@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionRecordDto> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,13 +34,11 @@
|
||||
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
|
||||
LEFT JOIN adm_encounter_participant ep ON ep.encounter_id = sr.encounter_id
|
||||
<where>
|
||||
ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改
|
||||
AND mr.skin_test_flag = 1
|
||||
AND md.skin_test_flag = 1
|
||||
AND sr.status_enum in (2,3,6) --服务状态有效
|
||||
AND ep.type_code = '1' --参与者身份类型是医生
|
||||
AND sr.status_enum in (2,3,6) --服务状态有效
|
||||
|
||||
<!-- 门诊号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != ''">
|
||||
@@ -90,13 +88,11 @@
|
||||
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
|
||||
LEFT JOIN adm_encounter_participant ep ON ep.encounter_id = sr.encounter_id
|
||||
<where>
|
||||
ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改
|
||||
AND mr.skin_test_flag = 1
|
||||
AND md.skin_test_flag = 1
|
||||
AND sr.status_enum in (2,3,6) --服务状态有效
|
||||
AND ep.type_code = '1' --参与者身份类型是医生
|
||||
AND sr.status_enum in (2,3,6) --服务状态有效
|
||||
|
||||
<!-- 门诊号 查询条件-->
|
||||
<if test="OutpatientSkinTestRecordSearchParam != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != null and OutpatientSkinTestRecordSearchParam.encounterBusNo != ''">
|
||||
@@ -133,4 +129,126 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 门诊输液记录患者列表信息查询-->
|
||||
<select id="getOutpatientInfusionPatient"
|
||||
resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam">
|
||||
SELECT
|
||||
T1.service_id,
|
||||
T1.prescription_no,
|
||||
T1.encounter_busNo,
|
||||
T1.birth_date,
|
||||
T1.patient_busNo,
|
||||
T1.patient_id,
|
||||
T1.patient_name,
|
||||
T1.gender_enum,
|
||||
T1.create_time
|
||||
from
|
||||
(
|
||||
SELECT DISTINCT
|
||||
sr.id AS service_id, --服务申请管理ID
|
||||
sr.prescription_no, --处方号
|
||||
e.bus_no as encounter_busNo, --就诊号
|
||||
pt.birth_date , --病人生日
|
||||
pt.bus_no AS patient_busNo, --病人ID(前台显示用)
|
||||
sr.patient_id, --病人ID
|
||||
pt.name AS patient_name, --病人姓名
|
||||
pt.gender_enum AS gender_enum, --病人性别
|
||||
mr.create_time AS create_time --开单时间
|
||||
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
|
||||
<where>
|
||||
ad.bus_no = 'sy001' -- 输液的编号,todo:编号未定,后期修改
|
||||
AND mr.infusion_flag = 1
|
||||
AND sr.status_enum in (2,3) --服务状态未完成
|
||||
</where>
|
||||
ORDER BY
|
||||
mr.create_time,e.bus_no,pt.bus_no
|
||||
) AS T1
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 门诊输液记录初始化,默认显示今天待执行输液记录-->
|
||||
<select id="getOutpatientInfusionRecord"
|
||||
resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto">
|
||||
SELECT
|
||||
T1.service_id,
|
||||
T1.bus_no,
|
||||
T1.based_on_id,
|
||||
T1.activity_id,
|
||||
T1.prescription_no,
|
||||
T1.encounter_id,
|
||||
T1.encounter_busNo,
|
||||
T1.patient_name,
|
||||
T1.patient_busNo,
|
||||
T1.patient_id,
|
||||
T1.medication_information,
|
||||
T1.medication_antity,
|
||||
T1.medication_statusEnum,
|
||||
T1.clinical_status_enum,
|
||||
T1.flag_text,
|
||||
T1.speed,
|
||||
T1.method_code,
|
||||
T1.dose,
|
||||
T1.doctor_id,
|
||||
T1.perform_org,
|
||||
T1.performer_id,
|
||||
T1.occurrence_start_time,
|
||||
T1.occurrence_end_time,
|
||||
T1.create_time
|
||||
from
|
||||
(
|
||||
SELECT
|
||||
sr.id AS service_id, --服务申请管理ID
|
||||
sr.bus_no, --服务请求编码
|
||||
sr.based_on_id, --请求基于什么的ID
|
||||
sr.activity_id,--请求code,输液
|
||||
sr.prescription_no, --处方号
|
||||
sr.encounter_id , --就诊ID
|
||||
e.bus_no AS encounter_busNo, --就诊ID(前台显示用)
|
||||
pt.name AS patient_name, --病人姓名
|
||||
pt.bus_no AS patient_busNo, --病人ID(前台显示用)
|
||||
sr.patient_id, --病人ID
|
||||
ad.name AS medication_information, --药品信息
|
||||
mr.antity AS medication_antity,--药品数量
|
||||
mr.status_enum AS medication_statusEnum, --药品状态
|
||||
ai.clinical_status_enum, --皮试检查结果
|
||||
CASE mr.skin_test_flag--皮试标志
|
||||
WHEN 1 THEN '是'
|
||||
ELSE '否'
|
||||
END AS flag_text,
|
||||
mr.speed, --输液速度
|
||||
mr.method_code,--用法
|
||||
mr.dose || ' '|| mr.dose_unit_code AS dose,--单次剂量,剂量单位
|
||||
mr.practitioner_id as doctor_id, --开单医生
|
||||
mr.org_id,--开单科室
|
||||
sr.performer_id, --执行护士
|
||||
to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_start_time, --预计执行时间
|
||||
to_char(sr.occurrence_end_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_end_time, --预计结束时间
|
||||
mr.create_time --开单时间
|
||||
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
|
||||
AND sr.status_enum in (2,3) --服务状态未完成
|
||||
|
||||
</where>
|
||||
ORDER BY
|
||||
mr.create_time,e.bus_no,pt.bus_no
|
||||
) AS T1
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -12,4 +12,13 @@ import com.openhis.workflow.domain.ServiceRequest;
|
||||
*/
|
||||
public interface IServiceRequestService extends IService<ServiceRequest> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询服务申请管理中basedOnId相同的个数
|
||||
*
|
||||
* @param basedOnId 请求基于什么的ID
|
||||
* @return basedOnId相同的个数
|
||||
*/
|
||||
Long countServiceRequestByBasedOnId(Long basedOnId) ;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.openhis.workflow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -17,4 +19,19 @@ import com.openhis.workflow.service.IServiceRequestService;
|
||||
public class ServiceRequestServiceImpl extends ServiceImpl<ServiceRequestMapper, ServiceRequest>
|
||||
implements IServiceRequestService {
|
||||
|
||||
@Autowired
|
||||
private ServiceRequestMapper serviceRequestMapper;
|
||||
|
||||
/**
|
||||
* 查询服务申请管理中basedOnId相同的个数
|
||||
*
|
||||
* @param basedOnId 请求基于什么的ID
|
||||
* @return basedOnId相同的个数
|
||||
*/
|
||||
@Override
|
||||
public Long countServiceRequestByBasedOnId(Long basedOnId) {
|
||||
QueryWrapper<ServiceRequest> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("based_on_id", basedOnId);
|
||||
return serviceRequestMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user