版本更新

This commit is contained in:
Zhang.WH
2025-09-03 15:54:41 +08:00
parent 0b93d16b64
commit 8f82322d10
3290 changed files with 154339 additions and 23829 deletions

View File

@@ -0,0 +1,82 @@
package com.openhis.web.outpatientmanage.appservice;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
/**
* 门诊管理——输液实现类
*
* @author liuhr
* @date 2025/3/12
*/
public interface IOutpatientInfusionAppService {
/**
* 获取门诊输液记录的患者列表
*
* @param outpatientInfusionPatientDto 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 分页查询
*/
R<?> getOutpatientInfusionPatientList(OutpatientInfusionPatientDto outpatientInfusionPatientDto, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 门诊输液执行历史记录查询
*
* @param serviceReqId 诊疗项目id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液执行历史记录列表
*/
R<?> getInfusionPerformRecord(Long serviceReqId, Integer pageNo, Integer pageSize);
/**
* 门诊输液待执行记录查询
*
* @param encounterId 就诊ID
* @param serviceStatus 就诊状态
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液待执行记录列表
*/
R<?> getInfusionPendingRecord(Long encounterId, Integer serviceStatus, Integer pageNo, Integer pageSize);
/**
* 输液执行
*
* @param serviceReqIdList 输液请求id列表
* @return 执行结果
*/
R<?> infusionPerform(List<Long> serviceReqIdList);
/**
* 修改输液执行时间
*
* @param serviceReqId 患者输液信息
* @param performTime 患者输液信息
* @return 执行结果
*/
R<?> editPatientInfusionTime(Long serviceReqId, String performTime);
/**
* 撤销执行
*
* @param serviceReqId 输液请求id
* @return 撤销结果
*/
R<?> cancelInfusionPerform(Long serviceReqId);
/**
* 门诊输液初始化
*
* @return 初始化信息
*/
R<?> init();
}

View File

@@ -0,0 +1,54 @@
package com.openhis.web.outpatientmanage.appservice;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestInitDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
/**
* 门诊管理 应用实现类
*
* @author liuhr
* @date 2025/3/7
*/
public interface IOutpatientSkinTestRecordService {
/**
* 获取门诊皮试记录初期数据列表
*
* @return 获取门诊皮试记录初期数据列表
*/
OutpatientSkinTestInitDto getOutpatientSkinTestInit();
/**
* 分页查询门诊皮试记录,可选条件
*
* @param outpatientSkinTestRecordSearchParam 查询条件
* @param searchKey 查询条件-模糊查询
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
* @return 获取门诊皮试记录列表
*/
IPage<OutpatientSkinTestRecordDto> getSkinTestRecords(
OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, String searchKey,Integer pageNo, Integer pageSize,
HttpServletRequest request);
/**
* 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新)
*
* @param outpatientSkinTestRecordDto 皮试记录信息
* @return 更新结果
*/
boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
/**
* 护士核对皮试结果后,确认签名(服务申请管理与过敏与不耐受的相关字段更新)
*
* @param outpatientSkinTestRecordDto 皮试记录信息
* @return 更新结果
*/
boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto);
}

View File

@@ -0,0 +1,74 @@
package com.openhis.web.outpatientmanage.appservice;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.common.dto.PerformInfoDto;
/**
* 门诊处置
*
* @author yuxj
* @date 2025/4/10
*/
public interface IOutpatientTreatmentAppService {
/**
* 获取门诊处置初期数据列表
*
* @return 获取门诊处置初期数据列表
*/
R<?> init();
/**
* 分页查询就诊病人列表
*
* @param outpatientTreatmentEncounterDto 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 就诊病人分页列表
*/
R<?> getEncounterInfoListPage(OutpatientTreatmentEncounterDto outpatientTreatmentEncounterDto, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request);
/**
* 处置单查询
*
* @param outpatientTreatmentInfoDto 处置信息
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 处置单
*/
R<?> getOutpatientTreatmentInfo(OutpatientTreatmentInfoDto outpatientTreatmentInfoDto, Integer pageNo,
Integer pageSize);
/**
* 诊疗执行记录查询
*
* @param reqId 请求项目id
* @return 执行记录列表
*/
R<?> getPerformRecord(Long reqId);
/**
* 诊疗执行
*
* @param performInfoList 执行信息列表
* @return 执行结果
*/
R<?> perform(List<PerformInfoDto> performInfoList);
/**
* 取消执行
*
* @param performInfoList 执行信息列表
* @return 取消结果
*/
R<?> cancelPerform(List<PerformInfoDto> performInfoList);
}

View File

