Revert "Fix Bug #550: AI修复"

This reverts commit 16c42ca108.
This commit is contained in:
2026-05-27 08:59:07 +08:00
parent bd14563691
commit 9db5ced4e3
5432 changed files with 778638 additions and 171 deletions

View File

@@ -0,0 +1,81 @@
package com.openhis.web.outpatientmanage.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 门诊管理——输液实现类
*
* @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,45 @@
package com.openhis.web.outpatientmanage.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.dto.SkinTestQueryDto;
import com.openhis.web.outpatientmanage.dto.SkinTestSaveDto;
import java.util.List;
/**
* 门诊皮试 应用实现类
*/
public interface IOutpatientSkinTestAppService {
/**
* 查询皮试初始化数据
*
* @return 皮试初始化数据
*/
R<?> init();
/**
* 查询皮试记录
*
* @param encounterId 就诊id
* @return 皮试记录
*/
List<SkinTestQueryDto> getRecordInfo(Long encounterId);
/**
* 保存皮试检查记录
*
* @param skinTestSaveDto 皮试检查 保存Dto
* @return 结果
*/
R<?> saveRecordInfo(SkinTestSaveDto skinTestSaveDto);
/**
* 删除皮试检查记录
*
* @param recordId 皮试记录ID
* @return 结果
*/
R<?> deleteRecordInfo(Long recordId);
}

View File

@@ -0,0 +1,82 @@
package com.openhis.web.outpatientmanage.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.common.dto.PerformInfoDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 门诊处置
*
* @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);
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
R<?> getBloodTransfusionPatch(Long requestId);
}

View File

