From 24c11b86ca58755bf7560a02179c215ae0db5cda Mon Sep 17 00:00:00 2001 From: liuhongrui Date: Sun, 30 Mar 2025 11:10:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=8A=E7=96=97=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/openhis/common/enums/AssignSeqEnum.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java index a843b338..2ff82bf6 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java @@ -64,7 +64,11 @@ public enum AssignSeqEnum { /** * 支付编码 */ - PAYMENT_NO("11", "支付编码", "SF"); + PAYMENT_NO("11", "支付编码", "SF"), + /** + * 诊疗项目编码 + */ + ACTIVITY_DEFINITION_NUM("11", "诊疗编码", "AD");; private final String code; private final String info; From 73f15d7ee9d88fbceeb2177ff1f991ee4fd0ebd9 Mon Sep 17 00:00:00 2001 From: "Zhang.WH" Date: Sun, 30 Mar 2025 12:41:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=80=E8=B4=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IOutpatientRefundAppService.java | 20 ++- .../impl/OutpatientRefundAppServiceImpl.java | 118 ++++++++++++++++-- .../OutpatientRefundController.java | 26 +++- .../dto/EncounterPatientPageDto.java | 27 ++++ .../dto/EncounterPatientPageParam.java | 10 +- .../web/chargemanage/dto/RefundItemDto.java | 33 ++++- .../mapper/OutpatientRefundAppMapper.java | 18 +++ .../impl/ReceiptApprovalAppServiceImpl.java | 3 +- .../main/resources/i18n/messages.properties | 6 +- .../OutpatientChargeAppMapper.xml | 29 ++--- .../OutpatientRefundAppMapper.xml | 114 +++++++++++++++-- .../common/constant/PromptMsgConstant.java | 17 +++ .../openhis/common/enums/AssignSeqEnum.java | 2 +- .../common/enums/ChargeItemStatus.java | 17 ++- .../common/enums/ContractCategory.java | 50 ++++++++ .../openhis/common/enums/DispenseStatus.java | 2 +- .../common/enums/NotPerformedReason.java | 35 ++++++ .../openhis/common/enums/RequestStatus.java | 4 +- .../service/IChargeItemService.java | 7 ++ .../service/impl/ChargeItemServiceImpl.java | 16 ++- .../service/impl/OrganizationServiceImpl.java | 8 +- .../financial/domain/PaymentRecDetail.java | 6 +- .../domain/PaymentReconciliation.java | 5 +- .../service/IMedicationDispenseService.java | 8 ++ .../impl/MedicationDispenseServiceImpl.java | 14 +++ .../service/IDeviceDispenseService.java | 9 ++ .../service/IServiceRequestService.java | 12 +- .../impl/DeviceDispenseServiceImpl.java | 19 ++- .../impl/ServiceRequestServiceImpl.java | 24 ++-- .../impl/SupplyRequestServiceImpl.java | 27 ++-- 30 files changed, 600 insertions(+), 86 deletions(-) create mode 100644 openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java create mode 100644 openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java index 9386da1c..6d6216ac 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java @@ -3,10 +3,13 @@ */ package com.openhis.web.chargemanage.appservice; -import com.core.common.core.domain.R; - import java.util.List; +import javax.servlet.http.HttpServletRequest; + +import com.core.common.core.domain.R; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; + /** * 门诊退费 service * @@ -30,4 +33,17 @@ public interface IOutpatientRefundAppService { * @return 操作结果 */ R refundPayment(List paymentIdList); + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java index fdc0baaf..21f1f6d7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java @@ -3,20 +3,37 @@ */ package com.openhis.web.chargemanage.appservice.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +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.AgeCalculatorUtil; +import com.core.common.utils.MessageUtils; import com.openhis.administration.service.IChargeItemService; import com.openhis.common.constant.CommonConstants; -import com.openhis.common.enums.PaymentStatus; +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.financial.service.IPaymentReconciliationService; +import com.openhis.medication.service.IMedicationDispenseService; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; import com.openhis.web.chargemanage.dto.RefundItemDto; import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper; +import com.openhis.workflow.service.IDeviceDispenseService; +import com.openhis.workflow.service.IServiceRequestService; /** * 门诊退费 impl @@ -33,6 +50,12 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi private IPaymentReconciliationService paymentReconciliationService; @Autowired private IChargeItemService chargeItemService; + @Autowired + private IMedicationDispenseService medicationDispenseService; + @Autowired + private IDeviceDispenseService deviceDispenseService; + @Autowired + private IServiceRequestService serviceRequestService; /** * 根据就诊id查询患者的账单 @@ -56,20 +79,97 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi */ @Override public R refundPayment(List paymentIdList) { - - // 医生同意退费 - // 查询所有的chargeid,对应生成一个负的chargeitem - // 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行 - // 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药) - + // todo:医生同意退费(审批流) // 根据支付id获取对应收费项目的id列表 List chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList); - //根据收费项目id列表查询退费项 + // 根据收费项目id列表查询退费项 List refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE); - return null; + List medDisIdList = new ArrayList<>(); + List devDisIdList = new ArrayList<>(); + List serReqIdList = new ArrayList<>(); + + for (RefundItemDto refundItem : refundItemList) { + if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(refundItem.getServiceTable())) { + + // 药品需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"药品"})); + } else { + // todo:审批流药师同意退费 + medDisIdList.add(refundItem.getDispenseId()); + } + } else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 诊疗项目需医技科室同意退费 + if (RequestStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00002, null)); + } else { + // todo:审批流医技师同意退费 + serReqIdList.add(refundItem.getServiceId()); + } + } else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 耗材需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"耗材"})); + } else { + devDisIdList.add(refundItem.getDispenseId()); + } + } + } + // 更新收费状态:已退费 + chargeItemService.updateRefundChargeStatus(chargeItemIdList); + // 更新未发放药品状态:停止发放,停止原因:退费 + medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新未发放耗材状态:停止发放,停止原因:退费 + deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新执行诊疗状态:停止 + serviceRequestService.updateStopRequestStatus(serReqIdList); + // 返回退费成功信息 + return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"处方退费"})); + } + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @Override + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request) { + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper( + encounterPatientPageParam, searchKey, + new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr, + CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo, + CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)), + request); + // 就诊患者分页列表 + Page encounterPatientPage = + outpatientRefundAppMapper.selectBilledEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper, + ChargeItemStatus.BILLED.getValue(), AccountType.MEDICAL_INSURANCE.getValue()); + + encounterPatientPage.getRecords().forEach(e -> { + // 性别枚举 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 收费状态枚举 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum())); + // 计算年龄 + e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate())); + // 合同类型枚举 + e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(ContractCategory.class, e.getCategoryEnum())); + }); + return R.ok(encounterPatientPage); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java index 174d080b..4e195c6f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java @@ -3,17 +3,20 @@ */ package com.openhis.web.chargemanage.controller; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import java.util.List; - /** * 门诊退费 controller * @@ -29,6 +32,25 @@ public class OutpatientRefundController { @Autowired private IOutpatientRefundAppService outpatientRefundAppService; + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @GetMapping(value = "/encounter-patient-page") + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(outpatientRefundAppService.getBilledEncounterPatientPage(encounterPatientPageParam, searchKey, + pageNo, pageSize, request)); + } + /** * 根据就诊id查询患者的账单 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java index f38b4f45..a8231c02 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java @@ -8,6 +8,7 @@ import java.util.Date; 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; @@ -72,7 +73,9 @@ public class EncounterPatientPageDto { /** * 账户类型编码 */ + @Dict(dictCode = "account_code") private String typeCode; + private String typeCode_dictText; /** * 账户余额 @@ -92,4 +95,28 @@ public class EncounterPatientPageDto { /** 收费状态 */ private Integer statusEnum; private String statusEnum_enumText; + + /** + * 医保总额 + */ + private BigDecimal insurancePrice; + + /** + * 自费总额 + */ + private BigDecimal selfPrice; + + /** + * 付款总额 + */ + private BigDecimal totalAmount; + + /** 合同类型 */ + private Integer categoryEnum; + private String categoryEnum_enumText; + + /** + * 结算时间 + */ + private Date billDate; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java index db852eae..ff776799 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java @@ -53,13 +53,13 @@ public class EncounterPatientPageParam { */ private Date startTime; + /** + * 收费时间 + */ + private Date billTime; + /** * 收费状态 */ private Integer statusEnum; - - /** - * 退款标识 - */ - private Integer refundFlag; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java index c4ce3eb4..1b9212e3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java @@ -14,4 +14,35 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class RefundItemDto {} +public class RefundItemDto { + + /** 收费ID */ + private Long chargeId; + + /** 医疗服务所在表 */ + private String serviceTable; + + /** 医疗服务ID */ + private Long serviceId; + + /** 请求编码 */ + private String busNo; + + /** 请求数量 */ + private Integer quantity; + + /** 请求单位编码 */ + private String unitCode; + + /** 退款状态 */ + private Integer refundStatus; + + /** 项目id */ + private Long itemId; + + /** 发放id */ + private Long dispenseId; + + /** 项目名 */ + private Long itemName; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java index a4e7132c..293d17b6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java @@ -8,6 +8,11 @@ import java.util.List; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; import com.openhis.web.chargemanage.dto.RefundItemDto; @@ -47,4 +52,17 @@ public interface OutpatientRefundAppMapper { @Param("medMedicationRequest") String medMedicationRequest, @Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest, @Param("three") Integer three); + + /** + * 查询已结算就诊患者分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @param billed 收费状态:已结算 + * @param insurance 账户类型:医保 + * @return 已结算就诊患者分页列表 + */ + Page selectBilledEncounterPatientPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("billed") Integer billed, + @Param("insurance") Integer insurance); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java index 4cd470a5..c9a63fe7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java @@ -246,6 +246,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService List chargeDetailList) { List resultList = new ArrayList<>(); + // todo:同一批次不能改价 // 将各个项目的定价信息按项目id分组 Map> chargeDetailGroup = chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId)); @@ -307,7 +308,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService */ private ChargeItemDefDetail addChargeItemDefApp(String conditionValue, BigDecimal sellPrice, Long definitionId) { ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail(); - // todo:命中条件或建成字典枚举,此处为批次号,单位 + // todo:命中条件或建成字典枚举,此处为批次号,单位,优先级加一 chargeItemDefDetail // 命中值 .setConditionValue(conditionValue) diff --git a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties index 31c39ddf..653376ce 100644 --- a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties +++ b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties @@ -31,9 +31,6 @@ no.update.permission=您没有修改数据的权限,请联系管理员添加 no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] - - - apl.common.M00001={0}添加成功 apl.common.M00002={0}保存成功 apl.common.M00003={0}已经存在 @@ -43,4 +40,5 @@ apl.common.M00006=操作失败,该数据已被他人删除,请刷新后重试 apl.common.M00007=操作失败,该数据已被他人更改,请刷新后重试 apl.common.M00008=请勿重复提交 apl.common.M00009=查询成功 -apl.common.M00010=操作失败,请联系管理员 \ No newline at end of file +apl.common.M00010=操作失败,请联系管理员 +apl.chargeRefund.M00001=该收费单相关{0}已经发出,请先退药后再进行退费 \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index 8a322737..2e9074f6 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -4,22 +4,23 @@ diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml index 93fbf507..d37d7496 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml @@ -24,46 +24,144 @@ AND T1.delete_flag = '0' + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java index a67d431d..3d550099 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java @@ -70,4 +70,21 @@ public class PromptMsgConstant { String M00001 = "apl.inventory.M00001"; } + + /** + * 退费 + */ + public interface ChargeRefund { + + /** + * 该收费单相关{0}已经发出,请先退药后再进行退费 + */ + String M00001 = "apl.chargeRefund.M00001"; + + /** + * 该收费单相关诊疗项目已经执行,请等待医技科室审批完成后再进行退费 + */ + String M00002 = "apl.chargeRefund.M00002"; + + } } diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java index a843b338..a8469414 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java @@ -29,7 +29,7 @@ public enum AssignSeqEnum { /** * 处方号 */ - PRESCRIPTION_NO("4", "处方号", "P"), + PRESCRIPTION_NO("4", "处方号", "PR"), /** * 药品请求编码 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java index 4d5b2d68..1200feea 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java @@ -37,10 +37,25 @@ public enum ChargeItemStatus implements HisEnumInterface { */ ERROR(6, "entered-in-error", "错误"), + /** + * 退费中 + */ + REFUNDING(7, "refunding", "退费中"), + + /** + * 全部退费 + */ + REFUNDED(8, "refunded", "全部退费"), + + /** + * 部分退费 + */ + PART_REFUND(9, "part-refund", "部分退费"), + /** * 未知 */ - UNKNOWN(7, "unknown", "未知"); + UNKNOWN(10, "unknown", "未知"); private final Integer value; private final String code; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java new file mode 100644 index 00000000..771e8c8d --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java @@ -0,0 +1,50 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 合同类型 + * + * @author zwh + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum ContractCategory implements HisEnumInterface{ + + /** + * 自费 + */ + SELF_CHARGE(1, "1", "自费"), + + /** + * 公费 + */ + PUBLIC_CHARGE(2, "2", "公费"), + + /** + * 省医保 + */ + PROVINCIAL_INSURANCE(3, "3", "省医保"), + + /** + * 市医保 + */ + MUNICIPAL_INSURANCE(4, "4", "市医保"), + + /** + * 职工医保 + */ + WORKER_INSURANCE(5, "5", "职工医保"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java index 5e949485..deb87a9b 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java @@ -46,7 +46,7 @@ public enum DispenseStatus implements HisEnumInterface { /** * 拒绝发药 */ - DECLINED(7, "DE", "拒绝发药 已退药"), + DECLINED(7, "DE", "拒绝发药"), /** * 已汇总 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java new file mode 100644 index 00000000..7e941573 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 未执行原因 + * + * @author zwh + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum NotPerformedReason { + + /** + * 退费 + */ + REFUND(1, "1", "退费"), + + /** + * 异常 + */ + ERROR(9, "9", "异常"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java index 71abcc59..8364f7ff 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java @@ -36,9 +36,9 @@ public enum RequestStatus implements HisEnumInterface { ON_HOLD(4, "on_hold", "暂停"), /** - * 撤回 + * 取消 */ - CANCELLED(5, "cancelled", "撤回"), + CANCELLED(5, "cancelled", "取消"), /** * 停止 diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java index 5b7b3600..a0bd9684 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java @@ -43,4 +43,11 @@ public interface IChargeItemService extends IService { * @return 收费信息 */ List getChargeItemInfo(List chargeItemIdList); + + /** + * 更新收费状态:已退费 + * + * @param chargeItemIdList 收费id列表 + */ + void updateRefundChargeStatus(List chargeItemIdList); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java index d673a38f..4a92fc44 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.ChargeItem; import com.openhis.administration.mapper.ChargeItemMapper; import com.openhis.administration.service.IChargeItemService; +import com.openhis.common.enums.ChargeItemStatus; import lombok.AllArgsConstructor; @@ -56,8 +57,8 @@ public class ChargeItemServiceImpl extends ServiceImpl() - .eq(ChargeItem::getEncounterId, encounterId).set(ChargeItem::getAccountId, accountId)); + int update = baseMapper.update(new ChargeItem().setAccountId(accountId), + new LambdaUpdateWrapper().eq(ChargeItem::getEncounterId, encounterId)); return update > 0; } @@ -71,4 +72,15 @@ public class ChargeItemServiceImpl extends ServiceImpl getChargeItemInfo(List chargeItemIdList) { return baseMapper.selectBatchIds(chargeItemIdList); } + + /** + * 更新收费状态:已退费 + * + * @param chargeItemIdList 收费id列表 + */ + @Override + public void updateRefundChargeStatus(List chargeItemIdList) { + baseMapper.update(new ChargeItem().setStatusEnum(ChargeItemStatus.REFUNDED.getValue()), + new LambdaUpdateWrapper().in(ChargeItem::getId, chargeItemIdList)); + } } \ 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 0c0288d3..3e4da9b4 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 @@ -30,8 +30,8 @@ public class OrganizationServiceImpl extends ServiceImpl().eq(Organization::getId, orgId) - .set(Organization::getActiveFlag, AccountStatus.ACTIVE.getValue())); + int updateCount = baseMapper.update(new Organization().setActiveFlag(AccountStatus.ACTIVE.getValue()), + new LambdaUpdateWrapper().eq(Organization::getId, orgId)); return updateCount > 0; } @@ -43,8 +43,8 @@ public class OrganizationServiceImpl extends ServiceImpl().eq(Organization::getId, orgId) - .set(Organization::getActiveFlag, AccountStatus.INACTIVE.getValue())); + int updateCount = baseMapper.update(new Organization().setActiveFlag(AccountStatus.INACTIVE.getValue()), + new LambdaUpdateWrapper().eq(Organization::getId, orgId)); return updateCount > 0; } diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java index 14a4f64c..94e9967f 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java @@ -6,8 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -31,6 +31,9 @@ public class PaymentRecDetail extends HisBaseEntity { /** 先前支付明细id */ private Long predecessorId; + /** 付款id */ + private Long reconciliationId; + /** 付款类型 */ private Integer targetEnum; @@ -73,5 +76,4 @@ public class PaymentRecDetail extends HisBaseEntity { /** 单笔交易结果 */ private Integer resultEnum; - } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java index a331f6c5..a9432cab 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java @@ -6,8 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -88,5 +88,6 @@ public class PaymentReconciliation extends HisBaseEntity { /** 就诊ID */ private Long encounterId; - + /** 结算时间 */ + private Date billDate; } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDispenseService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDispenseService.java index c8d090b1..ff2bb39f 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDispenseService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDispenseService.java @@ -20,4 +20,12 @@ public interface IMedicationDispenseService extends IService * @param medicationRequestList 药品请求信息 */ void addMedicationDispense(List medicationRequestList); + + /** + * 更新未发放药品状态:停止发放 + * + * @param medDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + void updateStopDispenseStatus(List medDisIdList, Integer refund); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDispenseServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDispenseServiceImpl.java index a8da42f2..6cb6d3a5 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDispenseServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDispenseServiceImpl.java @@ -4,6 +4,7 @@ import java.util.List; import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.core.common.utils.DateUtils; import com.openhis.common.enums.DispenseStatus; @@ -74,4 +75,17 @@ public class MedicationDispenseServiceImpl extends ServiceImpl medDisIdList, Integer refund) { + baseMapper.update( + new MedicationDispense().setStatusEnum(DispenseStatus.STOPPED.getValue()).setNotPerformedReasonEnum(refund), + new LambdaUpdateWrapper().in(MedicationDispense::getId, medDisIdList)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IDeviceDispenseService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IDeviceDispenseService.java index 2efbf78f..4071ddc4 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IDeviceDispenseService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IDeviceDispenseService.java @@ -1,5 +1,7 @@ package com.openhis.workflow.service; +import java.util.List; + import com.baomidou.mybatisplus.extension.service.IService; import com.openhis.workflow.domain.DeviceDispense; @@ -11,4 +13,11 @@ import com.openhis.workflow.domain.DeviceDispense; */ public interface IDeviceDispenseService extends IService { + /** + * 更新未发放耗材状态:停止发放 + * + * @param devDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + void updateStopDispenseStatus(List devDisIdList, Integer refund); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java index 2ed4a05d..f98df483 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java @@ -1,6 +1,7 @@ package com.openhis.workflow.service; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; + import com.baomidou.mybatisplus.extension.service.IService; import com.openhis.workflow.domain.ServiceRequest; @@ -12,13 +13,18 @@ import com.openhis.workflow.domain.ServiceRequest; */ public interface IServiceRequestService extends IService { - /** * 查询服务申请管理中basedOnId相同的个数 * * @param basedOnId 请求基于什么的ID * @return basedOnId相同的个数 */ - Long countServiceRequestByBasedOnId(Long basedOnId) ; + Long countServiceRequestByBasedOnId(Long basedOnId); + /** + * 更新执行诊疗状态:停止 + * + * @param serReqIdList 服务请求id列表 + */ + void updateStopRequestStatus(List serReqIdList); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java index 0dc5c1e6..5e046696 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java @@ -1,8 +1,12 @@ package com.openhis.workflow.service.impl; +import java.util.List; + import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.common.enums.DispenseStatus; import com.openhis.workflow.domain.DeviceDispense; import com.openhis.workflow.mapper.DeviceDispenseMapper; import com.openhis.workflow.service.IDeviceDispenseService; @@ -14,6 +18,19 @@ import com.openhis.workflow.service.IDeviceDispenseService; * @date 2025-02-20 */ @Service -public class DeviceDispenseServiceImpl extends ServiceImpl implements IDeviceDispenseService { +public class DeviceDispenseServiceImpl extends ServiceImpl + implements IDeviceDispenseService { + /** + * 更新未发放耗材状态:停止发放 + * + * @param devDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + @Override + public void updateStopDispenseStatus(List devDisIdList, Integer refund) { + baseMapper.update( + new DeviceDispense().setStatusEnum(DispenseStatus.STOPPED.getValue()).setNotPerformedReasonEnum(refund), + new LambdaUpdateWrapper().in(DeviceDispense::getId, devDisIdList)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java index c40e3c9c..41deca8c 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java @@ -1,11 +1,13 @@ package com.openhis.workflow.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + 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.common.enums.RequestStatus; import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.mapper.ServiceRequestMapper; import com.openhis.workflow.service.IServiceRequestService; @@ -20,9 +22,6 @@ import com.openhis.workflow.service.IServiceRequestService; public class ServiceRequestServiceImpl extends ServiceImpl implements IServiceRequestService { - @Autowired - private ServiceRequestMapper serviceRequestMapper; - /** * 查询服务申请管理中basedOnId相同的个数 * @@ -33,6 +32,17 @@ public class ServiceRequestServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ServiceRequest::getBasedOnId, basedOnId); - return serviceRequestMapper.selectCount(queryWrapper); + return baseMapper.selectCount(queryWrapper); + } + + /** + * 更新执行诊疗状态:停止 + * + * @param serReqIdList 服务请求id列表 + */ + @Override + public void updateStopRequestStatus(List serReqIdList) { + baseMapper.update(new ServiceRequest().setStatusEnum(RequestStatus.STOPPED.getValue()), + new LambdaUpdateWrapper().in(ServiceRequest::getId, serReqIdList)); } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java index 4f57c284..08bae25b 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java @@ -53,10 +53,10 @@ public class SupplyRequestServiceImpl extends ServiceImpl agreeRequest(String busNo, LoginUser loginUser, Date now) { // 更新单据状态 - baseMapper.update(null, - new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getApprovalTime, now).set(SupplyRequest::getApproverId, loginUser.getUserId()) - .set(SupplyRequest::getStatusEnum, SupplyStatus.AGREE.getValue())); + baseMapper.update( + new SupplyRequest().setApprovalTime(now).setApproverId(loginUser.getPractitionerId()) + .setStatusEnum(SupplyStatus.AGREE.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); // 返回单据详情 return this.getSupplyByBusNo(busNo); } @@ -69,10 +69,9 @@ public class SupplyRequestServiceImpl extends ServiceImpl().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getStatusEnum, SupplyStatus.APPROVAL.getValue()) - .set(SupplyRequest::getApplyTime, DateUtils.getNowDate())); + int updateCount = baseMapper.update( + new SupplyRequest().setApplyTime(DateUtils.getNowDate()).setStatusEnum(SupplyStatus.APPROVAL.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } @@ -84,8 +83,8 @@ public class SupplyRequestServiceImpl extends ServiceImpl() - .eq(SupplyRequest::getBusNo, busNo).set(SupplyRequest::getStatusEnum, SupplyStatus.WITHDRAW.getValue())); + int updateCount = baseMapper.update(new SupplyRequest().setStatusEnum(SupplyStatus.WITHDRAW.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } @@ -99,10 +98,10 @@ public class SupplyRequestServiceImpl extends ServiceImpl().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getApprovalTime, now).set(SupplyRequest::getApproverId, loginUser.getUserId()) - .set(SupplyRequest::getStatusEnum, SupplyStatus.REJECT.getValue())); + int updateCount = baseMapper.update( + new SupplyRequest().setApprovalTime(now).setApproverId(loginUser.getPractitionerId()) + .setStatusEnum(SupplyStatus.REJECT.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } From cedf3fb275c97e9e4eba14b3c37e167f4a3290e2 Mon Sep 17 00:00:00 2001 From: liuhongrui Date: Sun, 30 Mar 2025 12:59:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=AF=8A=E7=96=97=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...iagnosisTreatmentManageAppServiceImpl.java | 148 +++++++++++------- .../dto/DiagnosisTreatmentDto.java | 10 +- .../dto/DiagnosisTreatmentInitDto.java | 20 +++ .../dto/DiagnosisTreatmentSelParam.java | 2 +- .../dto/DiagnosisTreatmentUpDto.java | 3 +- .../dto/MedicationManageUpDto.java | 1 - .../ActivityDefinitionManageMapper.xml | 6 +- .../common/constant/CommonConstants.java | 4 + .../workflow/domain/ActivityDefinition.java | 2 +- 9 files changed, 130 insertions(+), 66 deletions(-) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java index 181bdee9..698656ce 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java @@ -11,6 +11,8 @@ import java.util.stream.Stream; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.openhis.administration.domain.Supplier; +import com.openhis.administration.service.ISupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,21 +22,20 @@ 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.core.domain.entity.SysDictData; -import com.core.common.utils.MessageUtils; -import com.core.common.utils.SecurityUtils; +import com.core.common.utils.*; import com.core.common.utils.bean.BeanUtils; import com.core.system.service.ISysDictTypeService; +import com.openhis.administration.domain.ChargeItemDefinition; import com.openhis.administration.domain.Organization; import com.openhis.administration.service.IOrganizationService; +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.datadictionary.appservice.IDiagnosisTreatmentManageAppService; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentInitDto; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; +import com.openhis.web.datadictionary.dto.*; import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper; import com.openhis.workflow.domain.ActivityDefinition; import com.openhis.workflow.mapper.ActivityDefinitionMapper; @@ -59,6 +60,13 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme private ISysDictTypeService iSysDictTypeService; @Resource private ActivityDefinitionManageMapper activityDefinitionManageMapper; + @Autowired + private IItemDefinitionService itemDefinitionServic; + @Autowired + private ISysDictTypeService sysDictTypeService; + + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; /** * 诊疗目录初期查询 @@ -82,7 +90,15 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme .collect(Collectors.toList()); diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations); - // 获取诊疗分类 + // 获取诊目录疗分类 + List diagnosisList = + sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE); + // 获取诊疗录疗分类 + List diagnosisCategories = diagnosisList.stream().map( + category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setDiagnosisCategoryOptions(diagnosisCategories); + // 查询医疗服务项类型 List medical_service_items = iSysDictTypeService.selectDictDataByType(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getCode()); @@ -92,30 +108,31 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme status.getDictLabel())) .collect(Collectors.toList()); List diseaseTreatmentCategories = new ArrayList<>(); - - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), - ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); - diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); - diseaseTreatmentCategories.add(diseaseTreatmentCategory); - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); - - // 查询手术与治疗类型 - List medical_service_items2 = - iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); - // 获取手术与治疗List - List diseaseTreatmentCategoryList2 = medical_service_items2 - .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), - status.getDictLabel())) - .collect(Collectors.toList()); - - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), - ActivityDefCategory.TREATMENT_SURGERY.getInfo()); - diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); - diseaseTreatmentCategories.add(diseaseTreatmentCategory2); - - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); +// +// //获取目录分类 +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), +// ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); +// diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory); +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); +// +// // 查询手术与治疗类型 +// List medical_service_items2 = +// iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); +// // 获取手术与治疗List +// List diseaseTreatmentCategoryList2 = medical_service_items2 +// .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), +// status.getDictLabel())) +// .collect(Collectors.toList()); +// +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), +// ActivityDefCategory.TREATMENT_SURGERY.getInfo()); +// diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory2); +// +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); // 获取类型 List typeEnumOptions = Stream.of(ActivityType.values()) @@ -138,15 +155,6 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) { - // - // // 构建查询条件 - // QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, - // searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); - // // 设置排序 - // queryWrapper.orderByAsc("bus_no"); - // // 分页查询 - // Page diseaseTreatmentPage = HisPageUtils.selectPage(activityDefinitionMapper, - // queryWrapper, pageNo, pageSize, DiagnosisTreatmentDto.class); // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, @@ -163,8 +171,6 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); // 类型举类回显赋值 e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum())); - // 目录类别举类回显赋值 - e.setCategory_enumText(EnumUtils.getInfoByValue(ActivityDefCategory.class, e.getCategoryEnum())); // 状态举类回显赋值 e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); }); @@ -198,14 +204,32 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R editDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_NUM.getPrefix(), 10); + activityDefinition.setBusNo(code); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); // 更新诊疗信息 - return iActivityDefinitionService.updateById(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + if (iActivityDefinitionService.updateById(activityDefinition)) { + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType()) + .setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setInstanceId(diagnosisTreatmentUpDto.getId()); + // 更新价格表 + return itemDefinitionServic.updateItem(chargeItemDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } /** @@ -267,13 +291,31 @@ public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatme @Override public R addDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); + // 新增外来诊疗目录 - ActivityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); - return iActivityDefinitionService.addDiagnosisTreatment(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + activityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); + if (iActivityDefinitionService.addDiagnosisTreatment(activityDefinition)) { + + ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, itemUpFromDirectoryDto); + itemUpFromDirectoryDto.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue()) + .setConditionFlag(Whether.YES.getValue()).setChargeName(diagnosisTreatmentUpDto.getName()) + .setInstanceId(activityDefinition.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice()); + + return itemDefinitionServic.addItem(itemUpFromDirectoryDto) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java index dec2ecb1..9b91cc16 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java @@ -26,8 +26,9 @@ public class DiagnosisTreatmentDto { private Long id; /** 目录类别 */ - private Integer categoryEnum; - private String category_enumText; + @Dict(dictCode = "activity_category_code") + private String categoryCode; + private String categoryCode_dictText; /** 编码 */ private String busNo; @@ -93,9 +94,6 @@ public class DiagnosisTreatmentDto { private Long locationId; private String locationId_dictText; - /** 售价 */ - private BigDecimal price; - /** 财务类别 */ @Dict(dictCode = "fin_type_code") private String typeCode; @@ -114,6 +112,6 @@ public class DiagnosisTreatmentDto { /** 最高零售价 */ private BigDecimal maximumRetailPrice; - + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java index 77408654..7ebbb51a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java @@ -3,6 +3,8 @@ package com.openhis.web.datadictionary.dto; import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; @@ -19,6 +21,8 @@ public class DiagnosisTreatmentInitDto { private List diseaseTreatmentCategoryList; private List exeOrganizations; private List typeEnumOptions; + //诊疗目录 + private List diagnosisCategoryOptions; /** * 状态 @@ -64,6 +68,21 @@ public class DiagnosisTreatmentInitDto { } } + /** + * 诊疗目录类型 + */ + @Data + public static class dictCategoryCode { + private String value; + private String info; + private List children = new ArrayList<>(); + + public dictCategoryCode(String value, String info) { + this.value = value; + this.info = info; + } + } + /** * 执行机构 */ @@ -77,4 +96,5 @@ public class DiagnosisTreatmentInitDto { this.label = label; } } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java index 48c42698..e5fd9eb5 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java @@ -16,7 +16,7 @@ import lombok.experimental.Accessors; public class DiagnosisTreatmentSelParam { /** 目录类别 */ - private Integer categoryEnum; + private Integer categoryCode; /** 类型 */ private Integer typeEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java index e46683b7..5425e648 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java @@ -22,13 +22,14 @@ import java.math.BigDecimal; @Data @Accessors(chain = true) public class DiagnosisTreatmentUpDto { + /** ID */ @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 目录类别 */ @NotNull(message = "目录类别不能为空") - private ActivityDefCategory categoryEnum; + private String categoryCode; /** 编码 */ @NotBlank(message = "项目编码不能为空") diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java index b809a736..aa77d98d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java @@ -53,7 +53,6 @@ public class MedicationManageUpDto { private Integer activeFlag; /** 批次号 */ - @NotBlank(message = "批次号不能为空") private String lotNumber; /** 生效日期 */ diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml index d0192249..a615f28f 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml @@ -6,7 +6,7 @@ SELECT T3.id, - T3.category_enum, + T3.category_code, T3.bus_no, T3.name, T3.py_str, @@ -33,7 +33,7 @@ ( SELECT T1.id, - T1.category_enum, + T1.category_code, T1.bus_no, T1.name, T1.py_str, @@ -83,7 +83,7 @@