门诊输液 更新

This commit is contained in:
liuhongrui
2025-03-19 19:45:05 +08:00
parent a445ad299c
commit 3d09f06d1d
8 changed files with 163 additions and 209 deletions

View File

@@ -5,7 +5,8 @@ import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
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 javax.servlet.http.HttpServletRequest;
/** /**
* 门诊管理——输液实现类 * 门诊管理——输液实现类
@@ -18,13 +19,13 @@ public interface IOutpatientInfusionRecordService {
/** /**
* 获取门诊输液记录的患者列表 * 获取门诊输液记录的患者列表
* *
* @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数 * @param searchKey 模糊查询关键字
* @param pageNo 当前页 * @param pageNo 当前页
* @param pageSize 每页多少条 * @param pageSize 每页多少条
* @return 分页查询 * @return 分页查询
*/ */
IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatientList( IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatientList(
OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize); String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
/** /**
* 点击患者,查询该患者的输液记录 * 点击患者,查询该患者的输液记录
@@ -33,7 +34,7 @@ public interface IOutpatientInfusionRecordService {
* @return 当前患者门诊输液待执行列表 * @return 当前患者门诊输液待执行列表
*/ */
List<OutpatientInfusionRecordDto> List<OutpatientInfusionRecordDto>
getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto); getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto, HttpServletRequest request);
/** /**
* 执行患者门诊输液 * 执行患者门诊输液
@@ -54,11 +55,9 @@ public interface IOutpatientInfusionRecordService {
/** /**
* 门诊输液执行历史记录查询 * 门诊输液执行历史记录查询
* *
* @param beginTime 开始时间
* @param endTime 结束时间
* @param historyFlag 查询的是否为执行履历 * @param historyFlag 查询的是否为执行履历
* @return 门诊输液记录列表 * @return 门诊输液记录列表
*/ */
List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag); List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(HttpServletRequest request,boolean historyFlag);
} }

View File