@@ -0,0 +1,275 @@
package com.openhis.web.outpatientmanage.appservice.impl;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
/**
* 门诊管理——输液实现类
*
* @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.ACTIVE.getValue(),
"待执行"));
serviceStatusOptions.add(new OutpatientStationInitDto.ServiceStatus(RequestStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.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) {
// 构建查询条件 - 当 serviceStatus 为 null 时,不添加状态过滤
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = HisQueryUtils
.buildQueryWrapper(serviceStatus != null ? new OutpatientInfusionRecordDto().setServiceStatus(serviceStatus) : new OutpatientInfusionRecordDto(), 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,156 @@
package com.openhis.web.outpatientmanage.appservice.impl;
import com.core.common.core.domain.R;
import com.core.common.utils.MessageUtils;
import com.openhis.clinical.domain.AllergyIntolerance;
import com.openhis.clinical.service.IAllergyIntoleranceService;
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.web.outpatientmanage.appservice.IOutpatientSkinTestAppService;
import com.openhis.web.outpatientmanage.dto.AllergyIntoInitDto;
import com.openhis.web.outpatientmanage.dto.SkinTestMedLotNumberDto;
import com.openhis.web.outpatientmanage.dto.SkinTestQueryDto;
import com.openhis.web.outpatientmanage.dto.SkinTestSaveDto;
import com.openhis.web.outpatientmanage.mapper.OutpatientSkinTestAppMapper;
import com.openhis.workflow.service.IActivityDefinitionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 门诊皮试 应用实现类
*/
@Service
public class OutpatientSkinTestAppServiceImpl implements IOutpatientSkinTestAppService {
@Resource
OutpatientSkinTestAppMapper outpatientSkinTestAppMapper;
@Resource
IActivityDefinitionService iActivityDefinitionService;
@Resource
IAllergyIntoleranceService iAllergyIntoleranceService;
/**
* 查询皮试初始化数据
*
* @return 皮试初始化数据
*/
@Override
public R<?> init() {
AllergyIntoInitDto initDto = new AllergyIntoInitDto();
// 获取临床状况列表
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption1 = Stream.of(ClinicalStatus.values())
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setClinicalStatusOptions(statusEnumOption1);
// 获取验证状态列表
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption2 = Stream.of(ConditionVerificationStatus.values())
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setVerificationStatusOptions(statusEnumOption2);
// 获取危险程度列表
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption3 = Stream.of(Criticality.values())
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setCriticalityOptions(statusEnumOption3);
// 获取严重程度列表
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption4 = Stream.of(Severity.values())
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setSeverityOptions(statusEnumOption4);
return R.ok(initDto);
}
/**
* 查询皮试记录
*
* @param encounterId 就诊id
* @return 皮试记录
*/
@Override
public List<SkinTestQueryDto> getRecordInfo(Long encounterId) {
// 皮试检查定义id
Long skinTestDefinitionId = iActivityDefinitionService
.getAppointActivityDefinitionId(CommonConstants.BusinessName.SKIN_TEST_INSPECTION);
// 药品库存批次号信息
List<SkinTestMedLotNumberDto> medLotNumber =
outpatientSkinTestAppMapper.getMedLotNumber(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
List<SkinTestQueryDto> recordInfo = outpatientSkinTestAppMapper.getRecordInfo(encounterId, skinTestDefinitionId,
RequestStatus.COMPLETED.getValue());
for (SkinTestQueryDto skinTestQueryDto : recordInfo) {
// 匹配批次号信息
List<SkinTestMedLotNumberDto> lotNumberList =
medLotNumber.stream().filter(e -> e.getMedicationId().equals(skinTestQueryDto.getMedicationId()))
.collect(Collectors.toList());
skinTestQueryDto.setLotNumberList(lotNumberList);
// 临床状况
skinTestQueryDto.setClinicalStatusEnum_enumText(
EnumUtils.getInfoByValue(ClinicalStatus.class, skinTestQueryDto.getClinicalStatusEnum()));
// 验证状态
skinTestQueryDto.setVerificationStatusEnum_enumText(EnumUtils
.getInfoByValue(ConditionVerificationStatus.class, skinTestQueryDto.getVerificationStatusEnum()));
}
return recordInfo;
}
/**
* 保存皮试检查记录
*
* @param skinTestSaveDto 皮试检查 保存Dto
* @return 结果
*/
@Override
public R<?> saveRecordInfo(SkinTestSaveDto skinTestSaveDto) {
AllergyIntolerance allergyIntolerance = new AllergyIntolerance();
allergyIntolerance.setId(skinTestSaveDto.getRecordId()); // 皮试记录ID
allergyIntolerance.setRequestId(skinTestSaveDto.getRequestId()); // 医嘱请求D
allergyIntolerance.setEncounterId(skinTestSaveDto.getEncounterId()); // 就诊ID
allergyIntolerance.setPatientId(skinTestSaveDto.getPatientId()); // 患者ID
allergyIntolerance.setMedicationId(skinTestSaveDto.getMedicationId()); // 药品ID
allergyIntolerance.setLotNumber(skinTestSaveDto.getLotNumber()); // 批次号
allergyIntolerance.setRecordedDate(skinTestSaveDto.getRecordedDate()); // 记录日期
allergyIntolerance.setClinicalStatusEnum(skinTestSaveDto.getClinicalStatusEnum()); // 临床状况
allergyIntolerance.setVerificationStatusEnum(skinTestSaveDto.getVerificationStatusEnum()); // 验证状态
allergyIntolerance.setPractitionerId(skinTestSaveDto.getPractitionerId()); // 记录者
allergyIntolerance.setCheckPractitionerId(skinTestSaveDto.getCheckPractitionerId()); // 断言者
iAllergyIntoleranceService.saveOrUpdate(allergyIntolerance);
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"皮试检查记录"}));
}
/**
* 删除皮试检查记录
*
* @param recordId 皮试记录ID
* @return 结果
*/
@Override
public R<?> deleteRecordInfo(Long recordId) {
boolean res = iAllergyIntoleranceService.removeById(recordId);
if (res) {
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"皮试记录"}));
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
}
}

View File