@@ -0,0 +1,277 @@
package com.openhis.web.outpatientmanage.appservice.impl;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionAppService;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientStationInitDto;
import com.openhis.web.outpatientmanage.mapper.OutpatientInfusionAppMapper;
import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.mapper.ServiceRequestMapper;
import com.openhis.workflow.service.IServiceRequestService;
/**
* 门诊管理——输液实现类
*
* @author liuhr
* @date 2025/3/12
*/
@Service
@Transactional
public class OutpatientInfusionAppServiceImpl implements IOutpatientInfusionAppService {
@Resource
private OutpatientInfusionAppMapper outpatientInfusionAppMapper;
@Autowired
private IServiceRequestService serviceRequestService;
@Autowired
private ServiceRequestMapper serviceRequestMapper;
@Autowired
private AssignSeqUtil assignSeqUtil;
/**
* 门诊输液初始化
*
* @return 初始化信息
*/
@Override
public R<?> init() {
OutpatientStationInitDto initDto = new OutpatientStationInitDto();
// 执行状态
List<OutpatientStationInitDto.ServiceStatus> serviceStatusOptions = new ArrayList<>();
serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.getInfo()));
// serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.IN_PROGRESS.getValue(),
// RequestStatus.IN_PROGRESS.getInfo()));
serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.CANCELLED.getValue(),
RequestStatus.CANCELLED.getInfo()));
initDto.setServiceStatusOptions(serviceStatusOptions);
return R.ok(initDto);
}
/**
* 获取门诊输液记录的患者列表
*
* @param outpatientInfusionPatientDto 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 分页查询
*/
@Override
public R<?> getOutpatientInfusionPatientList(OutpatientInfusionPatientDto outpatientInfusionPatientDto,
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<OutpatientInfusionPatientDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientInfusionPatientDto, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientBusNo,
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
// 查询输液患者列表
IPage<OutpatientInfusionPatientDto> outpatientInfusionPatientPage =
outpatientInfusionAppMapper.getOutpatientInfusionPatient(new Page<>(pageNo, pageSize), queryWrapper,
RequestStatus.ACTIVE.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.getValue(),
CommonConstants.TableName.MED_MEDICATION_REQUEST);
outpatientInfusionPatientPage.getRecords().forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 性别
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
if (e.getBirthDate() != null) {
// 计算年龄
e.setAgeString(AgeCalculatorUtil.getAge(e.getBirthDate()));
}
});
return R.ok(outpatientInfusionPatientPage);
}
/**
* 门诊输液执行记录查询
*
* @param serviceReqId 诊疗项目id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液执行历史记录列表
*/
@Override
public R<?> getInfusionPerformRecord(Long serviceReqId, Integer pageNo, Integer pageSize) {
// 构建查询条件
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(null, null, null, null);
// 查询门诊输液执行记录
Page<OutpatientInfusionRecordDto> outpatientInfusionRecordPage =
outpatientInfusionAppMapper.selectInfusionPerformRecord(new Page<>(pageNo, pageSize), queryWrapper,
serviceReqId, RequestStatus.COMPLETED.getValue());
outpatientInfusionRecordPage.getRecords().forEach(e -> {
// 诊疗状态
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
});
return R.ok(outpatientInfusionRecordPage);
}
/**
* 门诊输液待执行记录查询
*
* @param encounterId 就诊ID
* @param serviceStatus 就诊状态
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液待执行记录列表
*/
@Override
public R<?> getInfusionPendingRecord(Long encounterId, Integer serviceStatus, Integer pageNo, Integer pageSize) {
// 构建查询条件
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = HisQueryUtils
.buildQueryWrapper(new OutpatientInfusionRecordDto().setServiceStatus(serviceStatus), null, null, null);
// 查询门诊输液待执行记录
Page<OutpatientInfusionRecordDto> outpatientInfusionRecordPage =
outpatientInfusionAppMapper.selectInfusionPendingRecord(new Page<>(pageNo, pageSize), queryWrapper,
encounterId, RequestStatus.COMPLETED.getValue(), CommonConstants.TableName.MED_MEDICATION_REQUEST);
outpatientInfusionRecordPage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
// 发药状态
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
// 诊疗状态
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
});
return R.ok(outpatientInfusionRecordPage);
}
/**
* 输液执行
*
* @param serviceReqIdList 输液请求id列表
* @return 执行结果
*/
@Override
public R<?> infusionPerform(List<Long> serviceReqIdList) {
// todo:查出对应的耗材并发放
// 获取执行人,执行科室,当前时间
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
Long orgId = SecurityUtils.getLoginUser().getOrgId();
Date now = DateUtils.getNowDate();
List<ServiceRequest> serviceRequestList =
serviceRequestService.listByIds(serviceReqIdList.stream().distinct().collect(Collectors.toList()));
// 新增一条执行记录
for (ServiceRequest serviceRequest : serviceRequestList) {
serviceRequest.setBasedOnId(serviceRequest.getId()).setStatusEnum(RequestStatus.COMPLETED.getValue())
.setOccurrenceEndTime(now)
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4))
.setBasedOnTable(CommonConstants.TableName.WOR_SERVICE_REQUEST).setPerformerId(practitionerId)
.setOrgId(orgId).setGroupId(null).setId(null);
serviceRequestService.save(serviceRequest);
}
// 获取诊疗执行信息
List<OutpatientInfusionRecordDto> outpatientInfusionRecordList =
outpatientInfusionAppMapper.selectPerformInfo(serviceReqIdList, RequestStatus.COMPLETED.getValue());
if (!outpatientInfusionRecordList.isEmpty()) {
for (OutpatientInfusionRecordDto outpatientInfusionRecord : outpatientInfusionRecordList) {
// 校验是否已发药
if (!DispenseStatus.COMPLETED.getValue().equals(outpatientInfusionRecord.getDispenseStatus())) {
throw new ServiceException("请等待发药后再执行");
}
// 校验是否已经执行
if (outpatientInfusionRecord.getExecuteNum().equals(outpatientInfusionRecord.getPerformCount())) {
// 更新主诊疗执行状态
serviceRequestMapper.update(null,
new LambdaUpdateWrapper<ServiceRequest>()
.eq(ServiceRequest::getId, outpatientInfusionRecord.getServiceId())
.set(ServiceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue())
.set(ServiceRequest::getOccurrenceEndTime, now));
} else if (outpatientInfusionRecord.getExecuteNum() < (outpatientInfusionRecord.getPerformCount())) {
throw new ServiceException("当前项目已全部执行,请勿重复执行");
}
}
}
return R.ok("执行成功");
}
/**
* 修改输液执行时间
*
* @param serviceReqId 患者输液信息
* @param performTime 患者输液信息
* @return 执行结果
*/
@Override
public R<?> editPatientInfusionTime(Long serviceReqId, String performTime) {
// 更新输液执行时间
int countUpdate = serviceRequestMapper.update(null,
new LambdaUpdateWrapper<ServiceRequest>().eq(ServiceRequest::getId, serviceReqId)
.set(ServiceRequest::getOccurrenceEndTime, DateUtils.dateTime("yyyy-MM-dd HH:mm:ss", performTime)));
if (countUpdate >= 0) {
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"执行时间"}));
}
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 撤销执行
*
* @param serviceReqId 输液请求id
* @return 撤销结果
*/
@Override
public R<?> cancelInfusionPerform(Long serviceReqId) {
// todo:查出对应的耗材并退回到药房
// 获取执行人,执行科室,当前时间
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
Long orgId = SecurityUtils.getLoginUser().getOrgId();
Date now = DateUtils.getNowDate();
// 获取诊疗项目信息
ServiceRequest serviceRequest = serviceRequestService.getById(serviceReqId);
if (serviceRequest != null) {
// 重复取消校验
if (RequestStatus.CANCELLED.getValue().equals(serviceRequest.getStatusEnum())) {
return R.fail("已取消执行,请勿重复操作");
}
boolean result = serviceRequestService.updateCancelledStatus(serviceReqId, now, practitionerId, orgId);
// 更新主服务请求状态为待执行
serviceRequestService.updateDraftStatus(List.of(serviceRequest.getBasedOnId()), null, null);
if (result) {
// 判断是否全部取消执行
boolean exists = serviceRequestMapper.exists(new LambdaQueryWrapper<ServiceRequest>()
.eq(ServiceRequest::getBasedOnId, serviceRequest.getBasedOnId())
.eq(ServiceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue()));
if (!exists) {
// 全部取消执行后更新主服务请求状态为已取消
serviceRequestService.updateCancelledStatus(serviceRequest.getBasedOnId(), null, null, null);
}
}
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
}
return R.ok("取消执行成功");
}
}

View File