@@ -1,16 +1,15 @@
package com.openhis.web.outpatientmanage.appservice.impl; package com.openhis.web.outpatientmanage.appservice.impl;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -33,7 +32,6 @@ import com.openhis.common.utils.HisQueryUtils;
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.web.outpatientmanage.mapper.OutpatientManageMapper; import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper;
import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.mapper.ServiceRequestMapper; import com.openhis.workflow.mapper.ServiceRequestMapper;
@@ -67,49 +65,20 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
/** /**
* 获取门诊输液记录的患者列表 * 获取门诊输液记录的患者列表
* *
* @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数 * @param searchKey 模糊查询关键字
* @param pageNo 当前页 * @param pageNo 当前页
* @param pageSize 每页多少条 * @param pageSize 每页多少条
* @return 分页查询 * @return 分页查询
*/ */
@Override @Override
public IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatientList( public IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatientList(String searchKey, Integer pageNo,
OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize) { Integer pageSize, HttpServletRequest request) {
LocalDateTime beginTime;
LocalDateTime endTime;
String searchKey;
// 搜索key为空
if (outpatientInfusionSearchParam == null) {
searchKey = null;
} else {
searchKey = outpatientInfusionSearchParam.getSearchKey();
}
// 任意开始结束时间为空,默认查询当天日期记录
if (outpatientInfusionSearchParam.getBeginTime() == null
|| outpatientInfusionSearchParam.getEndTime() == null) {
beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true);
endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false);
} else {// 时间不空,删选时间
beginTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getBeginTime(), true);
endTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getEndTime(), false);
}
// 构建查询条件 // 构建查询条件
QueryWrapper<OutpatientInfusionPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey, QueryWrapper<OutpatientInfusionPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientBusNo, new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientBusNo,
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)), CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)),
null); request);
// based_on_id 是为空的
queryWrapper.eq(CommonConstants.FieldName.basedOnId, null);
// 状态是未完成的
queryWrapper.in(CommonConstants.FieldName.requestStatus, EventStatus.IN_PROGRESS.getValue(),
EventStatus.NOT_DONE.getValue());
// 添加时间段查询条件
if (beginTime != null && endTime != null) {
queryWrapper.ge(CommonConstants.FieldName.createTime, beginTime);
queryWrapper.le(CommonConstants.FieldName.createTime, endTime);
}
IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientDto = IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientDto =
outpatientManageMapper.getOutpatientInfusionPatient(new Page<>(pageNo, pageSize), queryWrapper); outpatientManageMapper.getOutpatientInfusionPatient(new Page<>(pageNo, pageSize), queryWrapper);
@@ -131,25 +100,29 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
* @return 当前患者门诊输液待执行列表 * @return 当前患者门诊输液待执行列表
*/ */
@Override @Override
public List<OutpatientInfusionRecordDto> public List<OutpatientInfusionRecordDto> getPatientInfusionRecord(
getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) { OutpatientInfusionPatientDto outpatientInfusionPatientDto, HttpServletRequest request) {
if (outpatientInfusionPatientDto == null && outpatientInfusionPatientDto.getPatientId() != null) { if (outpatientInfusionPatientDto == null && outpatientInfusionPatientDto.getPatientId() != null) {
return null; return null;
} }
// 创建查询包装器
LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OutpatientInfusionRecordDto::getPatientId, outpatientInfusionPatientDto.getPatientId());
// based_on_id 是为空的
queryWrapper.eq(OutpatientInfusionRecordDto::getBasedOnId, null);
// 状态是未完成的
queryWrapper.in(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue(),
EventStatus.NOT_DONE.getValue());
// 从数据库获取输液记录列表
List<OutpatientInfusionRecordDto> infusionList =
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
return infusionList; // 构建查询条件
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(null, null, null, request);
queryWrapper.eq(CommonConstants.FieldName.PatientId, outpatientInfusionPatientDto.getPatientId());
// based_on_id 是为空的
queryWrapper.eq(CommonConstants.FieldName.BasedOnId, null);
// 状态是未完成的
queryWrapper.in(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue(),
EventStatus.NOT_DONE.getValue());
// 默认显示100条
IPage<OutpatientInfusionRecordDto> OutpatientInfusionRecordPage =
outpatientManageMapper.getOutpatientInfusionRecord(new Page<>(1, 100), queryWrapper);
return OutpatientInfusionRecordPage.getRecords();
} }
/** /**
@@ -178,8 +151,9 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
List<OutpatientInfusionRecordDto> groupRecords = entry.getValue(); List<OutpatientInfusionRecordDto> groupRecords = entry.getValue();
// 获取组内药品个数 // 获取组内药品个数
Long groupCount = outpatientManageMapper.countMedicationExecuteNum(groupRecords.get(0).getServiceId(), null, Long groupCount = outpatientManageMapper.countExecuteNumOrGroupNum(groupRecords.get(0).getServiceId(), null,
groupRecords.get(0).getGroupId(), false); groupRecords.get(0).getGroupId(), false);
// 检查组内药品是否全部选中 // 检查组内药品是否全部选中
if (groupCount != groupRecords.size()) { if (groupCount != groupRecords.size()) {
return false; return false;
@@ -191,7 +165,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId();
// 获取执行次数 // 获取执行次数
Long exeCount = Long exeCount =
outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); outpatientManageMapper.countExecuteNumOrGroupNum(record.getServiceId(), prefixBusNo, null, true);
if (exeCount < record.getExecuteNum()) { if (exeCount < record.getExecuteNum()) {
ServiceRequest serviceRequest = new ServiceRequest(); ServiceRequest serviceRequest = new ServiceRequest();
@@ -216,7 +190,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId();
// 获取执行次数 // 获取执行次数
Long exeCount = Long exeCount =
outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); outpatientManageMapper.countExecuteNumOrGroupNum(record.getServiceId(), prefixBusNo, null, true);
// 执行完毕后,更新执行服务请求表的状态 // 执行完毕后,更新执行服务请求表的状态
if (exeCount.equals(record.getExecuteNum())) { if (exeCount.equals(record.getExecuteNum())) {
@@ -267,49 +241,36 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
/** /**
* 显示门诊输液执行记录查询 * 显示门诊输液执行记录查询
* *
* @param beginTime 开始时间
* @param endTime 结束时间
* @param historyFlag 查询的是否为执行履历 * @param historyFlag 查询的是否为执行履历
* @return 门诊输液执行记录查询 * @return 门诊输液执行记录查询
*/ */
@Override @Override
public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(String beginTime, String endTime, public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(HttpServletRequest request,
boolean historyFlag) { boolean historyFlag) {
LocalDateTime beginDateTime; // 构建查询条件
LocalDateTime endDateTime; QueryWrapper<OutpatientInfusionRecordDto> queryWrapper =
// 筛选时间不传,默认当天记录 HisQueryUtils.buildQueryWrapper(null, null, null, request);
if (beginTime == null || endTime == null) {
beginDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true);
endDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false);
} else {
beginDateTime = DateUtils.startDayOrEndDay(beginTime, true);
endDateTime = DateUtils.startDayOrEndDay(endTime, false);
}
// 创建查询包装器
LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new LambdaQueryWrapper<>();
// 执行历史查询的条件 // 执行历史查询的条件
if (historyFlag) { if (historyFlag) {
// based_on_id 不为空,此条件筛选出执行履历 // based_on_id 不为空,此条件筛选出执行履历
queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId); queryWrapper.isNotNull(CommonConstants.FieldName.BasedOnId);
// 状态是已完成 // 状态是已完成
queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.COMPLETED.getValue()); queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.COMPLETED.getValue());
// 门诊输液待执行记录查询 // 门诊输液待执行记录查询
} else { } else {
// based_on_id 为空,此条件筛选控制不显示执行履历 // based_on_id 为空,此条件筛选控制不显示执行履历
queryWrapper.isNull(OutpatientInfusionRecordDto::getBasedOnId); queryWrapper.isNull(CommonConstants.FieldName.BasedOnId);
// 状态是进行中 // 状态是进行中
queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue()); queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue());
} }
// 时间筛选
queryWrapper.ge(OutpatientInfusionRecordDto::getCreateTime, beginDateTime);
queryWrapper.le(OutpatientInfusionRecordDto::getCreateTime, endDateTime);
// 从数据库获取输液记录列表 // 默认显示100条
List<OutpatientInfusionRecordDto> infusionPerformList = IPage<OutpatientInfusionRecordDto> OutpatientInfusionRecordPage =
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); outpatientManageMapper.getOutpatientInfusionRecord(new Page<>(1, 100), queryWrapper);
List<OutpatientInfusionRecordDto> infusionPerformList = OutpatientInfusionRecordPage.getRecords();
// 遍历列表并处理每个记录 // 遍历列表并处理每个记录
infusionPerformList.forEach(e -> { infusionPerformList.forEach(e -> {

View File

@@ -2,6 +2,8 @@ package com.openhis.web.outpatientmanage.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -12,7 +14,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 lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -35,16 +36,18 @@ public class OutpatientInfusionRecordController {
/** /**
* 查询门诊输液的患者列表 * 查询门诊输液的患者列表
* *
* @param outpatientInfusionSearchParam 查询参数 * @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 返回门诊输液的患者列表 * @return 返回门诊输液的患者列表
*/ */
@GetMapping(value = "/infusion-patient-list") @GetMapping(value = "/infusion-patient-list")
public R<?> getOutpatientInfusionPatientList(OutpatientInfusionSearchParam outpatientInfusionSearchParam, public R<?> getOutpatientInfusionPatientList(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return R.ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(outpatientInfusionSearchParam, return R
pageNo, pageSize)); .ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(searchKey, pageNo, pageSize, request));
} }
/** /**
@@ -54,9 +57,10 @@ public class OutpatientInfusionRecordController {
* @return 当前患者门诊输液待执行列表 * @return 当前患者门诊输液待执行列表
*/ */
@GetMapping(value = "/patient-infusion-record") @GetMapping(value = "/patient-infusion-record")
public R<?> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) { public R<?> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto,
HttpServletRequest request) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto)); return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto, request));
} }
/** /**
@@ -94,29 +98,23 @@ public class OutpatientInfusionRecordController {
/** /**
* 门诊输液待执行记录查询 * 门诊输液待执行记录查询
* *
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 门诊输液待执行记录列表 * @return 门诊输液待执行记录列表
*/ */
@GetMapping(value = "/infusion-wait-perform-record") @GetMapping(value = "/infusion-wait-perform-record")
public R<?> getPatientInfusionRecords(@RequestParam(required = false) String beginTime, public R<?> getPatientInfusionRecords(HttpServletRequest request) {
@RequestParam(required = false) String endTime) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, false)); return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(request, false));
} }
/** /**
* 门诊输液执行历史记录查询 * 门诊输液执行历史记录查询
* *
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 门诊输液执行历史记录列表 * @return 门诊输液执行历史记录列表
*/ */
@GetMapping(value = "/infusion-perform-record") @GetMapping(value = "/infusion-perform-record")
public R<?> getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime, public R<?> getPatientInfusionPerformRecord(HttpServletRequest request) {
@RequestParam(required = false) String endTime) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, true)); return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(request, true));
} }
} }

