门诊收费部分代码上传

This commit is contained in:
Zhang.WH
2025-03-14 17:53:51 +08:00
parent 8d1b7ff6ca
commit 1cd51b8c09
19 changed files with 404 additions and 14 deletions

View File

@@ -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);
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -91,4 +91,8 @@ public class EncounterPatientPageDto implements Serializable {
* 年龄
*/
private String age;
/** 收费状态 */
private Integer statusEnum;
private String statusEnum_enumText;
}

View File

@@ -55,4 +55,9 @@ public class EncounterPatientPageParam implements Serializable {
* 开始时间
*/
private Date startTime;
/**
* 收费状态
*/
private Integer statusEnum;
}

View File

@@ -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;
}

View File

@@ -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<EncounterPatientPageDto> selectEncounterPatientPage(@Param("page") Page<EncounterPatientPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<EncounterPatientPageParam> queryWrapper);
/**
* 根据就诊id查询患者处方列表
*
* @param encounterId 就诊id
* @param activity 项目
* @param medication 药品
* @param device 耗材
* @return 患者处方列表
*/
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId,
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device);
}

View File

@@ -72,7 +72,7 @@ public class InventoryManageAssembler {
// 收费状态:已结算
.setStatusEnum(ChargeItemStatus.BILLED.getValue())
// 收费类型:采购
.setContextEnum(ChargeItemContext.PRESCRIPTION.getValue())
.setContextEnum(ChargeItemContext.PURCHASE.getValue())
// 发生时间
.setOccurrenceTime(now)
// 开立人

View File

@@ -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.*;

View File

@@ -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;

View File

@@ -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}
</select>
<select id="selectEncounterPatientPrescription"
resultType="com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto">
SELECT T1.encounter_id,
T1.context_enum,
T1.status_enum,
T1.requesting_org_id,
T1.quantity_value,
T1.quantity_unit,
T1.unit_price,
T1.total_price,
T1.prescription_no,
T1.enterer_id,
T1.entered_date,
T1.account_id,
CASE WHEN T1.context_enum = #{activity} THEN T2."name"
WHEN T1.context_enum = #{medication} THEN T3."name"
WHEN T1.context_enum = #{device} THEN T4."name"
END AS item_name,
CASE WHEN T1.context_enum = #{activity} THEN T2.id
WHEN T1.context_enum = #{medication} THEN T3.id
WHEN T1.context_enum = #{device} THEN T4.id
END AS item_id
FROM adm_charge_item AS T1
LEFT JOIN wor_activity_definition AS T2
ON T1.context_enum = #{activity}
AND T1.product_id = T2.id
LEFT JOIN med_medication_definition AS T3
ON T1.context_enum = #{medication}
AND T1.product_id = T3.id
LEFT JOIN adm_device_definition AS T4
ON T1.context_enum = #{device}
AND T1.product_id = T4.id
WHERE T1.encounter_id = #{encounterId}
AND T1.delete_flag = '0'
</select>
</mapper>