diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IDispenseAddAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IDispenseAddAppService.java new file mode 100644 index 00000000..abd8b1b0 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IDispenseAddAppService.java @@ -0,0 +1,22 @@ +package com.openhis.web.pharmacymanage.appservice; + +import com.openhis.medication.domain.MedicationRequest; + +import java.util.List; + +/** + * 新增药品发放草稿 应用实现接口 + * + * @author wangyang + * @date 2025/3/14 + */ +public interface IDispenseAddAppService { + + /** + * 新增药品发放草稿 + * + * @param medicationRequestList + * @return 无 + */ + boolean addMedicationDispense(List medicationRequestList); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java new file mode 100644 index 00000000..8978f2e4 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java @@ -0,0 +1,61 @@ +package com.openhis.web.pharmacymanage.appservice; + +import com.core.common.core.domain.R; +import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam; + +import javax.servlet.http.HttpServletRequest; + +/** + * 处方管理 应用实现接口 + * + * @author wangyang + * @date 2025/3/18 + */ +public interface IWesternMedicineDispenseAppService { + + /** + * 页面初始化 + * + * @return 初始化信息 + */ + R init(); + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人分页列表 + */ + R getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, + Integer pageNo, + Integer pageSize, + HttpServletRequest request); + + + /** + * 查询处方单列表 + * @param encounterId 就诊号 + * @return 处方单列表 + */ + R getPrescriptionInfo(Long encounterId); + + /** + * 处方单核对发药 + * @param prescriptionNo 处方号 + * @return 处理结果 + */ + R medicineDispense(String prescriptionNo); + + + /** + * 处方单作废 + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + * @return 处理结果 + */ + R medicineCancel(String prescriptionNo, + Integer notPerformedReasonEnum); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IDispenseAddAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IDispenseAddAppServiceImpl.java new file mode 100644 index 00000000..0d385b9b --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IDispenseAddAppServiceImpl.java @@ -0,0 +1,88 @@ +package com.openhis.web.pharmacymanage.appservice.impl; + +import com.core.common.utils.DateUtils; +import com.openhis.common.enums.DispenseStatus; +import com.openhis.medication.domain.MedicationDispense; +import com.openhis.medication.domain.MedicationRequest; +import com.openhis.medication.service.IMedicationDispenseService; +import com.openhis.web.pharmacymanage.appservice.IDispenseAddAppService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 西药发放 应用实现类 + * + * @author wangyang + * @date 2025/3/14 + */ +@Service +public class IDispenseAddAppServiceImpl implements IDispenseAddAppService { + + @Resource + IMedicationDispenseService iMedicationDispenseService; + + /** + * 新增药品发放草稿 + * + * @param medicationRequestList 药品请求数据 + * @return 无 + */ + @Override + public boolean addMedicationDispense(List medicationRequestList) { + + List medicationDispenseList = new ArrayList<>(); + MedicationDispense medicationDispense; + + for (MedicationRequest medicationRequest : medicationRequestList) { + + medicationDispense = new MedicationDispense(); + + // 药品发放id + medicationDispense.setBusNo(medicationRequest.getBusNo()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatus.DRAFT.getValue()); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药类型 + medicationDispense.setDispenseEnum(medicationRequest.getCategoryEnum()); + // 药品编码 + medicationDispense.setMedicationId(medicationRequest.getMedicationId()); + // 请求数量 + medicationDispense.setQuantity(medicationRequest.getQuantity()); + // 请求单位编码 + medicationDispense.setUnitCode(medicationRequest.getUnitCode()); + // 产品批号 + medicationDispense.setLotNumber(medicationRequest.getLotNumber()); + // 患者id + medicationDispense.setPatientId(medicationRequest.getPatientId()); + // 就诊id + medicationDispense.setEncounterId(medicationRequest.getEncounterId()); + // 支持用药信息 + medicationDispense.setSupportInfo(medicationRequest.getSupportInfo()); + // 发药人 + medicationDispense.setPractitionerId(0L); + // 发放药房 + medicationDispense.setLocationId(medicationRequest.getPerformOrg()); + // 药品请求id + medicationDispense.setMedReqId(medicationRequest.getId()); + // 已发药数量 + medicationDispense.setDispenseQuantity(0); + // 用法 + medicationDispense.setMethodCode(medicationRequest.getMethodCode()); + // 用药频次 + medicationDispense.setFrequencyCode(medicationRequest.getRateCode()); + // 单次剂量 + medicationDispense.setDose(medicationRequest.getDose()); + // 剂量单位 + medicationDispense.setDoseUnitCode(medicationRequest.getDoseUnitCode()); + // 单次最大剂量 + medicationDispense.setMaxUnit(medicationRequest.getMaxDose()); + + medicationDispenseList.add(medicationDispense); + } + return iMedicationDispenseService.saveBatch(medicationDispenseList); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java new file mode 100644 index 00000000..a819ef33 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java @@ -0,0 +1,264 @@ +package com.openhis.web.pharmacymanage.appservice.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.DateUtils; +import com.core.common.utils.MessageUtils; +import com.core.common.utils.SecurityUtils; +import com.openhis.administration.domain.Organization; +import com.openhis.administration.service.IOrganizationService; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.DispenseStatusEnum; +import com.openhis.common.enums.NotPerformedReasonEnum; +import com.openhis.common.enums.OrganizationClass; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.medication.domain.MedicationDispense; +import com.openhis.medication.service.IMedicationDispenseService; +import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService; +import com.openhis.web.pharmacymanage.dto.*; +import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper; +import com.openhis.workflow.domain.InventoryItem; +import com.openhis.workflow.service.IInventoryItemService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 西药发放 应用实现类 + * + * @author wangyang + * @date 2025/3/14 + */ +@Service +public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService { + + @Autowired + private IOrganizationService iOrganizationService; + + @Autowired + IMedicationDispenseService iMedicationDispenseService; + + @Autowired + IInventoryItemService iInventoryItemService; + + @Autowired + WesternMedicineDispenseMapper westernMedicineDispenseMapper; + + /** + * 获取页面初始化信息 + * + * @return 初始化信息 + */ + @Override + public R init() { + + PageInitDto initDto = new PageInitDto(); + + // 获取科室下拉选列表 + List organizationList = iOrganizationService.getList(OrganizationClass.CLINIC.getValue()); + List organizationOptions = organizationList.stream() + .map(organization -> new PageInitDto.DepartmentOption(organization.getId(), + organization.getName())).collect(Collectors.toList()); + + // 未发药原因下拉选列表 + List notPerformedReasonOptions = + Stream.of(NotPerformedReasonEnum.values()).map(notPerformedReason -> + new PageInitDto.NotPerformedReasonOption(notPerformedReason.getValue(), + notPerformedReason.getInfo())).collect(Collectors.toList()); + + initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions); + return R.ok(initDto); + } + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人列表 + */ + @Override + public R getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, + Integer pageNo, + Integer pageSize, + HttpServletRequest request) { + + // 查询条件设定 + String condition = encounterInfoSearchParam.getCondition(); + if (!condition.isEmpty()){ + Pattern pattern = Pattern.compile(".*\\d.*"); + Matcher matcher = pattern.matcher(encounterInfoSearchParam.getCondition()); + encounterInfoSearchParam.setIdCard(matcher.find() ? condition:""); + encounterInfoSearchParam.setPatientName(!matcher.find() ? condition:""); + } + + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam,null,null, request); + + // 查询就诊病人列表 + Page encounterInfoPageDto = westernMedicineDispenseMapper.selectEncounterInfoListPage( + new Page<>(pageNo, pageSize), queryWrapper); + + return R.ok(encounterInfoPageDto); + } + + /** + * 查询处方单列表 + * @param encounterId 就诊号 + * @return 处方单列表 + */ + @Override + public R getPrescriptionInfo(Long encounterId) { + + // 患者基本信息查询 + PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper. + selectPrescriptionPatientInfo(encounterId); + + // 处方单信息查询 + List prescriptionMedicineInfoList = westernMedicineDispenseMapper. + selectPrescriptionMedicineInfoList(encounterId); + + // 计算合计金额 + if(!prescriptionMedicineInfoList.isEmpty()) { + BigDecimal totalPrice = new BigDecimal(0); + for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) { + totalPrice.add(item.getTotal_price()); + } + prescriptionPatientInfoDto.setTotalPrice(totalPrice); + } + + PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto(); + prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto); + prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList); + + return R.ok(prescriptionInfoDto); + } + + /** + * 处方单核对发药 + * @param prescriptionNo 处方号 + * @return 处理结果 + */ + @Override + public R medicineDispense(String prescriptionNo) { + + List medicationDispenseList = new ArrayList<>(); + List inventoryItemList = new ArrayList<>(); + boolean iMedicationDispenseUpdFlg = true; + boolean iInventoryItemUpdFlg = true; + + // 获取药品待发放和库存信息 + List dispenseInventoryList = westernMedicineDispenseMapper. + selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo); + if(!dispenseInventoryList.isEmpty()){ + MedicationDispense medicationDispense; + InventoryItem inventoryItem; + for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) { + + // 药品发放表项目设定 + medicationDispense = new MedicationDispense(); + // id + medicationDispense.setId(dispenseInventoryDto.getDispenseId()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatusEnum.COMPLETED.getValue()); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药人 + medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId()); + // 已发药数量 + medicationDispense.setDispenseQuantity(dispenseInventoryDto.getDispenseQuantity()); + // 配药时间 + medicationDispense.setPrepareTime(DateUtils.getNowDate()); + // 发药时间 + medicationDispense.setDispenseTime(DateUtils.getNowDate()); + medicationDispenseList.add(medicationDispense); + + // 库存表项目设定 + inventoryItem = new InventoryItem(); + // 库存数量 + if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto. + getInventoryBaseUnitCode())) { + + // id + inventoryItem.setId(dispenseInventoryDto.getInventoryId()); + // 包装数量 + inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())); + // 拆零数量(拆零比×包装数量) + inventoryItem.setMinQuantity(dispenseInventoryDto.getPartPercent(). + multiply(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()))); + } else if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto. + getInventoryMinUnitCode())) { + // 拆零数量 + inventoryItem.setMinQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())); + // 包装数量(拆零数量÷拆零比) + inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()). + divide(dispenseInventoryDto.getPartPercent(),RoundingMode.HALF_UP)); + } + inventoryItemList.add(inventoryItem); + } + // 药品发放更新 + iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList); + + // 库存更新 + iInventoryItemUpdFlg = iInventoryItemService.updateBatchById(inventoryItemList); + } + return iMedicationDispenseUpdFlg && iInventoryItemUpdFlg ? + R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null)); + } + + /** + * 作废 + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + * @return 处理结果 + */ + @Override + public R medicineCancel(String prescriptionNo, + Integer notPerformedReasonEnum) { + + List medicationDispenseList = new ArrayList<>(); + boolean iMedicationDispenseUpdFlg = true; + + // 获取药品待发放记录 + List dispenseInventoryList = westernMedicineDispenseMapper. + selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo); + if(!dispenseInventoryList.isEmpty()){ + MedicationDispense medicationDispense; + for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) { + + // 药品发放表项目设定 + medicationDispense = new MedicationDispense(); + // id + medicationDispense.setId(dispenseInventoryDto.getDispenseId()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatusEnum.DECLINED.getValue()); + // 未发药原因 + medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药人 + medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId()); + medicationDispenseList.add(medicationDispense); + } + // 药品发放更新 + iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList); + } + return iMedicationDispenseUpdFlg? + R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null)); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java new file mode 100644 index 00000000..63701cb3 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java @@ -0,0 +1,90 @@ +package com.openhis.web.pharmacymanage.controller; + +import com.core.common.core.domain.R; +import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService; +import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + * 西药发药 + * + * @author wangyang + * @date 2025/3/14 + */ +@RestController +@RequestMapping("/pharmacy-manage/western-medicine-dispense") +@Slf4j +@AllArgsConstructor +public class WesternMedicineDispenseController { + + @Autowired + public IWesternMedicineDispenseAppService iWesternMedicineDispenseService; + + /** + * 获取页面初始化信息 + * + * @return 初始化信息 + */ + @GetMapping(value = "/init") + public R medicineDispenseInit() { + return iWesternMedicineDispenseService.init(); + } + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人列表 + */ + @GetMapping("/encounter-list") + public R getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest request) { + return iWesternMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam, + pageNo, pageSize, request); + } + + /** + * 处方单查询 + * + * @param encounterId 就诊Id + */ + @GetMapping("/prescription-list") + public R getPatientInfoList(@RequestParam(value = "encounterId") Long encounterId) { + return iWesternMedicineDispenseService.getPrescriptionInfo(encounterId); + } + + /** + * 核对发药 + * + * @param prescriptionNo 处方号 + */ + @GetMapping("/medicine-dispense") + public R medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) { + return iWesternMedicineDispenseService.medicineDispense(prescriptionNo); + } + + /** + * 作废 + * + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + */ + @GetMapping("/medicine-cancel") + public R medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo, + @RequestParam(value = "prescriptionNo") Integer notPerformedReasonEnum) { + return iWesternMedicineDispenseService.medicineCancel(prescriptionNo,notPerformedReasonEnum); + } +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java new file mode 100644 index 00000000..1e0e470f --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java @@ -0,0 +1,47 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 药品发放和库存表连接信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class DispenseInventoryDto { + + /** 药品发放表主键ID */ + private Long dispenseId; + + /** 请求单位编码 */ + private String dispenseUnitCode; + + /** 请求数量 */ + private Integer dispenseQuantity; + + /** 库存项目表主键ID */ + private Long inventoryId; + + /** 常规单位 */ + private String inventoryBaseUnitCode; + + /** 当前库存数量(常规单位) */ + private BigDecimal inventoryBaseQuantity; + + /** 最小单位 */ + private String inventoryMinUnitCode; + + /** 当前库存数量(最小单位数量) */ + private BigDecimal inventoryMinQuantity; + + /** 拆零比 */ + private BigDecimal partPercent; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java new file mode 100644 index 00000000..d8cb007f --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java @@ -0,0 +1,38 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 就诊人员列表 + * + * @author WangYang + * @date 2025-03-18 + */ +@Data +@Accessors(chain = true) +public class EncounterInfoPageDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 就诊ID */ + private Long encounterId; + + /** 科室 */ + private String departmentName; + + /** 患者姓名 */ + private String patientName; + + /** 性别 */ + private Integer genderEnum; + private String genderEnum_enumText; + + /** 就诊日期 */ + private String encounterDate; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java new file mode 100644 index 00000000..e9ca23a1 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java @@ -0,0 +1,32 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 处方列表查询条件 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class EncounterInfoSearchParam implements Serializable { + + /** 科室 */ + private long departmentId; + + /** 患者姓名或者证件号 */ + private String condition; + + /** 患者姓名 */ + private String patientName; + + /** 证件号 */ + private String idCard; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java new file mode 100644 index 00000000..2ec69933 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java @@ -0,0 +1,49 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PageInitDto { + + /** 科室列表 */ + private List departmentOptions; + + /** 未发药原因 */ + private List notPerformedReasonOptions; + + @Data + public static class DepartmentOption { + + private Long value; + private String label; + + public DepartmentOption(Long value, String label) { + this.value = value; + this.label = label; + } + } + + @Data + public static class NotPerformedReasonOption { + + private Integer value; + private String label; + + public NotPerformedReasonOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java new file mode 100644 index 00000000..aa11d25d --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java @@ -0,0 +1,29 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * 处方信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 患者基本信息 */ + private PrescriptionPatientInfoDto prescriptionPatientInfoDto; + + /** 处方药品信息 */ + List prescriptionMedicineInfoDtoList; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java new file mode 100644 index 00000000..90c8d618 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java @@ -0,0 +1,77 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 就诊人员列表 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionMedicineInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 科室 */ + private String departmentName; + + /** 开单医生 */ + private String doctorName; + + /** 处方号 */ + private String prescriptionNo; + + /** 药品名称 */ + private String medicineName; + + /** 规格 */ + private String totalVolume; + + /** 单次剂量 */ + private BigDecimal dose; + + /** 用药频次 */ + private String rateCode; + + /** 用法 */ + private String methodCode; + + /** 剂量单位 */ + private String doseUnitCode; + + /** 单次最大剂量 */ + private BigDecimal maxDose; + + /** 首次用量 */ + private BigDecimal firstDose; + + /** 首次持续时间 */ + private String firstDuration; + + /** 给药间隔 */ + private String dispenseInterval; + + /** 单次发药数 */ + private Integer dispensePerQuantity; + + /** 每次发药供应天数 */ + private Integer dispensePerDuration; + + /** 数量 */ + private Integer quantity; + + /** 单价 */ + private BigDecimal unitPrice; + + /** 金额 */ + private BigDecimal total_price; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java new file mode 100644 index 00000000..69182e78 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java @@ -0,0 +1,56 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 患者基本信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionPatientInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 姓名 */ + private String patientName; + + /** 性别 */ + private Integer genderEnum; + private String genderEnum_enumText; + + /** 生日 */ + private Date birth_date; + + /** 年龄 */ + private String age; + + /** 合同类型 */ + private Integer categoryEnum; + private String categoryEnum_enumText; + + /** 证件号 */ + private String idCard; + + /** 就诊科室 */ + private String organizationName; + + /** 就诊日期 */ + private String encounterDate; + + /** 门诊诊断 */ + private String diagnoseName; + + /** 总金额 */ + private BigDecimal totalPrice; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java new file mode 100644 index 00000000..5e367ae9 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java @@ -0,0 +1,48 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.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.pharmacymanage.dto.*; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface WesternMedicineDispenseMapper { + + /** + * 就诊病人列表分页查询 + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 就诊病人列表 + */ + Page selectEncounterInfoListPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 患者基本信息查询 + * @param encounterId 就诊号 + * @return 患者基本信息 + */ + PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId); + + + /** + * 处方单查询 + * @param encounterId 就诊号 + * @return 处方单列表 + */ + List selectPrescriptionMedicineInfoList(@Param("encounterId") Long encounterId); + + /** + * 待发药和库存信息查询 + * @param prescriptionNo 处方号 + * @return 待发药信息 + */ + List selectDispenseInventoryInfoByPrescriptionNo(@Param("prescriptionNo") String prescriptionNo); +} diff --git a/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml new file mode 100644 index 00000000..78be848a --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatusEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatusEnum.java new file mode 100644 index 00000000..07943141 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatusEnum.java @@ -0,0 +1,71 @@ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 药品请求状态 + * + * @author wangyang + * @date 2025-03-14 + */ +@Getter +@AllArgsConstructor +public enum DispenseStatusEnum implements HisEnumInterface { + + /** + * 草稿 + */ + DRAFT(0, "DR", "草稿"), + + /** + * 待配药 + */ + PREPARATION(1, "PR", "待配药"), + + /** + * 待发药 + */ + IN_PROGRESS(2, "IN", "待发药"), + + /** + * 已发药 + */ + COMPLETED(3, "CO", "已发药"), + + /** + * 暂停 + */ + ON_HOLD(4, "ON", "暂停"), + + /** + * 停止 + */ + STOPPED(5, "ST", "停止"), + + /** + * 未知 + */ + UNKNOWN(6, "UN", "未知"), + + /** + * 拒绝发药 已汇总,部分发药,部分退药,已退药 + */ + DECLINED(7, "DE", "拒绝发药 已汇总,部分发药,部分退药,已退药"); + + private Integer value; + private String code; + private String info; + + public static DispenseStatusEnum getByValue(Integer value) { + if (value == null) { + return null; + } + for (DispenseStatusEnum val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java new file mode 100644 index 00000000..e9eb5288 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java @@ -0,0 +1,136 @@ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 药品请求状态 + * + * @author wangyang + * @date 2025-03-14 + */ +@Getter +@AllArgsConstructor +public enum NotPerformedReasonEnum implements HisEnumInterface { + + /** + * 订单已停止 + */ + ORDER_STOPPED(1,"OS", "订单已停止"), + + /** + * 过时订单 + */ + OUTDATED_ORDER(2, "OO", "过时订单"), + + /** + * 不完整的数据 + */ + INCOMPLETE_DATA(3, "ID", "不完整的数据"), + + /** + * 产品不可用 + */ + PRODUCT_NOT_AVAILABLE(4, "PNA", "产品不可用"), + + /** + * 道德/宗教 + */ + MORAL_RELIGIOUS(5, "MR", "道德/宗教"), + + /** + * 无法提供护理 + */ + UNABLE_PROVIDE(6, "UP", "无法提供护理"), + + /** + * 先尝试其他治疗方法 + */ + OTHER_TREATMENT(7, "OT", "先尝试其他治疗方法"), + + /** + * 处方/请求需要澄清 + */ + PRESCRIPTION_REQUEST_CLARIFICATION(8, "PRC", "处方/请求需要澄清"), + + /** + * 药物水平过高 + */ + EXCESSIVE_DRUG_LEVELS(9, "EDL", "药物水平过高"), + + /** + * 入院 + */ + HOSPITALIZED(10, "HO", "入院"), + + /** + * 实验室干扰问题 + */ + LABORATORY_INTERFERENCE_ISSUE(11, "LII", "实验室干扰问题"), + + /** + * 患者不可用 + */ + PATIENT_UNAVAILABLE(12, "PU", "患者不可用"), + + /** + * 患者怀孕或哺乳 + */ + PATIENT_PREGNANT_BREASTFEEDING(13, "PPB", "患者怀孕或哺乳"), + + /** + * 过敏 + */ + ALLERGY(14, "AL", "过敏"), + + /** + * 药物与另一种药物相互作用 + */ + ANOTHER_DRUG(15, "AD", "药物与另一种药物相互作用"), + + /** + * 重复治疗 + */ + REPEAT_TREATMENT(16, "RT", "重复治疗"), + + /** + * 疑似不耐受 + */ + SUSPECTED_INTOLERANCE(17, "SI", "疑似不耐受"), + + /** + * 计划手术的患者 + */ + PATIENTS_PLANNING_SURGERY(18, "PPS", "计划手术的患者"), + + /** + * 冲洗 + */ + WASH(19, "WA", "冲洗"), + + /** + * 药物缺货 + */ + DRUG_SHORTAGE(20, "DS", "药物缺货"), + + /** + * 药物不可用 + */ + MEDICATION_NOT_AVAILABLE(21, "MNA", "药物不可用"); + + private Integer value; + private String code; + private String info; + + public static NotPerformedReasonEnum getByValue(Integer value) { + if (value == null) { + return null; + } + for (NotPerformedReasonEnum val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java index dd66aa3b..d868ba68 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java @@ -3,6 +3,8 @@ package com.openhis.administration.service; import com.baomidou.mybatisplus.extension.service.IService; import com.openhis.administration.domain.Organization; +import java.util.List; + /** * 机构管理Service接口 * @@ -27,4 +29,11 @@ public interface IOrganizationService extends IService { */ boolean inactiveOrg(Long orgId); + /** + * 获取机构下拉列表 + * + * @param classEnum 机构分类 + * @return 机构下拉列表 + */ + List getList(Integer classEnum); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java index 2c66cfb7..af19a220 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java @@ -1,13 +1,15 @@ package com.openhis.administration.service.impl; -import org.springframework.stereotype.Service; - +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.Organization; import com.openhis.administration.mapper.OrganizationMapper; import com.openhis.administration.service.IOrganizationService; import com.openhis.common.enums.AccountStatus; +import org.springframework.stereotype.Service; + +import java.util.List; /** * 机构管理Service业务层处理 @@ -45,4 +47,15 @@ public class OrganizationServiceImpl extends ServiceImpl 0; } + /** + * 获取机构下拉列表 + * + * @param classEnum 机构分类 + * @return 机构下拉列表 + */ + @Override + public List getList(Integer classEnum) { + return baseMapper.selectList(new LambdaQueryWrapper().select(Organization::getId, Organization::getName) + .eq(Organization::getClassEnum, classEnum)); + } } \ No newline at end of file