View File

@@ -50,4 +50,7 @@ public class OutpatientInfusionPatientDto {
/** 病人年龄 */ /** 病人年龄 */
private String ageString; private String ageString;
/** 开单时间 */
private Date createTime;
} }

View File

@@ -1,24 +0,0 @@
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;
}

View File

@@ -1,7 +1,9 @@
package com.openhis.web.outpatientmanage.mapper; package com.openhis.web.outpatientmanage.mapper;
import java.util.Date;
import java.util.List; import java.util.List;
import com.openhis.workflow.domain.ServiceRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -57,11 +59,13 @@ public interface OutpatientManageMapper {
/** /**
* 门诊输液记录查询 * 门诊输液记录查询
* *
* @param page 分页参数默认100条记录
* @param queryWrapper 查询条件 * @param queryWrapper 查询条件
* @return 门诊输液记录列表 * @return 门诊输液记录列表
*/ */
List<OutpatientInfusionRecordDto> getOutpatientInfusionRecord( IPage<OutpatientInfusionRecordDto> getOutpatientInfusionRecord(
@Param(Constants.WRAPPER) LambdaQueryWrapper<OutpatientInfusionRecordDto> queryWrapper); @Param("page") Page<OutpatientInfusionRecordDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionRecordDto> queryWrapper);
/** /**
* 查询药品已执行数量/查询同组内药品数量 * 查询药品已执行数量/查询同组内药品数量
@@ -72,7 +76,7 @@ public interface OutpatientManageMapper {
* @param flag 控制查询条件 * @param flag 控制查询条件
* @return 查询个数 * @return 查询个数
*/ */
long countMedicationExecuteNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo, long countExecuteNumOrGroupNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo,
@Param("groupId") Long groupId, @Param("flag") boolean flag); @Param("groupId") Long groupId, @Param("flag") boolean flag);
} }