@@ -0,0 +1,301 @@
package com.openhis.web.outpatientmanage.appservice.impl;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.openhis.common.enums.DispenseStatus;
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.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.utils.DateUtils;
import com.core.common.utils.SecurityUtils;
import com.core.common.utils.StringUtils;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.mapper.PractitionerMapper;
import com.openhis.administration.mapper.PractitionerRoleMapper;
import com.openhis.administration.service.IPractitionerRoleService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.clinical.domain.AllergyIntolerance;
import com.openhis.clinical.mapper.AllergyIntoleranceMapper;
import com.openhis.clinical.service.IAllergyIntoleranceService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.ClinicalStatus;
import com.openhis.common.enums.RequestStatus;
import com.openhis.common.enums.VerificationStatus;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestInitDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
import com.openhis.web.outpatientmanage.mapper.OutpatientInfusionAppMapper;
import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.mapper.ServiceRequestMapper;
import com.openhis.workflow.service.IServiceRequestService;
/**
* 门诊管理 应用实现类
*
* @author liuhr
* @date 2025/3/7
*/
@Service
public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestRecordService {
@Resource
OutpatientInfusionAppMapper outpatientInfusionAppMapper;
@Autowired
ServiceRequestMapper serviceRequestMapper;
@Autowired
PractitionerMapper practitionerMapper;
@Autowired
PractitionerRoleMapper practitionerRoleMapper;
@Autowired
IAllergyIntoleranceService allergyIntoleranceService;
@Autowired
IPractitionerRoleService practitionerRoleService;
@Autowired
IPractitionerService practitionerService;
@Autowired
AllergyIntoleranceMapper allergyIntoleranceMapper;
@Autowired
IServiceRequestService serviceRequestService;
/**
* 获取门诊皮试记录初期数据列表
*
* @return 获取门诊皮试记录初期数据列表
*/
@Override
public OutpatientSkinTestInitDto getOutpatientSkinTestInit() {
OutpatientSkinTestInitDto initDto = new OutpatientSkinTestInitDto();
// 获取皮试状态
List<OutpatientSkinTestInitDto.statusEnumOption> statusEnumOptions1 = Stream.of(VerificationStatus.values())
.map(status -> new OutpatientSkinTestInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setVerificationStatus(statusEnumOptions1);
// 获取皮试结果
List<OutpatientSkinTestInitDto.statusEnumOption> statusEnumOptions2 = Stream.of(ClinicalStatus.values())
.map(status -> new OutpatientSkinTestInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setClinicalStatus(statusEnumOptions2);
return initDto;
}
/**
* 分页查询门诊皮试记录,可选条件
*
* @param outpatientSkinTestRecordSearchParam 查询条件
* @param searchKey 查询条件-模糊查询
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
*/
@Override
public IPage<OutpatientSkinTestRecordDto> getSkinTestRecords(
OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<OutpatientSkinTestRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientSkinTestRecordSearchParam, searchKey, new HashSet<>(
Arrays.asList(CommonConstants.FieldName.PrescriptionNo,
CommonConstants.FieldName.PatientBusNo, CommonConstants.FieldName.EncounterBusNo)), request);
IPage<OutpatientSkinTestRecordDto> outpatientSkinTestRecordPage =
outpatientInfusionAppMapper.getSkinTestRecords(new Page<>(pageNo, pageSize), queryWrapper);
outpatientSkinTestRecordPage.getRecords().forEach(e -> {
// 皮试结果状态枚举类回显赋值
e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
// 皮试检查项目状态枚举类回显赋值
e.setVerificationStatusEnum_enumText(
EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum()));
// 药品状态状态枚举类回显赋值
e.setMedicationStatusEnum_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, e.getMedicationStatusEnum()));
});
return outpatientSkinTestRecordPage;
}
/**
* 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新)
*
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
@Override
public boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
// 判断核对人是否不为空,药品状态不是已发药
if (outpatientSkinTestRecordDto.getPerformerCheckId() != null
|| outpatientSkinTestRecordDto.getMedicationStatusEnum() != DispenseStatus.COMPLETED.getValue()) {
// 签名后不能修改,未发药不能修改
return false;
}
// 更新服务申请管理表
ServiceRequest serviceRequest = new ServiceRequest();
// 更新的条件
serviceRequest.setId(outpatientSkinTestRecordDto.getId());
// 判断开始时间为空,不允许更新表
if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceStartTime())) {
return false;
}
Date endTime;
// 判断结束时间为空以开始时间基础加10分钟
if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceEndTime())) {
// 结束时间为空开始时间加10min设置
endTime =
DateUtils.addDateMinute(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceStartTime()), 10);
} else {
endTime = DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime());
}
// 设置开始时间
serviceRequest
.setOccurrenceStartTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceStartTime()));
// 设置结束时间
serviceRequest.setOccurrenceEndTime(endTime);
// // 获取系统登录的userId找到practitionerId
// Practitioner practitioner =
// practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
// if (practitioner == null) {
// return false;
// }
// 获取当前登录账号的参与者id
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 设置执行人ID
serviceRequest.setPerformerId(practitionerId);
// 以执行人ID获取执行人的身份类别
// PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitionerId);
// if (practitionerRole != null) {
// // 设置执行人身份类别
// serviceRequest.setPerformerTypeCode(practitionerRole.getRoleCode());
// }
// 以id为主条件更新服务申请管理表
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", serviceRequest.getId()).set("performer_type_code", serviceRequest.getPerformerTypeCode())
.set("performer_id", serviceRequest.getPerformerId())
.set("occurrence_start_time", serviceRequest.getOccurrenceStartTime())
.set("occurrence_end_time", serviceRequest.getOccurrenceEndTime());
int countUpdate = serviceRequestMapper.update(null, updateWrapper);
// 过敏与不耐受表更新
AllergyIntolerance allergyIntolerance = new AllergyIntolerance();
if (outpatientSkinTestRecordDto.getClinicalStatusEnum() != null) {
// 设置临床状态(皮试结果)
allergyIntolerance.setClinicalStatusEnum(outpatientSkinTestRecordDto.getClinicalStatusEnum());
}
allergyIntolerance
// 设置服务申请ID
.setRequestId(outpatientSkinTestRecordDto.getId())
// 设置验证状态(皮试检查的状态)
.setVerificationStatusEnum(outpatientSkinTestRecordDto.getVerificationStatusEnum())
// 设置患者id
.setPatientId(outpatientSkinTestRecordDto.getPatientId())
// 设置记录者id
.setPractitionerId(practitionerId)
// 设置记录日期(当下日期)
.setRecordedDate(DateUtils.getNowDate())
// 设置备注
.setNote(outpatientSkinTestRecordDto.getNote());
// 以服务申请ID为主条件更新过敏与不耐受表
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
updateWrapperAI.eq("request_id", allergyIntolerance.getRequestId());
boolean result = allergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI);
// 更新或插入失败
if (!result || countUpdate <= 0) {
return false;
}
return true;
}
@Override
public boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
// 过敏与不耐受表更新
QueryWrapper<AllergyIntolerance> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("request_id", outpatientSkinTestRecordDto.getId());
AllergyIntolerance allergyIntolerance = allergyIntoleranceMapper.selectOne(queryWrapper);
// 检查的状态是确定和反驳的时候,不更新
if (allergyIntolerance == null
|| (allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.CONFIRMED.getValue()
&& allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.REFUTED.getValue())) {
return false;
}
// 更新服务申请管理表的
ServiceRequest serviceRequest = new ServiceRequest();
// 获取系统登录的userId找到practitionerId
Practitioner practitioner =
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
// 找不到找到practitionerId时不更新
if (practitioner == null) {
return false;
}
// 设置核对人ID
serviceRequest.setPerformerCheckId(practitioner.getId());
// 把服务请求的状态设置为已完成
serviceRequest.setStatusEnum(RequestStatus.COMPLETED.getValue());
// 以id为主条件更新服务申请管理表
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", outpatientSkinTestRecordDto.getId())
.set("performer_check_id", serviceRequest.getPerformerCheckId())
.set("status_enum", serviceRequest.getStatusEnum());
boolean resultUpdateRequestService = serviceRequestService.update(null, updateWrapper);
// 设置断言人
allergyIntolerance.setCheckPractitionerId(practitioner.getId());
// 当皮试结果是为阳性的时候,设置过敏时间
if (allergyIntolerance.getClinicalStatusEnum() == ClinicalStatus.ACTIVE.getValue()) {
// 设置过敏时间(皮实结束时间)
allergyIntolerance
.setOnsetDateTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime()));
}
// 以服务申请ID为主条件更新服务申请管理表
UpdateWrapper<AllergyIntolerance> updateWrapperAI = new UpdateWrapper<>();
updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId())
.set("check_practitioner_id", allergyIntolerance.getCheckPractitionerId())
.set("onset_date_time", allergyIntolerance.getOnsetDateTime());
boolean resultUpdateAllergyIntolerance = allergyIntoleranceService.update(null, updateWrapperAI);
if (resultUpdateRequestService && resultUpdateAllergyIntolerance) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,591 @@
package com.openhis.web.outpatientmanage.appservice.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.openhis.clinical.domain.Procedure;
import com.openhis.clinical.service.IProcedureService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.medication.domain.MedicationRequest;
import com.openhis.medication.service.IMedicationRequestService;
import com.openhis.web.common.dto.PerformInfoDto;
import com.openhis.web.common.dto.PerformRecordDto;
import com.openhis.web.outpatientmanage.appservice.IOutpatientTreatmentAppService;
import com.openhis.web.outpatientmanage.dto.OutpatientStationInitDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.outpatientmanage.mapper.OutpatientTreatmentAppMapper;
import com.openhis.web.pharmacymanage.appservice.impl.IReturnMedicineAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.IWesternMedicineDispenseAppServiceImpl;
import com.openhis.web.pharmacymanage.dto.InventoryDto;
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
import com.openhis.workflow.domain.DeviceDispense;
import com.openhis.workflow.domain.DeviceRequest;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IInventoryItemService;
import com.openhis.workflow.service.IServiceRequestService;
import cn.hutool.core.lang.Pair;
/**
* 门诊处置
*
* @author yuxj
* @date 2025/4/10
*/
@Service
public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAppService {
@Resource
private OutpatientTreatmentAppMapper outpatientTreatmentAppMapper;
@Resource
private IServiceRequestService serviceRequestService;
@Resource
private IMedicationRequestService medicationRequestService;
@Resource
private IDeviceDispenseService deviceDispenseService;
@Resource
private IDeviceRequestService deviceRequestService;
@Resource
private IInventoryItemService inventoryItemService;
@Resource
private IProcedureService procedureService;
@Resource
private ReturnMedicineMapper returnMedicineMapper;
@Resource
private IWesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
@Resource
private IReturnMedicineAppServiceImpl returnedMedicineAppServiceImpl;
@Resource
private AssignSeqUtil assignSeqUtil;
/**
* 获取门诊处置初期数据列表
*
* @return 获取门诊处置初期数据列表
*/
@Override
public R<?> init() {
OutpatientStationInitDto initDto = new OutpatientStationInitDto();
// 执行状态
List<OutpatientStationInitDto.ServiceStatus> serviceStatusOptions = new ArrayList<>();
// serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.COMPLETED.getValue(),
// RequestStatus.COMPLETED.getInfo()));
// serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.IN_PROGRESS.getValue(),
// RequestStatus.IN_PROGRESS.getInfo()));
// serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.CANCELLED.getValue(),
// RequestStatus.CANCELLED.getInfo()));
initDto.setServiceStatusOptions(serviceStatusOptions);
return R.ok(initDto);
}
/**
* 分页查询就诊病人列表
*
* @param outpatientTreatmentEncounterDto 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 就诊病人列表
*/
@Override
public R<?> getEncounterInfoListPage(OutpatientTreatmentEncounterDto outpatientTreatmentEncounterDto,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
// 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>();
searchFields.add(CommonConstants.FieldName.PatientName);
searchFields.add(CommonConstants.FieldName.idCard);
searchFields.add(CommonConstants.FieldName.PatientPyStr);
searchFields.add(CommonConstants.FieldName.PatientWbStr);
// 构建查询条件
QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
// 查询就诊病人列表
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto = outpatientTreatmentAppMapper
.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
encounterInfoPageDto.getRecords().forEach(prescriptionPatientInfoDto -> {
// 性别
prescriptionPatientInfoDto.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
// 计算年龄
prescriptionPatientInfoDto.setAge(prescriptionPatientInfoDto.getBirthDate() != null
? AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()) : "");
});
return R.ok(encounterInfoPageDto);
}
/**
* 处置单查询
*
* @param outpatientTreatmentInfoDto 处置信息
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 处置单
*/
@Override
public R<?> getOutpatientTreatmentInfo(OutpatientTreatmentInfoDto outpatientTreatmentInfoDto, Integer pageNo,
Integer pageSize) {
// 构建查询条件
QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientTreatmentInfoDto, null, null, null);
// 查询处置单
IPage<OutpatientTreatmentInfoDto> treatmentInfo = outpatientTreatmentAppMapper.selectTreatmentInfoPage(
new Page<>(pageNo, pageSize), queryWrapper, RequestStatus.COMPLETED.getValue(),
DispenseStatus.DRAFT.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
List<OutpatientTreatmentInfoDto> treatmentList = treatmentInfo.getRecords();
// 获取请求ids
List<Long> reqIds =
treatmentList.stream().map(OutpatientTreatmentInfoDto::getRequestId).collect(Collectors.toList());
Map<Long, List<Procedure>> procedureRecordGroup = new HashMap<>();
if (!reqIds.isEmpty()) {
// 查询执行记录
List<Procedure> procedureRecords = procedureService.getProcedureRecords(reqIds, null);
if (procedureRecords != null && !procedureRecords.isEmpty()) {
// 根据服务请求id分组
procedureRecordGroup = procedureRecords.stream()
.collect(Collectors.groupingBy(Procedure::getRequestId, Collectors.toList()));
}
}
// 为每个治疗项设置执行状态统计
for (OutpatientTreatmentInfoDto treatment : treatmentList) {
// 初始化计数器
int performCount = 0;
int cancelCount = 0;
if (!procedureRecordGroup.isEmpty()) {
// 安全获取执行记录
List<Procedure> records = procedureRecordGroup.get(treatment.getRequestId());
if (records != null && !records.isEmpty()) {
// 统计状态数量
for (Procedure record : records) {
if (EventStatus.COMPLETED.getValue().equals(record.getStatusEnum())) {
performCount++;
} else if (EventStatus.CANCEL.getValue().equals(record.getStatusEnum())) {
cancelCount++;
}
}
}
}
// 设置统计结果
treatment.setPerformCount(performCount);
treatment.setCancelCount(cancelCount);
// 发放状态
if (treatment.getDispenseStatus() != null) {
treatment.setDispenseStatus_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, treatment.getDispenseStatus()));
}
// 收费状态
if (treatment.getChargeStatus() != null) {
treatment.setChargeStatus_enumText(
EnumUtils.getInfoByValue(ChargeItemStatus.class, treatment.getChargeStatus()));
}
}
return R.ok(treatmentInfo);
}
/**
* 诊疗执行记录查询
*
* @param reqId 请求项目id
* @return 执行记录列表
*/
@Override
public R<?> getPerformRecord(Long reqId) {
// 查询执行记录
List<PerformRecordDto> performRecordList = outpatientTreatmentAppMapper.selectPerformRecordList(List.of(reqId));
performRecordList.forEach(performRecordDto -> {
// 获取执行状态
performRecordDto
.setStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, performRecordDto.getStatusEnum()));
});
return R.ok(performRecordList);
}
/**
* 诊疗执行
*
* @param performInfoList 执行信息列表
* @return 执行结果
*/
@Override
public R<?> perform(List<PerformInfoDto> performInfoList) {
// 分别创建两个列表来存储不同类型的请求
List<PerformInfoDto> serviceMedPerformList = new ArrayList<>();
List<PerformInfoDto> devicePerformList = new ArrayList<>();
for (PerformInfoDto item : performInfoList) {
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
serviceMedPerformList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
devicePerformList.add(item);
}
}
// 分别处理诊疗/药品执行和耗材发放
if (!serviceMedPerformList.isEmpty()) {
// 处理诊疗执行
for (PerformInfoDto performInfoDto : serviceMedPerformList) {
Long groupId = performInfoDto.getGroupId();
Long encounterId = null;
Long requestId = null;
Long patientId = null;
Integer exeCount = 0;
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(performInfoDto.getRequestTable())) {
ServiceRequest serviceRequest = serviceRequestService.getById(performInfoDto.getRequestId());
if (serviceRequest != null) {
encounterId = serviceRequest.getEncounterId();
requestId = serviceRequest.getId();
patientId = serviceRequest.getPatientId();
exeCount = serviceRequest.getQuantity();
}
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(performInfoDto.getRequestTable())) {
MedicationRequest medicationRequest =
medicationRequestService.getById(performInfoDto.getRequestId());
if (medicationRequest != null) {
encounterId = medicationRequest.getEncounterId();
requestId = medicationRequest.getId();
patientId = medicationRequest.getPatientId();
exeCount = medicationRequest.getExecuteNum();
}
}
// 根据请求id查询执行记录
List<Procedure> procedureRecordList = procedureService
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
// 初始化计数器
int performCount = 0;
int cancelCount = 0;
// 统计状态数量
for (Procedure record : procedureRecordList) {
if (EventStatus.COMPLETED.getValue().equals(record.getStatusEnum())) {
performCount++;
} else if (EventStatus.CANCEL.getValue().equals(record.getStatusEnum())) {
cancelCount++;
}
}
// 判断该项目是否已经执行了
if (performCount - cancelCount < exeCount) {
// 未执行则新增执行记录
boolean result = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
ProcedureCategory.OUTPATIENT_ADVICE, null, groupId, null);
if (!result) {
throw new ServiceException("执行失败,请联系管理员");
}
}
} else {
// 新增执行记录
boolean result = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
null, groupId, null);
if (!result) {
throw new ServiceException("执行失败,请联系管理员");
}
}
}
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 返回信息
String returnMsg = null;
if (!devicePerformList.isEmpty()) {
// 耗材请求id列表
List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// 获取耗材发放id列表
List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
// 获取库存信息
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个耗材分组
Map<Long, List<InventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
List<InventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
if (!inventoryList.isEmpty()) {
for (InventoryDto inventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity =
inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = inventoryDto.getInventoryQuantity()
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
}
}
}
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
if (dispenseList != null) {
for (DeviceDispense deviceDispense : dispenseList) {
if (deviceDispense.getStatusEnum().equals(DispenseStatus.PREPARATION.getValue())) {
// 耗材发放状态
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
// 发药数量
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
// 发药时间
deviceDispense.setDispenseTime(DateUtils.getNowDate());
// 发药人
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
Collections.nCopies(deviceDispense.getQuantity(), CommonConstants.Common.DEV_TRACE_NO)));
}
}
// 药品发放更新
deviceDispenseService.updateBatchById(dispenseList);
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 更新请求状态为已完成
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
// 调用医保商品销售接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
// 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
westernMedicineDispenseAppServiceImpl.ybMedicineIntegrated(null, devDispenseIdList);
if (uploadFailedNoList != null) {
returnMsg = "3505商品销售上传错误错误项目编码" + uploadFailedNoList;
} else {
returnMsg = "3505商品销售上传成功";
}
}
}
return R.ok(returnMsg, "执行成功");
}
/**
* 取消执行
*
* @param performInfoList 执行信息列表
* @return 取消结果
*/
@Override
public R<?> cancelPerform(List<PerformInfoDto> performInfoList) {
// 分别创建两个列表来存储不同类型的请求
List<PerformInfoDto> serviceMedCancelList = new ArrayList<>();
List<PerformInfoDto> deviceCancelList = new ArrayList<>();
for (PerformInfoDto item : performInfoList) {
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
serviceMedCancelList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
deviceCancelList.add(item);
}
}
// 分别处理诊疗执行和耗材发放
if (!serviceMedCancelList.isEmpty()) {
// 处理诊疗取消执行
for (PerformInfoDto performInfoDto : serviceMedCancelList) {
// 根据请求id查询执行记录
List<Procedure> procedureRecordList = procedureService
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
Procedure procedure = procedureRecordList.get(0);
// 初始化计数器
int performCount = 0;
int cancelCount = 0;
// 统计状态数量
for (Procedure record : procedureRecordList) {
if (EventStatus.COMPLETED.getValue().equals(record.getStatusEnum())) {
performCount++;
} else if (EventStatus.CANCEL.getValue().equals(record.getStatusEnum())) {
cancelCount++;
}
}
// 判断该项目是否已经执行了
if (performCount - cancelCount > 0) {
// 已执行则新增取消执行记录
boolean result = procedureService.addProcedureRecord(procedure.getEncounterId(),
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
performInfoDto.getGroupId(), null);
if (!result) {
throw new ServiceException("取消执行失败,请联系管理员");
}
}
}
}
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 返回信息
String returnMsg = null;
if (!deviceCancelList.isEmpty()) {
// 待退的耗材请求id列表
List<Long> devRefundRequestIdList = new ArrayList<>();
// 耗材请求id和待退的耗材请求id
List<Pair<Long, Long>> devRequestIdPairList = new ArrayList<>();
// 耗材发放id列表
List<Long> devDispenseIdList = deviceCancelList.stream().map(PerformInfoDto::getDispenseId).toList();
for (PerformInfoDto performInfoDto : deviceCancelList) {
// 查询耗材请求
DeviceRequest deviceRequest = deviceRequestService.getById(performInfoDto.getRequestId());
Long requestId = deviceRequest.getId();
// 查询待退的耗材请求
DeviceRequest deviceRefundRequest = deviceRequestService.getOne(new LambdaQueryWrapper<DeviceRequest>()
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
if (deviceRefundRequest != null) {
if (deviceRefundRequest.getStatusEnum().equals(EventStatus.CANCEL.getValue())) {
// 获取待退的耗材请求id
devRefundRequestIdList.add(deviceRefundRequest.getId());
devRequestIdPairList.add(new Pair<>(requestId, deviceRefundRequest.getId()));
}
} else {
// 生成退耗材请求
deviceRequest.setId(null); // 耗材请求id
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
deviceRequest.setQuantity(deviceRequest.getQuantity() * (-1)); // 请求数量
deviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
deviceRequest.setRefundDeviceId(deviceRequest.getId()); // 退药id
deviceRequestService.save(deviceRequest);
// 获取生成的退耗材请求的id
devRefundRequestIdList.add(deviceRequest.getId());
devRequestIdPairList.add(new Pair<>(requestId, deviceRequest.getId()));
}
}
// 退耗材处理
// 退耗材单列表
List<DeviceDispense> devRefundList = new ArrayList<>();
if (!devDispenseIdList.isEmpty()) {
// 耗材已发放信息查询
List<DeviceDispense> deviceDispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 根据发药单对应生成退药单
for (DeviceDispense deviceDispense : deviceDispenseList) {
// 耗材发放编码
deviceDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
// 退耗材的耗材请求id
for (Pair<Long, Long> pair : devRequestIdPairList) {
if (deviceDispense.getDeviceReqId().equals(pair.getKey())) {
deviceDispense.setDeviceReqId(pair.getValue());
}
}
// 退药时间
deviceDispense.setDispenseTime(DateUtils.getNowDate());
// 退药状态
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
deviceDispense.setId(null);
devRefundList.add(deviceDispense);
}
deviceDispenseService.saveBatch(devRefundList);
// 药品退药请求状态变更(待退药→已完成)
deviceRequestService.updateCompletedStatusBatch(devRefundRequestIdList);
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (InventoryDto inventory : inventoryList) {
// 库存表项目设定
InventoryItem inventoryItem = new InventoryItem();
// id
inventoryItem.setId(inventory.getInventoryId());
// 库存数量
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
inventoryItem
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
inventoryItem.setQuantity(inventory.getInventoryQuantity()
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
}
inventoryItemList.add(inventoryItem);
}
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 调用医保商品销售退货接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
if (!devRefundList.isEmpty()) {
List<String> uploadFailedNoList =
returnedMedicineAppServiceImpl.ybReturnIntegrated(new ArrayList<>(), devDispenseIdList);
if (uploadFailedNoList != null) {
returnMsg = "3506商品销售退货上传错误错误项目编码" + uploadFailedNoList;
} else {
returnMsg = "3506商品销售退货上传成功";
}
}
}
}
return R.ok(returnMsg, "取消执行成功");
}
}