@@ -0,0 +1,642 @@
package com.openhis.web.outpatientmanage.appservice.impl;
import cn.hutool.core.lang.Pair;
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.enums.DelFlag;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.administration.service.IChargeItemService;
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.BloodTransfusionPatchDto;
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.ReturnMedicineAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.WesternMedicineDispenseAppServiceImpl;
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 门诊处置
*
* @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 WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
@Resource
private ReturnMedicineAppServiceImpl returnedMedicineAppServiceImpl;
@Resource
private IChargeItemService chargeItemService;
@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.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(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.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()) {
List<ChargeItem> chargeItemList = chargeItemService.getChargeItemInfoByReqId(
serviceMedPerformList.stream().map(PerformInfoDto::getRequestId).collect(Collectors.toList()));
if (chargeItemList == null || chargeItemList.isEmpty()) {
throw new ServiceException("未找到对应的收费项,请联系管理员");
}
// 按requestId分组收费项
Map<Long, List<ChargeItem>> chargeItemMap
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getServiceId));
// 过滤出已收费的执行项目
serviceMedPerformList = serviceMedPerformList.stream().filter(performInfo -> {
List<ChargeItem> chargeItems = chargeItemMap.get(performInfo.getRequestId());
return chargeItems != null && chargeItems.stream()
.anyMatch(chargeItem -> ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum()));
}).toList();
// 处理诊疗执行
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().intValue();
}
} 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) {
// 未执行则新增执行记录
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
ProcedureCategory.OUTPATIENT_ADVICE, null, null, DateUtils.getNowDate(), groupId, null);
if (procedureId == null) {
throw new ServiceException("执行失败,请联系管理员");
}
}
} else {
// 新增执行记录
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
null, null, DateUtils.getNowDate(), groupId, null);
if (procedureId == null) {
throw new ServiceException("执行失败,请联系管理员");
}
}
}
}
// 返回信息
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();
// 更新请求状态为已完成
LambdaUpdateWrapper<DeviceRequest> updateWrapper
= new LambdaUpdateWrapper<DeviceRequest>().in(DeviceRequest::getId, devRequestIdList)
.set(DeviceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue());
deviceRequestService.update(updateWrapper);
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 获取耗材待发放id列表
List<Long> devUnDispenseIdList = new ArrayList<>();
if (dispenseList != null) {
List<DeviceDispense> unDispenseList = dispenseList.stream()
.filter(x -> DispenseStatus.PREPARATION.getValue().equals(x.getStatusEnum())).toList();
for (DeviceDispense deviceDispense : unDispenseList) {
// 耗材发放状态
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().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
devUnDispenseIdList.add(deviceDispense.getId());
}
// 药品发放更新
deviceDispenseService.updateBatchById(dispenseList);
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 获取药品待发放库存信息
List<UnDispenseInventoryDto> unDispenseInventoryList = returnMedicineMapper.selectInventoryInfoList(
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap = unDispenseInventoryList.stream()
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLotNumber()
+ CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
if (!inventoryList.isEmpty()) {
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.anyMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 停供库存校验
throw new ServiceException(inventoryList.get(0).getItemName() + "库存已停供");
}
// 最小单位数量
BigDecimal minQuantity = BigDecimal.ZERO;
// 库存数量
BigDecimal inventoryQuantity = BigDecimal.ZERO;
// 库存id
Long inventoryId = null;
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity = unDispenseInventoryDto.getQuantity()
.multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
if (PublicationStatus.ACTIVE.getValue()
.equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
inventoryId = unDispenseInventoryDto.getInventoryId();
}
}
if (minQuantity.compareTo(inventoryQuantity) > 0) {
// 库存不足
throw new ServiceException(inventoryList.get(0).getItemName() + "库存不足");
} else {
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryId)
.setQuantity(inventoryQuantity.subtract(minQuantity)));
}
}
}
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// // 调用医保商品销售接口
// 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("执行成功");
}
/**
* 取消执行
*
* @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) {
// 已执行则新增取消执行记录
Long procedureId = procedureService.addProcedureRecord(procedure.getEncounterId(),
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
null, DateUtils.getNowDate(), performInfoDto.getGroupId(), null);
if (procedureId == null) {
throw new ServiceException("取消执行失败,请联系管理员");
}
}
}
}
}
// 返回信息
String returnMsg = null;
if (!deviceCancelList.isEmpty()) {
// 待退的耗材请求id列表
List<Long> devRefundRequestIdList = new ArrayList<>();
// 耗材请求id和待退的耗材请求id
List<Pair<Long, Long>> devRequestIdPairList = new ArrayList<>();
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(RequestStatus.CANCELLED.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().multiply(new BigDecimal("-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<>();
// 耗材发放id列表
List<Long> devDispenseIdList = deviceCancelList.stream().map(PerformInfoDto::getDispenseId).toList();
if (!devRefundRequestIdList.isEmpty() && !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<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(
devDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (UnDispenseInventoryDto 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, "取消执行成功");
}
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
@Override
public R<?> getBloodTransfusionPatch(Long requestId) {
BloodTransfusionPatchDto bloodTransfusionPatch
= outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
// 性别枚举
bloodTransfusionPatch.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
// 计算年龄
if (bloodTransfusionPatch.getBirthDate() != null) {
bloodTransfusionPatch.setAge(AgeCalculatorUtil.getAge(bloodTransfusionPatch.getBirthDate()));
}
return R.ok(bloodTransfusionPatch);
}
}

View File

@@ -0,0 +1,123 @@
package com.openhis.web.outpatientmanage.controller;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 门诊输液记录
*
* @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(value = "serviceStatus", required = false) 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(value = "serviceReqId", required = false) 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,66 @@
package com.openhis.web.outpatientmanage.controller;
import com.core.common.core.domain.R;
import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestAppService;
import com.openhis.web.outpatientmanage.dto.SkinTestSaveDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 门诊皮试
*/
@RestController
@RequestMapping("/outpatient-manage/skin-test")
@Slf4j
@AllArgsConstructor
public class OutpatientSkinTestAppController {
@Autowired
private IOutpatientSkinTestAppService outpatientSkinTestAppService;
/**
* 查询皮试初始化数据
*
* @return 皮试初始化数据
*/
@GetMapping(value = "/init")
public R<?> init() {
return outpatientSkinTestAppService.init();
}
/**
* 查询皮试记录
*
* @param encounterId 就诊id
* @return 皮试记录
*/
@GetMapping(value = "/record-info")
public R<?> getRecordInfo(@RequestParam(value = "encounterId") Long encounterId) {
return R.ok(outpatientSkinTestAppService.getRecordInfo(encounterId));
}
/**
* 保存皮试检查记录
*
* @param skinTestSaveDto 皮试检查 保存Dto
* @return 结果
*/
@PostMapping(value = "/save-record-info")
public R<?> saveRecordInfo(@RequestBody SkinTestSaveDto skinTestSaveDto) {
return outpatientSkinTestAppService.saveRecordInfo(skinTestSaveDto);
}
/**
* 删除皮试检查记录
*
* @param recordId 皮试记录ID
* @return 结果
*/
@DeleteMapping("/delete-record-info")
public R<?> deleteRecordInfo(@RequestParam Long recordId) {
return R.ok(outpatientSkinTestAppService.deleteRecordInfo(recordId));
}
}