View File

@@ -133,32 +133,34 @@
<select id="getOutpatientInfusionPatient" <select id="getOutpatientInfusionPatient"
resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto"> resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto">
SELECT SELECT
T1.service_id, T1.tenant_id,
T1.prescription_no, T1.service_id,
T1.encounter_busNo, T1.prescription_no,
T1.birth_date, T1.encounter_bus_no,
T1.patient_busNo, T1.birth_date,
T1.patient_id, T1.patient_bus_no,
T1.patient_name, T1.patient_id,
T1.id_card, T1.patient_name,
T1.gender_enum, T1.id_card,
T1.create_time T1.gender_enum,
from T1.create_time
FROM
( (
SELECT DISTINCT SELECT DISTINCT
sr.id AS service_id, --服务申请管理ID sr.id AS service_id, --服务申请管理ID
sr.prescription_no, --处方号 sr.prescription_no, --处方号
sr.tenant_id, sr.encounter_id,
e.bus_no as encounter_busNo, --就诊号 e.bus_no as encounter_bus_no, --就诊号
pt.birth_date , --病人生日 pt.birth_date , --病人生日
pt.bus_no AS patient_busNo, --病人ID前台显示用 pt.bus_no AS patient_bus_no, --病人ID前台显示用
sr.patient_id, --病人ID sr.patient_id, --病人ID
pt.name AS patient_name, --病人姓名 pt.name AS patient_name, --病人姓名
pt.name AS id_card, --病人身份证号 pt.id_card AS id_card, --病人身份证号
pt.gender_enum AS gender_enum, --病人性别 sr.tenant_id,
mr.create_time AS create_time --开单时间 pt.gender_enum AS gender_enum, --病人性别
mr.create_time AS create_time --开单时间
FROM FROM
wor_service_request sr wor_service_request sr
LEFT JOIN adm_encounter e ON e.id = sr.encounter_id LEFT JOIN adm_encounter e ON e.id = sr.encounter_id
LEFT JOIN adm_patient pt ON pt.id = sr.patient_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 wor_activity_definition ad ON ad.id = sr.activity_id
@@ -167,6 +169,7 @@
ad.bus_no = 'sy001' -- 输液的编号todo编号未定后期修改 ad.bus_no = 'sy001' -- 输液的编号todo编号未定后期修改
AND mr.infusion_flag = 1 AND mr.infusion_flag = 1
AND sr.status_enum in (2,3) --服务状态未完成 AND sr.status_enum in (2,3) --服务状态未完成
AND sr.based_on_id = null
</where> </where>
ORDER BY ORDER BY
mr.create_time,e.bus_no,pt.bus_no mr.create_time,e.bus_no,pt.bus_no
@@ -205,64 +208,70 @@
T1.occurrence_start_time, T1.occurrence_start_time,
T1.occurrence_end_time, T1.occurrence_end_time,
T1.create_time T1.create_time
from FROM
( (
SELECT SELECT
sr.id AS service_id, --服务申请管理ID sr.tenant_id,
sr.bus_no, -- 服务请求编码 sr.id AS service_id, --服务申请管理ID
sr.based_on_id, -- 请求基于什么的ID sr.bus_no, -- 服务请求编码
sr.execute_num, -- 执行次数 sr.based_on_id, -- 请求基于什么的ID
sr.activity_id,--请求code,输液 sr.execute_num, -- 执行次数
sr.prescription_no, --处方号 sr.activity_id,--请求code,输液
sr.encounter_id , --就诊ID sr.prescription_no, --处方号
sr.tenant_id, sr.encounter_id , --就诊ID
sr.status_enum AS request_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前台显示用
sr.patient_id, --病人ID sr.patient_id, --病人ID
md.id AS medication_id, --药品ID md.id AS medication_id, --药品ID
md.name AS medication_information, --药品信息 md.name AS medication_information, --药品信息
mr.antity AS medication_antity,--药品数量 mr.antity AS medication_antity,--药品数量
mr.status_enum AS medication_status_Enum, --药品状态 mr.status_enum AS medication_status_Enum, --药品状态
mr.group_id, --注射药品组号 mr.group_id, --注射药品组号
CASE mr.skin_test_flag CASE mr.skin_test_flag
WHEN 1 THEN 1 WHEN 1 THEN 1
ELSE 0 ELSE 0
END AS skin_test_flag --皮试标志 END AS skin_test_flag ,--皮试标志
ai.clinical_status_enum, --皮试检查结果 ai.clinical_status_enum, --皮试检查结果
mr.speed, --输液速度 mr.speed, --输液速度
mr.method_code,--用法 mr.method_code,--用法
mr.dose || ' '|| mr.dose_unit_code AS dose,--单次剂量,剂量单位 mr.dose || ' '|| mr.dose_unit_code AS dose,--单次剂量,剂量单位
mr.practitioner_id as doctor_id, --开单医生 mr.practitioner_id as doctor_id, --开单医生
mr.org_id,--开单科室 mr.org_id,--开单科室
sr.performer_id, --执行护士 sr.performer_id, --执行护士
to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_start_time, --预计执行时间 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, --预计结束时间 to_char(sr.occurrence_end_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_end_time, --预计结束时间
mr.create_time --开单时间 mr.create_time --开单时间
FROM FROM
wor_service_request sr wor_service_request sr
LEFT JOIN adm_encounter e ON e.id = sr.encounter_id LEFT JOIN adm_encounter e ON e.id = sr.encounter_id
LEFT JOIN adm_patient pt ON pt.id = sr.patient_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 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_request mr ON mr.prescription_no = sr.prescription_no
LEFT JOIN med_medication m ON m.id = mr.medication_id 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 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
</where> <!-- 时间筛选 -->
ORDER BY <if test="beginTime != null and endTime != null">
mr.create_time desc,e.bus_no,pt.bus_no AND mr.create_time BETWEEN TO_TIMESTAMP(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS')
AND TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
</if>
</where>
ORDER BY
mr.create_time desc,e.bus_no,pt.bus_no
) AS T1 ) AS T1
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<!-- 查询药品已执行数量/查询同组内药品数量 --> <!-- 查询药品已执行数量/查询同组内药品数量 -->
<select id="countMedicationExecuteNum" resultType="long"> <select id="countExecuteNumOrGroupNum" resultType="long">
SELECT COUNT(*) SELECT COUNT(*)
FROM FROM
@@ -281,7 +290,7 @@
<!-- 药品已执行数量 条件筛选 --> <!-- 药品已执行数量 条件筛选 -->
<if test="flag and paramId != null and paramId != '' and prefixBusNo != null and prefixBusNo != '' "> <if test="flag and paramId != null and paramId != '' and prefixBusNo != null and prefixBusNo != '' ">
AND sr.base_on_id = #{paramId} AND sr.based_on_id = #{paramId}
AND sr.bus_no LIKE CONCAT(#{prefixBusNo}, '%') AND sr.bus_no LIKE CONCAT(#{prefixBusNo}, '%')
AND sr.status_enum = 6 --服务状态是已完成 AND sr.status_enum = 6 --服务状态是已完成
</if> </if>
@@ -292,7 +301,6 @@
AND mr.group_id = #{groupId} AND mr.group_id = #{groupId}
AND sr.status_enum = 2 --服务状态是进行中 AND sr.status_enum = 2 --服务状态是进行中
</if> </if>
</where> </where>
</select> </select>

View File

@@ -113,11 +113,16 @@ public class CommonConstants {
*/ */
String PatientBusNo = "patient_bus_no"; String PatientBusNo = "patient_bus_no";
/**
* 患者ID
*/
String PatientId = "patient_id";
/** /**
* 就诊号 * 就诊号
*/ */
String EncounterBusNo = "encounter_bus_no"; String EncounterBusNo = "encounter_bus_no";
/** /**
* 身份证号 * 身份证号
*/ */
@@ -141,17 +146,17 @@ public class CommonConstants {
/** /**
* 请求状态 * 请求状态
*/ */
String requestStatus = "request_status"; String RequestStatus = "request_status";
/** /**
* 创建时间 * 创建时间
*/ */
String createTime = "create_time"; String CreateTime = "create_time";
/** /**
* 请求基于什么的ID * 请求基于什么的ID
*/ */
String basedOnId = "based_on_id"; String BasedOnId = "based_on_id";
} }
/** /**