View File

@@ -0,0 +1,124 @@
package com.openhis.web.outpatientmanage.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionAppService;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊输液记录
*
* @author liuhr
* @date 2025/3/12
*/
@RestController
@RequestMapping("/outpatient-manage/infusion")
@Slf4j
@AllArgsConstructor
public class OutpatientInfusionController {
@Autowired
private IOutpatientInfusionAppService outpatientInfusionAppService;
/**
* 门诊输液初始化
*
* @return 初始化信息
*/
@GetMapping("/init")
public R<?> outpatientInfusionInit() {
return outpatientInfusionAppService.init();
}
/**
* 查询门诊输液的患者列表
*
* @param outpatientInfusionPatientDto 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 返回门诊输液的患者列表
*/
@GetMapping(value = "/infusion-patient-list")
public R<?> getOutpatientInfusionPatientList(OutpatientInfusionPatientDto outpatientInfusionPatientDto,
String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return outpatientInfusionAppService.getOutpatientInfusionPatientList(outpatientInfusionPatientDto, searchKey,
pageNo, pageSize, request);
}
/**
* 门诊输液待执行记录查询
*
* @param encounterId 就诊ID
* @param serviceStatus 就诊状态
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液待执行记录列表
*/
@GetMapping(value = "/infusion-pending-record")
public R<?> getInfusionPendingRecord(@RequestParam Long encounterId,@RequestParam Integer serviceStatus,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return outpatientInfusionAppService.getInfusionPendingRecord(encounterId, serviceStatus,pageNo, pageSize);
}
/**
* 门诊输液执行历史记录查询
*
* @param serviceReqId 诊疗项目id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 门诊输液执行历史记录列表
*/
@GetMapping(value = "/infusion-perform-record")
public R<?> getInfusionPerformRecord(@RequestParam Long serviceReqId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return outpatientInfusionAppService.getInfusionPerformRecord(serviceReqId, pageNo, pageSize);
}
/**
* 输液执行
*
* @param serviceReqIdList 输液请求id列表
* @return 执行结果
*/
@PutMapping("/infusion-perform")
public R<?> infusionPerform(@RequestBody List<Long> serviceReqIdList) {
return outpatientInfusionAppService.infusionPerform(serviceReqIdList);
}
/**
* 修改输液执行时间
*
* @param serviceReqId 患者输液信息
* @param performTime 患者输液信息
* @return 执行结果
*/
@PutMapping("/infusion-perform-time")
public R<?> editPatientInfusionTime(@RequestParam Long serviceReqId, @RequestParam String performTime) {
return outpatientInfusionAppService.editPatientInfusionTime(serviceReqId, performTime);
}
/**
* 撤销执行
*
* @param serviceReqId 输液请求id
* @return 撤销结果
*/
@PutMapping(value = "/cancel-perform")
public R<?> cancelInfusionPerform(@RequestParam Long serviceReqId) {
return outpatientInfusionAppService.cancelInfusionPerform(serviceReqId);
}
}

