From 1cd51b8c09252e7a6708fa4251e87ea9836e8d3d Mon Sep 17 00:00:00 2001 From: "Zhang.WH" Date: Fri, 14 Mar 2025 17:53:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E6=94=B6=E8=B4=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IOutpatientChargeAppService.java | 28 +++++++- .../impl/OutpatientChargeAppServiceImpl.java | 67 ++++++++++++++++++ .../OutpatientChargeController.java | 38 +++++++++-- .../dto/EncounterPatientPageDto.java | 4 ++ .../dto/EncounterPatientPageParam.java | 5 ++ .../dto/EncounterPatientPrescriptionDto.java | 68 +++++++++++++++++++ .../mapper/OutpatientChargeAppMapper.java | 15 ++++ .../assembler/InventoryManageAssembler.java | 2 +- .../PurchaseInventoryController.java | 1 + .../dto/InventoryReceiptInitDto.java | 1 + .../OutpatientChargeAppMapper.xml | 44 +++++++++++- .../com/openhis/common/enums/AccountType.java | 44 ++++++++++++ .../common/enums/ChargeItemContext.java | 14 +++- .../administration/domain/ChargeItem.java | 7 +- .../service/IAccountService.java | 15 ++++ .../service/IChargeItemService.java | 9 +++ .../service/impl/AccountServiceImpl.java | 35 ++++++++++ .../service/impl/ChargeItemServiceImpl.java | 15 ++++ .../workflow/domain/ServiceRequest.java | 6 +- 19 files changed, 404 insertions(+), 14 deletions(-) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java create mode 100644 openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AccountType.java diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java index 4db73eec..9e76b7e8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java @@ -3,11 +3,11 @@ */ package com.openhis.web.chargemanage.appservice; +import javax.servlet.http.HttpServletRequest; + import com.core.common.core.domain.R; import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; -import javax.servlet.http.HttpServletRequest; - /** * 门诊收费 service * @@ -28,4 +28,28 @@ public interface IOutpatientChargeAppService { */ R getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); + + /** + * 根据就诊id查询患者处方列表 + * + * @param encounterId 就诊id + * @return 患者处方列表 + */ + R getEncounterPatientPrescription(Long encounterId); + + /** + * 医保转自费 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + R changeToSelfPay(Long encounterId); + + /** + * 自费转医保 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + R changeToMedicalInsurance(Long encounterId); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java index 4e9e9897..9f6b63a6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java @@ -15,8 +15,14 @@ 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.IAccountService; +import com.openhis.administration.service.IChargeItemService; import com.openhis.common.constant.CommonConstants; +import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.enums.AdministrativeGender; +import com.openhis.common.enums.ChargeItemContext; +import com.openhis.common.enums.ChargeItemStatus; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.chargemanage.appservice.IOutpatientChargeAppService; @@ -35,6 +41,10 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi @Autowired private OutpatientChargeAppMapper outpatientChargeAppMapper; + @Autowired + private IChargeItemService chargeItemService; + @Autowired + private IAccountService accountService; /** * 查询就诊患者分页列表 @@ -63,9 +73,66 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi 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())); }); return R.ok(encounterPatientPage); } + + /** + * 根据就诊id查询患者处方列表 + * + * @param encounterId 就诊id + * @return 患者处方列表 + */ + @Override + public R getEncounterPatientPrescription(Long encounterId) { + return R.ok(outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId, + ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(), + ChargeItemContext.DEVICE.getValue())); + } + + /** + * 医保转自费 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + @Override + public R changeToSelfPay(Long encounterId) { + // 获取就诊患者的自费账户id + Long accountId = accountService.getSelfPayAccount(encounterId); + if (accountId == null) { + R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + } + // 医保转自费 + boolean result = chargeItemService.updateAccountType(encounterId, accountId); + if (!result) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + } + return R.ok(); + } + + /** + * 自费转医保 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + @Override + public R changeToMedicalInsurance(Long encounterId) { + // 获取就诊患者的医保账户id + Long accountId = accountService.getMedicalInsuranceAccount(encounterId); + if (accountId == null) { + R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + } + // 自费转医保 + boolean result = chargeItemService.updateAccountType(encounterId, accountId); + if (!result) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + } + return R.ok(); + } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java index a6abbfb2..2743406a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java @@ -6,10 +6,7 @@ package com.openhis.web.chargemanage.controller; import javax.servlet.http.HttpServletRequest; 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 org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.chargemanage.appservice.IOutpatientChargeAppService; @@ -51,4 +48,37 @@ public class OutpatientChargeController { return R.ok(outpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo, pageSize, request)); } + + /** + * 根据就诊id查询患者处方列表 + * + * @param encounterId 就诊id + * @return 患者处方列表 + */ + @GetMapping(value = "/patient-prescription") + public R getEncounterPatientPrescription(@RequestParam Long encounterId) { + return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId)); + } + + /** + * 医保转自费 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + @PutMapping("/self-pay") + public R changeToSelfPay(@RequestParam Long encounterId) { + return outpatientChargeAppService.changeToSelfPay(encounterId); + } + + /** + * 自费转医保 + * + * @param encounterId 就诊id + * @return 操作结果 + */ + @PutMapping("/medical-insurance") + public R changeToMedicalInsurance(@RequestParam Long encounterId) { + return outpatientChargeAppService.changeToMedicalInsurance(encounterId); + } } 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 183e452a..d81e11ad 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 @@ -91,4 +91,8 @@ public class EncounterPatientPageDto implements Serializable { * 年龄 */ private String age; + + /** 收费状态 */ + private Integer statusEnum; + private String statusEnum_enumText; } 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 0c2787d4..60c171f1 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 @@ -55,4 +55,9 @@ public class EncounterPatientPageParam implements Serializable { * 开始时间 */ private Date startTime; + + /** + * 收费状态 + */ + private Integer statusEnum; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java new file mode 100644 index 00000000..4b71f9c0 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java @@ -0,0 +1,68 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 就诊患者处方 dto + * + * @author zwh + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class EncounterPatientPrescriptionDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 收费项目类型 */ + private Integer contextEnum; + private String contextEnum_enumText; + + /** 收费状态 */ + private Integer statusEnum; + private String statusEnum_enumText; + + /** 就诊ID */ + private Long encounterId; + + /** 开立科室 */ + private Long requestingOrgId; + + /** 数量 */ + private Long quantityValue; + + /** 单位 */ + private String quantityUnit; + + /** 单价 */ + private BigDecimal unitPrice; + + /** 总价 */ + private BigDecimal totalPrice; + + /** 处方号 */ + private String prescriptionNo; + + /** 开立人ID */ + private Long entererId; + + /** 开立时间 */ + private Date enteredDate; + + /** 关联账户ID */ + private Long accountId; + + /** 物品编码 */ + private Long itemId; + + /** 物品名称 */ + private String itemName; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientChargeAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientChargeAppMapper.java index 9b910bb8..7cd73443 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientChargeAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientChargeAppMapper.java @@ -3,6 +3,8 @@ */ package com.openhis.web.chargemanage.mapper; +import java.util.List; + import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -11,6 +13,7 @@ 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.EncounterPatientPrescriptionDto; /** * 门诊收费 appMapper @@ -30,4 +33,16 @@ public interface OutpatientChargeAppMapper { */ Page selectEncounterPatientPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 根据就诊id查询患者处方列表 + * + * @param encounterId 就诊id + * @param activity 项目 + * @param medication 药品 + * @param device 耗材 + * @return 患者处方列表 + */ + List selectEncounterPatientPrescription(@Param("encounterId") Long encounterId, + @Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java index 2718eb4f..39773586 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java @@ -72,7 +72,7 @@ public class InventoryManageAssembler { // 收费状态:已结算 .setStatusEnum(ChargeItemStatus.BILLED.getValue()) // 收费类型:采购 - .setContextEnum(ChargeItemContext.PRESCRIPTION.getValue()) + .setContextEnum(ChargeItemContext.PURCHASE.getValue()) // 发生时间 .setOccurrenceTime(now) // 开立人 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java index a4aac194..a40938d6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java @@ -5,6 +5,7 @@ package com.openhis.web.inventorymanage.controller; import javax.servlet.http.HttpServletRequest; +import com.openhis.web.inventorymanage.dto.InventoryReceiptInitDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryReceiptInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryReceiptInitDto.java index df507c8e..dfe766d8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryReceiptInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryReceiptInitDto.java @@ -9,6 +9,7 @@ import com.openhis.administration.domain.Location; import com.openhis.administration.domain.Supplier; import com.openhis.medication.domain.MedicationDetail; +import com.openhis.web.basedatamanage.dto.LocationQueryDto; import lombok.Data; import lombok.experimental.Accessors; 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 1b9f14c4..ca811321 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 @@ -13,7 +13,8 @@ T3.birth_date, T3.id_card, T3.patient_py_str, - T3.patient_wb_str + T3.patient_wb_str, + T3.status_enum FROM ( SELECT T1.id AS encounter_id, T1.bus_no AS encounter_bus_no, @@ -25,13 +26,52 @@ T2.birth_date, T2.id_card, T2.py_str AS patient_py_str, - T2.wb_str AS patient_wb_str + T2.wb_str AS patient_wb_str, + T3.status_enum FROM adm_encounter AS T1 LEFT JOIN adm_patient AS T2 ON T1.patient_id = T2.id + LEFT JOIN adm_charge_item AS T3 + ON T3.encounter_id = T1.id WHERE T1.delete_flag = '0' ORDER BY T1.encounter_bus_no DESC ) AS T3 ${ew.customSqlSegment} + + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AccountType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AccountType.java new file mode 100644 index 00000000..a74ad2e5 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AccountType.java @@ -0,0 +1,44 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 账户类型 + * + * @author zwh + * @date 2025-03-14 + */ +@Getter +@AllArgsConstructor +public enum AccountType implements HisEnumInterface { + + /** + * 自费 + */ + SELF_PAY(1, "1", "自费"), + + /** + * 医保 + */ + MEDICAL_INSURANCE(2, "2", "医保"); + + private Integer value; + private String code; + private String info; + + public static AccountType getByValue(Integer value) { + if (value == null) { + return null; + } + for (AccountType 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/ChargeItemContext.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java index 0173941a..327ba10e 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java @@ -22,9 +22,19 @@ public enum ChargeItemContext { PURCHASE(1, "采购"), /** - * 处方 + * 药品 */ - PRESCRIPTION(2, "处方"); + MEDICATION(2, "药品"), + + /** + * 耗材 + */ + DEVICE(3, "耗材"), + + /** + * 项目 + */ + ACTIVITY(4, "项目"); private Integer value; private String info; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java index a6a03279..61a428fe 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java @@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.core.common.core.domain.HisBaseEntity; -import liquibase.pro.packaged.S; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -35,6 +34,9 @@ public class ChargeItem extends HisBaseEntity { /** 层级 */ private String busNo; + /** 处方号 */ + private String prescriptionNo; + /** 患者ID */ private Long patientId; @@ -122,4 +124,7 @@ public class ChargeItem extends HisBaseEntity { /** 机构 */ private Integer orgId; + /** 退费ID */ + private Long refundId; + } diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IAccountService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IAccountService.java index 0d3b711b..ea76e4a1 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IAccountService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IAccountService.java @@ -18,4 +18,19 @@ public interface IAccountService extends IService { */ Long saveAccountByRegister(Account account); + /** + * 获取就诊患者的自费账户id + * + * @param encounterId 就诊id + * @return 账户id + */ + Long getSelfPayAccount(Long encounterId); + + /** + * 获取就诊患者的医保账户id + * + * @param encounterId 就诊id + * @return 账户id + */ + Long getMedicalInsuranceAccount(Long encounterId); } \ No newline at end of file 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 8c377b1c..981ec0fd 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 @@ -26,4 +26,13 @@ public interface IChargeItemService extends IService { * @param chargeItem 费用项 */ void saveChargeItemByRegister(ChargeItem chargeItem); + + /** + * 更改就诊患者账户类型 + * + * @param encounterId 就诊患者 + * @param accountId 账户id + * @return 更新结果 + */ + boolean updateAccountType(Long encounterId, Long accountId); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java index 61da4ec8..1fa9af36 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java @@ -2,10 +2,12 @@ package com.openhis.administration.service.impl; import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.Account; import com.openhis.administration.mapper.AccountMapper; import com.openhis.administration.service.IAccountService; +import com.openhis.common.enums.AccountType; /** * 就诊账户管理Service业务层处理 @@ -27,4 +29,37 @@ public class AccountServiceImpl extends ServiceImpl impl return account.getId(); } + /** + * 获取就诊患者的自费账户id + * + * @param encounterId 就诊id + * @return 账户id + */ + @Override + public Long getSelfPayAccount(Long encounterId) { + Account account = baseMapper.selectOne(new LambdaQueryWrapper().select(Account::getId) + .eq(Account::getEncounterId, encounterId).eq(Account::getTypeCode, AccountType.SELF_PAY.getCode())); + if (account != null) { + return account.getId(); + } + return null; + } + + /** + * 获取就诊患者的医保账户id + * + * @param encounterId 就诊id + * @return 账户id + */ + @Override + public Long getMedicalInsuranceAccount(Long encounterId) { + Account account = baseMapper + .selectOne(new LambdaQueryWrapper().select(Account::getId).eq(Account::getEncounterId, encounterId) + .eq(Account::getTypeCode, AccountType.MEDICAL_INSURANCE.getCode())); + if (account != null) { + return account.getId(); + } + return null; + } + } \ 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 4386363c..677f3209 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 @@ -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.openhis.administration.domain.ChargeItem; import com.openhis.administration.mapper.ChargeItemMapper; @@ -45,4 +46,18 @@ public class ChargeItemServiceImpl extends ServiceImpl() + .eq(ChargeItem::getEncounterId, encounterId).set(ChargeItem::getAccountId, accountId)); + return update > 0; + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/ServiceRequest.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/ServiceRequest.java index db199319..22accef5 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/ServiceRequest.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/ServiceRequest.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; @@ -28,6 +28,9 @@ public class ServiceRequest extends HisBaseEntity { @TableId(type = IdType.ASSIGN_ID) private Long id; + /** 服务编码 */ + private String busNo; + /** 处方号 */ private String prescriptionNo; @@ -103,5 +106,4 @@ public class ServiceRequest extends HisBaseEntity { /** 历史请求 */ private Long relevantHistoryId; - } \ No newline at end of file