View File

@@ -0,0 +1,119 @@
package com.openhis.web.outpatientmanage.controller;
import com.core.common.core.domain.R;
import com.openhis.web.common.dto.PerformInfoDto;
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;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 门诊处置
*
* @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);
}
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
@GetMapping(value = "/blood-transfusion-patch")
public R<?> getBloodTransfusionPatch(@RequestParam(value = "requestId") Long requestId) {
return outpatientTreatmentAppService.getBloodTransfusionPatch(requestId);
}
}

View File

@@ -0,0 +1,38 @@
package com.openhis.web.outpatientmanage.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 皮试检查 初始数据Dto
*/
@Data
@Accessors(chain = true)
public class AllergyIntoInitDto {
//临床状况列表
private List<statusEnumOption> clinicalStatusOptions;
//验证状态列表
private List<statusEnumOption> verificationStatusOptions;
//危险程度列表
private List<statusEnumOption> criticalityOptions;
//严重程度列表
private List<statusEnumOption> severityOptions;
/**
* 状态
*/
@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,56 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 输血贴
*
* @author yuxj
* @date 2025-04-11
*/
@Data
@Accessors(chain = true)
public class BloodTransfusionPatchDto {
/** 患者姓名 */
private String patientName;
/** 性别编码 */
private Integer genderEnum;
private String genderEnum_enumText;
/** 生日 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthDate;
/** 病人年龄 */
private String age;
/**
* 项目名称
*/
private String activityName;
/**
* 项目编码
*/
private String busNo;
/**
* 科室
*/
private String orgName;
/**
* 医生
*/
private String practitionerName;
}

View File

@@ -0,0 +1,60 @@
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 门诊输液患者显示列表
*
* @author liuhr
* @date 2025/3/13
*/
@Data
@Accessors(chain = true)
public class OutpatientInfusionPatientDto {
/** 服务申请管理表ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long serviceId;
/** 处方号 */
private String prescriptionNo;
/** 就诊号 */
private String encounterBusNo;
/** 病人ID前台显示用 */
private String patientBusNo;
/** 就诊id */
@JsonSerialize(using = ToStringSerializer.class)
private Long 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,183 @@
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 门诊输液记录Dto
*
* @author liuhr
* @date 2025/3/12
*/
@Data
@Accessors(chain = true)
public class OutpatientInfusionRecordDto {
/**
* 服务申请管理表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long serviceId;
/**
* 诊疗名称
*/
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,35 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 门诊工作站初始化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,60 @@
/*
* 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,120 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 处方信息
*
* @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 BigDecimal 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 BigDecimal medQuantity;
/** 排序号 */
private Integer sortNumber;
/** 执行次数 */
private Integer performCount;
/** 取消执行次数 */
private Integer cancelCount;
/** 用法 */
@Dict(dictCode = "method_code")
private String methodCode;
private String methodCode_dictText;
/** 用药天数 */
private Integer dispensePerDuration;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 皮试检查药品批号 Dto
*/
@Data
@Accessors(chain = true)
public class SkinTestMedLotNumberDto {
/** 药品ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long medicationId;
/**
* 供应商
*/
private String supplierName;
/**
* 批次号
*/
private String lotNumber;
}

View File

@@ -0,0 +1,86 @@
/*
* 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 com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 皮试检查 查询Dto
*/
@Data
@Accessors(chain = true)
public class SkinTestQueryDto {
/** 医嘱请求D */
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId;
/** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** 药品ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long medicationId;
/**
* 药品名称
*/
private String medicationName;
/**
* 批次号集合
*/
private List<SkinTestMedLotNumberDto> lotNumberList;
/** 皮试记录ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long recordId;
/**
* 批次号
*/
private String lotNumber;
/**
* 记录日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date recordedDate;
/** 临床状况 */
private Integer clinicalStatusEnum;
private String clinicalStatusEnum_enumText;
/** 验证状态 */
private Integer verificationStatusEnum;
private String verificationStatusEnum_enumText;
/** 记录者 */
@JsonSerialize(using = ToStringSerializer.class)
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
private Long practitionerId;
private String practitionerId_dictText;
/** 断言者 */
@JsonSerialize(using = ToStringSerializer.class)
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
private Long checkPractitionerId;
private String checkPractitionerId_dictText;
}

View File

@@ -0,0 +1,66 @@
/*
* 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 org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 皮试检查 保存Dto
*/
@Data
@Accessors(chain = true)
public class SkinTestSaveDto {
/** 皮试记录ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long recordId;
/** 医嘱请求D */
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId;
/** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** 药品ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long medicationId;
/**
* 批次号
*/
private String lotNumber;
/**
* 记录日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date recordedDate;
/** 临床状况 */
private Integer clinicalStatusEnum;
/** 验证状态 */
private Integer verificationStatusEnum;
/** 记录者 */
private Long practitionerId;
/** 断言者 */
private Long checkPractitionerId;
}

View File

@@ -0,0 +1,75 @@
package com.openhis.web.outpatientmanage.mapper;
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 org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 门诊管理
*
* @author liuhr
* @date 2025/3/5
*/
public interface OutpatientInfusionAppMapper {
/**
* 门诊输液患者记录分页查询
*
* @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,35 @@
package com.openhis.web.outpatientmanage.mapper;
import com.openhis.web.outpatientmanage.dto.SkinTestMedLotNumberDto;
import com.openhis.web.outpatientmanage.dto.SkinTestQueryDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 门诊皮试
*/
@Repository
public interface OutpatientSkinTestAppMapper {
/**
* 查询皮试记录
*
* @param encounterId 就诊id
* @param activityId 皮试检查的定义id
* @param requestStatus 请求状态
* @return 皮试记录
*/
List<SkinTestQueryDto> getRecordInfo(@Param("encounterId") Long encounterId, @Param("activityId") Long activityId,
@Param("requestStatus") Integer requestStatus);
/**
* 查询药品库存批次号信息
*
* @param itemTable 药品定义表名
* @return 药品库存批次号信息
*/
List<SkinTestMedLotNumberDto> getMedLotNumber(@Param("itemTable") String itemTable);
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.mapper;
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.common.dto.PerformRecordDto;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface OutpatientTreatmentAppMapper {
/**
* 就诊病人列表分页查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @param amb 就诊类型:门诊
* @param completed 请求状态:已完成
* @param cancelled 请求状态:取消
* @return 就诊病人列表
*/
Page<OutpatientTreatmentEncounterDto> selectEncounterInfoListPage(
@Param("page") Page<OutpatientTreatmentEncounterDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper, @Param("amb") Integer amb,
@Param("completed") Integer completed, @Param("cancelled") Integer cancelled);
/**
* 处置项目查询
*
* @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);
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
BloodTransfusionPatchDto getBloodTransfusionPatch(@Param("requestId") Long requestId);
}