View File

@@ -0,0 +1,90 @@
package com.openhis.web.outpatientmanage.controller;
import javax.servlet.http.HttpServletRequest;
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.IOutpatientSkinTestRecordService;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto;
import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊皮试记录
*
* @author liuhr
* @date 2025/3/5
*/
@RestController
@RequestMapping("/outpatient-manage/skin-test")
@Slf4j
@AllArgsConstructor
public class OutpatientSkinTestRecordController {
@Autowired
private IOutpatientSkinTestRecordService OutpatientSkinTestRecordService;
/**
* 门诊皮试记录初期数据
*
* @return
*/
@GetMapping("/init")
public R<?> getOutpatientSkinTestInit() {
return R.ok(OutpatientSkinTestRecordService.getOutpatientSkinTestInit());
}
/**
* 护士确认执行皮试后,更新皮试记录信息
*
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
@PutMapping("/outpatient-record-skin-test")
public R<?> editSkinTestRecord(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
if (!OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto)) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试项目检查"}));
}
/**
* 皮试记录护士核对签名
*
* @param outpatientSkinTestRecordDto 皮试记录信息
*/
@PutMapping("/outpatient-record-sign-check")
public R<?> nurseSignChkPs(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) {
if (!OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto)) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试记录护士核对签名"}));
}
/**
* 分页查询门诊皮实记录,可选条件
*
* @param outpatientSkinTestRecordSearchParam 查询条件
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
*/
@GetMapping("/outpatient-record-page")
public R<?> getSkinTestRecords(OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return R.ok(OutpatientSkinTestRecordService.getSkinTestRecords(outpatientSkinTestRecordSearchParam, searchKey,
pageNo, pageSize, request));
}
}

View File

@@ -0,0 +1,110 @@
package com.openhis.web.outpatientmanage.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.openhis.web.common.dto.PerformInfoDto;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.appservice.IOutpatientTreatmentAppService;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊处置
*
* @author yuxj
* @date 2025/4/10
*/
@RestController
@RequestMapping("/outpatient-manage/treatment")
@Slf4j
@AllArgsConstructor
public class OutpatientTreatmentController {
@Resource
private IOutpatientTreatmentAppService outpatientTreatmentAppService;
/**
* 门诊处置初期数据
*
* @return 初始化信息
*/
@GetMapping("/init")
public R<?> outpatientTreatmentInit() {
return outpatientTreatmentAppService.init();
}
/**
* 分页查询就诊病人列表
*
* @param outpatientTreatmentEncounterDto 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 就诊病人列表
*/
@GetMapping("/encounter-list")
public R<?> getEncounterInfoList(OutpatientTreatmentEncounterDto outpatientTreatmentEncounterDto,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return outpatientTreatmentAppService.getEncounterInfoListPage(outpatientTreatmentEncounterDto, pageNo, pageSize,
searchKey, request);
}
/**
* 处置单查询
*
* @param outpatientTreatmentInfoDto 处置信息
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 处置单
*/
@GetMapping("/treatment-list")
public R<?> getOutpatientTreatmentInfo(OutpatientTreatmentInfoDto outpatientTreatmentInfoDto,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize) {
return outpatientTreatmentAppService.getOutpatientTreatmentInfo(outpatientTreatmentInfoDto, pageNo, pageSize);
}
/**
* 诊疗执行记录查询
*
* @param reqId 请求项目id
* @return 执行记录列表
*/
@GetMapping(value = "/perform-record")
public R<?> getPerformRecord(@RequestParam Long reqId) {
return outpatientTreatmentAppService.getPerformRecord(reqId);
}
/**
* 诊疗执行
*
* @param performInfoList 执行信息列表
* @return 执行结果
*/
@PutMapping("/perform")
public R<?> perform(@RequestBody List<PerformInfoDto> performInfoList) {
return outpatientTreatmentAppService.perform(performInfoList);
}
/**
* 取消执行
*
* @param performInfoList 执行信息列表
* @return 取消结果
*/
@PutMapping(value = "/cancel-perform")
public R<?> cancelPerform(@RequestBody List<PerformInfoDto> performInfoList) {
return outpatientTreatmentAppService.cancelPerform(performInfoList);
}
}

View File

@@ -0,0 +1,62 @@
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
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 encounterId;
/** 病人姓名 */
private String patientName;
/** 病人性别 */
private Integer genderEnum;
private String genderEnum_enumText;
/** 执行状态 */
private Integer serviceStatus;
private String serviceStatus_enumText;
/** 病人生日 */
private Date birthDate;
/** 病人身份证号 */
private String idCard;
/** 病人年龄 */
private String ageString;
/** 开单时间 */
private String createTime;
}

View File

@@ -0,0 +1,186 @@
package com.openhis.web.outpatientmanage.dto;
import java.math.BigDecimal;
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 javax.validation.constraints.NotBlank;
/**
* 门诊输液记录Dto
*
* @author liuhr
* @date 2025/3/12
*/
@Data
@Accessors(chain = true)
public class OutpatientInfusionRecordDto {
/**
* 服务申请管理表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long serviceId;
/**
* 诊疗名称
*/
private String serviceName;
/**
* 服务申请状态
*/
private Integer serviceStatus;
private String serviceStatus_enumText;
/**
* 请求基于什么的ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long basedOnId;
/**
* 服务请求编码
*/
private String busNo;
/**
* 就诊ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/**
* 执行次数
*/
private Integer executeNum;
/**
* 已经行次数
*/
private Integer performCount;
/**
* 分组id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long groupId;
/**
* 执行护士
*/
private String performerName;
/**
* 执行科室
*/
private String orgName;
/**
* 开单医生
*/
private String practitionerName;
/**
* 预计结束时间
*/
private String occurrenceEndTime;
/**
* 药品名称
*/
private String medicationName;
/**
* 药品数量
*/
private BigDecimal quantity;
/**
* 请求单位编码
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/**
* 单次剂量
*/
private BigDecimal dose;
/**
* 单次剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
private String doseUnitCode_dictText;
/**
* 用法
*/
@Dict(dictCode = "method_code")
private String methodCode;
private String methodCode_dictText;
/**
* 用药频次
*/
@Dict(dictCode = "rate_code")
private String rateCode;
private String rateCode_dictText;
/**
* 执行人
*/
@Dict(dictTable = "adm_practitioner", dictCode = "id", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long performerId;
private String performerId_dictText;
/**
* 配药人
*/
@Dict(dictTable = "adm_practitioner", dictCode = "id", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long preparerId;
private String preparerId_dictText;
/**
* 输液速度
*/
private Integer speed;
/**
* 发放状态
*/
private Integer dispenseStatus;
private String dispenseStatus_enumText;
/**
* 皮试标志(是/否)
*/
private Integer skinTestFlag;
private String skinTestFlag_enumText;
/**
* 开单时间
*/
private String authoredTime;
/**
* 打印次数
*/
private Integer printCount;
/**
* 执行科室名称
*/
private String deptName;
}

View File

@@ -0,0 +1,37 @@
package com.openhis.web.outpatientmanage.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 皮试初始化记录
*
* @author liuhr
* @date 2025/3/15
*/
@Data
@Accessors(chain = true)
public class OutpatientSkinTestInitDto {
//皮试检查项目状态
private List<OutpatientSkinTestInitDto.statusEnumOption> verificationStatus;
//皮试结果
private List<OutpatientSkinTestInitDto.statusEnumOption> clinicalStatus;
/**
* 状态
*/
@Data
public static class statusEnumOption {
private Integer value;
private String info;
public statusEnumOption(Integer value, String info) {
this.value = value;
this.info = info;
}
}
}

View File

@@ -0,0 +1,98 @@
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
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.util.Date;
/**
* 门诊皮试记录Dto
*
* @author liuhr
* @date 2025/3/5
*/
@Data
@Accessors(chain = true)
public class OutpatientSkinTestRecordDto {
/** 服务申请管理表ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 处方号 */
private String prescriptionNo;
/** 就诊号 */
private String encounterBusNo;
/** 病人ID前台显示用 */
private String patientBusNo;
/** 病人ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** 病人姓名 */
private String patientName;
/** 执行护士 */
@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_practitioner", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long performerCheckId;
private String performerCheckId_dictText;
/** 预计执行时间 */
private String occurrenceStartTime;
/** 预计结束时间 */
private String occurrenceEndTime;
/** 药品信息 */
private String medicationInformation;
/** 药品 */
private String medicationDetail;
/** 药品批次号 */
private String medicationLotNumber;
/** 药品状态 */
private Integer medicationStatusEnum;
private String medicationStatusEnum_enumText;
/** 皮试结果 */
private Integer clinicalStatusEnum;
private String clinicalStatusEnum_enumText;
/** 皮试检查项目状态 */
private Integer verificationStatusEnum;;
private String verificationStatusEnum_enumText;
/** 备注 */
private String note;
/** 记录日期 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date recordedDate;
/** 手机号 */
private String phone;
}

View File

@@ -0,0 +1,20 @@
package com.openhis.web.outpatientmanage.dto;
import lombok.Data;
/**
* 门诊皮试记录查询体体条件类
*
* @author liuhr
* @date 2025/3/5
*/
@Data
public class OutpatientSkinTestRecordSearchParam {
/** 手机号 */
private String phone;
/** 皮试项目检查状态 */
private Integer clinicalStatusEnum;
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 门诊工作站初始化dto
*
* @author zwh
* @date 2025-05-19
*/
@Data
@Accessors(chain = true)
public class OutpatientStationInitDto {
/** 执行状态 */
private List<OutpatientStationInitDto.ServiceStatus> serviceStatusOptions;
/** 执行状态 */
@Data
public static class ServiceStatus {
private Integer value;
private String label;
public ServiceStatus(Integer value, String label) {
this.value = value;
this.label = label;
}
}
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
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 WangYang
* @date 2025-03-18
*/
@Data
@Accessors(chain = true)
public class OutpatientTreatmentEncounterDto {
/** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 就诊号 */
private String encounterNo;
/** 患者姓名 */
private String patientName;
/** 拼音码 */
private String patientPyStr;
/** 五笔码 */
private String patientWbStr;
/** 性别 */
private Integer genderEnum;
private String genderEnum_enumText;
/** 就诊日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String receptionTime;
/**
* 年龄
*/
private String age;
/**
* 生日
*/
private Date birthDate;
/** 执行状态 */
private Integer statusEnum;
}

View File

@@ -0,0 +1,113 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import java.math.BigDecimal;
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;
/**
* 处方信息
*
* @author yuxj
* @date 2025-04-11
*/
@Data
@Accessors(chain = true)
public class OutpatientTreatmentInfoDto {
/** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 请求id */
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId;
/** 请求状态 */
private Integer serviceStatus;
private String serviceStatus_enumText;
/** 发放ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long dispenseId;
/** 发放状态 */
private Integer dispenseStatus;
private String dispenseStatus_enumText;
/** 执行次数 */
private Integer executeNum;
/** 数量 */
private Integer quantity;
/** 单位 */
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/** 编码 */
private String busNo;
/** 收费状态 */
private Integer chargeStatus;
private String chargeStatus_enumText;
/** 单价 */
private BigDecimal unitPrice;
/** 总价 */
private BigDecimal totalPrice;
/** 请求所在表名 */
private String requestTable;
/** 诊疗类型 */
@Dict(dictCode = "activity_category_code")
private String serviceCategory;
private String serviceCategory_dictText;
/** 耗材类型 */
@Dict(dictCode = "device_category_code")
private String deviceCategory;
private String deviceCategory_dictText;
/** 药品类型 */
@Dict(dictCode = "med_category_code")
private String medCategory;
private String medCategory_dictText;
/** 五笔码 */
private String wbStr;
/** 拼音码 */
private String pyStr;
/** 项目名 */
private String itemName;
/** 规格 */
private String size;
/** 组号 */
private Long groupId;
/** 药品数量 */
private Integer medQuantity;
/** 排序号 */
private Integer sortNumber;
/** 执行次数 */
private Integer performCount;
/** 取消执行次数 */
private Integer cancelCount;
}

View File

@@ -0,0 +1,87 @@
package com.openhis.web.outpatientmanage.mapper;
import java.util.List;
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;
/**
* 门诊管理
*
* @author liuhr
* @date 2025/3/5
*/
public interface OutpatientInfusionAppMapper {
/**
* 门诊皮试记录分页查询
*
* @param page 分页参数
* @param queryWrapper 查询条件
* @return 门诊输液记录列表
*/
IPage<OutpatientSkinTestRecordDto> getSkinTestRecords(@Param("page") Page<OutpatientSkinTestRecordDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientSkinTestRecordDto> queryWrapper);
/**
* 门诊输液患者记录分页查询
*
* @param page 分页参数
* @param queryWrapper 查询条件
* @param inProgress 诊疗请求状态:待执行
* @param completed 诊疗请求状态:已完成
* @param cancelled 诊疗请求状态:取消
* @param medMedicationRequest 药品请求表
* @return 门诊输液患者记录
*/
IPage<OutpatientInfusionPatientDto> getOutpatientInfusionPatient(
@Param("page") Page<OutpatientInfusionPatientDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionPatientDto> queryWrapper,
@Param("inProgress") Integer inProgress, @Param("completed") Integer completed,
@Param("cancelled") Integer cancelled, @Param("medMedicationRequest") String medMedicationRequest);
/**
* 查询门诊输液待执行记录
*
* @param page 分页参数
* @param queryWrapper 查询条件
* @param encounterId 就诊id
* @param completed 执行状态:已完成
* @param medMedicationRequest 药品请求表
* @return 门诊输液待执行记录
*/
Page<OutpatientInfusionRecordDto> selectInfusionPendingRecord(@Param("page") Page<OutpatientInfusionRecordDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionRecordDto> queryWrapper,
@Param("encounterId") Long encounterId, @Param("completed") Integer completed,
@Param("medMedicationRequest") String medMedicationRequest);
/**
* 查询门诊输液执行记录
*
* @param page 分页参数
* @param queryWrapper 查询条件
* @param serviceReqId 诊疗项目id
* @param completed 执行状态:已完成
* @return 门诊输液执行记录
*/
Page<OutpatientInfusionRecordDto> selectInfusionPerformRecord(@Param("page") Page<OutpatientInfusionRecordDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientInfusionRecordDto> queryWrapper,
@Param("serviceReqId") Long serviceReqId, @Param("completed") Integer completed);
/**
* 获取诊疗执行信息
*
* @param serviceReqIdList 待执行诊疗id列表
* @param completed 执行状态:已完成
* @return 诊疗执行信息
*/
List<OutpatientInfusionRecordDto> selectPerformInfo(@Param("serviceReqIdList") List<Long> serviceReqIdList,
@Param("completed") Integer completed);
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.common.dto.PerformRecordDto;
@Repository
public interface OutpatientTreatmentAppMapper {
/**
* 就诊病人列表分页查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @param amb 就诊类型:门诊
* @return 就诊病人列表
*/
Page<OutpatientTreatmentEncounterDto> selectEncounterInfoListPage(
@Param("page") Page<OutpatientTreatmentEncounterDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper,
@Param("amb") Integer amb);
/**
* 处置项目查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @param reqCompleted 请求状态:已完成
* @param draft 发放状态:草稿
* @param worServiceRequest 请求所在表:服务请求
* @param worDeviceRequest 请求所在表:耗材请求
* @param medMedicationRequest 请求所在表:药品请求
* @return 处置单
*/
Page<OutpatientTreatmentInfoDto> selectTreatmentInfoPage(@Param("page") Page<OutpatientTreatmentInfoDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper,
@Param("reqCompleted") Integer reqCompleted, @Param("draft") Integer draft,
@Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest,
@Param("medMedicationRequest") String medMedicationRequest);
/**
* 查询执行记录
*
* @param reqIds 项目ids
* @return 执行记录列表
*/
List<PerformRecordDto> selectPerformRecordList(@Param("reqIds") List<Long> reqIds);
}