提交merge1.3

This commit is contained in:
2025-12-27 15:31:06 +08:00
parent cbd3e7f981
commit 79ea4ed4f7
148 changed files with 6722 additions and 10861 deletions

View File

@@ -11,7 +11,6 @@ public enum TenantOptionDict {
* 医院名称
*/
YB_HOSPITAL_NAME("hospitalName", "医保-医院名称", 0),
/**
* 医保-医疗机构等级(3101接口)
*/
@@ -24,37 +23,30 @@ public enum TenantOptionDict {
* 电子发票appid
*/
EINVOICE_APP_ID("app_id", "电子发票-appid", 3),
/**
* 电子发票key
*/
EINVOICE_KEY("key", "电子发票-key", 4),
/**
* 电子发票url
*/
EINVOICE_URL("url", "电子发票-url", 5),
/**
* 医保开关
*/
YB_SWITCH("yb_switch", "医保开关", 6),
/**
* 电子地址
*/
ELE_ADDRESS("eleAddress", "电子处方-请求地址", 22),
/**
* 服务地址
*/
ADDRESS("address", "服务地址", 23),
/**
* 超时时间
*/
TIME("time", "超时时间", 24),
/**
* 是否加密
*/
@@ -63,32 +55,26 @@ public enum TenantOptionDict {
* 医保区划
*/
YB_INSUPLC_ADMDVS("insuplc_admdvs", "医保-区划", 26),
/**
* 电子处方appId
*/
ELE_PRE_APP_ID("pre_app_id", "电子处方-appId", 27),
/**
* 电子处方appSecret
*/
ELE_PRE_APP_SECRET("pre_app_secret", "电子处方-appSecret", 28),
/**
* 电子处方私钥
*/
ELE_APP_PRVKEY("APP_PRVKEY", "电子处方-私钥", 29),
/**
* 电子处方公钥
*/
ELE_PLAF_PUBKEY("PLAF_PUBKEY", "电子处方-公钥", 30),
/**
* 医院等级
*/
EINVOICE_HOSPITAL_LV("hospital_lv", "电子发票-医院等级", 39),
/**
* 无视LIS&PACS报错
*/
@@ -160,27 +146,14 @@ public enum TenantOptionDict {
/**
* 电子发票开关
*/
<<<<<<< HEAD
INVOICE_SWITCH("invoiceSwitch", "电子发票开关 (0:关闭 1:开启)", 56),
=======
INVOICE_SWITCH("invoiceSwitch", "电子发票开关", 56),
>>>>>>> v1.3
/**
* 医嘱定价来源
*/
ORDER_PRICING_SOURCE("orderPricingSource", "定价来源 batchSellingPrice/retailPrice", 57),
/**
* 三方支付(签到)
*/
<<<<<<< HEAD
THREE_PART_SIGN_URL("threePartSignUrl", "三方支付GET请求", 58),
/**
* 三方支付(消费)
*/
THREE_PART_PAY_URL("threePartPayUrl", "三方支付GET请求", 59),
=======
THREE_PART_SIGN_URL("threePartSignUrl", "三方支付【签到】请求路径", 58),
/**
* 三方支付(签到)
@@ -210,14 +183,9 @@ public enum TenantOptionDict {
* 三方支付(消费)
*/
THREE_PART_PAY_MAPPING_METHOD("threePartPayMappingMethod", "三方支付【消费】请求方式", 65),
>>>>>>> v1.3
/**
* 三方支付(退费)
*/
<<<<<<< HEAD
THREE_PART_RETURN_URL("threePartReturnUrl", "三方支付GET请求", 60),
=======
THREE_PART_RETURN_URL("threePartReturnUrl", "三方支付【退费】请求路径", 66),
/**
* 三方支付(退费)
@@ -231,14 +199,9 @@ public enum TenantOptionDict {
* 三方支付(退费)
*/
THREE_PART_RETURN_MAPPING_METHOD("threePartReturnMappingMethod", "三方支付【退费】请求方式", 69),
>>>>>>> v1.3
/**
* 三方支付(隔天退费)
*/
<<<<<<< HEAD
THREE_PART_NEXT_DAY_RETURN_URL("threePartNextDayReturnUrl", "三方支付GET请求", 61),
=======
THREE_PART_NEXT_DAY_RETURN_URL("threePartNextDayReturnUrl", "三方支付【隔天退费】请求路径", 70),
/**
* 三方支付(隔天退费)
@@ -252,14 +215,9 @@ public enum TenantOptionDict {
* 三方支付(隔天退费)
*/
THREE_PART_NEXT_DAY_RETURN_MAPPING_METHOD("threePartNextDayReturnMappingMethod", "三方支付【隔天退费】请求方式", 73),
>>>>>>> v1.3
/**
* 三方支付路径(支付结果查询)
*/
<<<<<<< HEAD
THREE_PART_PAY_QUERY_URL("threePartPayQueryUrl", "三方支付GET请求", 62),
=======
THREE_PART_PAY_QUERY_URL("threePartPayQueryUrl", "三方支付【支付结果查询】请求路径", 74),
/**
* 三方支付(支付结果查询)
@@ -273,14 +231,9 @@ public enum TenantOptionDict {
* 三方支付(支付结果查询)
*/
THREE_PART_PAY_QUERY_MAPPING_METHOD("threePartPayQueryMappingMethod", "三方支付【支付结果查询】请求方式", 77),
>>>>>>> v1.3
/**
* 三方支付路径(退费结果查询)
*/
<<<<<<< HEAD
THREE_PART_RETURN_QUERY_URL("threePartReturnQueryUrl", "三方支付GET请求", 63),
=======
THREE_PART_RETURN_QUERY_URL("threePartReturnQueryUrl", "三方支付【退费结果查询】请求路径", 78),
/**
* 三方支付(退费结果查询)
@@ -294,19 +247,9 @@ public enum TenantOptionDict {
* 三方支付(退费结果查询)
*/
THREE_PART_RETURN_QUERY_MAPPING_METHOD("threePartReturnQueryMappingMethod", "三方支付【退费结果查询】请求方式", 81),
>>>>>>> v1.3
/**
* 三方支付路径(隔天退费结果查询)
*/
<<<<<<< HEAD
THREE_PART_NEXT_DAY_RETURN_QUERY_URL("threePartNextDayReturnQueryUrl", "三方支付GET请求", 64),
/**
* 三方支付参数
*/
THREE_PART_PARAM("threePartParam", "三方支付GET请求", 65);
=======
THREE_PART_NEXT_DAY_RETURN_QUERY_URL("threePartNextDayReturnQueryUrl", "三方支付【隔天退费结果查询】请求路径", 82),
/**
* 三方支付(隔天退费结果查询)
@@ -320,8 +263,7 @@ public enum TenantOptionDict {
* 三方支付(隔天退费结果查询)
*/
THREE_PART_NEXT_DAY_RETURN_QUERY_MAPPING_METHOD("threePartNextDayReturnQueryMappingMethod", "三方支付【隔天退费结果查询】请求方式",
85),
85),
/**
* 三方支付(签出)
*/
@@ -338,32 +280,26 @@ public enum TenantOptionDict {
* 三方支付(签出)
*/
THREE_PART_SIGN_OUT_MAPPING_METHOD("threePartSignOutMappingMethod", "三方支付【签出】请求方式", 89),
/**
* 三方支付(签出)
*/
YB_INPATIENT_SETTLEMENT_UP_URL("ybInpatientSetlUp", "选填4101或4101A", 90),
/**
* PACS查看报告地址
*/
PACS_REPORT_URL("pacsReportUrl", "PACS查看报告地址", 91),
/**
* LIS查看报告地址
*/
LIS_REPORT_URL("lisReportUrl", "LIS查看报告地址", 92),
/**
* 开药时药房允许多选开关
*/
PHARMACY_MULTIPLE_CHOICE_SWITCH("pharmacyMultipleChoiceSwitch", "开药时药房允许多选开关", 93),
/**
* PEIS服务地址
*/
PEIS_SERVER_URL("peisServerUrl", "PEIS服务地址", 94);
>>>>>>> v1.3
private final String code;
private final String name;

View File

@@ -65,11 +65,11 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
OutpatientInitDto initDto = new OutpatientInitDto();
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(),
ChargeItemStatus.PLANNED.getInfo()));
ChargeItemStatus.PLANNED.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLABLE.getInfo()));
ChargeItemStatus.BILLABLE.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.BILLED.getInfo()));
ChargeItemStatus.BILLED.getInfo()));
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
return R.ok(initDto);
}
@@ -86,17 +86,17 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
*/
@Override
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<EncounterPatientPageParam> 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);
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<EncounterPatientPageDto> encounterPatientPage = outpatientChargeAppMapper
.selectEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
.selectEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
encounterPatientPage.getRecords().forEach(e -> {
// 性别枚举
@@ -117,13 +117,13 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
*/
@Override
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId) {
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
List<EncounterPatientPrescriptionDto> prescriptionDtoList
= outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
prescriptionDtoList.forEach(e -> {
// 收费状态枚举
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
@@ -142,7 +142,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
// 获取就诊患者的自费账户id
Long accountId = accountService.getSelfPayAccount(encounterId);
if (accountId == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"自费账户"}));
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[]{"自费账户"}));
}
// 医保转自费
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
@@ -163,7 +163,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
// 获取就诊患者的医保账户id
Long accountId = accountService.getMedicalInsuranceAccount(encounterId);
if (accountId == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"医保账户"}));
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[]{"医保账户"}));
}
// 自费转医保
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
@@ -184,7 +184,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
// 获取就诊患者的学生自费账户id
Long accountId = accountService.getStudentSelfAccount(encounterId);
if (accountId == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"医保账户"}));
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[]{"医保账户"}));
}
// 自费转医保
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
@@ -205,7 +205,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
// 获取就诊患者的学生医保账户id
Long accountId = accountService.getStudentYbAccount(encounterId);
if (accountId == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"医保账户"}));
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[]{"医保账户"}));
}
// 自费转医保
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
@@ -214,8 +214,6 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
}
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
}
<<<<<<< HEAD
=======
/**
* 根据就诊id查询患者处方列表并新增字段应收金额实收金额优惠金额折扣率
@@ -226,14 +224,14 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
@Override
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescriptionWithPrice(Long encounterId) {
List<EncounterPatientPrescriptionDto> prescriptionDtoList = outpatientChargeAppMapper
.selectEncounterPatientPrescriptionWithPrice(encounterId, ChargeItemContext.ACTIVITY.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.REGISTER.getValue(), ChargeItemStatus.PLANNED.getValue(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.REFUNDED.getValue(),
ChargeItemStatus.PART_REFUND.getValue(), YbPayment.DISCOUNT_PAY.getValue(),
YbPayment.SELF_CASH_VALUE.getValue(), YbPayment.SELF_CASH_VX_VALUE.getValue(),
YbPayment.SELF_CASH_ALI_VALUE.getValue(), YbPayment.SELF_CASH_UNION_VALUE.getValue());
.selectEncounterPatientPrescriptionWithPrice(encounterId, ChargeItemContext.ACTIVITY.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.REGISTER.getValue(), ChargeItemStatus.PLANNED.getValue(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.REFUNDED.getValue(),
ChargeItemStatus.PART_REFUND.getValue(), YbPayment.DISCOUNT_PAY.getValue(),
YbPayment.SELF_CASH_VALUE.getValue(), YbPayment.SELF_CASH_VX_VALUE.getValue(),
YbPayment.SELF_CASH_ALI_VALUE.getValue(), YbPayment.SELF_CASH_UNION_VALUE.getValue());
prescriptionDtoList.forEach(e -> {
// 应收金额
BigDecimal receivableAmount = e.getReceivableAmount();
@@ -242,7 +240,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
// 计算折扣率
BigDecimal discountRate = BigDecimal.ONE;
if (receivableAmount.compareTo(BigDecimal.ZERO) > 0 && receivedAmount.compareTo(BigDecimal.ZERO) > 0
&& receivableAmount.compareTo(receivedAmount) > 0) {
&& receivableAmount.compareTo(receivedAmount) > 0) {
discountRate = receivedAmount.divide(receivableAmount, 2, RoundingMode.HALF_UP);
}
e.setDiscountRate(this.returnDiscountRate(discountRate));
@@ -254,10 +252,11 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
/**
* 调整折扣率
*
*
* @param discountRate 折扣率
* @return 调整后的折扣率0.05的倍数)
**/
*
*/
private String returnDiscountRate(BigDecimal discountRate) {
BigDecimal compareValue = BigDecimal.valueOf(0.05);
BigDecimal remainder = discountRate.remainder(compareValue);
@@ -278,5 +277,4 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
return df.format(reActuarial);
}
}
>>>>>>> v1.3
}

View File

@@ -16,7 +16,9 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class CurrentDayEncounterDto {
/** 租户ID */
/**
* 租户ID
*/
private Integer tenantId;
/**
@@ -134,43 +136,5 @@ public class CurrentDayEncounterDto {
* 电话
*/
private String phone;
<<<<<<< HEAD
/**
* 退号日期/时间
*/
private Date returnDate;
/**
* 退号原因
*/
private String returnReason;
/**
* 退号操作人
*/
private String operatorName;
/**
* 退号操作工号(用户账号)
*/
private String operatorId;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 合同编码(费用性质代码)
*/
private String contractNo;
/**
* 退款方式(多个支付方式用逗号分隔)
*/
private String refundMethod;
=======
>>>>>>> v1.3
}

View File

@@ -23,142 +23,191 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class EncounterPatientPrescriptionDto {
/** 收费项目类型 */
/**
* 收费项目类型
*/
private Integer contextEnum;
private String contextEnum_enumText;
/** 收费状态 */
/**
* 收费状态
*/
private Integer statusEnum;
private String statusEnum_enumText;
/** 就诊ID */
/**
* 就诊ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者id */
/**
* 患者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** ID */
/**
* ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 开立科室 */
/**
* 开立科室
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long requestingOrgId;
/** 数量 */
/**
* 数量
*/
private Long quantityValue;
/** 单位 */
/**
* 单位
*/
@Dict(dictCode = "unit_code")
private String quantityUnit;
private String quantityUnit_dictText;
/** 单价 */
/**
* 单价
*/
private BigDecimal unitPrice;
/** 总价 */
/**
* 总价
*/
private BigDecimal totalPrice;
/** 处方号 */
/**
* 处方号
*/
private String prescriptionNo;
/** 业务编码 */
/**
* 业务编码
*/
private String busNo;
/** 收款人ID */
/**
* 收款人ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
private Long entererId;
private String entererId_dictText;
/** 开立时间 */
/**
* 开立时间
*/
private Date enteredDate;
/** 收费时间 */
/**
* 收费时间
*/
private Date billDate;
/** 关联账户ID */
/**
* 关联账户ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long accountId;
/** 物品编码 */
/**
* 物品编码
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long itemId;
/** 物品名称 */
/**
* 物品名称
*/
private String itemName;
/** 特病标识 */
/**
* 特病标识
*/
@Dict(dictCode = "med_type")
private String medTypeCode;
private String medTypeCode_dictText;
<<<<<<< HEAD
=======
>>>>>>> v1.3
/** 用法 */
/**
* 用法
*/
@Dict(dictCode = "method_code")
private String methodCode;
private String methodCode_dictText;
<<<<<<< HEAD
private String dose;
@Dict(dictCode = "unit_code")
private String doseUnitCode;
/** 单次剂量单位 */
private String doseUnitCode_dictText;
/** 频次 */
private String rateCode;
=======
/** 剂量 */
/**
* 剂量
*/
private String dose;
/** 剂量单位 */
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
private String doseUnitCode_dictText;
/** 频次 */
/**
* 频次
*/
private String rateCode;
>>>>>>> v1.3
/** 合同编码 */
/**
* 合同编码
*/
private String contractNo;
/** 医保编码 */
/**
* 医保编码
*/
private String ybNo;
/** 合同名称 */
/**
* 合同名称
*/
private String contractName;
/** 服务所在表 */
/**
* 服务所在表
*/
private String serviceTable;
/** 服务所在表对应的id */
/**
* 服务所在表对应的id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long serviceId;
/** 付款id */
/**
* 付款id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long paymentId;
<<<<<<< HEAD
=======
/** 实收金额 */
/**
* 实收金额
*/
private BigDecimal receivedAmount = BigDecimal.ZERO;
/** 优惠金额 */
/**
* 优惠金额
*/
private BigDecimal discountAmount = BigDecimal.ZERO;
/** 应收金额 */
/**
* 应收金额
*/
private BigDecimal receivableAmount = BigDecimal.ZERO;
/** 折扣率 */
/**
* 折扣率
*/
@Dict(dictCode = "charge_discount")
private String discountRate = "0";
private String discountRate_dictText;
>>>>>>> v1.3
}

View File

@@ -79,7 +79,7 @@ public interface ICommonService {
* @return 库存项目信息
*/
R<?> getInventoryItemList(InventoryItemParam inventoryItemParam, String searchKey, Integer pageNo,
Integer pageSize);
Integer pageSize);
/**
* 根据项目相关信息查询项目库存相关信息
@@ -188,8 +188,6 @@ public interface ICommonService {
* @return 诊疗项目
*/
R<?> getActivityDefinition();
<<<<<<< HEAD
=======
/**
* 查询备份单号
@@ -205,5 +203,4 @@ public interface ICommonService {
* @return 处理结果
*/
R<?> lotNumberMatch(List<Long> encounterIdList);
>>>>>>> v1.3
}

View File

@@ -89,8 +89,6 @@ public class CommonServiceImpl implements ICommonService {
@Resource
private ISupplierService supplierService;
<<<<<<< HEAD
=======
@Resource
private IDocInventoryItemStaticService iDocInventoryItemStaticService;
@@ -100,7 +98,6 @@ public class CommonServiceImpl implements ICommonService {
@Resource
private IDeviceDispenseService deviceDispenseService;
>>>>>>> v1.3
/**
* 获取药房列表
*
@@ -119,7 +116,6 @@ public class CommonServiceImpl implements ICommonService {
locationDtoList.add(locationDto);
}
return locationDtoList;
}
@@ -267,20 +263,20 @@ public class CommonServiceImpl implements ICommonService {
*/
@Override
public R<?> getInventoryItemList(InventoryItemParam inventoryItemParam, String searchKey, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
Integer purchaseFlag = inventoryItemParam.getPurchaseFlag();
inventoryItemParam.setPurchaseFlag(null);
// 构建查询条件
QueryWrapper<InventoryItemParam> queryWrapper = HisQueryUtils.buildQueryWrapper(inventoryItemParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr,
CommonConstants.FieldName.WbStr)),
null);
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr,
CommonConstants.FieldName.WbStr)),
null);
// 查询库存项目信息
IPage<InventoryItemDto> inventoryItems = commonAppMapper.selectInventoryItemList(new Page<>(pageNo, pageSize),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), purchaseFlag, ConditionCode.PURCHASE.getCode(),
PublicationStatus.RETIRED.getValue(), queryWrapper);
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), purchaseFlag, ConditionCode.PURCHASE.getCode(),
PublicationStatus.RETIRED.getValue(), queryWrapper);
List<InventoryItemDto> inventoryItemDtoList = inventoryItems.getRecords();
inventoryItemDtoList.forEach(e -> {
// 项目类型
@@ -307,9 +303,9 @@ public class CommonServiceImpl implements ICommonService {
public R<?> getInventoryItemInfo(InventoryItemParam inventoryItemParam) {
// 查询项目库存相关信息
List<LocationInventoryDto> locationInventoryDtoList = commonAppMapper.selectInventoryItemInfo(
inventoryItemParam.getOrgLocationId(), CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, inventoryItemParam.getObjLocationId(),
inventoryItemParam.getLotNumber(), inventoryItemParam.getItemId(), ConditionCode.PURCHASE.getCode());
inventoryItemParam.getOrgLocationId(), CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, inventoryItemParam.getObjLocationId(),
inventoryItemParam.getLotNumber(), inventoryItemParam.getItemId(), ConditionCode.PURCHASE.getCode());
// 医保编码和生产厂家校验
for (LocationInventoryDto dto : locationInventoryDtoList) {
@@ -353,7 +349,7 @@ public class CommonServiceImpl implements ICommonService {
if (traceNo != null && !StringUtils.isEmpty(traceNo)) {
// 数据源更改
InventoryItem inventoryItem = inventoryItemService.getOne(
new LambdaQueryWrapper<InventoryItem>().like(InventoryItem::getTraceNo, traceNo).last("LIMIT 1"));
new LambdaQueryWrapper<InventoryItem>().like(InventoryItem::getTraceNo, traceNo).last("LIMIT 1"));
if (inventoryItem != null) {
String itemId = inventoryItem.getItemId().toString();
// TraceNoManage traceNoManage = commonAppMapper.getInfoByTraceNo("%" + traceNo + "%");
@@ -387,11 +383,11 @@ public class CommonServiceImpl implements ICommonService {
// 判断传入的是药品还是耗材,查询追溯码状态只有进的数据
if (searchTraceNoParam.getItemType().equals(ItemType.MEDICINE.getValue())) {
traceNoManageList = traceNoManageMapper.getItemTraceNoInfo(
CommonConstants.TableName.MED_MEDICATION_DEFINITION, searchTraceNoParam.getItemId(),
searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
CommonConstants.TableName.MED_MEDICATION_DEFINITION, searchTraceNoParam.getItemId(),
searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
} else if (searchTraceNoParam.getItemType().equals(ItemType.DEVICE.getValue())) {
traceNoManageList = traceNoManageMapper.getItemTraceNoInfo(CommonConstants.TableName.ADM_DEVICE_DEFINITION,
searchTraceNoParam.getItemId(), searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
searchTraceNoParam.getItemId(), searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
}
if (traceNoManageList != null) {
for (TraceNoManage traceNoItem : traceNoManageList) {
@@ -409,8 +405,8 @@ public class CommonServiceImpl implements ICommonService {
@Override
public R<?> getContractMetadata() {
// TODO: Contract表的基础数据维护还没做,具体不知道状态字段的取值是什么,先查询默认值为0的数据
List<Contract> ContractList =
contractMapper.selectList(new LambdaQueryWrapper<Contract>().eq(Contract::getStatusEnum, 0));
List<Contract> ContractList
= contractMapper.selectList(new LambdaQueryWrapper<Contract>().eq(Contract::getStatusEnum, 0));
// 复制同名字段并 return
return R.ok(ContractList.stream().map(contract -> {
ContractMetadata metadata = new ContractMetadata();
@@ -447,8 +443,8 @@ public class CommonServiceImpl implements ICommonService {
Location location = locationService.getById(locationId);
// 查询所有子集位置
List<Location> childLocations = locationService.list(new LambdaQueryWrapper<Location>()
.likeRight(Location::getBusNo, location.getBusNo()).eq(Location::getFormEnum, locationForm)
.ne(Location::getStatusEnum, LocationStatus.INACTIVE.getValue()));
.likeRight(Location::getBusNo, location.getBusNo()).eq(Location::getFormEnum, locationForm)
.ne(Location::getStatusEnum, LocationStatus.INACTIVE.getValue()));
List<LocationDto> locationDtoList = new ArrayList<>();
LocationDto locationDto;
for (Location childLocation : childLocations) {
@@ -470,8 +466,8 @@ public class CommonServiceImpl implements ICommonService {
// 查询当前登录者管理的病区
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
List<Long> locationIds = practitionerRoleService.getLocationIdsByPractitionerId(practitionerId);
List<Location> locationList =
locationService.getLocationList(locationIds, Collections.singletonList(LocationStatus.ACTIVE.getValue()));
List<Location> locationList
= locationService.getLocationList(locationIds, Collections.singletonList(LocationStatus.ACTIVE.getValue()));
List<Location> wardList = new ArrayList<>();
for (Location ward : locationList) {
if (LocationForm.WARD.getValue().equals(ward.getFormEnum())) {
@@ -517,12 +513,12 @@ public class CommonServiceImpl implements ICommonService {
advicePrintInfoDto = commonAppMapper.selectTreatmentPrintInfo(requestIds);
}
advicePrintInfoDto
.setAge(advicePrintInfoDto.getBirthDate() != null
? AgeCalculatorUtil.getAge(advicePrintInfoDto.getBirthDate()) : "")
.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, advicePrintInfoDto.getGenderEnum()))
.setEncounterYbClass_enumText(
EnumUtils.getInfoByValue(EncounterYbClass.class, advicePrintInfoDto.getEncounterYbClass()));
.setAge(advicePrintInfoDto.getBirthDate() != null
? AgeCalculatorUtil.getAge(advicePrintInfoDto.getBirthDate()) : "")
.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, advicePrintInfoDto.getGenderEnum()))
.setEncounterYbClass_enumText(
EnumUtils.getInfoByValue(EncounterYbClass.class, advicePrintInfoDto.getEncounterYbClass()));
if (advicePrintInfoDto.getChrgitmLv() != null) {
advicePrintInfoDto
.setChrgitmLv_enumText(EnumUtils.getInfoByValue(InsuranceLevel.class, advicePrintInfoDto.getChrgitmLv()));
@@ -549,8 +545,8 @@ public class CommonServiceImpl implements ICommonService {
@Override
public R<?> getSupplierList() {
return R.ok(supplierService.list(new LambdaQueryWrapper<Supplier>().select(Supplier::getId, Supplier::getName)
.eq(Supplier::getTypeEnum, SupplierType.SUPPLIER.getValue())
.eq(Supplier::getDeleteFlag, DelFlag.NO.getCode()).eq(Supplier::getActiveFlag, Whether.YES.getValue())));
.eq(Supplier::getTypeEnum, SupplierType.SUPPLIER.getValue())
.eq(Supplier::getDeleteFlag, DelFlag.NO.getCode()).eq(Supplier::getActiveFlag, Whether.YES.getValue())));
}
/**
@@ -563,8 +559,6 @@ public class CommonServiceImpl implements ICommonService {
return R.ok(commonAppMapper.getActivityDefinition(PublicationStatus.ACTIVE.getValue()));
}
<<<<<<< HEAD
=======
/**
* 查询备份单号
*
@@ -572,16 +566,16 @@ public class CommonServiceImpl implements ICommonService {
*/
@Override
public R<?> getBackupNoList() {
List<DocInventoryItemStatic> docInventoryItemStaticList =
iDocInventoryItemStaticService.list(new LambdaQueryWrapper<DocInventoryItemStatic>()
.eq(DocInventoryItemStatic::getDeleteFlag, DelFlag.NO.getCode())
.eq(DocInventoryItemStatic::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
List<DocInventoryItemStatic> docInventoryItemStaticList
= iDocInventoryItemStaticService.list(new LambdaQueryWrapper<DocInventoryItemStatic>()
.eq(DocInventoryItemStatic::getDeleteFlag, DelFlag.NO.getCode())
.eq(DocInventoryItemStatic::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
if (docInventoryItemStaticList.isEmpty()) {
return null;
}
// 直接去重并按BusNo倒序排序
List<String> busNoList = docInventoryItemStaticList.stream().map(DocInventoryItemStatic::getBusNo).distinct() // 去重
.sorted(Comparator.reverseOrder()).collect(Collectors.toList());
.sorted(Comparator.reverseOrder()).collect(Collectors.toList());
return R.ok(busNoList);
}
@@ -595,27 +589,27 @@ public class CommonServiceImpl implements ICommonService {
public R<?> lotNumberMatch(List<Long> encounterIdList) {
// 查询患者待发放的药品信息
List<MedicationDispense> medicationDispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
.eq(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
.eq(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
// 药品批号匹配
if (medicationDispenseList != null && !medicationDispenseList.isEmpty()) {
// 获取待发放的药品id
List<Long> medicationIdList =
medicationDispenseList.stream().map(MedicationDispense::getMedicationId).distinct().toList();
List<Long> medicationIdList
= medicationDispenseList.stream().map(MedicationDispense::getMedicationId).distinct().toList();
// 获取发药药房
List<Long> locationIdList =
medicationDispenseList.stream().map(MedicationDispense::getLocationId).distinct().toList();
List<Long> locationIdList
= medicationDispenseList.stream().map(MedicationDispense::getLocationId).distinct().toList();
// 查询待发放药品的库存明细
List<InventoryDetailDto> inventoryDetailList = commonAppMapper
.selectMedicineInventoryDetail(medicationIdList, locationIdList, PublicationStatus.ACTIVE.getValue());
.selectMedicineInventoryDetail(medicationIdList, locationIdList, PublicationStatus.ACTIVE.getValue());
if (inventoryDetailList == null || inventoryDetailList.isEmpty()) {
return R.fail("发药单生成失败,请检查药品库存");
}
// 将库存信息根据药品id和库房id进行分组
Map<String, List<InventoryDetailDto>> inventoryDetailMap = inventoryDetailList.stream()
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
// 按照效期排序(先进先出)
for (List<InventoryDetailDto> inventoryList : inventoryDetailMap.values()) {
inventoryList.sort(Comparator.comparing(InventoryDetailDto::getExpirationDate));
@@ -628,7 +622,7 @@ public class CommonServiceImpl implements ICommonService {
currentIndex++;
// 根据发放药品和发放药房做key
String inventoryKey = medicationDispense.getMedicationId() + CommonConstants.Common.DASH
+ medicationDispense.getLocationId();
+ medicationDispense.getLocationId();
// 查询对应的库存信息
if (!inventoryDetailMap.containsKey(inventoryKey)) {
return R.fail("药品库存不存在药品ID: " + medicationDispense.getMedicationId());
@@ -653,8 +647,8 @@ public class CommonServiceImpl implements ICommonService {
}
// 获取库存剩余数量
BigDecimal remainingInventoryQuantity =
inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
BigDecimal remainingInventoryQuantity
= inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
// 如果剩余库存数量大于等于0则说明当前批号库存充足
if (remainingInventoryQuantity.compareTo(BigDecimal.ZERO) >= 0) {
medicationDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
@@ -665,7 +659,7 @@ public class CommonServiceImpl implements ICommonService {
if (!inventoryDetailDto.getInventoryUnitCode().equals(medicationDispense.getUnitCode())) {
// 发药数量取库存大单位数量
dispenseQuantity = inventoryDetailDto.getInventoryQuantity()
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
// 大单位数量不足则跳出循环
if (dispenseQuantity.compareTo(BigDecimal.ZERO) == 0) {
continue;
@@ -680,10 +674,10 @@ public class CommonServiceImpl implements ICommonService {
BeanUtils.copyProperties(medicationDispense, splitMedicationDispense);
// 数量拆分
splitMedicationDispense.setQuantity(medicationDispense.getQuantity().subtract(dispenseQuantity))
// 重置id与批号
.setId(null).setLotNumber(null)
// 重新生成发药单编码
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
// 重置id与批号
.setId(null).setLotNumber(null)
// 重新生成发药单编码
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
// 将拆分出来的发药单添加到原发药单列表中
medicationDispenseList.add(splitMedicationDispense);
@@ -710,27 +704,27 @@ public class CommonServiceImpl implements ICommonService {
}
// 查询患者待发放的耗材信息
List<DeviceDispense> deviceDispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
// 耗材批号匹配
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
// 获取待发放的耗材id
List<Long> deviceIdList =
deviceDispenseList.stream().map(DeviceDispense::getDeviceDefId).distinct().toList();
List<Long> deviceIdList
= deviceDispenseList.stream().map(DeviceDispense::getDeviceDefId).distinct().toList();
// 获取发耗材房
List<Long> locationIdList =
deviceDispenseList.stream().map(DeviceDispense::getLocationId).distinct().toList();
List<Long> locationIdList
= deviceDispenseList.stream().map(DeviceDispense::getLocationId).distinct().toList();
// 查询待发放耗材的库存明细
List<InventoryDetailDto> inventoryDetailList = commonAppMapper.selectDeviceInventoryDetail(deviceIdList,
locationIdList, PublicationStatus.ACTIVE.getValue());
locationIdList, PublicationStatus.ACTIVE.getValue());
if (inventoryDetailList == null || inventoryDetailList.isEmpty()) {
return R.fail("发耗材单生成失败,请检查耗材库存");
}
// 将库存信息根据耗材id和库房id进行分组
Map<String, List<InventoryDetailDto>> inventoryDetailMap = inventoryDetailList.stream()
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
// 按照效期排序(先进先出)
for (List<InventoryDetailDto> inventoryList : inventoryDetailMap.values()) {
inventoryList.sort(Comparator.comparing(InventoryDetailDto::getExpirationDate));
@@ -742,8 +736,8 @@ public class CommonServiceImpl implements ICommonService {
DeviceDispense deviceDispense = deviceDispenseList.get(currentIndex);
currentIndex++;
// 根据发放耗材和发放耗材房做key
String inventoryKey =
deviceDispense.getDeviceDefId() + CommonConstants.Common.DASH + deviceDispense.getLocationId();
String inventoryKey
= deviceDispense.getDeviceDefId() + CommonConstants.Common.DASH + deviceDispense.getLocationId();
// 查询对应的库存信息
if (!inventoryDetailMap.containsKey(inventoryKey)) {
return R.fail("耗材库存不存在耗材ID: " + deviceDispense.getDeviceDefId());
@@ -768,8 +762,8 @@ public class CommonServiceImpl implements ICommonService {
}
// 获取库存剩余数量
BigDecimal remainingInventoryQuantity =
inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
BigDecimal remainingInventoryQuantity
= inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
// 如果剩余库存数量大于等于0则说明当前批号库存充足
if (remainingInventoryQuantity.compareTo(BigDecimal.ZERO) >= 0) {
deviceDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
@@ -780,7 +774,7 @@ public class CommonServiceImpl implements ICommonService {
if (!inventoryDetailDto.getInventoryUnitCode().equals(deviceDispense.getUnitCode())) {
// 发耗材数量取库存大单位数量
dispenseQuantity = inventoryDetailDto.getInventoryQuantity()
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
// 大单位数量不足则跳出循环
if (dispenseQuantity.compareTo(BigDecimal.ZERO) == 0) {
continue;
@@ -795,10 +789,10 @@ public class CommonServiceImpl implements ICommonService {
BeanUtils.copyProperties(deviceDispense, splitDeviceDispense);
// 数量拆分
splitDeviceDispense.setQuantity(deviceDispense.getQuantity().subtract(dispenseQuantity))
// 重置id与批号
.setId(null).setLotNumber(null)
// 重新生成发耗材单编码
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
// 重置id与批号
.setId(null).setLotNumber(null)
// 重新生成发耗材单编码
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
// 将拆分出来的发耗材单添加到原发耗材单列表中
deviceDispenseList.add(splitDeviceDispense);
@@ -825,5 +819,4 @@ public class CommonServiceImpl implements ICommonService {
}
return R.ok();
}
>>>>>>> v1.3
}

View File

@@ -89,7 +89,7 @@ public class CommonAppController {
/**
* 病区列表
*
* @return 病区列表
* @return 病区列表
*/
@GetMapping(value = "/ward-list")
public R<?> getWardList(@RequestParam(value = "orgId", required = false) Long orgId) {
@@ -103,7 +103,7 @@ public class CommonAppController {
*/
@GetMapping(value = "/department-list")
public R<?> getDepartmentList() {
return commonService.getDepartmentList();
return commonService.getDepartmentList();
}
/**
@@ -117,9 +117,9 @@ public class CommonAppController {
*/
@GetMapping(value = "/inventory-item")
public R<?> getInventoryItemList(InventoryItemParam inventoryItemParam,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "50") Integer pageSize) {
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "50") Integer pageSize) {
return commonService.getInventoryItemList(inventoryItemParam, searchKey, pageNo, pageSize);
}
@@ -201,7 +201,7 @@ public class CommonAppController {
/**
* 查询参与者下拉列表
*
*
* @param searchKey 模糊查询关键字
* @return 参与者下拉列表
*/
@@ -220,45 +220,11 @@ public class CommonAppController {
@GetMapping("/advice-print")
public R<?> getAdvicePrintInfo(@RequestParam(value = "requestIds") List<Long> requestIds, String isPrescription) {
return commonService.getAdvicePrintInfo(requestIds, isPrescription);
<<<<<<< HEAD
}
/**
* 查询参与者签名
*
* @param practitionerId 参与者id
* @return 参与者签名
*/
@GetMapping(value = "/practitioner-signature")
public R<?> getPractitionerSignature(@RequestParam(value = "practitionerId") Long practitionerId) {
return commonService.getPractitionerSignature(practitionerId);
}
/**
* 查询所有供应商
*
* @return 供应商
*/
@GetMapping(value = "/supplier")
public R<?> getSupplierList() {
return commonService.getSupplierList();
}
/**
* 查询所有诊疗项目
*
* @return 诊疗项目
*/
@GetMapping(value = "/activity-definition")
public R<?> getActivityDefinition() {
return commonService.getActivityDefinition();
=======
>>>>>>> v1.3
}
/**
* 查询参与者签名
*
* @param practitionerId 参与者id
* @return 参与者签名
*/

View File

@@ -38,10 +38,10 @@ public interface CommonAppMapper {
* @return 库存项目信息
*/
IPage<InventoryItemDto> selectInventoryItemList(@Param("page") Page<InventoryItemDto> page,
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("medicine") Integer medicine, @Param("device") Integer device,
@Param("purchaseFlag") Integer purchaseFlag, @Param("purchase") String purchase,
@Param("retired") Integer retired, @Param(Constants.WRAPPER) QueryWrapper<InventoryItemParam> queryWrapper);
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("medicine") Integer medicine, @Param("device") Integer device,
@Param("purchaseFlag") Integer purchaseFlag, @Param("purchase") String purchase,
@Param("retired") Integer retired, @Param(Constants.WRAPPER) QueryWrapper<InventoryItemParam> queryWrapper);
/**
* 查询项目库存相关信息
@@ -54,9 +54,9 @@ public interface CommonAppMapper {
* @return 项目库存相关信息
*/
List<LocationInventoryDto> selectInventoryItemInfo(@Param("orgLocationId") Long orgLocationId,
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("objLocationId") Long objLocationId, @Param("lotNumber") String lotNumber, @Param("itemId") Long itemId,
@Param("purchase") String purchase);
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("objLocationId") Long objLocationId, @Param("lotNumber") String lotNumber, @Param("itemId") Long itemId,
@Param("purchase") String purchase);
/**
* 查询追溯码信息
@@ -100,13 +100,11 @@ public interface CommonAppMapper {
/**
* 查询所有诊疗项目
*
*
* @param statusEnum 启用状态
* @return 诊疗项目
*/
List<ActivityDefinitionDto> getActivityDefinition(@Param("statusEnum") Integer statusEnum);
<<<<<<< HEAD
=======
/**
* 查询药品库存详细信息
@@ -117,7 +115,7 @@ public interface CommonAppMapper {
* @return 库存详细信息
*/
List<InventoryDetailDto> selectMedicineInventoryDetail(@Param("medicationIdList") List<Long> medicationIdList,
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
/**
* 查询耗材库存详细信息
@@ -128,6 +126,5 @@ public interface CommonAppMapper {
* @return 库存详细信息
*/
List<InventoryDetailDto> selectDeviceInventoryDetail(@Param("deviceIdList") List<Long> deviceIdList,
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
>>>>>>> v1.3
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
}

View File

@@ -13,10 +13,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
@@ -114,8 +111,8 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// 获取状态
List<DeviceManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
deviceManageInitDto.setStatusFlagOptions(statusEnumOptions);
// // 获取执行科室
@@ -131,28 +128,27 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// .map(category -> new DeviceManageInitDto.deviceCategory(category.getValue(), category.getInfo()))
// .collect(Collectors.toList());
// deviceManageInitDto.setDeviceCategories(deviceCategories);
// 获取器材
List<SysDictData> deviceList =
sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DEVICE_CATEGORY_CODE);
List<SysDictData> deviceList
= sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DEVICE_CATEGORY_CODE);
// 从字典中获取器材分类
List<DeviceManageInitDto.dictCategoryCode> deviceCategories = deviceList.stream()
.map(category -> new DeviceManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel()))
.collect(Collectors.toList());
.map(category -> new DeviceManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel()))
.collect(Collectors.toList());
deviceManageInitDto.setDeviceCategories(deviceCategories);
// 获取医保是否对码
List<DeviceManageInitDto.statusEnumOption> statusYBWeatherOption = Stream.of(Whether.values())
.map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
deviceManageInitDto.setStatusYBWeatherOptions(statusYBWeatherOption);
// 查询供应商列表
List<Supplier> supplierList = supplierService.getList();
// 供应商信息
List<DeviceManageInitDto.supplierListOption> supplierListOptions = supplierList.stream()
.map(supplier -> new DeviceManageInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
.map(supplier -> new DeviceManageInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
deviceManageInitDto.setSupplierListOptions(supplierListOptions);
return R.ok(deviceManageInitDto);
@@ -169,15 +165,15 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
*/
@Override
public R<?> getDevicePage(DeviceManageSelParam deviceManageSelParam, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<DeviceManageDto> queryWrapper = HisQueryUtils.buildQueryWrapper(deviceManageSelParam, searchKey,
new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
// 分页查询
IPage<DeviceManageDto> deviceManagePage =
deviceManageMapper.getDevicePage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<DeviceManageDto> deviceManagePage
= deviceManageMapper.getDevicePage(new Page<>(pageNo, pageSize), queryWrapper);
deviceManagePage.getRecords().forEach(e -> {
// 高值器材标志枚举类回显赋值
@@ -219,8 +215,8 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// 调用医保目录对照接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(deviceDefinition.getYbNo())) {
R<?> r =
ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
R<?> r
= ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
@@ -228,29 +224,29 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
chargeItemDefinition.setYbType(deviceManageDto.getYbType()).setTypeCode(deviceManageDto.getItemTypeCode())
.setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageDto.getRetailPrice())
.setChargeName(deviceManageDto.getName());;
.setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageDto.getRetailPrice())
.setChargeName(deviceManageDto.getName());;
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition);
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition);
// 更新价格表
boolean upItemDef = itemDefinitionServic.updateItem(chargeItemDefinition);
// 更新子表,修改购入价,条件:采购
boolean upItemDetail1 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
deviceManageDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
deviceManageDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
// 更新子表,修改零售价,条件:单位
boolean upItemDetail2 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
deviceManageDto.getRetailPrice(), ConditionCode.UNIT.getCode());
deviceManageDto.getRetailPrice(), ConditionCode.UNIT.getCode());
// 更新子表,修改最高零售价,条件:限制
boolean upItemDetail3 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
deviceManageDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
deviceManageDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
// 更新价格表
return upItemDef && upItemDetail1 && upItemDetail2 && upItemDetail3
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? 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));
}
@@ -288,12 +284,12 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
// 更新器材信息
return deviceDefinitionService.updateBatchById(DeviceDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -314,12 +310,12 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
// 更新器材信息
return deviceDefinitionService.updateBatchById(DeviceDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -344,27 +340,27 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// 调用医保目录对照接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(deviceDefinition.getYbNo())) {
R<?> r =
ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
R<?> r
= ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
}
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.INSERT.getCode(),
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition);
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition);
ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto();
BeanUtils.copyProperties(deviceManageUpDto, itemUpFromDirectoryDto);
itemUpFromDirectoryDto.setTypeCode(deviceManageUpDto.getItemTypeCode())
.setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setConditionFlag(Whether.YES.getValue()).setChargeName(deviceManageUpDto.getName())
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageUpDto.getRetailPrice());
.setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setConditionFlag(Whether.YES.getValue()).setChargeName(deviceManageUpDto.getName())
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageUpDto.getRetailPrice());
return itemDefinitionServic.addItem(itemUpFromDirectoryDto)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
? 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));
}
@@ -391,21 +387,21 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// 查询机构ID、位置信息供后续使用
Long orgId = SecurityUtils.getLoginUser().getOrgId();
List<Location> locationList = locationService.list(new LambdaQueryWrapper<Location>()
.eq(Location::getDeleteFlag, DelFlag.NO.getCode()).orderByAsc(Location::getId));
.eq(Location::getDeleteFlag, DelFlag.NO.getCode()).orderByAsc(Location::getId));
Long defaultLocationId = locationList.stream().findFirst().orElse(new Location()).getId();
Map<String, List<Location>> locationNameMap =
locationList.stream().collect(Collectors.groupingBy(Location::getName));
Map<String, List<Location>> locationNameMap
= locationList.stream().collect(Collectors.groupingBy(Location::getName));
// 创建表数据
for (DeviceImportDto importDto : importDtoList) {
// 创建器材定义
DeviceDefinition deviceDefinition =
createDeviceDefinitionEntity(importDto, orgId, defaultLocationId, locationNameMap);
DeviceDefinition deviceDefinition
= createDeviceDefinitionEntity(importDto, orgId, defaultLocationId, locationNameMap);
deviceDefinitionService.save(deviceDefinition);
// 创建费用定价和详情
chargeItemDefinitionService.addChargeItemDefinitionAndDetail(importDto.getName(), importDto.getTypeCode(),
importDto.getYbType(), importDto.getUnitCode(), importDto.getPurchasePrice(),
importDto.getRetailPrice(), importDto.getMaximumRetailPrice(), orgId,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
importDto.getYbType(), importDto.getUnitCode(), importDto.getPurchasePrice(),
importDto.getRetailPrice(), importDto.getMaximumRetailPrice(), orgId,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
}
return R.ok(null, "导入成功!");
}
@@ -432,7 +428,7 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
List<DeviceRequest> deviceRequestList = deviceRequestService.getDevRequestByDeviceId(deviceId);
if (!deviceRequestList.isEmpty()) {
if (deviceRequestList.stream()
.allMatch(x -> x.getStatusEnum().equals(RequestStatus.COMPLETED.getValue()))) {
.allMatch(x -> x.getStatusEnum().equals(RequestStatus.COMPLETED.getValue()))) {
return R.ok(1, "医生开过该耗材,不可编辑");
} else {
// 校验是否可以编辑
@@ -558,7 +554,7 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
}
if (!lineValidateMsgList.isEmpty()) {
fieldValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
}
}
if (!fieldValidateMsgList.isEmpty()) {
@@ -567,12 +563,12 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
// 重复校验(文件行重复)
List<String> lineRepeatedValidateMsgList = new ArrayList<>();
List<List<DeviceImportDto>> importDtoGroupList = new ArrayList<>(importDtoList.stream()
.collect(Collectors.groupingBy(e -> e.getName() + e.getManufacturerText() + e.getSize())).values());
.collect(Collectors.groupingBy(e -> e.getName() + e.getManufacturerText() + e.getSize())).values());
for (List<DeviceImportDto> importDtoGroup : importDtoGroupList) {
if (importDtoGroup.size() > 1) {
lineRepeatedValidateMsgList.add(
"■ 第" + importDtoGroup.stream().map(DeviceImportDto::getLineNumber).sorted().map(Object::toString)
.collect(Collectors.joining(",")) + "行的【" + importDtoGroup.get(0).getName() + "】重复;");
"■ 第" + importDtoGroup.stream().map(DeviceImportDto::getLineNumber).sorted().map(Object::toString)
.collect(Collectors.joining(",")) + "行的【" + importDtoGroup.get(0).getName() + "】重复;");
}
}
if (!lineRepeatedValidateMsgList.isEmpty()) {
@@ -582,12 +578,12 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
List<String> dbRepeatedValidateMsgList = new ArrayList<>();
for (DeviceImportDto importDto : importDtoList) {
List<DeviceDefinition> deviceDefinitionList = deviceDefinitionService
.list(new LambdaQueryWrapper<DeviceDefinition>().eq(DeviceDefinition::getName, importDto.getName())
.eq(DeviceDefinition::getManufacturerText, importDto.getManufacturerText())
.eq(DeviceDefinition::getSize, importDto.getSize()));
.list(new LambdaQueryWrapper<DeviceDefinition>().eq(DeviceDefinition::getName, importDto.getName())
.eq(DeviceDefinition::getManufacturerText, importDto.getManufacturerText())
.eq(DeviceDefinition::getSize, importDto.getSize()));
if (!deviceDefinitionList.isEmpty()) {
dbRepeatedValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
}
}
if (!dbRepeatedValidateMsgList.isEmpty()) {
@@ -606,7 +602,7 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
* @return 器材定义实体
*/
private DeviceDefinition createDeviceDefinitionEntity(DeviceImportDto importDto, Long orgId, Long defaultLocationId,
Map<String, List<Location>> locationNameMap) {
Map<String, List<Location>> locationNameMap) {
DeviceDefinition deviceDefinition = new DeviceDefinition();
// 根据输入的所在位置名称获取位置ID
List<Location> mapLocationList = locationNameMap.get(importDto.getLocationName());
@@ -616,20 +612,20 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
deviceDefinition.setLocationId(mapLocationList.get(0).getId());
}
deviceDefinition.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_NUM.getPrefix(), 10))
.setName(importDto.getName()).setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setCategoryCode(importDto.getCategoryCode()).setTypeCode(importDto.getTypeCode())
.setUnitCode(importDto.getUnitCode()).setSize(importDto.getSize())
.setItemMinQuantity(importDto.getItemMinQuantity()).setItemMaxQuantity(importDto.getItemMaxQuantity())
.setPartPercent(importDto.getPartPercent()).setMinUnitCode(importDto.getMinUnitCode()).setOrgId(orgId)
.setHvcmFlag(CommonUtil.tryParseInt(importDto.getHvcmFlag())).setSalesUnitCode(importDto.getSalesUnitCode())
.setApprovalNumber(importDto.getApprovalNumber()).setYbFlag(CommonUtil.tryParseInt(importDto.getYbFlag()))
.setYbNo(importDto.getYbNo()).setYbOrgNo(importDto.getYbOrgNo())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag()))
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()))
.setStatusEnum(PublicationStatus.ACTIVE.getValue()).setManufacturerText(importDto.getManufacturerText())
.setAllergenFlag(CommonUtil.tryParseInt(importDto.getAllergenFlag()))
.setRxFlag(CommonUtil.tryParseInt(importDto.getRxFlag()));
.setName(importDto.getName()).setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setCategoryCode(importDto.getCategoryCode()).setTypeCode(importDto.getTypeCode())
.setUnitCode(importDto.getUnitCode()).setSize(importDto.getSize())
.setItemMinQuantity(importDto.getItemMinQuantity()).setItemMaxQuantity(importDto.getItemMaxQuantity())
.setPartPercent(importDto.getPartPercent()).setMinUnitCode(importDto.getMinUnitCode()).setOrgId(orgId)
.setHvcmFlag(CommonUtil.tryParseInt(importDto.getHvcmFlag())).setSalesUnitCode(importDto.getSalesUnitCode())
.setApprovalNumber(importDto.getApprovalNumber()).setYbFlag(CommonUtil.tryParseInt(importDto.getYbFlag()))
.setYbNo(importDto.getYbNo()).setYbOrgNo(importDto.getYbOrgNo())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag()))
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()))
.setStatusEnum(PublicationStatus.ACTIVE.getValue()).setManufacturerText(importDto.getManufacturerText())
.setAllergenFlag(CommonUtil.tryParseInt(importDto.getAllergenFlag()))
.setRxFlag(CommonUtil.tryParseInt(importDto.getRxFlag()));
return deviceDefinition;
}

View File

@@ -87,26 +87,26 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
DiagnosisTreatmentInitDto diagnosisTreatmentInitDto = new DiagnosisTreatmentInitDto();
// 获取状态
List<DiagnosisTreatmentInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diagnosisTreatmentInitDto.setStatusFlagOptions(statusEnumOptions);
// 获取执行科室
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Organization::getTypeEnum, OrganizationType.DEPARTMENT);
List<Organization> organizations = organizationService.list(queryWrapper);
List<DiagnosisTreatmentInitDto.exeOrganization> exeOrganizations = organizations.stream()
.map(exeOrg -> new DiagnosisTreatmentInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
.collect(Collectors.toList());
.map(exeOrg -> new DiagnosisTreatmentInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
.collect(Collectors.toList());
diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations);
// 获取诊目录疗分类
List<SysDictData> diagnosisList =
sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE);
List<SysDictData> diagnosisList
= sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE);
// 获取诊疗录疗分类
List<DiagnosisTreatmentInitDto.dictCategoryCode> diagnosisCategories = diagnosisList.stream()
.map(category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(),
.map(category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(),
category.getDictLabel()))
.collect(Collectors.toList());
.collect(Collectors.toList());
diagnosisTreatmentInitDto.setDiagnosisCategoryOptions(diagnosisCategories);
// // 查询医疗服务项类型
@@ -143,18 +143,17 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
// diseaseTreatmentCategories.add(diseaseTreatmentCategory2);
//
// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories);
// 获取类型
List<DiagnosisTreatmentInitDto.statusEnumOption> typeEnumOptions = Stream.of(ActivityType.values())
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diagnosisTreatmentInitDto.setTypeEnumOptions(typeEnumOptions);
// 获取是/否 列表
// 获取状态
List<DiagnosisTreatmentInitDto.statusEnumOption> statusWeatherOption = Stream.of(Whether.values())
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diagnosisTreatmentInitDto.setStatusWeatherOption(statusWeatherOption);
return R.ok(diagnosisTreatmentInitDto);
@@ -171,15 +170,15 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
*/
@Override
public R<?> getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam,
searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
// 分页查询
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage =
activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper);
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper);
diseaseTreatmentPage.getRecords().forEach(e -> {
// 医保标记枚举类回显赋值
@@ -237,7 +236,7 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(activityDefinition.getYbNo())) {
R<?> r = ybService.directoryCheck(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
activityDefinition.getId());
activityDefinition.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
@@ -245,27 +244,27 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType())
.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode())
.setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION)
.setInstanceId(diagnosisTreatmentUpDto.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice())
.setPriceCode(diagnosisTreatmentUpDto.getPriceCode()).setChargeName(diagnosisTreatmentUpDto.getName());
.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode())
.setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION)
.setInstanceId(diagnosisTreatmentUpDto.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice())
.setPriceCode(diagnosisTreatmentUpDto.getPriceCode()).setChargeName(diagnosisTreatmentUpDto.getName());
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, activityDefinition);
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, activityDefinition);
// 更新价格表
boolean upItemDef = itemDefinitionService.updateItem(chargeItemDefinition);
// 更新子表,修改零售价,条件:单位
boolean upItemDetail1 = itemDefinitionService.updateItemDetail(chargeItemDefinition,
diagnosisTreatmentUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
diagnosisTreatmentUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
// 更新子表,修改最高零售价,条件:限制
boolean upItemDetail2 = itemDefinitionService.updateItemDetail(chargeItemDefinition,
diagnosisTreatmentUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
diagnosisTreatmentUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
// 更新价格表
return upItemDef && upItemDetail1 && upItemDetail2
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? 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));
@@ -291,11 +290,11 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
// 更新诊疗信息
return activityDefinitionService.updateBatchById(ActivityDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
@@ -319,11 +318,11 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
// 更新诊疗信息
return activityDefinitionService.updateBatchById(ActivityDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
@@ -359,28 +358,28 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(activityDefinition.getYbNo())) {
R<?> r = ybService.directoryCheck(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
activityDefinition.getId());
activityDefinition.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
}
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.INSERT.getCode(),
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, activityDefinition);
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, activityDefinition);
ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto();
BeanUtils.copyProperties(diagnosisTreatmentUpDto, itemUpFromDirectoryDto);
itemUpFromDirectoryDto.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode())
.setUnitCode(diagnosisTreatmentUpDto.getPermittedUnitCode())
.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())
.setPriceCode(diagnosisTreatmentUpDto.getPriceCode());
.setUnitCode(diagnosisTreatmentUpDto.getPermittedUnitCode())
.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())
.setPriceCode(diagnosisTreatmentUpDto.getPriceCode());
return itemDefinitionService.addItem(itemUpFromDirectoryDto)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
? 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));
@@ -396,8 +395,8 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
@Override
public R<?> importData(MultipartFile file) {
// 读取文件
R<List<DiagnosisTreatmentImportDto>> readResult =
CommonUtil.readImportedExcelFile(file, DiagnosisTreatmentImportDto.class);
R<List<DiagnosisTreatmentImportDto>> readResult
= CommonUtil.readImportedExcelFile(file, DiagnosisTreatmentImportDto.class);
if (R.SUCCESS != readResult.getCode()) {
return readResult;
}
@@ -416,9 +415,9 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
activityDefinitionService.save(activityDefinition);
// 创建费用定价和详情
chargeItemDefinitionService.addChargeItemDefinitionAndDetail(importDto.getName(), importDto.getTypeCode(),
importDto.getYbType(), importDto.getPermittedUnitCode(), null, importDto.getRetailPrice(),
importDto.getMaximumRetailPrice(), orgId, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
activityDefinition.getId());
importDto.getYbType(), importDto.getPermittedUnitCode(), null, importDto.getRetailPrice(),
importDto.getMaximumRetailPrice(), orgId, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
activityDefinition.getId());
}
return R.ok(null, "导入成功!");
}
@@ -446,12 +445,8 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
List<ServiceRequest> serviceRequestList = serviceRequestService.getServiceRequestByActivityId(activityId);
if (!serviceRequestList.isEmpty()) {
if (serviceRequestList.stream().anyMatch(
serviceRequest -> RequestStatus.COMPLETED.getValue().equals(serviceRequest.getStatusEnum()))) {
<<<<<<< HEAD
return R.ok(1,"医生开过该诊疗项目,不可编辑");
=======
serviceRequest -> RequestStatus.COMPLETED.getValue().equals(serviceRequest.getStatusEnum()))) {
return R.ok(1, "医生开过该诊疗项目,不可编辑");
>>>>>>> v1.3
}
}
return R.ok();
@@ -518,7 +513,7 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
}
if (!lineValidateMsgList.isEmpty()) {
fieldValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
}
}
if (!fieldValidateMsgList.isEmpty()) {
@@ -527,13 +522,13 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
// 重复校验(文件行重复)
List<String> lineRepeatedValidateMsgList = new ArrayList<>();
List<List<DiagnosisTreatmentImportDto>> importDtoGroupList = new ArrayList<>(
importDtoList.stream().collect(Collectors.groupingBy(DiagnosisTreatmentImportDto::getName)).values());
importDtoList.stream().collect(Collectors.groupingBy(DiagnosisTreatmentImportDto::getName)).values());
for (List<DiagnosisTreatmentImportDto> importDtoGroup : importDtoGroupList) {
if (importDtoGroup.size() > 1) {
lineRepeatedValidateMsgList.add("■ 第"
+ importDtoGroup.stream().map(DiagnosisTreatmentImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(","))
+ "行的【" + importDtoGroup.get(0).getName() + "】重复;");
+ importDtoGroup.stream().map(DiagnosisTreatmentImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(","))
+ "行的【" + importDtoGroup.get(0).getName() + "】重复;");
}
}
if (!lineRepeatedValidateMsgList.isEmpty()) {
@@ -543,10 +538,10 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
List<String> dbRepeatedValidateMsgList = new ArrayList<>();
for (DiagnosisTreatmentImportDto importDto : importDtoList) {
List<ActivityDefinition> deviceDefinitionList = activityDefinitionService.list(
new LambdaQueryWrapper<ActivityDefinition>().eq(ActivityDefinition::getName, importDto.getName()));
new LambdaQueryWrapper<ActivityDefinition>().eq(ActivityDefinition::getName, importDto.getName()));
if (!deviceDefinitionList.isEmpty()) {
dbRepeatedValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
}
}
if (!dbRepeatedValidateMsgList.isEmpty()) {
@@ -565,14 +560,14 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
private ActivityDefinition createActivityDefinitionEntity(DiagnosisTreatmentImportDto importDto, Long orgId) {
ActivityDefinition activityDefinition = new ActivityDefinition();
activityDefinition.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_DEFINITION_NUM.getPrefix(), 10))
.setName(importDto.getName()).setCategoryCode(importDto.getCategoryCode())
.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setPermittedUnitCode(importDto.getPermittedUnitCode()).setOrgId(orgId)
.setYbFlag(CommonUtil.tryParseInt(importDto.getYbFlag())).setYbNo(importDto.getYbNo())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag()))
.setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()));
.setName(importDto.getName()).setCategoryCode(importDto.getCategoryCode())
.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setPermittedUnitCode(importDto.getPermittedUnitCode()).setOrgId(orgId)
.setYbFlag(CommonUtil.tryParseInt(importDto.getYbFlag())).setYbNo(importDto.getYbNo())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag()))
.setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()));
return activityDefinition;
}
}

View File

@@ -12,10 +12,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
@@ -118,53 +115,53 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
MedicationManageInitDto medicationManageInitDto = new MedicationManageInitDto();
// 获取状态,从枚举里面取下拉值
List<MedicationManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 获取适用范围
List<MedicationManageInitDto.domainEnumOption> domainEnumOptions = Stream.of(ApplicableScope.values())
.map(domain -> new MedicationManageInitDto.domainEnumOption(domain.getValue(), domain.getInfo()))
.collect(Collectors.toList());
.map(domain -> new MedicationManageInitDto.domainEnumOption(domain.getValue(), domain.getInfo()))
.collect(Collectors.toList());
// 查询供应商列表
List<Supplier> supplierList = supplierService.getList();
// 供应商信息
List<MedicationManageInitDto.supplierListOption> supplierListOptions = supplierList.stream()
.map(supplier -> new MedicationManageInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
.map(supplier -> new MedicationManageInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
// 获取药品分类
List<SysDictData> medicalList =
sysDictTypeService.selectDictDataByType(CommonConstants.DictName.MED_CATEGORY_CODE);
List<SysDictData> medicalList
= sysDictTypeService.selectDictDataByType(CommonConstants.DictName.MED_CATEGORY_CODE);
// 获取药品分类
List<MedicationManageInitDto.dictCategoryCode> medicationCategories = medicalList.stream().map(
category -> new MedicationManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel()))
.collect(Collectors.toList());
category -> new MedicationManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel()))
.collect(Collectors.toList());
// 获取是/否 列表
// 获取状态
List<MedicationManageInitDto.statusEnumOption> statusWeatherOption = Stream.of(Whether.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 权限限制
List<MedicationManageInitDto.statusEnumOption> statusRestrictedOptions = Stream.of(PermissionLimit.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 拆分属性
List<MedicationManageInitDto.statusEnumOption> partAttributeEnumOptions = Stream.of(SplitPropertyCode.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 住院临时医嘱拆分属性的枚举
List<MedicationManageInitDto.statusEnumOption> tempOrderSplitPropertyOptions =
Stream.of(TempOrderSplitPropertyCode.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 权限限制
List<MedicationManageInitDto.statusEnumOption> statusRestrictedOptions = Stream.of(PermissionLimit.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 拆分属性
List<MedicationManageInitDto.statusEnumOption> partAttributeEnumOptions = Stream.of(SplitPropertyCode.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 住院临时医嘱拆分属性的枚举
List<MedicationManageInitDto.statusEnumOption> tempOrderSplitPropertyOptions
= Stream.of(TempOrderSplitPropertyCode.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 医保等级List
List<MedicationManageInitDto.statusEnumOption> chrgitmLvOptions = Stream.of(InsuranceLevel.values())
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
medicationManageInitDto.setStatusFlagOptions(statusEnumOptions);
medicationManageInitDto.setDomainFlagOptions(domainEnumOptions);
@@ -190,18 +187,18 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
*/
@Override
public R<?> getMedicationList(MedicationSearchParam medicationSearchParam,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<MedicationManageDto> queryWrapper = HisQueryUtils.buildQueryWrapper(medicationSearchParam,
searchKey, new HashSet<>(Arrays.asList("name", "name_en", "merchandise_name", "bus_no", "py_str", "wb_str",
"merchandise_py_str", "merchandise_wb_str")),
null);
searchKey, new HashSet<>(Arrays.asList("name", "name_en", "merchandise_name", "bus_no", "py_str", "wb_str",
"merchandise_py_str", "merchandise_wb_str")),
null);
IPage<MedicationManageDto> medicationManageDtoPage =
medicationManageSearchMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<MedicationManageDto> medicationManageDtoPage
= medicationManageSearchMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper);
// 枚举类回显赋值
medicationManageDtoPage.getRecords().forEach(e -> {
@@ -232,10 +229,10 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
e.setBasicFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getBasicFlag()));
// 拆分分属性
e.setPartAttributeEnum_enumText(
EnumUtils.getInfoByValue(SplitPropertyCode.class, e.getPartAttributeEnum()));
EnumUtils.getInfoByValue(SplitPropertyCode.class, e.getPartAttributeEnum()));
// 住院临时医嘱拆分属性
e.setThoPartAttributeEnum_enumText(
EnumUtils.getInfoByValue(TempOrderSplitPropertyCode.class, e.getThoPartAttributeEnum()));
EnumUtils.getInfoByValue(TempOrderSplitPropertyCode.class, e.getThoPartAttributeEnum()));
// // 活动标记
// e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag()));
@@ -263,18 +260,18 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// 拼音码
medicationDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDefinition.getName()));
medicationDefinition
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDefinition.getMerchandiseName()));
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDefinition.getMerchandiseName()));
// 五笔码
medicationDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDefinition.getName()));
medicationDefinition
.setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDefinition.getMerchandiseName()));
.setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDefinition.getMerchandiseName()));
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
chargeItemDefinition.setYbType(medicationManageUpDto.getYbType())
.setTypeCode(medicationManageUpDto.getTypeCode())
.setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setInstanceId(medicationManageUpDto.getMedicationDefId()).setPrice(medicationManageUpDto.getRetailPrice())
.setChargeName(medicationManageUpDto.getName());
.setTypeCode(medicationManageUpDto.getTypeCode())
.setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setInstanceId(medicationManageUpDto.getMedicationDefId()).setPrice(medicationManageUpDto.getRetailPrice())
.setChargeName(medicationManageUpDto.getName());
// 更新子表药品信息
if (medicationService.updateById(medication)) {
@@ -282,11 +279,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
boolean updateMedicationDefinition = medicationDefinitionService.updateById(medicationDefinition);
if (updateMedicationDefinition) {
// 调用医保目录对照接口
String ybSwitch =
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
String ybSwitch
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(medicationDefinition.getYbNo())) {
R<?> r = ybService.directoryCheck(CommonConstants.TableName.MED_MEDICATION_DEFINITION,
medicationDefinition.getId());
medicationDefinition.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
@@ -295,24 +292,24 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medication);
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medication);
// Todo:封装一个价格初始话的方法给app层调用
// 更新价格表
boolean updateChargeItemDefinition = itemDefinitionServic.updateItem(chargeItemDefinition);
// 更新子表,修改购入价,条件:采购
boolean upItemDetail1 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
medicationManageUpDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
medicationManageUpDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
// 更新子表,修改零售价,条件:单位
boolean upItemDetail2 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
medicationManageUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
medicationManageUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
// 更新子表,修改最高零售价,条件:限制
boolean upItemDetail3 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
medicationManageUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
medicationManageUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
return (updateMedicationDefinition && updateChargeItemDefinition && upItemDetail1 && upItemDetail2
&& upItemDetail3)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
&& upItemDetail3)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} else {
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
@@ -356,11 +353,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// TODO:别用三元,日志在业务代码以后记录
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
// 更新药品信息
return medicationService.updateBatchById(medicationList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -382,11 +379,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
// 更新药品信息
return medicationService.updateBatchById(medicationList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -406,11 +403,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// 拼音码
medicationDetail.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getName()));
medicationDetail
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getMerchandiseName()));
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getMerchandiseName()));
// 五笔码
medicationDetail.setWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDetail.getName()));
medicationDetail
.setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDetail.getMerchandiseName()));
.setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDetail.getMerchandiseName()));
// 新增主表外来药品目录
if (medicationDefinitionService.addMedication(medicationDetail)) {
@@ -418,31 +415,31 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(medicationDetail.getYbNo())) {
R<?> r = ybService.directoryCheck(CommonConstants.TableName.MED_MEDICATION_DEFINITION,
medicationDetail.getId());
medicationDetail.getId());
if (200 != r.getCode()) {
throw new RuntimeException("医保目录对照接口异常");
}
}
// 插入操作记录
operationRecordService.addEntityOperationRecord(DbOpType.INSERT.getCode(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medicationDetail);
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medicationDetail);
// 新增子表外来药品目录
boolean insertMedicationSuccess = medicationService.addMedication(medicationDetail);
ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto();
BeanUtils.copyProperties(medicationManageUpDto, itemUpFromDirectoryDto);
itemUpFromDirectoryDto.setInstanceId(medicationDetail.getMedicationDefId())
.setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setEffectiveStart(DateUtils.getNowDate()).setOrgId(SecurityUtils.getLoginUser().getOrgId())
.setConditionFlag(Whether.YES.getValue()).setChargeName(medicationDetail.getName())
.setPrice(medicationManageUpDto.getRetailPrice());
.setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setEffectiveStart(DateUtils.getNowDate()).setOrgId(SecurityUtils.getLoginUser().getOrgId())
.setConditionFlag(Whether.YES.getValue()).setChargeName(medicationDetail.getName())
.setPrice(medicationManageUpDto.getRetailPrice());
// 添加药品成功后,添加相应的条件价格表信息
boolean insertItemDefinitionSuccess = itemDefinitionServic.addItem(itemUpFromDirectoryDto);
return (insertMedicationSuccess && insertItemDefinitionSuccess)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"药品目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
} else {
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
}
@@ -450,11 +447,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
@Override
public R<?> exportMedication(String searchKey, Integer ybMatchFlag, Integer statusEnum, String categoryCode,
HttpServletResponse response) {
HttpServletResponse response) {
// 获取租户ID
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
List<MedicationManageDto> list =
medicationManageSearchMapper.getList(searchKey, ybMatchFlag, statusEnum, categoryCode, tenantId);
List<MedicationManageDto> list
= medicationManageSearchMapper.getList(searchKey, ybMatchFlag, statusEnum, categoryCode, tenantId);
ExcelUtil<MedicationManageDto> util = new ExcelUtil<>(MedicationManageDto.class);
util.exportExcel(response, list, "药品目录");
return null;
@@ -482,24 +479,24 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// 查询机构ID、位置信息供后续使用
Long orgId = SecurityUtils.getLoginUser().getOrgId();
List<Location> locationList = locationService.list(new LambdaQueryWrapper<Location>()
.eq(Location::getDeleteFlag, DelFlag.NO.getCode()).orderByAsc(Location::getId));
.eq(Location::getDeleteFlag, DelFlag.NO.getCode()).orderByAsc(Location::getId));
Long defaultLocationId = locationList.stream().findFirst().orElse(new Location()).getId();
Map<String, List<Location>> locationNameMap =
locationList.stream().collect(Collectors.groupingBy(Location::getName));
Map<String, List<Location>> locationNameMap
= locationList.stream().collect(Collectors.groupingBy(Location::getName));
// 创建表数据
for (MedicationImportDto importDto : importDtoList) {
// 创建药品定义
MedicationDefinition medicationDefinition = createMedicationDefinitionEntity(importDto);
medicationDefinitionService.save(medicationDefinition);
// 创建药品
Medication medication =
createMedicationEntity(importDto, medicationDefinition.getId(), defaultLocationId, locationNameMap);
Medication medication
= createMedicationEntity(importDto, medicationDefinition.getId(), defaultLocationId, locationNameMap);
medicationService.save(medication);
// 创建费用定价和详情
chargeItemDefinitionService.addChargeItemDefinitionAndDetail(importDto.getName(), importDto.getTypeCode(),
importDto.getYbType(), importDto.getUnitCode(), importDto.getPurchasePrice(),
importDto.getRetailPrice(), importDto.getMaximumRetailPrice(), orgId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medicationDefinition.getId());
importDto.getYbType(), importDto.getUnitCode(), importDto.getPurchasePrice(),
importDto.getRetailPrice(), importDto.getMaximumRetailPrice(), orgId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medicationDefinition.getId());
}
return R.ok(null, "导入成功!");
}
@@ -523,11 +520,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
*/
@Override
public R<?> validateMedicationEdit(Long medicationId) {
List<MedicationRequest> medicationRequestList =
medicationRequestService.getMedRequestByMedicationId(medicationId);
List<MedicationRequest> medicationRequestList
= medicationRequestService.getMedRequestByMedicationId(medicationId);
if (!medicationRequestList.isEmpty()) {
if (medicationRequestList.stream()
.allMatch(x -> x.getStatusEnum().equals(RequestStatus.COMPLETED.getValue()))) {
.allMatch(x -> x.getStatusEnum().equals(RequestStatus.COMPLETED.getValue()))) {
return R.ok(1, "医生开过该药品,不可编辑");
} else {
// 校验是否可以编辑
@@ -542,7 +539,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
/**
* 导入信息校验
*
*
* @param importDtoList 药品目录导入数据列表
*/
private R<?> validateImportDtoList(List<MedicationImportDto> importDtoList) {
@@ -559,9 +556,9 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
lineValidateMsgList.add("药品分类必填");
}
if (Whether.YES.getCode().equals(importDto.getYbMatchFlag())
&& !MedCategoryCode.TRADITIONAL_CHINESE_MEDICINE.getValue().equals(importDto.getCategoryCode())
&& !MedCategoryCode.WESTERN_MEDICINE.getValue().equals(importDto.getCategoryCode())
&& !MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue().equals(importDto.getCategoryCode())) {
&& !MedCategoryCode.TRADITIONAL_CHINESE_MEDICINE.getValue().equals(importDto.getCategoryCode())
&& !MedCategoryCode.WESTERN_MEDICINE.getValue().equals(importDto.getCategoryCode())
&& !MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue().equals(importDto.getCategoryCode())) {
lineValidateMsgList.add("医保药的药品分类只能选择中成药、西药或中草药;");
}
if (StringUtils.isEmpty(importDto.getMerchandiseName())) {
@@ -605,7 +602,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
lineValidateMsgList.add("是否限制使用必填");
}
if (Whether.YES.getCode().equals(importDto.getRestrictedFlag())
&& StringUtils.isEmpty(importDto.getRestrictedScope())) {
&& StringUtils.isEmpty(importDto.getRestrictedScope())) {
lineValidateMsgList.add("限制使用时,限制使用范围必填");
}
if (StringUtils.isEmpty(importDto.getChildrenFlag())) {
@@ -618,7 +615,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
lineValidateMsgList.add("是否抗生素必填");
}
if (Whether.YES.getCode().equals(importDto.getAntibioticFlag())
&& StringUtils.isEmpty(importDto.getAntibioticCode())) {
&& StringUtils.isEmpty(importDto.getAntibioticCode())) {
lineValidateMsgList.add("为抗生素时,抗生素分类必填");
}
if (StringUtils.isEmpty(importDto.getSelfFlag())) {
@@ -731,7 +728,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
}
if (!lineValidateMsgList.isEmpty()) {
fieldValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
}
}
if (!fieldValidateMsgList.isEmpty()) {
@@ -740,15 +737,15 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
// 重复校验(文件行重复)
List<String> lineRepeatedValidateMsgList = new ArrayList<>();
List<List<MedicationImportDto>> importDtoGroupList = new ArrayList<>(importDtoList.stream()
.collect(Collectors.groupingBy(e -> e.getName() + e.getManufacturerText() + e.getTotalVolume())).values());
.collect(Collectors.groupingBy(e -> e.getName() + e.getManufacturerText() + e.getTotalVolume())).values());
for (List<MedicationImportDto> importDtoGroup : importDtoGroupList) {
if (importDtoGroup.size() > 1) {
lineRepeatedValidateMsgList
.add(
"■ 第"
+ importDtoGroup.stream().map(MedicationImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(","))
+ "行的【" + importDtoGroup.get(0).getName() + "】重复;");
.add(
"■ 第"
+ importDtoGroup.stream().map(MedicationImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(","))
+ "行的【" + importDtoGroup.get(0).getName() + "】重复;");
}
}
if (!lineRepeatedValidateMsgList.isEmpty()) {
@@ -758,18 +755,18 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
List<String> dbRepeatedValidateMsgList = new ArrayList<>();
for (MedicationImportDto importDto : importDtoList) {
List<MedicationDefinition> medicationDefinitionList = medicationDefinitionService.list(
new LambdaQueryWrapper<MedicationDefinition>().eq(MedicationDefinition::getName, importDto.getName())
.eq(MedicationDefinition::getManufacturerText, importDto.getManufacturerText()));
new LambdaQueryWrapper<MedicationDefinition>().eq(MedicationDefinition::getName, importDto.getName())
.eq(MedicationDefinition::getManufacturerText, importDto.getManufacturerText()));
if (!medicationDefinitionList.isEmpty()) {
List<Medication> medicationList =
medicationService.list(new LambdaQueryWrapper<Medication>()
.in(Medication::getMedicationDefId,
medicationDefinitionList.stream().map(MedicationDefinition::getId)
.collect(Collectors.toList()))
.eq(Medication::getTotalVolume, importDto.getTotalVolume()));
List<Medication> medicationList
= medicationService.list(new LambdaQueryWrapper<Medication>()
.in(Medication::getMedicationDefId,
medicationDefinitionList.stream().map(MedicationDefinition::getId)
.collect(Collectors.toList()))
.eq(Medication::getTotalVolume, importDto.getTotalVolume()));
if (!medicationList.isEmpty()) {
dbRepeatedValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
.add("■ 第" + importDto.getLineNumber() + "行的【" + importDto.getName() + "】在系统中已存在;");
}
}
}
@@ -781,48 +778,48 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
/**
* 创建药品定义实体
*
*
* @param importDto 药品目录导入Dto
* @return 药品定义实体
*/
private MedicationDefinition createMedicationDefinitionEntity(MedicationImportDto importDto) {
MedicationDefinition medicationDefinition = new MedicationDefinition();
medicationDefinition.setName(importDto.getName())
.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_NUM.getPrefix(), 10)).setDomainEnum(1)
.setVersion(importDto.getVersion()).setNameEn(importDto.getNameEn())
.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setCategoryCode(importDto.getCategoryCode()).setMerchandiseName(importDto.getMerchandiseName())
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getMerchandiseName()))
.setMerchandiseWbStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getMerchandiseName()))
.setUnitCode(importDto.getUnitCode()).setMinUnitCode(importDto.getMinUnitCode())
.setPartPercent(importDto.getPartPercent()).setDoseFrom(CommonUtil.tryParseInt(importDto.getDoseFrom()))
.setApprovalNumber(importDto.getApprovalNumber())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag())).setYbNo(importDto.getYbNo())
.setPharmacologyCategoryCode(importDto.getPharmacologyCategoryCode())
.setSkinTestFlag(CommonUtil.tryParseInt(importDto.getSkinTestFlag()))
.setInjectFlag(CommonUtil.tryParseInt(importDto.getInjectFlag()))
.setManufacturerText(importDto.getManufacturerText())
.setRestrictedFlag(CommonUtil.tryParseInt(importDto.getRestrictedFlag()))
.setRestrictedScope(importDto.getRestrictedScope()).setActiveFlag(Whether.YES.getValue())
.setChildrenFlag(CommonUtil.tryParseInt(importDto.getChildrenFlag()))
.setNationalDrugCode(importDto.getNationalDrugCode())
.setPartAttributeEnum(CommonUtil.tryParseInt(importDto.getPartAttributeEnum()))
.setAntibioticCode(importDto.getAntibioticCode())
.setSelfFlag(CommonUtil.tryParseInt(importDto.getSelfFlag()))
.setAntibioticFlag(CommonUtil.tryParseInt(importDto.getAntibioticFlag()))
.setBasicFlag(CommonUtil.tryParseInt(importDto.getBasicFlag()))
.setThoPartAttributeEnum(CommonUtil.tryParseInt(importDto.getThoPartAttributeEnum()))
.setUnitConversionRatio(importDto.getUnitConversionRatio())
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()))
.setRxFlag(CommonUtil.tryParseInt(importDto.getRxFlag())).setItemMinQuantity(importDto.getItemMinQuantity())
.setItemMaxQuantity(importDto.getItemMaxQuantity());
.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_NUM.getPrefix(), 10)).setDomainEnum(1)
.setVersion(importDto.getVersion()).setNameEn(importDto.getNameEn())
.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()))
.setWbStr(ChineseConvertUtils.toWBFirstLetter(importDto.getName()))
.setCategoryCode(importDto.getCategoryCode()).setMerchandiseName(importDto.getMerchandiseName())
.setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getMerchandiseName()))
.setMerchandiseWbStr(ChineseConvertUtils.toPinyinFirstLetter(importDto.getMerchandiseName()))
.setUnitCode(importDto.getUnitCode()).setMinUnitCode(importDto.getMinUnitCode())
.setPartPercent(importDto.getPartPercent()).setDoseFrom(CommonUtil.tryParseInt(importDto.getDoseFrom()))
.setApprovalNumber(importDto.getApprovalNumber())
.setYbMatchFlag(CommonUtil.tryParseInt(importDto.getYbMatchFlag())).setYbNo(importDto.getYbNo())
.setPharmacologyCategoryCode(importDto.getPharmacologyCategoryCode())
.setSkinTestFlag(CommonUtil.tryParseInt(importDto.getSkinTestFlag()))
.setInjectFlag(CommonUtil.tryParseInt(importDto.getInjectFlag()))
.setManufacturerText(importDto.getManufacturerText())
.setRestrictedFlag(CommonUtil.tryParseInt(importDto.getRestrictedFlag()))
.setRestrictedScope(importDto.getRestrictedScope()).setActiveFlag(Whether.YES.getValue())
.setChildrenFlag(CommonUtil.tryParseInt(importDto.getChildrenFlag()))
.setNationalDrugCode(importDto.getNationalDrugCode())
.setPartAttributeEnum(CommonUtil.tryParseInt(importDto.getPartAttributeEnum()))
.setAntibioticCode(importDto.getAntibioticCode())
.setSelfFlag(CommonUtil.tryParseInt(importDto.getSelfFlag()))
.setAntibioticFlag(CommonUtil.tryParseInt(importDto.getAntibioticFlag()))
.setBasicFlag(CommonUtil.tryParseInt(importDto.getBasicFlag()))
.setThoPartAttributeEnum(CommonUtil.tryParseInt(importDto.getThoPartAttributeEnum()))
.setUnitConversionRatio(importDto.getUnitConversionRatio())
.setChrgitmLv(CommonUtil.tryParseInt(importDto.getChrgitmLv()))
.setRxFlag(CommonUtil.tryParseInt(importDto.getRxFlag())).setItemMinQuantity(importDto.getItemMinQuantity())
.setItemMaxQuantity(importDto.getItemMaxQuantity());
return medicationDefinition;
}
/**
* 创建药品基本实体
*
*
* @param importDto 药品目录导入Dto
* @param medicationDefId 药品定义ID
* @param defaultLocationId 默认位置ID
@@ -830,7 +827,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
* @return 药品基本实体
*/
private Medication createMedicationEntity(MedicationImportDto importDto, Long medicationDefId,
Long defaultLocationId, Map<String, List<Location>> locationNameMap) {
Long defaultLocationId, Map<String, List<Location>> locationNameMap) {
Medication medication = new Medication();
// 根据输入的所在位置名称获取位置ID
List<Location> mapLocationList = locationNameMap.get(importDto.getLocationName());
@@ -840,10 +837,10 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
medication.setLocationId(mapLocationList.get(0).getId());
}
medication.setMedicationDefId(medicationDefId).setStatusEnum(PublicationStatus.ACTIVE.getValue())
.setDoseFormCode(importDto.getDoseFrom()).setTotalVolume(importDto.getTotalVolume())
.setActiveFlag(Whether.YES.getValue()).setMethodCode(importDto.getMethodCode())
.setRateCode(importDto.getRateCode()).setDose(importDto.getDose())
.setDoseUnitCode(importDto.getDoseUnitCode()).setMaxUnit(importDto.getMaxUnit());
.setDoseFormCode(importDto.getDoseFrom()).setTotalVolume(importDto.getTotalVolume())
.setActiveFlag(Whether.YES.getValue()).setMethodCode(importDto.getMethodCode())
.setRateCode(importDto.getRateCode()).setDose(importDto.getDose())
.setDoseUnitCode(importDto.getDoseUnitCode()).setMaxUnit(importDto.getMaxUnit());
return medication;
}

View File

@@ -22,271 +22,414 @@ import javax.validation.constraints.NotNull;
@Accessors(chain = true)
public class MedicationManageDto {
/** ID */
/**
* ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 药品编码 */
/**
* 药品编码
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long medicationDefId;
/** 药品状态 */
/**
* 药品状态
*/
private Integer statusEnum;
private String statusEnum_enumText;
/** 所属科室 */
/**
* 所属科室
*/
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
private String orgId_dictText;
/** 所在位置 */
/**
* 所在位置
*/
@Dict(dictTable = "adm_location", dictCode = "id", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long locationId;
private String locationId_dictText;
/** 剂型 */
/**
* 剂型
*/
@Dict(dictCode = "dose_form_code")
private String doseFormCode;
private String doseFormCode_dictText;
/** 规格 */
/**
* 规格
*/
private String totalVolume;
/** 成分 */
/**
* 成分
*/
private String ingredientItem;
/** 是否为活性 */
/**
* 是否为活性
*/
private Integer activeFlag;
private String activeFlag_enumText;
/** 批次号 */
/**
* 批次号
*/
private String lotNumber;
/** 生效日期 */
/**
* 生效日期
*/
private Date effectiveDate;
/** 到期日期 */
/**
* 到期日期
*/
private Date expirationDate;
/** 用法 */
/**
* 用法
*/
@Dict(dictCode = "method_code")
private String methodCode;
private String methodCode_dictText;
/** 用药频次 */
/**
* 用药频次
*/
@Dict(dictCode = "rate_code")
private String rateCode;
private String rateCode_dictText;
/** 单次剂量 */
/**
* 单次剂量
*/
private BigDecimal dose;
/** 剂量单位 */
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
private String doseUnitCode_dictText;
/** 单次最大剂量 */
/**
* 单次最大剂量
*/
private BigDecimal maxUnit;
/** 药品定义 */
/**
* 药品定义
*/
private String definition;
/** 用量限定 */
/**
* 用量限定
*/
private BigDecimal usageLimit;
/** DDD值 */
/**
* DDD值
*/
@Dict(dictCode = "ddd_code")
private String dddCode;
private String dddCode_dictText;
/** DDD单位 */
/**
* DDD单位
*/
@Dict(dictCode = "unit_code")
private String dddUnitCode;
private String dddUnitCode_dictText;
/** 药品编号 */
/**
* 药品编号
*/
private String busNo;
/** 药品名称 */
/**
* 药品名称
*/
private String name;
/** 适用范围 */
/**
* 适用范围
*/
private Integer domainEnum;
private String domainEnum_enumText;
/** 药品版本 */
/**
* 药品版本
*/
private String version;
/** 英文药名 */
/**
* 英文药名
*/
private String nameEn;
/** 药品名称拼音码 */
/**
* 药品名称拼音码
*/
private String pyStr;
/** 药品五笔码 */
/**
* 药品五笔码
*/
private String wbStr;
/** 药品分类 */
/**
* 药品分类
*/
@Dict(dictCode = "med_category_code")
private String categoryCode;
private String categoryCode_dictText;
/** 商品名称 */
/**
* 商品名称
*/
private String merchandiseName;
/** 商品名称拼音码 */
/**
* 商品名称拼音码
*/
private String merchandisePyStr;
/** 商品五笔码 */
/**
* 商品五笔码
*/
private String merchandiseWbStr;
/** 药品单位 */
/**
* 药品单位
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/** 最小单位 */
/**
* 最小单位
*/
@Dict(dictCode = "unit_code")
private String minUnitCode;
private String minUnitCode_dictText;
/** 所含耗材 */
/**
* 所含耗材
*/
private String comprisedText;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/** 剂量形式 */
/**
* 剂量形式
*/
@Dict(dictCode = "dose_form_code")
private Integer doseFrom;
private String doseFrom_dictText;
/** 批准文号 */
/**
* 批准文号
*/
private String approvalNumber;
/** 医保是否对码 */
/**
* 医保是否对码
*/
private Integer ybMatchFlag;
private String ybMatchFlag_enumText;;
private String ybMatchFlag_enumText;
;
/** 医保编码 */
private String ybNo;
/** 药理作用分类 */
/**
* 药理作用分类
*/
private String pharmacologyCategoryCode;
/** 是否皮试 */
/**
* 是否皮试
*/
private Integer skinTestFlag;
private String skinTestFlag_enumText;
/** 是否为注射药物 */
/**
* 是否为注射药物
*/
private Integer injectFlag;
private String injectFlag_enumText;
/** 生产厂家 */
/**
* 生产厂家
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long manufacturerId;
/** 供应商 */
/**
* 供应商
*/
@Dict(dictTable = "adm_supplier", dictCode = "id", dictText = "name")
@JsonSerialize(using = ToStringSerializer.class)
private Long supplyId;
private String supplyId_dictText;
/** 是否限制使用 */
/**
* 是否限制使用
*/
private Integer restrictedFlag;
private String restrictedFlag_enumText;
/** 限制使用范围 */
/**
* 限制使用范围
*/
private String restrictedScope;
/** 儿童用药标志 */
/**
* 儿童用药标志
*/
private Integer childrenFlag;
private String childrenFlag_enumText;
/** 产品特性 */
/**
* 产品特性
*/
private Integer characteristic;
private String characteristic_enumText;
/** 贯标国家编码 */
/**
* 贯标国家编码
*/
private String nationalDrugCode;
/** 拆分属性 */
/**
* 拆分属性
*/
private Integer partAttributeEnum;
private String partAttributeEnum_enumText;
/** 抗生素分类 */
/**
* 抗生素分类
*/
@Dict(dictCode = "antibiotic_type_code")
private String antibioticCode;
private String antibioticCode_dictText;
/** 权限限制 */
/**
* 权限限制
*/
private Integer restrictedEnum;
private String restrictedEnum_enumText;
/** 是否自制 */
/**
* 是否自制
*/
private Integer selfFlag;
private String selfFlag_enumText;
/** 是否抗生素 */
/**
* 是否抗生素
*/
private Integer antibioticFlag;
private String antibioticFlag_enumText;
/** 基药标识 */
/**
* 基药标识
*/
private Integer basicFlag;
private String basicFlag_enumText;
/** 生产厂商文本 */
/**
* 生产厂商文本
*/
private String manufacturerText;
/** 最小库存警戒数量(常规单位) */
/**
* 最小库存警戒数量(常规单位)
*/
private BigDecimal itemMinQuantity;
/** 最大库存警戒数量(常规单位) */
/**
* 最大库存警戒数量(常规单位)
*/
private BigDecimal itemMaxQuantity;
/** 售价 */
/**
* 售价
*/
private BigDecimal price;
/** 单次最小用药频次 */
/**
* 单次最小用药频次
*/
private String minRateCode;
/** 单次最大用药频次 */
/**
* 单次最大用药频次
*/
private String maxRateCode;
/** 医保类别 */
/**
* 医保类别
*/
private String ybType;
/** 财务类别 */
/**
* 财务类别
*/
@Dict(dictCode = "fin_type_code")
private String typeCode;
private String typeCode_dictText;
/** 成分 */
/**
* 成分
*/
private String ingredient;
/** 购入价 */
/**
* 购入价
*/
private BigDecimal purchasePrice;
/** 零售价 */
/**
* 零售价
*/
private BigDecimal retailPrice;
/** 最高零售价 */
/**
* 最高零售价
*/
private BigDecimal maximumRetailPrice;
/** 住院临时医嘱拆分属性 */
/**
* 住院临时医嘱拆分属性
*/
private Integer thoPartAttributeEnum;
private String thoPartAttributeEnum_enumText;
/** 剂量单位换算比 */
/**
* 剂量单位换算比
*/
private BigDecimal unitConversionRatio;
/** 医保等级 */
/**
* 医保等级
*/
private Integer chrgitmLv;
/** 处方标志 */
/**
* 处方标志
*/
private Integer rxFlag;
/**
@@ -294,12 +437,9 @@ public class MedicationManageDto {
*/
private String dosageInstruction;
<<<<<<< HEAD
=======
/**
* 药品69码
*/
private String drug69Code;
>>>>>>> v1.3
}

View File

@@ -24,238 +24,380 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class MedicationManageUpDto {
/** ID */
/**
* ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 药品编码 */
/**
* 药品编码
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long medicationDefId;
/** 所属科室 */
/**
* 所属科室
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
/** 所在位置 */
/**
* 所在位置
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long locationId;
/** 剂型 */
/**
* 剂型
*/
private String doseFormCode;
/** 规格 */
/**
* 规格
*/
private String totalVolume;
/** 成分 */
/**
* 成分
*/
private String ingredientItem;
/** 是否为活性 */
/**
* 是否为活性
*/
private Integer activeFlag;
/** 批次号 */
/**
* 批次号
*/
private String lotNumber;
/** 生效日期 */
/**
* 生效日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveDate;
/** 到期日期 */
/**
* 到期日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date expirationDate;
/** 用法 */
/**
* 用法
*/
private String methodCode;
/** 用药频次 */
/**
* 用药频次
*/
private String rateCode;
/** 单次剂量 */
/**
* 单次剂量
*/
private BigDecimal dose;
/** 剂量单位 */
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
@NotBlank(message = "剂量单位不能为空")
private String doseUnitCode;
private String doseUnitCode_dictText;
/** 单次最大剂量 */
/**
* 单次最大剂量
*/
private BigDecimal maxUnit;
/** 药品定义 */
/**
* 药品定义
*/
private String definition;
/** 药品编号 */
/**
* 药品编号
*/
private String busNo;
/** 药品名称 */
/**
* 药品名称
*/
@NotBlank(message = "药品名称不能为空")
private String name;
/** 适用范围 */
/**
* 适用范围
*/
private Integer domainEnum;
/** 药品版本 */
/**
* 药品版本
*/
private String version;
/** 英文药名 */
/**
* 英文药名
*/
private String nameEn;
/** 药品名称拼音码 */
/**
* 药品名称拼音码
*/
private String pyStr;
/** 药品五笔码 */
/**
* 药品五笔码
*/
private String wbStr;
/** 药品分类 */
/**
* 药品分类
*/
private String categoryCode;
/** 商品名称 */
/**
* 商品名称
*/
private String merchandiseName;
/** 商品名称拼音码 */
/**
* 商品名称拼音码
*/
private String merchandisePyStr;
/** 商品五笔码 */
/**
* 商品五笔码
*/
private String merchandiseWbStr;
/** 药品单位 */
/**
* 药品单位
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/** 最小单位 */
/**
* 最小单位
*/
private String minUnitCode;
/** 所含耗材 */
/**
* 所含耗材
*/
private String comprisedText;
/** 成分 */
/**
* 成分
*/
private String ingredient;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/** 剂量形式 */
/**
* 剂量形式
*/
@Dict(dictCode = "dose_form_code")
private Integer doseFrom;
private String doseFrom_dictText;
/** 批准文号 */
/**
* 批准文号
*/
private String approvalNumber;
/** 医保是否对码 */
/**
* 医保是否对码
*/
private Integer ybMatchFlag;
/** 医保编码 */
/**
* 医保编码
*/
private String ybNo;
/** 药理作用分类 */
/**
* 药理作用分类
*/
private String pharmacologyCategoryCode;
/** 是否皮试 */
/**
* 是否皮试
*/
private Integer skinTestFlag;
/** 是否为注射药物 */
/**
* 是否为注射药物
*/
private Integer injectFlag;
/** 生产厂家 */
/**
* 生产厂家
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long manufacturerId;
/** 生产厂商文本 */
/**
* 生产厂商文本
*/
private String manufacturerText;
/** 供应商 */
/**
* 供应商
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long supplyId;
/** 是否限制使用 */
/**
* 是否限制使用
*/
private Integer restrictedFlag;
/** 限制使用范围 */
/**
* 限制使用范围
*/
private String restrictedScope;
/** 儿童用药标志 */
/**
* 儿童用药标志
*/
private Integer childrenFlag;
/** 产品特性 */
/**
* 产品特性
*/
private Integer characteristic;
/** 购入价 */
/**
* 购入价
*/
private BigDecimal purchasePrice;
/** 零售价 */
/**
* 零售价
*/
private BigDecimal retailPrice;
/** 最高零售价 */
/**
* 最高零售价
*/
private BigDecimal maximumRetailPrice;
/** 医保类别 */
/**
* 医保类别
*/
private String ybType;
/** 财务类别 */
/**
* 财务类别
*/
@Dict(dictCode = "fin_type_code")
private String typeCode;
private String typeCode_dictText;
/** 单次最小用药频次 */
/**
* 单次最小用药频次
*/
private String minRateCode;
/** 单次最大用药频次 */
/**
* 单次最大用药频次
*/
private String maxRateCode;
/** 药品状态 */
/**
* 药品状态
*/
private Integer statusEnum;
private String statusEnum_enumText;
/** 拆分属性 */
/**
* 拆分属性
*/
private Integer partAttributeEnum;
/** 贯标国家编码 */
/**
* 贯标国家编码
*/
private String nationalDrugCode;
/** 是否抗生素 */
/**
* 是否抗生素
*/
private Integer antibioticFlag;
/** 是否自制 */
/**
* 是否自制
*/
private Integer selfFlag;
/** DDD值 */
/**
* DDD值
*/
private String dddCode;
/** DDD单位 */
/**
* DDD单位
*/
private String dddUnitCode;
/** 用量限定 */
/**
* 用量限定
*/
private BigDecimal usageLimit;
/** 抗生素分类 */
/**
* 抗生素分类
*/
@Dict(dictCode = "antibiotic_type_code")
private String antibioticCode;
private String antibioticCode_dictText;
/** 权限限制 */
/**
* 权限限制
*/
private Integer restrictedEnum;
/** 基药标识 */
/**
* 基药标识
*/
private Integer basicFlag;
/** 住院临时医嘱拆分属性 */
/**
* 住院临时医嘱拆分属性
*/
private Integer thoPartAttributeEnum;
/** 最小库存警戒数量(常规单位) */
/**
* 最小库存警戒数量(常规单位)
*/
private BigDecimal itemMinQuantity;
/** 最大库存警戒数量(常规单位) */
/**
* 最大库存警戒数量(常规单位)
*/
private BigDecimal itemMaxQuantity;
/** 剂量单位换算比 */
/**
* 剂量单位换算比
*/
private BigDecimal unitConversionRatio;
/** 医保等级 */
/**
* 医保等级
*/
private Integer chrgitmLv;
/** 处方标志 */
/**
* 处方标志
*/
private Integer rxFlag;
/**
@@ -263,12 +405,9 @@ public class MedicationManageUpDto {
*/
private String dosageInstruction;
<<<<<<< HEAD
=======
/**
* 药品69码
*/
private String drug69Code;
>>>>>>> v1.3
}

View File

@@ -5,10 +5,6 @@ import java.util.List;
import javax.annotation.Resource;
<<<<<<< HEAD
import org.springframework.beans.factory.annotation.Autowired;
=======
>>>>>>> v1.3
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -93,8 +89,8 @@ public class DepartmentIssuanceOrderServiceImpl implements IDepartmentIssuanceOr
@Override
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
Page<DepartmentDetailDto> issuanceOrderDtoDetailPage =
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
Page<DepartmentDetailDto> issuanceOrderDtoDetailPage
= departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
issuanceOrderDtoDetailPage.getRecords().forEach(e -> {
// 单据分类
@@ -123,15 +119,14 @@ public class DepartmentIssuanceOrderServiceImpl implements IDepartmentIssuanceOr
* @param dispenseIdList 耗材发放id
* @return 操作结果
*/
@Override
public boolean addOrEditIssuanceOrder(List<Long> dispenseIdList) {
// 获取单据号
String busNo = this.getBusNo();
// 获取更表所需信息
List<DepartmentDetailDto> detailDto =
departmentIssuanceOrderMapper.getInfo(dispenseIdList, DispenseStatus.COMPLETED.getValue());
List<DepartmentDetailDto> detailDto
= departmentIssuanceOrderMapper.getInfo(dispenseIdList, DispenseStatus.COMPLETED.getValue());
List<SupplyRequest> supplyRequestList = new ArrayList<>();
SupplyRequest supplyRequest;
@@ -140,24 +135,24 @@ public class DepartmentIssuanceOrderServiceImpl implements IDepartmentIssuanceOr
for (DepartmentDetailDto item : detailDto) {
// 供应申请
supplyRequest = new SupplyRequest().setBusNo(busNo).setTypeEnum(SupplyType.DISPENSING_ORDER.getValue())
.setStatusEnum(SupplyStatus.AGREE.getValue()).setCategoryEnum(item.getCategoryEnum())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
.setLotNumber(item.getLotNumber()).setSourceTypeEnum(LocationForm.CABINET.getValue())
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
.setApplyTime(item.getApplyTime()).setApproverId(item.getApproverId())
.setApprovalTime(item.getApprovalTime());
.setStatusEnum(SupplyStatus.AGREE.getValue()).setCategoryEnum(item.getCategoryEnum())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
.setLotNumber(item.getLotNumber()).setSourceTypeEnum(LocationForm.CABINET.getValue())
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
.setApplyTime(item.getApplyTime()).setApproverId(item.getApproverId())
.setApprovalTime(item.getApprovalTime());
supplyRequestList.add(supplyRequest);
// 供应发放
supplyDelivery = new SupplyDelivery().setRequestId(supplyRequest.getId())
.setStatusEnum(DispenseStatus.COMPLETED.getValue()).setTypeEnum(supplyRequest.getTypeEnum())
.setItemTable(supplyRequest.getItemTable()).setItemId(supplyRequest.getItemId())
.setBasedOnTable(CommonConstants.TableName.WOR_DEVICE_DISPENSE).setBasedOnIds(item.getDispenseIds())
.setUnitCode(supplyRequest.getUnitCode()).setQuantity(supplyRequest.getItemQuantity())
.setLotNumber(supplyRequest.getLotNumber()).setPractitionerId(supplyRequest.getApplicantId())
.setOccurrenceTime(supplyRequest.getApprovalTime()).setReceiverId(supplyRequest.getPurposeLocationId())
.setReceiveTime(supplyRequest.getApprovalTime());
.setStatusEnum(DispenseStatus.COMPLETED.getValue()).setTypeEnum(supplyRequest.getTypeEnum())
.setItemTable(supplyRequest.getItemTable()).setItemId(supplyRequest.getItemId())
.setBasedOnTable(CommonConstants.TableName.WOR_DEVICE_DISPENSE).setBasedOnIds(item.getDispenseIds())
.setUnitCode(supplyRequest.getUnitCode()).setQuantity(supplyRequest.getItemQuantity())
.setLotNumber(supplyRequest.getLotNumber()).setPractitionerId(supplyRequest.getApplicantId())
.setOccurrenceTime(supplyRequest.getApprovalTime()).setReceiverId(supplyRequest.getPurposeLocationId())
.setReceiveTime(supplyRequest.getApprovalTime());
supplyDeliveryList.add(supplyDelivery);
}

View File

@@ -4,14 +4,10 @@ import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
<<<<<<< HEAD
import com.openhis.web.doctorstation.dto.*;
=======
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
>>>>>>> v1.3
/**
* 医生站-医嘱/处方 应用Service
@@ -34,8 +30,8 @@ public interface IDoctorStationAdviceAppService {
* @return 医嘱信息
*/
IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing);
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing);
/**
* 查询医嘱绑定信息

View File

@@ -72,7 +72,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// @Resource
// IOrganizationLocationService iOrganizationLocationService;
@Resource
IMedicationDispenseService iMedicationDispenseService;
@@ -90,48 +89,28 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// @Resource
// OutpatientRegistrationAppMapper outpatientRegistrationAppMapper;
@Resource
DoctorStationSendApplyUtil doctorStationSendApplyUtil;
/**
* 查询医嘱信息
*
* @param adviceBaseDto 查询条件
* @param searchKey 模糊查询关键字
* @param locationId 药房id
* @param adviceBaseDto 查询条件
* @param searchKey 模糊查询关键字
* @param locationId 药房id
* @param adviceDefinitionIdParamList 医嘱定义id参数集合
<<<<<<< HEAD
* @param organizationId 患者挂号对应的科室id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param pricingFlag 划价标记
* @param adviceTypes 医嘱类型参数集合
=======
* @param organizationId 患者挂号对应的科室id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param pricingFlag 划价标记
* @param adviceTypes 医嘱类型参数集合
* @param orderPricing 医嘱定价来源 | 定时任务调用时传参
>>>>>>> v1.3
* @return 医嘱信息
*/
@Override
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
<<<<<<< HEAD
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes) {
// 医嘱定价来源
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
// 如果配置为空使用retailPrice作为默认值
if (StringUtils.isEmpty(orderPricingSource)) {
// throw new ServiceException("租户配置项【医嘱定价来源】未配置");
orderPricingSource = "retailPrice";
}
=======
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing) {
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing) {
// 设置默认科室 (不取前端传的了)
organizationId = SecurityUtils.getLoginUser().getOrgId();
@@ -143,27 +122,19 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
orderPricingSource = orderPricing;
}
// 开药时药房允许多选开关
String pharmacyMultipleChoiceSwitch =
TenantOptionUtil.getOptionContent(TenantOptionDict.PHARMACY_MULTIPLE_CHOICE_SWITCH);
String pharmacyMultipleChoiceSwitch
= TenantOptionUtil.getOptionContent(TenantOptionDict.PHARMACY_MULTIPLE_CHOICE_SWITCH);
// 药房允许多选
boolean pharmacyMultipleChoice = Whether.YES.getCode().equals(pharmacyMultipleChoiceSwitch);
>>>>>>> v1.3
// 构建查询条件
QueryWrapper<AdviceBaseDto> queryWrapper = HisQueryUtils.buildQueryWrapper(adviceBaseDto, searchKey,
new HashSet<>(Arrays.asList("advice_name", "py_str", "wb_str")), null);
IPage<AdviceBaseDto> adviceBaseInfo = doctorStationAdviceAppMapper.getAdviceBaseInfo(
<<<<<<< HEAD
new Page<>(pageNo, pageSize), PublicationStatus.ACTIVE.getValue(), organizationId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList, adviceTypes,
queryWrapper);
=======
new Page<>(pageNo, pageSize), PublicationStatus.ACTIVE.getValue(), organizationId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList, adviceTypes,
queryWrapper);
>>>>>>> v1.3
List<AdviceBaseDto> adviceBaseDtoList = adviceBaseInfo.getRecords();
// 如果searchKey不为null对查询结果进行排序adviceName以searchKey开头的排在前面
@@ -172,22 +143,22 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
}
// 医嘱定义ID集合
List<Long> adviceDefinitionIdList =
adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId).collect(Collectors.toList());
List<Long> adviceDefinitionIdList
= adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId).collect(Collectors.toList());
// 费用定价主表ID集合
List<Long> chargeItemDefinitionIdList =
adviceBaseDtoList.stream().map(AdviceBaseDto::getChargeItemDefinitionId).collect(Collectors.toList());
List<Long> chargeItemDefinitionIdList
= adviceBaseDtoList.stream().map(AdviceBaseDto::getChargeItemDefinitionId).collect(Collectors.toList());
// 医嘱库存集合
List<AdviceInventoryDto> adviceInventoryList =
doctorStationAdviceAppMapper.getAdviceInventory(locationId, adviceDefinitionIdList,
List<AdviceInventoryDto> adviceInventoryList
= doctorStationAdviceAppMapper.getAdviceInventory(locationId, adviceDefinitionIdList,
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
// 待发放个数信息
List<AdviceInventoryDto> adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
// 预减库存
List<AdviceInventoryDto> adviceInventory =
adviceUtils.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
List<AdviceInventoryDto> adviceInventory
= adviceUtils.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
// 查询取药科室配置
List<AdviceInventoryDto> medLocationConfig = doctorStationAdviceAppMapper.getMedLocationConfig(organizationId);
// 将配置转为 {categoryCode -> 允许的locationId集合}
@@ -198,22 +169,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
continue;
}
allowedLocByCategory.computeIfAbsent(String.valueOf(cfg.getCategoryCode()), k -> new HashSet<>())
.add(cfg.getLocationId());
.add(cfg.getLocationId());
}
}
// 费用定价子表信息
List<AdvicePriceDto> childCharge = doctorStationAdviceAppMapper
<<<<<<< HEAD
.getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), chargeItemDefinitionIdList);
// 费用定价主表信息
List<AdvicePriceDto> mainCharge =
doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList, PublicationStatus.ACTIVE.getValue());
=======
.getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), chargeItemDefinitionIdList);
// 费用定价主表信息
List<AdvicePriceDto> mainCharge =
doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList, PublicationStatus.ACTIVE.getValue());
>>>>>>> v1.3
List<AdvicePriceDto> mainCharge
= doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList, PublicationStatus.ACTIVE.getValue());
String unitCode = ""; // 包装单位
Long chargeItemDefinitionId; // 费用定价主表ID
for (AdviceBaseDto baseDto : adviceBaseDtoList) {
@@ -226,21 +190,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag()));
case CommonConstants.TableName.ADM_DEVICE_DEFINITION: // 耗材
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
<<<<<<< HEAD
List<
AdviceInventoryDto> inventoryList =
adviceInventory.stream()
.filter(e -> baseDto.getAdviceDefinitionId().equals(e.getItemId())
&& baseDto.getAdviceTableName().equals(e.getItemTable()))
.collect(Collectors.toList());
=======
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e -> baseDto
.getAdviceDefinitionId().equals(e.getItemId())
&& baseDto.getAdviceTableName().equals(e.getItemTable())
&& (pharmacyMultipleChoice
.getAdviceDefinitionId().equals(e.getItemId())
&& baseDto.getAdviceTableName().equals(e.getItemTable())
&& (pharmacyMultipleChoice
|| (baseDto.getPositionId() == null || baseDto.getPositionId().equals(e.getLocationId()))))
.collect(Collectors.toList());
>>>>>>> v1.3
.collect(Collectors.toList());
// 库存信息
baseDto.setInventoryList(inventoryList);
// 设置默认产品批号
@@ -277,25 +232,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
String finalUnitCode = unitCode;
// 从定价子表取价格(适用于批次售卖场景)
List<AdvicePriceDto> childPrice = childCharge.stream()
<<<<<<< HEAD
.filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId)
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
.peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode
.collect(Collectors.toList());
// 从定价主表取价格(适用于统一零售价场景)
List<AdvicePriceDto> mainPrice = mainCharge.stream()
.filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
.collect(Collectors.toList());
=======
.filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId)
&& e.getConditionValue().equals(adviceInventoryDto.getLotNumber()))
.peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode
.collect(Collectors.toList());
// 从定价主表取价格(适用于统一零售价场景)
List<AdvicePriceDto> mainPrice = mainCharge.stream()
.filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
.collect(Collectors.toList());
>>>>>>> v1.3
// 按批次售价
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
priceDtoList.addAll(childPrice);
@@ -307,8 +251,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
baseDto.setPriceList(priceDtoList);
break;
case CommonConstants.TableName.WOR_ACTIVITY_DEFINITION: // 诊疗
List<AdvicePriceDto> priceList =
mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
List<AdvicePriceDto> priceList
= mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
.collect(Collectors.toList());
// 价格信息
baseDto.setPriceList(priceList);
@@ -327,11 +271,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
* 查询医嘱绑定信息
*
* @param typeCode 1:用法绑东西 2:诊疗绑东西
<<<<<<< HEAD
* @param itemNo 用法的code 或者 诊疗定义id
=======
* @param itemNo 用法的code 或者 诊疗定义id
>>>>>>> v1.3
* @return 医嘱绑定信息
*/
@Override
@@ -343,7 +283,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
* 门诊保存/签发医嘱
*
* @param adviceSaveParam 医嘱表单信息
* @param adviceOpType 医嘱操作类型
* @param adviceOpType 医嘱操作类型
* @return 结果
*/
@Override
@@ -366,10 +306,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
* 保存时,校验库存
*/
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
List<AdviceSaveDto> medUpdateList =
medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
List<AdviceSaveDto> devUpdateList =
deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
List<AdviceSaveDto> medUpdateList
= medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
List<AdviceSaveDto> devUpdateList
= deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
// 编辑时,释放本身占用的库存发放
for (AdviceSaveDto adviceSaveDto : medUpdateList) {
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
@@ -378,9 +318,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId());
}
List<AdviceSaveDto> needCheckList =
adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
List<AdviceSaveDto> needCheckList
= adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
// 校验库存
String tipRes = adviceUtils.checkInventory(needCheckList);
if (tipRes != null) {
@@ -395,8 +335,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理药品请求
*/
List<String> medRequestIdList =
this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode);
List<String> medRequestIdList
= this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode);
/**
* 处理诊疗项目请求
@@ -423,24 +363,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
.in(ChargeItem::getServiceId, requestIds));
}
<<<<<<< HEAD
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"}));
=======
return R.ok(medRequestIdList,
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"门诊医嘱"}));
>>>>>>> v1.3
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"}));
}
/**
* 处理药品
*/
<<<<<<< HEAD
private void handMedication(List<AdviceSaveDto> medicineList, Date curDate, String adviceOpType,
Long organizationId, String signCode) {
=======
private List<String> handMedication(List<AdviceSaveDto> medicineList, Date curDate, String adviceOpType,
Long organizationId, String signCode) {
>>>>>>> v1.3
Long organizationId, String signCode) {
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
// 保存操作
@@ -452,9 +383,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项
ChargeItem chargeItem;
// 新增 + 修改
List<AdviceSaveDto> insertOrUpdateList =
medicineList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
List<AdviceSaveDto> insertOrUpdateList
= medicineList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
// 删除
List<AdviceSaveDto> deleteList = medicineList.stream()
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
@@ -532,14 +463,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
medicationRequest.setInfusionFlag(adviceSaveDto.getInjectFlag()); // 输液标志
medicationRequest.setSortNumber(adviceSaveDto.getSortNumber()); // 排序号
}
<<<<<<< HEAD
iMedicationRequestService.saveOrUpdate(medicationRequest);
if (is_save) {
// 处理药品发放
Long dispenseId =
iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
=======
if (medicationRequest.getId() == null) {
firstTimeSave = true;
}
@@ -549,9 +472,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
}
if (is_save) {
// 处理药品发放
Long dispenseId =
iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
>>>>>>> v1.3
Long dispenseId
= iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
// 保存药品费用项
chargeItem = new ChargeItem();
@@ -586,10 +508,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
}
}
<<<<<<< HEAD
=======
return medRequestIdList;
>>>>>>> v1.3
}
/**
@@ -606,9 +525,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项
ChargeItem chargeItem;
// 新增 + 修改
List<AdviceSaveDto> insertOrUpdateList =
deviceList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
List<AdviceSaveDto> insertOrUpdateList
= deviceList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
// 删除
List<AdviceSaveDto> deleteList = deviceList.stream()
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
@@ -666,12 +585,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
iDeviceRequestService.saveOrUpdate(deviceRequest);
if (is_save) {
// 处理耗材发放
Long dispenseId =
<<<<<<< HEAD
iDeviceDispenseService.handleDeviceDispense(deviceRequest, adviceSaveDto.getDbOpType());
=======
iDeviceDispenseService.handleDeviceDispense(deviceRequest, adviceSaveDto.getDbOpType());
>>>>>>> v1.3
Long dispenseId
= iDeviceDispenseService.handleDeviceDispense(deviceRequest, adviceSaveDto.getDbOpType());
// 保存耗材费用项
chargeItem = new ChargeItem();
@@ -710,7 +625,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
* 处理诊疗
*/
private void handService(List<AdviceSaveDto> activityList, Date curDate, String adviceOpType, Long organizationId,
String signCode) {
String signCode) {
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
// 保存操作
@@ -721,9 +636,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项
ChargeItem chargeItem;
// 新增 + 修改
List<AdviceSaveDto> insertOrUpdateList =
activityList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
List<AdviceSaveDto> insertOrUpdateList
= activityList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
// 删除
List<AdviceSaveDto> deleteList = activityList.stream()
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
@@ -816,8 +731,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 第一次保存时,处理诊疗套餐的子项信息
if (adviceSaveDto.getRequestId() == null) {
ActivityDefinition activityDefinition =
iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
ActivityDefinition activityDefinition
= iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
String childrenJson = activityDefinition.getChildrenJson();
if (childrenJson != null) {
// 诊疗子项参数类
@@ -840,30 +755,18 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
adviceSaveDto.setRequestId(serviceRequest.getId());
try {
// 查询诊疗定义
ActivityDefinition activityDefinition =
<<<<<<< HEAD
iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
ActivityDefinition activityDefinition
= iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
if (activityDefinition != null) {
// 检验 或 检查
if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())
|| ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
=======
iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
if (activityDefinition != null) {
// 检验 或 检查
if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())
|| ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
>>>>>>> v1.3
doctorStationSendApplyUtil.sendCrossSystemApply(adviceSaveDto, organizationId, curDate);
}
}
} catch (Exception e) {
if (!Whether.YES.getCode()
<<<<<<< HEAD
.equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) {
=======
.equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) {
>>>>>>> v1.3
throw e;
}
log.error(e.getMessage(), e);
@@ -884,15 +787,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 医嘱请求数据
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, null,
<<<<<<< HEAD
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
=======
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
>>>>>>> v1.3
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto
@@ -934,9 +831,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItemList.forEach(item -> {
switch (item.getServiceTable()) {
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> devReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_SERVICE_REQUEST -> serReqIdList.add(item.getServiceId());
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
medReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_DEVICE_REQUEST ->
devReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_SERVICE_REQUEST ->
serReqIdList.add(item.getServiceId());
}
});
List<Long> chargeItemIdList = chargeItemList.stream().map(ChargeItem::getId).collect(Collectors.toList());
@@ -963,7 +863,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 查询历史医嘱请求数据
*
* @param patientId 病人id
* @param patientId 病人id
* @param encounterId 就诊id
* @return 历史医嘱请求数据
*/
@@ -973,15 +873,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 医嘱请求数据
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, patientId,
<<<<<<< HEAD
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
=======
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
>>>>>>> v1.3
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto
@@ -1051,7 +945,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
@Override
public R<?> getProofAndTestHistory(Long patientId, Long adviceDefinitionId) {
return R.ok(doctorStationAdviceAppMapper.getProofAndTestHistory(patientId, adviceDefinitionId,
RequestStatus.COMPLETED.getValue()));
RequestStatus.COMPLETED.getValue()));
}
/**
@@ -1068,7 +962,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
throw new ServiceException("租户配置项【LIS查看报告地址】未配置");
}
List<ProofAndTestResultDto> proofResult = doctorStationAdviceAppMapper.getProofAndTestResult(encounterId,
RequestStatus.DRAFT.getValue(), ActivityType.PROOF.getValue());
RequestStatus.DRAFT.getValue(), ActivityType.PROOF.getValue());
for (ProofAndTestResultDto proofAndTestResultDto : proofResult) {
proofAndTestResultDto.setRequestUrl(lisReportUrl.concat(proofAndTestResultDto.getBusNo()));
}
@@ -1090,7 +984,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
throw new ServiceException("租户配置项【PACS查看报告地址】未配置");
}
List<ProofAndTestResultDto> testResult = doctorStationAdviceAppMapper.getProofAndTestResult(encounterId,
RequestStatus.DRAFT.getValue(), ActivityType.TEST.getValue());
RequestStatus.DRAFT.getValue(), ActivityType.TEST.getValue());
for (ProofAndTestResultDto proofAndTestResultDto : testResult) {
proofAndTestResultDto.setRequestUrl(pacsReportUrl.concat(proofAndTestResultDto.getBusNo()));
}
@@ -1098,7 +992,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
}
/**
* 根据searchKey对医嘱列表进行排序adviceName以searchKey(汉字)开头的排在前面 | pyStr以searchKey(字母)开头的排在前面
* 根据searchKey对医嘱列表进行排序adviceName以searchKey(汉字)开头的排在前面 |
* pyStr以searchKey(字母)开头的排在前面
*
* @param adviceList 医嘱列表
* @param searchKey 搜索关键字
@@ -1113,10 +1008,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
adviceList.sort((a, b) -> {
// 根据searchKey类型选择不同的字段
String aValue =
isPinyinSearch ? (a.getPyStr() != null ? a.getPyStr() : a.getAdviceName()) : a.getAdviceName();
String bValue =
isPinyinSearch ? (b.getPyStr() != null ? b.getPyStr() : b.getAdviceName()) : b.getAdviceName();
String aValue
= isPinyinSearch ? (a.getPyStr() != null ? a.getPyStr() : a.getAdviceName()) : a.getAdviceName();
String bValue
= isPinyinSearch ? (b.getPyStr() != null ? b.getPyStr() : b.getAdviceName()) : b.getAdviceName();
// 处理可能的null值
if (aValue == null && bValue == null) {

View File

@@ -99,12 +99,12 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
// 中医诊断
conditionDefinition.setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue());
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(conditionDefinition, searchKey,
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
// 设置排序
queryWrapper.orderByDesc("update_time");
// 诊断信息
Page<ConditionDefinitionMetadata> conditionDefinitionMetadataPage = HisPageUtils
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
conditionDefinitionMetadataPage.getRecords().forEach(e -> {
// 所属分类
e.setSourceEnum_enumText(EnumUtils.getInfoByValue(ConditionDefinitionSource.class, e.getSourceEnum()));
@@ -134,14 +134,14 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
// 中医证候
conditionDefinition
.setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue());
.setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue());
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(conditionDefinition, searchKey,
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
// 设置排序
queryWrapper.orderByDesc("update_time");
// 诊断信息
Page<ConditionDefinitionMetadata> conditionDefinitionMetadataPage = HisPageUtils
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
conditionDefinitionMetadataPage.getRecords().forEach(e -> {
// 所属分类
e.setSourceEnum_enumText(EnumUtils.getInfoByValue(ConditionDefinitionSource.class, e.getSourceEnum()));
@@ -192,12 +192,12 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
List<EncounterDiagnosis> diagnosisList = iEncounterDiagnosisService.getDiagnosisList(encounterId);
List<EncounterDiagnosis> newdiagnosisList = new ArrayList<>();
newdiagnosisList =
diagnosisList.stream().filter(diagno -> diagno.getDeleteFlag().equals("0") && diagno.getDiagSrtNo() != null)
.collect(Collectors.toList());
newdiagnosisList
= diagnosisList.stream().filter(diagno -> diagno.getDeleteFlag().equals("0") && diagno.getDiagSrtNo() != null)
.collect(Collectors.toList());
newdiagnosisList = newdiagnosisList.stream().sorted((d1, d2) -> d2.getDiagSrtNo().compareTo(d1.getDiagSrtNo())) // 降序
.collect(Collectors.toList());
.collect(Collectors.toList());
if (newdiagnosisList == null || newdiagnosisList.size() == 0) {
startNo = 1;
} else {
@@ -231,7 +231,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
}
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"中医诊断"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"中医诊断"}));
}
@Override
@@ -277,7 +277,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
}
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"中医诊断"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"中医诊断"}));
}
/**
@@ -290,17 +290,17 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
public R<?> getTcmEncounterDiagnosis(Long encounterId) {
HashMap<String, Object> resultMap = new HashMap<>();
// 中医就诊诊断信息
List<DiagnosisQueryDto> tcmEncounterDiagnosis =
doctorStationChineseMedicalAppMapper.getTcmEncounterDiagnosis(encounterId);
List<DiagnosisQueryDto> tcmEncounterDiagnosis
= doctorStationChineseMedicalAppMapper.getTcmEncounterDiagnosis(encounterId);
// 病
List<DiagnosisQueryDto> illness = tcmEncounterDiagnosis.stream().filter(
e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue().equals(e.getSourceEnum()))
.collect(Collectors.toList());
e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue().equals(e.getSourceEnum()))
.collect(Collectors.toList());
// 症
List<DiagnosisQueryDto> symptom = tcmEncounterDiagnosis.stream()
.filter(e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue()
.filter(e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue()
.equals(e.getSourceEnum()))
.collect(Collectors.toList());
.collect(Collectors.toList());
resultMap.put("illness", illness);
resultMap.put("symptom", symptom);
return R.ok(resultMap);
@@ -321,12 +321,12 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
*/
@Override
public IPage<AdviceBaseDto> getTcmAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag) {
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag) {
adviceBaseDto.setAdviceType(1); // 医嘱类型为药品
adviceBaseDto.setCategoryCode(MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue());// 中草药
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, pricingFlag, List.of(1, 2, 3), null);
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, pricingFlag, List.of(1, 2, 3), null);
}
/**
@@ -343,7 +343,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
// 保存时——中医处方去掉不修改的药方
medicineList = medicineList.stream().filter(e -> e.getAdviceDefinitionId() != null)
.collect(Collectors.toUnmodifiableList());
.collect(Collectors.toUnmodifiableList());
}
// 保存操作
boolean is_save = AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType);
@@ -358,18 +358,18 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
// 是否代煎
Integer sufferingFlag = adviceSaveParam.getSufferingFlag();
// 中药代煎定义id
Long sufferingDefinitionId =
iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.SUFFERING_TCM);
Long sufferingDefinitionId
= iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.SUFFERING_TCM);
// 保存时,校验库存
if (is_save) {
List<AdviceSaveDto> medUpdateList =
medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
List<AdviceSaveDto> medUpdateList
= medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
// 编辑时,释放本身占用的库存发放
for (AdviceSaveDto adviceSaveDto : medUpdateList) {
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
}
List<AdviceSaveDto> needCheckList = medicineList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
// 校验库存
String tipRes = adviceUtils.checkInventory(needCheckList);
if (tipRes != null) {
@@ -381,40 +381,40 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
// 费用项
ChargeItem chargeItem;
// 新增 + 修改
List<AdviceSaveDto> insertOrUpdateList =
medicineList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
List<AdviceSaveDto> insertOrUpdateList
= medicineList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
// 删除
List<AdviceSaveDto> deleteList = medicineList.stream()
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
for (AdviceSaveDto adviceSaveDto : deleteList) {
iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
// 删除已经产生的药品发放信息
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
// 删除费用项
iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST,
adviceSaveDto.getRequestId());
adviceSaveDto.getRequestId());
// 删除代煎费
iChargeItemService.remove(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getPrescriptionNo, adviceSaveDto.getPrescriptionNo())
.eq(ChargeItem::getProductId, sufferingDefinitionId));
.eq(ChargeItem::getPrescriptionNo, adviceSaveDto.getPrescriptionNo())
.eq(ChargeItem::getProductId, sufferingDefinitionId));
}
if (is_sign) {
// 按groupId分组
Map<Long, List<AdviceSaveDto>> groupMap =
insertOrUpdateList.stream().collect(Collectors.groupingBy(AdviceSaveDto::getGroupId));
Map<Long, List<AdviceSaveDto>> groupMap
= insertOrUpdateList.stream().collect(Collectors.groupingBy(AdviceSaveDto::getGroupId));
// 为每个分组生成唯一的处方号
groupMap.forEach((groupId, groupList) -> {
// 先查询当前groupId是否已经被签发生成过处方号
List<MedicationRequest> list = iMedicationRequestService
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getGroupId, groupId));
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getGroupId, groupId));
if (!list.isEmpty() && StringUtils.isNotEmpty(list.get(0).getPrescriptionNo())) {
groupList.forEach(dto -> dto.setPrescriptionNo(list.get(0).getPrescriptionNo()));
} else {
String prescriptionNo =
assignSeqUtil.getSeq(AssignSeqEnum.PRESCRIPTION_CHINESE_HERBAL_MEDICINE.getPrefix(), 8);
String prescriptionNo
= assignSeqUtil.getSeq(AssignSeqEnum.PRESCRIPTION_CHINESE_HERBAL_MEDICINE.getPrefix(), 8);
groupList.forEach(dto -> dto.setPrescriptionNo(prescriptionNo));
}
});
@@ -467,8 +467,8 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
iMedicationRequestService.saveOrUpdate(medicationRequest);
if (is_save) {
// 处理药品发放
Long dispenseId =
iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
Long dispenseId
= iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
// 保存药品费用项
chargeItem = new ChargeItem();
@@ -529,15 +529,11 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
// 先删除中药代煎的账单
iChargeItemService.remove(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getPrescriptionNo, prescriptionNo).eq(ChargeItem::getProductId, sufferingDefinitionId));
.eq(ChargeItem::getPrescriptionNo, prescriptionNo).eq(ChargeItem::getProductId, sufferingDefinitionId));
// 对应的诊疗医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null,
<<<<<<< HEAD
null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(3)).getRecords().get(0);
=======
null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0);
>>>>>>> v1.3
null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0);
if (activityAdviceBaseDto != null) {
// 费用定价
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
@@ -575,23 +571,23 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
} else if (Whether.NO.getValue().equals(sufferingFlag)) {
// 删除中药代煎的账单
iChargeItemService.remove(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getPrescriptionNo, prescriptionNo).eq(ChargeItem::getProductId, sufferingDefinitionId));
.eq(ChargeItem::getPrescriptionNo, prescriptionNo).eq(ChargeItem::getProductId, sufferingDefinitionId));
}
// 签发时,把草稿状态的账单更新为待收费[中医]
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !medicineList.isEmpty()) {
// 签发的医嘱id集合
List<Long> requestIds = medicineList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
iChargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
.set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue())
.eq(ChargeItem::getEncounterId, encounterId)
.eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue())
.in(ChargeItem::getServiceId, requestIds));
.set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue())
.eq(ChargeItem::getEncounterId, encounterId)
.eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue())
.in(ChargeItem::getServiceId, requestIds));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"门诊中医医嘱"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊中医医嘱"}));
}
/**
@@ -605,16 +601,16 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 医嘱请求数据
List<RequestBaseDto> requestBaseInfo = doctorStationChineseMedicalAppMapper.getTcmRequestBaseInfo(encounterId,
null, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
null, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
// 收费状态
requestBaseDto.setChargeStatus_enumText(
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
}
return R.ok(requestBaseInfo);
}
@@ -632,16 +628,16 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 医嘱请求数据
List<RequestBaseDto> requestBaseInfo = doctorStationChineseMedicalAppMapper.getTcmRequestHistoryInfo(
encounterId, patientId, CommonConstants.TableName.MED_MEDICATION_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId,
Whether.YES.getCode(), GenerateSource.DOCTOR_PRESCRIPTION.getValue());
encounterId, patientId, CommonConstants.TableName.MED_MEDICATION_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId,
Whether.YES.getCode(), GenerateSource.DOCTOR_PRESCRIPTION.getValue());
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
// 收费状态
requestBaseDto.setChargeStatus_enumText(
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
}
return R.ok(requestBaseInfo);
}
@@ -665,8 +661,8 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
for (Long conditionId : conditionIds) {
iConditionService.removeById(conditionId);
iEncounterDiagnosisService.remove(
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getConditionId, conditionId));
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getConditionId, conditionId));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"就诊诊断信息"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[]{"就诊诊断信息"}));
}
}

View File

@@ -32,59 +32,39 @@ public class DoctorStationAdviceController {
/**
* 查询医嘱信息
*
* @param adviceBaseDto 查询条件
* @param searchKey 模糊查询关键字
* @param locationId 药房id
* @param adviceBaseDto 查询条件
* @param searchKey 模糊查询关键字
* @param locationId 药房id
* @param adviceDefinitionIdParamList 医嘱定义id参数集合
* @param adviceTypes 医嘱类型参数集合
* @param organizationId 患者挂号对应的科室id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param adviceTypes 医嘱类型参数集合
* @param organizationId 患者挂号对应的科室id
* @param pageNo 当前页
* @param pageSize 每页多少条
* @return 医嘱信息
*/
@GetMapping(value = "/advice-base-info")
public R<?> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto,
<<<<<<< HEAD
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "locationId", required = false) Long locationId,
@RequestParam(value = "adviceDefinitionIdParamList", required = false) List<Long> adviceDefinitionIdParamList,
@RequestParam(value = "organizationId", defaultValue = "0") Long organizationId,
@RequestParam(value = "adviceTypes", defaultValue = "1,2,3") List<Integer> adviceTypes,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "locationId", required = false) Long locationId,
@RequestParam(value = "adviceDefinitionIdParamList", required = false) List<Long> adviceDefinitionIdParamList,
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam(value = "adviceTypes", defaultValue = "1,2,3") List<Integer> adviceTypes,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return R.ok(iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes));
=======
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "locationId", required = false) Long locationId,
@RequestParam(value = "adviceDefinitionIdParamList", required = false) List<Long> adviceDefinitionIdParamList,
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam(value = "adviceTypes", defaultValue = "1,2,3") List<Integer> adviceTypes,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return R.ok(iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null));
>>>>>>> v1.3
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null));
}
/**
* 查询医嘱绑定信息
*
* @param typeCode 1:用法绑东西 2:诊疗绑东西
<<<<<<< HEAD
* @param itemNo 用法的code 或者 诊疗定义id
=======
* @param itemNo 用法的code 或者 诊疗定义id
>>>>>>> v1.3
* @return 医嘱绑定信息
*/
@GetMapping(value = "/order-bind-info")
public R<?> getOrderBindInfo(@RequestParam(value = "typeCode") String typeCode,
<<<<<<< HEAD
@RequestParam(value = "itemNo") String itemNo) {
=======
@RequestParam(value = "itemNo") String itemNo) {
>>>>>>> v1.3
@RequestParam(value = "itemNo") String itemNo) {
return R.ok(iDoctorStationAdviceAppService.getOrderBindInfo(typeCode, itemNo));
}
@@ -166,14 +146,14 @@ public class DoctorStationAdviceController {
/**
* 查询检验检查开立历史(近30天)
*
*
* @param patientId 患者id
* @param adviceDefinitionId 医嘱定义id
* @return 检验检查开立历史
*/
@GetMapping(value = "/proof-test-history")
public R<?> getProofAndTestHistory(@RequestParam(value = "patientId") Long patientId,
@RequestParam(value = "adviceDefinitionId") Long adviceDefinitionId) {
@RequestParam(value = "adviceDefinitionId") Long adviceDefinitionId) {
return iDoctorStationAdviceAppService.getProofAndTestHistory(patientId, adviceDefinitionId);
}

View File

@@ -17,10 +17,14 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class AdviceBaseDto {
/** 医嘱类型 */
/**
* 医嘱类型
*/
private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目
/** 编号 */
/**
* 编号
*/
private String busNo;
/**
@@ -28,22 +32,34 @@ public class AdviceBaseDto {
*/
private String categoryCode;
/** 药品性质 */
/**
* 药品性质
*/
private String pharmacologyCategoryCode;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/** 剂量换算 */
/**
* 剂量换算
*/
private BigDecimal unitConversionRatio;
/** 拆分属性-门诊 */
/**
* 拆分属性-门诊
*/
private Integer partAttributeEnum;
/** 住院临时医嘱拆分属性 */
/**
* 住院临时医嘱拆分属性
*/
private Integer thoPartAttributeEnum;
/** 医嘱定义ID */
/**
* 医嘱定义ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long adviceDefinitionId;
@@ -58,7 +74,9 @@ public class AdviceBaseDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long positionId;
/** 医嘱名称 */
/**
* 医嘱名称
*/
private String adviceName;
/**
@@ -66,16 +84,24 @@ public class AdviceBaseDto {
*/
private String adviceBusNo;
/** 拼音码 */
/**
* 拼音码
*/
private String pyStr;
/** 五笔码 */
/**
* 五笔码
*/
private String wbStr;
/** 医保编码 */
/**
* 医保编码
*/
private String ybNo;
/** 商品名称 */
/**
* 商品名称
*/
private String productName;
/**
@@ -84,20 +110,28 @@ public class AdviceBaseDto {
private Integer activityType;
private String activityType_enumText;
/** 是否皮试 */
/**
* 是否皮试
*/
private Integer skinTestFlag;
private String skinTestFlag_enumText;
/** 是否为注射药物 */
/**
* 是否为注射药物
*/
private Integer injectFlag;
private String injectFlag_enumText;
/** 包装单位 */
/**
* 包装单位
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/** 最小单位 */
/**
* 最小单位
*/
@Dict(dictCode = "unit_code")
private String minUnitCode;
private String minUnitCode_dictText;
@@ -126,7 +160,9 @@ public class AdviceBaseDto {
*/
private String dose;
/** 剂量单位 */
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
private String doseUnitCode_dictText;
@@ -136,7 +172,9 @@ public class AdviceBaseDto {
*/
private String supplier;
/** 供应商ID */
/**
* 供应商ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long supplierId;
@@ -145,14 +183,20 @@ public class AdviceBaseDto {
*/
private String manufacturer;
/** 费用定价主表ID */
/**
* 费用定价主表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long chargeItemDefinitionId;
/** 所属科室 */
/**
* 所属科室
*/
private Long orgId;
/** 所在位置 */
/**
* 所在位置
*/
private Long locationId;
/**
@@ -160,7 +204,9 @@ public class AdviceBaseDto {
*/
private List<AdviceInventoryDto> inventoryList;
/** 默认产品批号 */
/**
* 默认产品批号
*/
private String defaultLotNumber;
/**
@@ -168,24 +214,26 @@ public class AdviceBaseDto {
*/
private List<AdvicePriceDto> priceList;
/** 是否限制使用 */
/**
* 是否限制使用
*/
private Integer restrictedFlag;
/** 限制使用范围 */
/**
* 限制使用范围
*/
private String restrictedScope;
/** 用药说明 */
/**
* 用药说明
*/
@Dict(dictCode = "dosage_instruction")
private String dosageInstruction;
private String dosageInstruction_dictText;
<<<<<<< HEAD
=======
/*
收费项目等级
*/
@Dict(dictCode = "chrgitm_lv")
private String chrgitmLv;
private String chrgitmLv_dictText;
>>>>>>> v1.3
}

View File

@@ -18,7 +18,9 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class RequestBaseDto {
/** 医嘱类型 */
/**
* 医嘱类型
*/
private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目
/**
@@ -26,7 +28,9 @@ public class RequestBaseDto {
*/
private String uniqueKey; // requestId拼接adviceType
/** 处方号 */
/**
* 处方号
*/
private String prescriptionNo;
/**
@@ -37,7 +41,9 @@ public class RequestBaseDto {
private Long requesterId;
private String requesterId_dictText;
/** 请求时间 */
/**
* 请求时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date requestTime;
@@ -74,7 +80,9 @@ public class RequestBaseDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long chargeItemId;
/** 医嘱名称 */
/**
* 医嘱名称
*/
private String adviceName;
/**
@@ -82,30 +90,44 @@ public class RequestBaseDto {
*/
private String volume;
/** 产品批号 */
/**
* 产品批号
*/
private String lotNumber;
/** 请求数量 */
/**
* 请求数量
*/
private Integer quantity;
/** 请求单位编码 */
/**
* 请求单位编码
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
/** 请求状态 */
/**
* 请求状态
*/
private Integer statusEnum;
private String statusEnum_enumText;
/** 收费状态 */
/**
* 收费状态
*/
private Integer chargeStatus;
private String chargeStatus_enumText;
/** 是否皮试 */
/**
* 是否皮试
*/
private Integer skinTestFlag;
private String skinTestFlag_enumText;
/** 是否为注射药物 */
/**
* 是否为注射药物
*/
private Integer injectFlag;
private String injectFlag_enumText;
@@ -128,7 +150,9 @@ public class RequestBaseDto {
*/
private BigDecimal dose;
/** 剂量单位 */
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
private String doseUnitCode_dictText;
@@ -149,10 +173,14 @@ public class RequestBaseDto {
*/
private String positionName;
/** 用药天数 */
/**
* 用药天数
*/
private Integer dispensePerDuration;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/**
@@ -170,16 +198,17 @@ public class RequestBaseDto {
*/
private Integer sortNumber;
/** 用药说明 */
/**
* 用药说明
*/
@Dict(dictCode = "dosage_instruction")
private String dosageInstruction;
private String dosageInstruction_dictText;
<<<<<<< HEAD
=======
/** 请求基于什么的ID */
/**
* 请求基于什么的ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long basedOnId;
>>>>>>> v1.3
}

View File

@@ -19,7 +19,7 @@ public interface DoctorStationAdviceAppMapper {
/**
* 查询医嘱信息
*
*
* @param page 分页参数
* @param statusEnum 状态
* @param organizationId 患者挂号对应的科室id
@@ -33,16 +33,16 @@ public interface DoctorStationAdviceAppMapper {
* @return 医嘱信息
*/
IPage<AdviceBaseDto> getAdviceBaseInfo(@Param("page") Page<AdviceBaseDto> page,
@Param("statusEnum") Integer statusEnum, @Param("organizationId") Long organizationId,
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("activityTableName") String activityTableName, @Param("pricingFlag") Integer pricingFlag,
@Param("adviceDefinitionIdParamList") List<Long> adviceDefinitionIdParamList,
@Param("adviceTypes") List<Integer> adviceTypes,
@Param(Constants.WRAPPER) QueryWrapper<AdviceBaseDto> queryWrapper);
@Param("statusEnum") Integer statusEnum, @Param("organizationId") Long organizationId,
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
@Param("activityTableName") String activityTableName, @Param("pricingFlag") Integer pricingFlag,
@Param("adviceDefinitionIdParamList") List<Long> adviceDefinitionIdParamList,
@Param("adviceTypes") List<Integer> adviceTypes,
@Param(Constants.WRAPPER) QueryWrapper<AdviceBaseDto> queryWrapper);
/**
* 查询医嘱库存
*
*
* @param locationId 药房id
* @param adviceDefinitionIdList 医嘱定义ID集合
* @param SqlCondition sql条件
@@ -50,12 +50,12 @@ public interface DoctorStationAdviceAppMapper {
* @return 医嘱库存
*/
List<AdviceInventoryDto> getAdviceInventory(@Param("locationId") Long locationId,
@Param("adviceDefinitionIdList") List<Long> adviceDefinitionIdList, @Param("SqlCondition") String SqlCondition,
@Param("status") Integer status);
@Param("adviceDefinitionIdList") List<Long> adviceDefinitionIdList, @Param("SqlCondition") String SqlCondition,
@Param("status") Integer status);
/**
* 查询待发放数量信息
*
*
* @param medicationTableName 药品定义表名
* @param deviceTableName 耗材定义表名
* @param status1 发放状态-草稿
@@ -63,12 +63,12 @@ public interface DoctorStationAdviceAppMapper {
* @return 待发放数量信息
*/
List<AdviceInventoryDto> getAdviceDraftInventory(@Param("medicationTableName") String medicationTableName,
@Param("deviceTableName") String deviceTableName, @Param("status1") Integer status1,
@Param("status2") Integer status2);
@Param("deviceTableName") String deviceTableName, @Param("status1") Integer status1,
@Param("status2") Integer status2);
/**
* 查询取药科室配置
*
*
* @param organizationId 患者挂号对应的科室id
* @return 取药科室配置
*/
@@ -76,23 +76,23 @@ public interface DoctorStationAdviceAppMapper {
/**
* 查询耗材的取药科室
*
*
* @param encounterId 就诊id
* @param distributionCategoryCode 发放编码(耗材)
* @return 耗材的取药科室id
*/
Long getTakeDeviceLocationId(@Param("encounterId") Long encounterId,
@Param("distributionCategoryCode") String distributionCategoryCode);
@Param("distributionCategoryCode") String distributionCategoryCode);
/**
* 查询 费用定价子表
*
*
* @param conditionCode 命中条件
* @param chargeItemDefinitionIdList 费用定价主表ID集合
* @return 费用定价子表
*/
List<AdvicePriceDto> getChildCharge(@Param("conditionCode") String conditionCode,
@Param("chargeItemDefinitionIdList") List<Long> chargeItemDefinitionIdList);
@Param("chargeItemDefinitionIdList") List<Long> chargeItemDefinitionIdList);
/**
* 查询 费用定价主表
@@ -102,7 +102,7 @@ public interface DoctorStationAdviceAppMapper {
* @return 费用定价子表
*/
List<AdvicePriceDto> getMainCharge(@Param("chargeItemDefinitionIdList") List<Long> chargeItemDefinitionIdList,
@Param("statusEnum") Integer statusEnum);
@Param("statusEnum") Integer statusEnum);
/**
* 查询医嘱请求数据
@@ -118,10 +118,10 @@ public interface DoctorStationAdviceAppMapper {
* @return 医嘱请求数据
*/
List<RequestBaseDto> getRequestBaseInfo(@Param("encounterId") Long encounterId, @Param("patientId") Long patientId,
@Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
@Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum);
@Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
@Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum);
/**
* 查询就诊费用性质
@@ -133,14 +133,14 @@ public interface DoctorStationAdviceAppMapper {
/**
* 查询诊疗绑定耗材
*
*
* @param activityId 诊疗id
* @param status 启用状态
* @param tableName 表名
* @return 诊疗绑定耗材
*/
List<ActivityBindDeviceDetailDto> getActivityBindDevice(@Param("activityId") String activityId,
@Param("status") Integer status, @Param("tableName") String tableName);
@Param("status") Integer status, @Param("tableName") String tableName);
/**
* 查询医嘱绑定信息
@@ -151,10 +151,8 @@ public interface DoctorStationAdviceAppMapper {
* @return 医嘱绑定信息
*/
List<OrderBindInfoDto> getOrderBindInfo(@Param("typeCode") String typeCode, @Param("status") Integer status,
@Param("itemNo") String itemNo);
@Param("itemNo") String itemNo);
<<<<<<< HEAD
=======
/**
* 查询检验检查开立历史(近30天)
*
@@ -164,18 +162,17 @@ public interface DoctorStationAdviceAppMapper {
* @return 检验检查开立历史
*/
List<ProofAndTestHistoryDto> getProofAndTestHistory(@Param("patientId") Long patientId,
@Param("adviceDefinitionId") Long adviceDefinitionId, @Param("status") Integer status);
@Param("adviceDefinitionId") Long adviceDefinitionId, @Param("status") Integer status);
/**
* 查询检验检查url相关参数
*
*
* @param encounterId
* @param status
* @param typeEnum
* @return 检验检查url相关参数
*/
List<ProofAndTestResultDto> getProofAndTestResult(@Param("encounterId") Long encounterId,
@Param("status") Integer status, @Param("typeEnum") Integer typeEnum);
@Param("status") Integer status, @Param("typeEnum") Integer typeEnum);
>>>>>>> v1.3
}

View File

@@ -10,10 +10,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
<<<<<<< HEAD
=======
import com.core.common.enums.TenantOptionDict;
>>>>>>> v1.3
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.SecurityUtils;
import com.core.common.utils.StringUtils;
@@ -80,19 +77,19 @@ public class AdviceUtils {
*/
public String checkInventory(List<AdviceSaveDto> adviceSaveList) {
// 医嘱定义ID集合
List<Long> adviceDefinitionIdList =
adviceSaveList.stream().map(AdviceSaveDto::getAdviceDefinitionId).collect(Collectors.toList());
List<Long> adviceDefinitionIdList
= adviceSaveList.stream().map(AdviceSaveDto::getAdviceDefinitionId).collect(Collectors.toList());
// 医嘱库存集合
List<AdviceInventoryDto> adviceInventoryList =
doctorStationAdviceAppMapper.getAdviceInventory(null, adviceDefinitionIdList,
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
List<AdviceInventoryDto> adviceInventoryList
= doctorStationAdviceAppMapper.getAdviceInventory(null, adviceDefinitionIdList,
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
// 待发放个数信息
List<AdviceInventoryDto> adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
// 预减库存
List<AdviceInventoryDto> adviceInventory =
this.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
List<AdviceInventoryDto> adviceInventory
= this.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
// 检查库存
for (AdviceSaveDto saveDto : adviceSaveList) {
boolean matched = false;
@@ -100,11 +97,11 @@ public class AdviceUtils {
// 匹配条件adviceDefinitionId, adviceTableName, locationId, lotNumber 同时相等
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
boolean lotNumberMatch = StringUtils.isEmpty(saveDto.getLotNumber())
|| saveDto.getLotNumber().equals(inventoryDto.getLotNumber());
|| saveDto.getLotNumber().equals(inventoryDto.getLotNumber());
// if (saveDto.)
if (inventoryDto.getItemId().equals(saveDto.getAdviceDefinitionId())
&& inventoryDto.getItemTable().equals(saveDto.getAdviceTableName())
&& inventoryDto.getLocationId().equals(saveDto.getLocationId()) && lotNumberMatch) {
&& inventoryDto.getItemTable().equals(saveDto.getAdviceTableName())
&& inventoryDto.getLocationId().equals(saveDto.getLocationId()) && lotNumberMatch) {
matched = true;
// 检查库存是否充足
BigDecimal minUnitQuantity = saveDto.getMinUnitQuantity();
@@ -135,38 +132,38 @@ public class AdviceUtils {
*/
public String checkExeMedInventory(List<MedicationRequestUseExe> medUseExeList) {
// 医嘱定义id集合
List<Long> adviceDefinitionIdList =
medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList());
List<Long> adviceDefinitionIdList
= medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList());
// 医嘱库存集合
List<AdviceInventoryDto> adviceInventoryList =
doctorStationAdviceAppMapper.getAdviceInventory(null, adviceDefinitionIdList,
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
List<AdviceInventoryDto> adviceInventoryList
= doctorStationAdviceAppMapper.getAdviceInventory(null, adviceDefinitionIdList,
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
// 待发放个数信息
List<AdviceInventoryDto> adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
// 预减库存
List<AdviceInventoryDto> adviceInventory =
this.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
List<AdviceInventoryDto> adviceInventory
= this.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
// 生命提示信息集合
List<String> tipsList = new ArrayList<>();
for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) {
Optional<AdviceInventoryDto> matchedInventory = adviceInventory.stream()
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
&& medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId())
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.findFirst();
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.findFirst();
// 匹配到库存信息
if (matchedInventory.isPresent()) {
AdviceInventoryDto inventoryDto = matchedInventory.get();
if ((medicationRequestUseExe.getExecuteTimesNum()
.multiply(medicationRequestUseExe.getMinUnitQuantity()))
.multiply(medicationRequestUseExe.getMinUnitQuantity()))
.compareTo(inventoryDto.getQuantity()) > 0) {
tipsList
.add("" + medicationRequestUseExe.getBusNo() + "】在" + inventoryDto.getLocationName() + "库存不足");
.add("" + medicationRequestUseExe.getBusNo() + "】在" + inventoryDto.getLocationName() + "库存不足");
}
} else {
tipsList.add("" + medicationRequestUseExe.getBusNo() + "】未匹配到库存信息");
@@ -194,7 +191,7 @@ public class AdviceUtils {
* @return 预减库存
*/
public List<AdviceInventoryDto> subtractInventory(List<AdviceInventoryDto> adviceInventoryList,
List<AdviceInventoryDto> adviceDraftInventoryList) {
List<AdviceInventoryDto> adviceDraftInventoryList) {
// 医嘱定价来源
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
// 统一零售价
@@ -207,11 +204,11 @@ public class AdviceUtils {
if (retailPrice) {
// 统一零售价时,忽略 lotNumber
key = String.format(CommonConstants.Common.S_DD_FORMAT, draft.getItemTable(), draft.getItemId(),
draft.getLocationId());
draft.getLocationId());
} else {
// 非统一零售价时,包含 lotNumber
key = String.format(CommonConstants.Common.SS_DD_FORMAT, draft.getItemTable(), draft.getLotNumber(),
draft.getItemId(), draft.getLocationId());
draft.getItemId(), draft.getLocationId());
}
if (draftMap.containsKey(key)) {
@@ -230,7 +227,7 @@ public class AdviceUtils {
Map<String, List<AdviceInventoryDto>> groupedInventory = new HashMap<>();
for (AdviceInventoryDto inventory : adviceInventoryList) {
String groupKey = String.format(CommonConstants.Common.S_DD_FORMAT, inventory.getItemTable(),
inventory.getItemId(), inventory.getLocationId());
inventory.getItemId(), inventory.getLocationId());
if (!groupedInventory.containsKey(groupKey)) {
groupedInventory.put(groupKey, new ArrayList<>());
@@ -276,11 +273,11 @@ public class AdviceUtils {
if (retailPrice) {
// 统一零售价时,忽略 lotNumber
key = String.format(CommonConstants.Common.S_DD_FORMAT, inventory.getItemTable(), inventory.getItemId(),
inventory.getLocationId());
inventory.getLocationId());
} else {
// 非统一零售价时,包含 lotNumber
key = String.format(CommonConstants.Common.SS_DD_FORMAT, inventory.getItemTable(),
inventory.getLotNumber(), inventory.getItemId(), inventory.getLocationId());
inventory.getLotNumber(), inventory.getItemId(), inventory.getLocationId());
}
AdviceInventoryDto draft = draftMap.get(key);
@@ -289,14 +286,9 @@ public class AdviceUtils {
BigDecimal newQty = inventory.getQuantity().subtract(draftQty);
inventory.setQuantity(newQty.compareTo(BigDecimal.ZERO) >= 0 ? newQty : BigDecimal.ZERO);
}
<<<<<<< HEAD
return inventory;
}).collect(Collectors.toList());
=======
result.add(inventory);
}
return result;
>>>>>>> v1.3
}
/**
@@ -307,7 +299,7 @@ public class AdviceUtils {
* @param activityChildrenJsonParams 诊疗子项参数类
*/
public void handleActivityChild(String childrenJson, Long organizationId,
ActivityChildrenJsonParams activityChildrenJsonParams) {
ActivityChildrenJsonParams activityChildrenJsonParams) {
// 治疗类型 (长期/临时)
Integer therapyEnum = activityChildrenJsonParams.getTherapyEnum();
// 当前登录账号的科室id
@@ -320,8 +312,9 @@ public class AdviceUtils {
try {
// 将JSON字符串转换为List<ActivityChildJsonDto>
List<ActivityChildJsonDto> activityChildJsonDtoList =
objectMapper.readValue(childrenJson, new TypeReference<>() {});
List<ActivityChildJsonDto> activityChildJsonDtoList
= objectMapper.readValue(childrenJson, new TypeReference<>() {
});
// 创建子项的诊疗请求
Long adviceDefinitionId; // 诊疗医嘱定义ID
BigDecimal quantity; // 子项请求数量
@@ -337,9 +330,9 @@ public class AdviceUtils {
adviceBaseDto = new AdviceBaseDto();
adviceBaseDto.setAdviceDefinitionId(adviceDefinitionId);
// 对应的子项诊疗医嘱信息
AdviceBaseDto activityAdviceBaseDto =
iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1,
1, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords().get(0);
AdviceBaseDto activityAdviceBaseDto
= iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1,
1, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords().get(0);
if (activityAdviceBaseDto != null) {
// 费用定价
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
@@ -369,7 +362,7 @@ public class AdviceUtils {
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue());
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
chargeItem
.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setPatientId(activityChildrenJsonParams.getPatientId()); // 患者
chargeItem.setContextEnum(ChargeItemContext.ACTIVITY.getValue()); // 类型
@@ -390,7 +383,7 @@ public class AdviceUtils {
// 计算总价,保留4位小数
BigDecimal qty = quantity;
chargeItem.setTotalPrice(
qty.multiply(advicePriceDto.getPrice()).setScale(6, RoundingMode.HALF_UP)); // 总价
qty.multiply(advicePriceDto.getPrice()).setScale(6, RoundingMode.HALF_UP)); // 总价
chargeItemList.add(chargeItem);
}
}

View File

@@ -18,16 +18,6 @@ import com.openhis.web.document.util.EnumUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
<<<<<<< HEAD
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
=======
>>>>>>> v1.3
/**
* 文书定义 controller
@@ -40,6 +30,7 @@ import java.util.Map;
@Slf4j
@AllArgsConstructor
public class DocDefinitionController {
private final IDocDefinitionAppService iDocDefinitionAppService;
/**
@@ -56,13 +47,8 @@ public class DocDefinitionController {
// 获取权限枚举列表
map.put("permissions", EnumUtil.toMapList(DocPermissionEnum.class));
<<<<<<< HEAD
//使用范围枚举
List<String> noInUseCodes=new ArrayList<>();
=======
// 使用范围枚举
List<String> noInUseCodes = new ArrayList<>();
>>>>>>> v1.3
noInUseCodes.add(DocUseRangeEnum.USE_BY_SELF.getCode());
map.put("useRanges", EnumUtil.toMapListFilter(DocUseRangeEnum.class, noInUseCodes));
return R.ok(map);

View File

@@ -35,11 +35,7 @@ import com.openhis.web.inhospitalcharge.appservice.IInHospitalRegisterAppService
import com.openhis.web.inhospitalcharge.dto.*;
import com.openhis.web.inhospitalcharge.mapper.InHospitalRegisterAppMapper;
import com.openhis.web.patientmanage.appservice.IPatientInformationService;
<<<<<<< HEAD
import com.openhis.web.patientmanage.dto.PatientInformationDto;
=======
import com.openhis.web.patientmanage.dto.PatientBaseInfoDto;
>>>>>>> v1.3
import com.openhis.yb.service.YbManager;
import lombok.extern.slf4j.Slf4j;
@@ -160,7 +156,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
iEncounterLocationService.save(zYEncounterLocation);
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"住院申请"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"住院申请"}));
}
/**
@@ -176,16 +172,16 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
*/
@Override
public IPage<InHospitalRegisterQueryDto> getRegisterInfo(InHospitalRegisterQueryDto inHospitalRegisterQueryDto,
String searchKey, String registeredFlag, Integer pageNo, Integer pageSize, HttpServletRequest request) {
String searchKey, String registeredFlag, Integer pageNo, Integer pageSize, HttpServletRequest request) {
Integer encounterStatus = EncounterZyStatus.TO_BE_REGISTERED.getValue(); // 待登记
// 构建查询条件
QueryWrapper<InHospitalRegisterQueryDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(inHospitalRegisterQueryDto, searchKey,
new HashSet<>(Arrays.asList("registrar", "source_name", "patient_name")), request);
QueryWrapper<InHospitalRegisterQueryDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(inHospitalRegisterQueryDto, searchKey,
new HashSet<>(Arrays.asList("registrar", "source_name", "patient_name")), request);
IPage<InHospitalRegisterQueryDto> inHospitalRegisterInfo = inHospitalRegisterAppMapper
.getInHospitalRegisterInfo(new Page<>(pageNo, pageSize), EncounterClass.IMP.getValue(), encounterStatus,
registeredFlag, LocationForm.WARD.getValue(), queryWrapper);
.getInHospitalRegisterInfo(new Page<>(pageNo, pageSize), EncounterClass.IMP.getValue(), encounterStatus,
registeredFlag, LocationForm.WARD.getValue(), queryWrapper);
inHospitalRegisterInfo.getRecords().forEach(e -> {
// 性别
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
@@ -207,13 +203,13 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
InHospitalPatientInfoDto patientInfo = inHospitalRegisterAppMapper.getPatientInfo(patientId);
// 性别
patientInfo
.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, patientInfo.getGenderEnum()));
.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, patientInfo.getGenderEnum()));
// 计算年龄
patientInfo
.setAge(patientInfo.getBirthDate() != null ? AgeCalculatorUtil.getAge(patientInfo.getBirthDate()) : "");
.setAge(patientInfo.getBirthDate() != null ? AgeCalculatorUtil.getAge(patientInfo.getBirthDate()) : "");
// 婚姻状态
patientInfo.setMaritalStatusEnum_enumText(
EnumUtils.getInfoByValue(MaritalStatus.class, patientInfo.getMaritalStatusEnum()));
EnumUtils.getInfoByValue(MaritalStatus.class, patientInfo.getMaritalStatusEnum()));
// 职业
patientInfo.setPrfsEnum_enumText(EnumUtils.getInfoByValue(OccupationType.class, patientInfo.getPrfsEnum()));
return patientInfo;
@@ -228,20 +224,20 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
@Override
public InHospitalInfoDto getInHospitalInfo(Long encounterId) {
InHospitalInfoDto inHospitalInfo = inHospitalRegisterAppMapper.getInHospitalInfo(encounterId,
LocationForm.WARD.getValue(), Whether.YES.getValue(), ParticipantType.ADMITTER.getCode(),
PublicationStatus.ACTIVE.getValue(), AccountType.PERSONAL_CASH_ACCOUNT.getCode());
LocationForm.WARD.getValue(), Whether.YES.getValue(), ParticipantType.ADMITTER.getCode(),
PublicationStatus.ACTIVE.getValue(), AccountType.PERSONAL_CASH_ACCOUNT.getCode());
// 优先级(患者病情)
inHospitalInfo
.setPriorityEnum_enumText(EnumUtils.getInfoByValue(PriorityLevel.class, inHospitalInfo.getPriorityEnum()));
.setPriorityEnum_enumText(EnumUtils.getInfoByValue(PriorityLevel.class, inHospitalInfo.getPriorityEnum()));
// 病区号
String wardBusNo = inHospitalInfo.getWardBusNo();
if (!StringUtils.isEmpty(wardBusNo)) {
// 计算床位数
Integer totalBedsNum = inHospitalRegisterAppMapper.getTotalBedsNum(LocationForm.BED.getValue(),
LocationStatus.INACTIVE.getValue(), wardBusNo);
LocationStatus.INACTIVE.getValue(), wardBusNo);
inHospitalInfo.setTotalBedsNum(totalBedsNum); // 当前病区总床位数
Integer idleBedsNum = inHospitalRegisterAppMapper.getIdleBedsNum(LocationForm.BED.getValue(),
LocationStatus.IDLE.getValue(), wardBusNo);
LocationStatus.IDLE.getValue(), wardBusNo);
inHospitalInfo.setIdleBedsNum(idleBedsNum); // 当前病区空闲床位数
}
return inHospitalInfo;
@@ -258,10 +254,10 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
HashMap<String, Integer> resMap = new HashMap<>();
// 当前病区总床位数
Integer totalBedsNum = inHospitalRegisterAppMapper.getTotalBedsNum(LocationForm.BED.getValue(),
LocationStatus.INACTIVE.getValue(), wardBusNo);
LocationStatus.INACTIVE.getValue(), wardBusNo);
// // 当前病区空闲床位数
Integer idleBedsNum = inHospitalRegisterAppMapper.getIdleBedsNum(LocationForm.BED.getValue(),
LocationStatus.IDLE.getValue(), wardBusNo);
LocationStatus.IDLE.getValue(), wardBusNo);
resMap.put("totalBedsNum", totalBedsNum);
resMap.put("idleBedsNum", idleBedsNum);
return resMap;
@@ -286,7 +282,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
patient.setIdCard(patientUpdateDto.getIdCard()); // 身份证号
iPatientService.saveOrUpdate(patient);
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"患者信息"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"患者信息"}));
}
/**
@@ -298,7 +294,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
@Override
public R<?> registerByCashier(InHospitalInfoDto inHospitalInfoDto) {
this.handleRegister(inHospitalInfoDto, null); // 处理入院登记信息
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"住院登记"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"住院登记"}));
}
/**
@@ -314,7 +310,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
// 新增患者
R<?> r = patientInformationService.addPatient(patientInformation);
if (r.getCode() == 200) {
Patient patient = (Patient)r.getData();
Patient patient = (Patient) r.getData();
// 住院信息
InHospitalInfoDto inHospitalInfoDto = noFilesRegisterDto.getInHospitalInfo();
this.handleRegister(inHospitalInfoDto, patient); // 处理入院登记信息
@@ -322,7 +318,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"无档登记"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"无档登记"}));
}
/**
@@ -355,7 +351,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
@Override
public List<LocationDto> getWardList(Long orgId) {
List<Location> wardList = inHospitalRegisterAppMapper.selectWardList(orgId, LocationForm.WARD.getValue(),
LocationStatus.ACTIVE.getValue());
LocationStatus.ACTIVE.getValue());
// 2. 转换为 LocationDto逻辑与原代码完全一致
List<LocationDto> locationDtoList = new ArrayList<>();
@@ -399,8 +395,8 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
// 先查询当前就诊是否已经分配了病区
EncounterLocation encounterLocation = iEncounterLocationService.getOne(
new LambdaQueryWrapper<EncounterLocation>().eq(EncounterLocation::getEncounterId, encounterReg.getId())
.eq(EncounterLocation::getFormEnum, LocationForm.WARD.getValue()));
new LambdaQueryWrapper<EncounterLocation>().eq(EncounterLocation::getEncounterId, encounterReg.getId())
.eq(EncounterLocation::getFormEnum, LocationForm.WARD.getValue()));
// 处理病区信息
EncounterLocation encounterLocationReg = new EncounterLocation();
if (encounterLocation != null) {
@@ -419,7 +415,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
Account accountPersonalCash = new Account();
accountPersonalCash.setTypeCode(AccountType.PERSONAL_CASH_ACCOUNT.getCode()); // 账户类型
accountPersonalCash.setPatientId(
inHospitalInfoDto.getPatientId() != null ? inHospitalInfoDto.getPatientId() : patient.getId()); // 患者id
inHospitalInfoDto.getPatientId() != null ? inHospitalInfoDto.getPatientId() : patient.getId()); // 患者id
accountPersonalCash.setEncounterId(encounterReg.getId()); // 住院就诊id
accountPersonalCash.setBalanceAmount(inHospitalInfoDto.getBalanceAmount()); // 账户余额
// 自费
@@ -430,7 +426,7 @@ public class InHospitalRegisterAppServiceImpl implements IInHospitalRegisterAppS
Account accountNoSelfFunded = new Account();
accountNoSelfFunded.setTypeCode(inHospitalInfoDto.getTypeCoce()); // 账户类型
accountNoSelfFunded.setPatientId(
inHospitalInfoDto.getPatientId() != null ? inHospitalInfoDto.getPatientId() : patient.getId()); // 患者id
inHospitalInfoDto.getPatientId() != null ? inHospitalInfoDto.getPatientId() : patient.getId()); // 患者id
accountNoSelfFunded.setEncounterId(encounterReg.getId()); // 住院就诊id
accountNoSelfFunded.setContractNo(contractNo); // 合同编码
accountNoSelfFunded.setEncounterFlag(Whether.YES.getValue());

View File

@@ -36,7 +36,7 @@ public interface IATDManageAppService {
* @return 入院患者分页列表
*/
R<?> getAdmissionPatientPage(AdmissionPageParam admissionPageParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
String searchKey, HttpServletRequest request);
/**
* 入院患者床位信息分页列表
@@ -56,16 +56,7 @@ public interface IATDManageAppService {
*/
R<?> getAdmissionPatientInfo(Long encounterId);
/**
<<<<<<< HEAD
* 住院患者待处理信息列表
*
* @param encounterId 住院id
* @return 待处理信息列表
*/
R<?> getInPatientPendingList(Long encounterId);
=======
* 住院患者待处理列表查询
*
* @param inpatientAdviceParam 查询条件
@@ -74,7 +65,6 @@ public interface IATDManageAppService {
* @return 住院患者医
*/
R<?> getInPatientPendingList(InpatientAdviceParam inpatientAdviceParam, Integer pageNo, Integer pageSize);
>>>>>>> v1.3
/**
* 入科床位分配
@@ -87,11 +77,7 @@ public interface IATDManageAppService {
/**
* 转科
*
<<<<<<< HEAD
* @param encounterId 住院id
=======
* @param encounterId 住院患者id
>>>>>>> v1.3
* @return 结果
*/
R<?> transferDepartment(Long encounterId);
@@ -99,12 +85,6 @@ public interface IATDManageAppService {
/**
* 出院
*
<<<<<<< HEAD
* @param encounterId 住院id
* @return 结果
*/
R<?> hospitalDischarge(Long encounterId);
=======
* @param encounterId 住院患者id
* @return 结果
*/
@@ -120,18 +100,19 @@ public interface IATDManageAppService {
/**
* 诊断个人账户金额信息获取
*
*
* @param encounterId 诊断id
* @return EncounterAccountDto 诊断账户金额
**/
*
*/
R<?> getAmount(Long encounterId);
/**
* 获取待配/退药
*
*
* @param encounterId 诊断id
* @return PendingMedicationDto 待配/退药
**/
*
*/
R<?> getPendingMedication(Long encounterId);
>>>>>>> v1.3
}

View File

@@ -17,21 +17,6 @@ import com.openhis.web.inhospitalnursestation.dto.MedicineSummaryParam;
public interface IMedicineSummaryAppService {
/**
<<<<<<< HEAD
* 查询发药单信息
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求
* @return 发药单信息
*/
R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo, Integer pageSize,
HttpServletRequest request);
/**
* 查询药品汇总单
=======
* 药品汇总单初始化
*
* @return 初始化信息
@@ -40,31 +25,15 @@ public interface IMedicineSummaryAppService {
/**
* 查询发药单信息
>>>>>>> v1.3
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
<<<<<<< HEAD
* @param searchKey 模糊查询关键字
* @param request 请求
* @return 药品汇总单
*/
R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
/**
* 查询药品汇总单详情
*
* @param summaryNo 汇总单号
* @return 药品汇总单详情
*/
=======
* @param request 请求
* @return 发药单信息
*/
R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo, Integer pageSize,
HttpServletRequest request);
HttpServletRequest request);
/**
* 查询药品汇总单
@@ -77,7 +46,7 @@ public interface IMedicineSummaryAppService {
* @return 药品汇总单
*/
R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
String searchKey, HttpServletRequest request);
/**
* 查询药品汇总单详情
@@ -85,7 +54,6 @@ public interface IMedicineSummaryAppService {
* @param summaryNo 汇总单号
* @return 药品汇总单详情
*/
>>>>>>> v1.3
R<?> getMedicineSummaryFormDetail(String summaryNo);
/**
@@ -102,16 +70,5 @@ public interface IMedicineSummaryAppService {
* @param summaryNo 汇总单号
* @return 处理结果
*/
<<<<<<< HEAD
R<?> checkInventoryItem(List<Long> devDispenseId, List<Long> medDispenseId);
/**
* 取消汇总
*
* @param summaryNo 汇总单号
* @return 处理结果
*/
=======
>>>>>>> v1.3
R<?> cancelSummary(String summaryNo);
}

View File

@@ -1,8 +1,5 @@
package com.openhis.web.inhospitalnursestation.appservice;
<<<<<<< HEAD
import com.core.common.core.domain.R;
=======
import java.time.LocalDateTime;
import java.util.List;
@@ -13,48 +10,20 @@ import com.core.common.core.domain.R;
import com.openhis.administration.dto.CostDetailSearchParam;
import com.openhis.web.inhospitalnursestation.dto.InpatientAdviceParam;
import com.openhis.web.regdoctorstation.dto.AdviceBatchOpParam;
>>>>>>> v1.3
import com.openhis.web.regdoctorstation.dto.RegAdviceSaveParam;
public interface INurseBillingAppService {
/*
* 住院护士 划价添加
* @return
*/
public R<?> addInNurseBilling(RegAdviceSaveParam regAdviceSaveParam);
<<<<<<< HEAD
/*
* 住院护士 划价列表 根据护士encounterId查询
* @return
*/
public R<?> getBillingListByEncounterId();
=======
>>>>>>> v1.3
/*
* 住院护士撤销划价
* @return
*/
<<<<<<< HEAD
public R<?> deleteInNurseBilling();
/*
* 医嘱计费添加 诊疗 耗材
*/
public R<?> addOrderBilling();
/*
* 医嘱计费删除 诊疗 耗材
*/
public R<?> deleteOrderBilling();
/*
* 医嘱计费修改 诊疗 耗材
*/
public R<?> updateOrderBilling();
/*
根据医嘱id查询已计费的 耗材列表
* @return
*/
public R<?> getOrderBillingByRequestId();
=======
public R<?> deleteInNurseBilling(List<AdviceBatchOpParam> paramList);
/**
@@ -66,7 +35,7 @@ public interface INurseBillingAppService {
* @return 住院患者医
*/
R<?> getInNurseBillingPage(InpatientAdviceParam inpatientAdviceParam, Integer pageNo, Integer pageSize,
LocalDateTime startTime, LocalDateTime endTime);
LocalDateTime startTime, LocalDateTime endTime);
/*
* 医嘱计费添加 诊疗 耗材
@@ -94,12 +63,11 @@ public interface INurseBillingAppService {
/**
* 费用明细导出
*
*
* @param costDetailSearchParam 查询条件
* @param request request请求
* @param response response响应
*/
void makeExcelFile(CostDetailSearchParam costDetailSearchParam, HttpServletRequest request,
HttpServletResponse response);
>>>>>>> v1.3
HttpServletResponse response);
}

View File

@@ -5,10 +5,7 @@ import com.openhis.web.inhospitalnursestation.dto.OrgDeviceSummaryParam;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
<<<<<<< HEAD
=======
import java.util.List;
>>>>>>> v1.3
/**
* 科室耗材盘点 应用实现接口
@@ -19,13 +16,6 @@ import java.util.List;
public interface IOrgDeviceStockTakeAppService {
/**
<<<<<<< HEAD
* 查询科室耗材汇总
*
* @param orgDeviceSummaryParam 查询条件
* @param startTime 开始时间
* @param endTime 结束时间
=======
* 页面初始化
*
* @return 初始化信息
@@ -36,30 +26,21 @@ public interface IOrgDeviceStockTakeAppService {
* 查询科室耗材汇总
*
* @param orgDeviceSummaryParam 查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求
* @return 科室耗材汇总单
*/
<<<<<<< HEAD
R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam, String startTime, String endTime,
=======
R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam,
>>>>>>> v1.3
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request);
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request);
/**
* 科室耗材汇总
*
* @return 科室耗材汇总单
*/
<<<<<<< HEAD
R<?> orgDeviceSummary(OrgDeviceSummaryParam orgDeviceSummaryParam);
=======
R<?> orgDeviceSummary(List<OrgDeviceSummaryParam> orgDeviceSummaryParamList);
>>>>>>> v1.3
}

View File

@@ -105,23 +105,23 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 住院状态
List<ATDManageInitDto.encounterStatusOption> encounterStatusOptions = new ArrayList<>();
encounterStatusOptions.add(new ATDManageInitDto.encounterStatusOption(EncounterZyStatus.REGISTERED.getValue(),
EncounterZyStatus.REGISTERED.getInfo()));
EncounterZyStatus.REGISTERED.getInfo()));
encounterStatusOptions
.add(new ATDManageInitDto.encounterStatusOption(EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue(),
EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getInfo()));
.add(new ATDManageInitDto.encounterStatusOption(EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue(),
EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getInfo()));
// 床位状态
List<ATDManageInitDto.bedStatusOption> bedStatusOptions = new ArrayList<>();
bedStatusOptions
.add(new ATDManageInitDto.bedStatusOption(LocationStatus.IDLE.getValue(), LocationStatus.IDLE.getInfo()));
.add(new ATDManageInitDto.bedStatusOption(LocationStatus.IDLE.getValue(), LocationStatus.IDLE.getInfo()));
bedStatusOptions.add(
new ATDManageInitDto.bedStatusOption(LocationStatus.OCCUPY.getValue(), LocationStatus.OCCUPY.getInfo()));
new ATDManageInitDto.bedStatusOption(LocationStatus.OCCUPY.getValue(), LocationStatus.OCCUPY.getInfo()));
// 患者病情
List<ATDManageInitDto.priorityOption> priorityOptions = Stream.of(PriorityLevel.values())
.map(
priorityLevel -> new ATDManageInitDto.priorityOption(priorityLevel.getValue(), priorityLevel.getInfo()))
.collect(Collectors.toList());
.map(
priorityLevel -> new ATDManageInitDto.priorityOption(priorityLevel.getValue(), priorityLevel.getInfo()))
.collect(Collectors.toList());
atdManageInitDto.setBedStatusOptions(bedStatusOptions).setEncounterStatusOptions(encounterStatusOptions)
.setPriorityOptions(priorityOptions);
.setPriorityOptions(priorityOptions);
return R.ok(atdManageInitDto);
}
@@ -137,17 +137,17 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
*/
@Override
public R<?> getAdmissionPatientPage(AdmissionPageParam admissionPageParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request) {
String searchKey, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<AdmissionPageParam> queryWrapper = HisQueryUtils.buildQueryWrapper(admissionPageParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr,
CommonConstants.FieldName.PatientName, CommonConstants.FieldName.BusNo)),
request);
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr,
CommonConstants.FieldName.PatientName, CommonConstants.FieldName.BusNo)),
request);
// 入院患者分页列表
Page<AdmissionPatientPageDto> admissionPatientPage = atdManageAppMapper.selectAdmissionPatientPage(
new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.IMP.getValue(),
EncounterZyStatus.TO_BE_REGISTERED.getValue(), EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue());
new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.IMP.getValue(),
EncounterZyStatus.TO_BE_REGISTERED.getValue(), EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue());
admissionPatientPage.getRecords().forEach(e -> {
// 性别枚举
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
@@ -174,15 +174,15 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
@Override
public R<?> getAdmissionBedPage(AdmissionPageParam admissionPageParam, Integer pageNo, Integer pageSize) {
// 构建查询条件
QueryWrapper<AdmissionPageParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(admissionPageParam, null, null, null);
QueryWrapper<AdmissionPageParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(admissionPageParam, null, null, null);
// 入院患者床位分页列表
Page<AdmissionBedPageDto> admissionBedPage =
atdManageAppMapper.selectAdmissionBadPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterActivityStatus.ACTIVE.getValue(), LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(),
LocationForm.BED.getValue(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
LocationStatus.INACTIVE.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue());
Page<AdmissionBedPageDto> admissionBedPage
= atdManageAppMapper.selectAdmissionBadPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterActivityStatus.ACTIVE.getValue(), LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(),
LocationForm.BED.getValue(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
LocationStatus.INACTIVE.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue());
admissionBedPage.getRecords().forEach(e -> {
// 性别枚举
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
@@ -207,42 +207,27 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
@Override
public R<?> getAdmissionPatientInfo(Long encounterId) {
// 查询住院患者详细信息
AdmissionPatientInfoDto admissionPatientInfoDto =
atdManageAppMapper.selectAdmissionPatientInfo(encounterId, EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
ParticipantType.PRIMARY_NURSE.getCode(), ParticipantType.ATTENDING_DOCTOR.getCode(),
ParticipantType.ADMITTING_DOCTOR.getCode(), ParticipantType.CHIEF_DOCTOR.getCode());
AdmissionPatientInfoDto admissionPatientInfoDto
= atdManageAppMapper.selectAdmissionPatientInfo(encounterId, EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
ParticipantType.PRIMARY_NURSE.getCode(), ParticipantType.ATTENDING_DOCTOR.getCode(),
ParticipantType.ADMITTING_DOCTOR.getCode(), ParticipantType.CHIEF_DOCTOR.getCode());
// 年龄
if (admissionPatientInfoDto.getBirthDate() != null) {
admissionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(admissionPatientInfoDto.getBirthDate()));
}
// 性别
admissionPatientInfoDto.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, admissionPatientInfoDto.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, admissionPatientInfoDto.getGenderEnum()));
// 病情
admissionPatientInfoDto.setPriorityEnum_enumText(
EnumUtils.getInfoByValue(PriorityLevel.class, admissionPatientInfoDto.getPriorityEnum()));
EnumUtils.getInfoByValue(PriorityLevel.class, admissionPatientInfoDto.getPriorityEnum()));
// 获取入院体征
getAdmissionSigns(encounterId, admissionPatientInfoDto);
return R.ok(admissionPatientInfoDto);
}
/**
<<<<<<< HEAD
* 住院患者待处理信息列表
*
* @param encounterId 住院id
* @return 待处理信息列表
*/
@Override
public R<?> getInPatientPendingList(Long encounterId) {
// List<InpatientAdviceDto> inPatientPendingList =
// atdManageAppMapper.selectInPatientPendingList(encounterId, EncounterActivityStatus.ACTIVE.getValue(),
// LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
// ParticipantType.PRIMARY_NURSE.getCode(), ParticipantType.ATTENDING_DOCTOR.getCode(),
// ParticipantType.ADMITTING_DOCTOR.getCode());
return null;
=======
* 住院患者医嘱查询
*
* @param inpatientAdviceParam 查询条件
@@ -253,19 +238,19 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
@Override
public R<?> getInPatientPendingList(InpatientAdviceParam inpatientAdviceParam, Integer pageNo, Integer pageSize) {
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
// 患者医嘱分页列表
Page<InpatientAdviceDto> inpatientAdvicePage = atdManageAppMapper.selectInpatientAdvicePage(
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, RequestStatus.DRAFT.getValue(),
RequestStatus.STOPPED.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), ActivityDefCategory.TRANSFER.getCode(),
ActivityDefCategory.DISCHARGE.getCode(), ActivityDefCategory.NURSING.getCode());
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, RequestStatus.DRAFT.getValue(),
RequestStatus.STOPPED.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), ActivityDefCategory.TRANSFER.getCode(),
ActivityDefCategory.DISCHARGE.getCode(), ActivityDefCategory.NURSING.getCode());
inpatientAdvicePage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
@@ -283,7 +268,6 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
}
});
return R.ok(inpatientAdvicePage);
>>>>>>> v1.3
}
/**
@@ -319,19 +303,19 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 更新住院参与者
// 住院医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAdmittingDoctorId(), ParticipantType.ADMITTING_DOCTOR.getCode());
admissionPatientInfoDto.getAdmittingDoctorId(), ParticipantType.ADMITTING_DOCTOR.getCode());
// 责任护士
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getPrimaryNurseId(), ParticipantType.PRIMARY_NURSE.getCode());
admissionPatientInfoDto.getPrimaryNurseId(), ParticipantType.PRIMARY_NURSE.getCode());
if (admissionPatientInfoDto.getAttendingDoctorId() != null) {
// 主治医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
}
if (admissionPatientInfoDto.getChiefDoctorId() != null) {
// 主任医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
}
}
// 更新入院体征
@@ -343,13 +327,13 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
if (oldBedId != null) {
// 判断目标床位是否已经被占用
if (targetEncounterId != null) {
List<EncounterLocation> locationList =
encounterLocationService.getEncounterLocationInfo(targetEncounterId, null);
List<EncounterLocation> locationList
= encounterLocationService.getEncounterLocationInfo(targetEncounterId, null);
// 查询目标患者的入科时间
Date targetStartTime = null;
Optional<EncounterLocation> encounterLocationOptional =
locationList.stream().filter(x -> x.getFormEnum().equals(LocationForm.BED.getValue()))
.filter(x -> x.getStatusEnum().equals(EncounterActivityStatus.ACTIVE.getValue())).findFirst();
Optional<EncounterLocation> encounterLocationOptional
= locationList.stream().filter(x -> x.getFormEnum().equals(LocationForm.BED.getValue()))
.filter(x -> x.getStatusEnum().equals(EncounterActivityStatus.ACTIVE.getValue())).findFirst();
if (encounterLocationOptional.isPresent()) {
EncounterLocation encounterLocation = encounterLocationOptional.get();
targetStartTime = encounterLocation.getStartTime();
@@ -363,18 +347,18 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 保存住院位置(目标床位)
// 病房
encounterLocationService.creatEncounterLocation(encounterId, startTime,
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
// 病床
encounterLocationService.creatEncounterLocation(encounterId, startTime, targetBedId,
LocationForm.BED.getValue());
LocationForm.BED.getValue());
// 保存住院位置(原床位)
// 病房
encounterLocationService.creatEncounterLocation(targetEncounterId, targetStartTime,
admissionPatientInfoDto.getHouseId(), LocationForm.HOUSE.getValue());
admissionPatientInfoDto.getHouseId(), LocationForm.HOUSE.getValue());
// 病床
encounterLocationService.creatEncounterLocation(targetEncounterId, targetStartTime, oldBedId,
LocationForm.BED.getValue());
LocationForm.BED.getValue());
} else {
// 更新旧病床状态:空闲
@@ -388,10 +372,10 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 保存住院位置
// 病房
encounterLocationService.creatEncounterLocation(encounterId, startTime,
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
// 病床
encounterLocationService.creatEncounterLocation(encounterId, startTime, targetBedId,
LocationForm.BED.getValue());
LocationForm.BED.getValue());
// 更新病床状态:占用
locationService.updateStatusById(targetBedId, LocationStatus.OCCUPY.getValue());
}
@@ -399,29 +383,29 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 保存住院位置
// 病房
encounterLocationService.creatEncounterLocation(encounterId, startTime,
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
admissionPatientInfoDto.getTargetHouseId(), LocationForm.HOUSE.getValue());
// 病床
encounterLocationService.creatEncounterLocation(encounterId, startTime, targetBedId,
LocationForm.BED.getValue());
LocationForm.BED.getValue());
// 更新病床状态:占用
locationService.updateStatusById(targetBedId, LocationStatus.OCCUPY.getValue());
// 保存住院参与者
// 住院医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAdmittingDoctorId(), ParticipantType.ADMITTING_DOCTOR.getCode());
admissionPatientInfoDto.getAdmittingDoctorId(), ParticipantType.ADMITTING_DOCTOR.getCode());
// 责任护士
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getPrimaryNurseId(), ParticipantType.PRIMARY_NURSE.getCode());
admissionPatientInfoDto.getPrimaryNurseId(), ParticipantType.PRIMARY_NURSE.getCode());
if (admissionPatientInfoDto.getAttendingDoctorId() != null) {
// 主治医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
admissionPatientInfoDto.getAttendingDoctorId(), ParticipantType.ATTENDING_DOCTOR.getCode());
}
if (admissionPatientInfoDto.getChiefDoctorId() != null) {
// 主任医生
encounterParticipantService.creatEncounterParticipants(encounterId, startTime,
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
admissionPatientInfoDto.getChiefDoctorId(), ParticipantType.CHIEF_DOCTOR.getCode());
}
}
if (admissionPatientInfoDto.getPriorityEnum() != null) {
@@ -429,8 +413,8 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
encounterService.updatePriorityEnumById(encounterId, admissionPatientInfoDto.getPriorityEnum());
}
// 更新住院状态:已住院
Integer result =
encounterService.updateEncounterStatus(encounterId, EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue());
Integer result
= encounterService.updateEncounterStatus(encounterId, EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue());
if (result == 0) {
return R.fail("床位分配失败,请联系管理员");
}
@@ -442,42 +426,35 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
/**
* 转科
*
<<<<<<< HEAD
* @param encounterId 住院id
=======
* @param encounterId 住院患者id
>>>>>>> v1.3
* @return 结果
*/
@Override
public R<?> transferDepartment(Long encounterId) {
<<<<<<< HEAD
return null;
=======
if (encounterId == null) {
return R.fail("转科失败,请选择有效的患者");
}
// 获取是否还有待执行医嘱
List<MedicationRequest> medicationRequestList = medicationRequestService
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getEncounterId, encounterId)
.ne(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.eq(MedicationRequest::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getEncounterId, encounterId)
.ne(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.eq(MedicationRequest::getDeleteFlag, DelFlag.NO.getCode()));
List<ServiceRequest> serviceRequestList = serviceRequestService
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getEncounterId, encounterId)
.ne(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.TRANSFER.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.DISCHARGE.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.NURSING.getValue())
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getEncounterId, encounterId)
.ne(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.TRANSFER.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.DISCHARGE.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.NURSING.getValue())
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
if (!medicationRequestList.isEmpty() || !serviceRequestList.isEmpty()) {
return R.fail("有待执行的医嘱,请执行完后再转科");
}
// 查询患者待取的药品
List<MedicationDispense> medicationDispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().eq(MedicationDispense::getEncounterId, encounterId)
.in(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue(),
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.SUMMARIZED.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<MedicationDispense>().eq(MedicationDispense::getEncounterId, encounterId)
.in(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue(),
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.SUMMARIZED.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
if (!medicationDispenseList.isEmpty()) {
return R.fail("患者有待取的药品,请先取药");
}
@@ -485,9 +462,9 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
Encounter encounter = encounterService.getById(encounterId);
// 查询转科信息
List<OrderProcess> orderProcessList = orderProcessService
.list(new LambdaQueryWrapper<OrderProcess>().eq(OrderProcess::getEncounterId, encounterId)
.eq(OrderProcess::getOriginalOrganizationId, encounter.getOrganizationId())
.orderByDesc(OrderProcess::getCreateTime));
.list(new LambdaQueryWrapper<OrderProcess>().eq(OrderProcess::getEncounterId, encounterId)
.eq(OrderProcess::getOriginalOrganizationId, encounter.getOrganizationId())
.orderByDesc(OrderProcess::getCreateTime));
if (orderProcessList.isEmpty()) {
return R.fail("转科失败,请检查转科信息");
}
@@ -495,7 +472,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 更新原病床状态:空闲
List<EncounterLocation> encounterLocationList = encounterLocationService.getEncounterLocationList(encounterId,
LocationForm.BED, EncounterActivityStatus.ACTIVE);
LocationForm.BED, EncounterActivityStatus.ACTIVE);
if (encounterLocationList == null || encounterLocationList.size() != 1) {
return R.fail("清床失败,请检查病床状态");
}
@@ -506,59 +483,51 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
// 新增患者待转病区
encounterLocationService.creatEncounterLocation(encounterId, DateUtils.getNowDate(),
orderProcess.getTargetLocationId(), LocationForm.WARD.getValue());
orderProcess.getTargetLocationId(), LocationForm.WARD.getValue());
// 更新住院信息
encounter.setOrganizationId(orderProcess.getTargetOrganizationId())
.setStatusEnum(EncounterZyStatus.REGISTERED.getValue());
.setStatusEnum(EncounterZyStatus.REGISTERED.getValue());
return R.ok("转科成功");
>>>>>>> v1.3
}
/**
* 出院
*
<<<<<<< HEAD
* @param encounterId 住院id
=======
* @param encounterId 住院患者id
>>>>>>> v1.3
* @return 结果
*/
@Override
public R<?> hospitalDischarge(Long encounterId) {
<<<<<<< HEAD
return null;
=======
if (encounterId == null) {
return R.fail("出院失败,请选择有效的患者");
}
// 获取是否还有待执行医嘱
List<MedicationRequest> medicationRequestList = medicationRequestService
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getEncounterId, encounterId)
.ne(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.eq(MedicationRequest::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<MedicationRequest>().eq(MedicationRequest::getEncounterId, encounterId)
.ne(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.eq(MedicationRequest::getDeleteFlag, DelFlag.NO.getCode()));
List<ServiceRequest> serviceRequestList = serviceRequestService
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getEncounterId, encounterId)
.ne(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.TRANSFER.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.DISCHARGE.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.NURSING.getValue())
.eq(ServiceRequest::getParentId, null)
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getEncounterId, encounterId)
.ne(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.TRANSFER.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.DISCHARGE.getValue())
.ne(ServiceRequest::getCategoryEnum, ActivityDefCategory.NURSING.getValue())
.eq(ServiceRequest::getParentId, null)
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
if (!medicationRequestList.isEmpty() || !serviceRequestList.isEmpty()) {
return R.fail("有待执行的医嘱,请执行完后再出院");
}
// 查询患者待取的药品
List<MedicationDispense> medicationDispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().eq(MedicationDispense::getEncounterId, encounterId)
.in(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue(),
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.SUMMARIZED.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
.list(new LambdaQueryWrapper<MedicationDispense>().eq(MedicationDispense::getEncounterId, encounterId)
.in(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue(),
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.SUMMARIZED.getValue())
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
if (!medicationDispenseList.isEmpty()) {
return R.fail("患者有待取的药品,请先取药");
}
int affectedRows =
encounterService.updateEncounterStatus(encounterId, EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue());
int affectedRows
= encounterService.updateEncounterStatus(encounterId, EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue());
if (affectedRows > 0) {
return R.ok("出院成功");
}
@@ -576,7 +545,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
Encounter encounter = encounterService.getById(encounterId);
if (EncounterZyStatus.ALREADY_SETTLED.getValue().equals(encounter.getStatusEnum())
|| EncounterZyStatus.REGISTERED.getValue().equals(encounter.getStatusEnum())) {
|| EncounterZyStatus.REGISTERED.getValue().equals(encounter.getStatusEnum())) {
return R.fail("请等待出院结算完成后再清床");
}
// 更新患者位置状态:已完成
@@ -585,7 +554,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
encounterParticipantService.updateEncounterParticipantsStatus(encounterId);
// 更新原病床状态:空闲
List<EncounterLocation> encounterLocationList = encounterLocationService.getEncounterLocationList(encounterId,
LocationForm.BED, EncounterActivityStatus.ACTIVE);
LocationForm.BED, EncounterActivityStatus.ACTIVE);
if (encounterLocationList == null || encounterLocationList.size() != 1) {
return R.fail("清床失败,请检查病床状态");
}
@@ -595,28 +564,30 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
/**
* 诊断个人账户金额信息获取
*
*
* @param encounterId 诊断id
* @return EncounterAccountDto 诊断账户金额
**/
*
*/
@Override
public R<?> getAmount(Long encounterId) {
return R.ok(atdManageAppMapper.getAmount(AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), encounterId));
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), encounterId));
}
/**
* 获取待配/退药
*
*
* @param encounterId 诊断id
* @return PendingMedicationDto 待配/退药
**/
*
*/
@Override
public R<?> getPendingMedication(Long encounterId) {
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
return R.ok(atdManageAppMapper.getPendingMedication(encounterId, DispenseStatus.PREPARATION.getValue(),
DispenseStatus.SUMMARIZED.getValue(), RequestStatus.CANCELLED.getValue(), tenantId));
DispenseStatus.SUMMARIZED.getValue(), RequestStatus.CANCELLED.getValue(), tenantId));
}
/**
@@ -679,7 +650,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
String endBloodPressure = dto.getEndBloodPressure() == null ? " " : dto.getEndBloodPressure();
String highBloodPressure = dto.getHighBloodPressure() == null ? " " : dto.getHighBloodPressure();
String bloodPressure = " ".equals(endBloodPressure) && " ".equals(highBloodPressure) ? null
: endBloodPressure + "/" + highBloodPressure;
: endBloodPressure + "/" + highBloodPressure;
map.put(TemperatureChartEnum.BLOOD_PRESSURE.getTypeCode(), bloodPressure);
// 获取文书定义列表
List<DocStatisticsDefinitionDto> definitionList = docStatisticsDefinitionAppService.getList(1);
@@ -691,9 +662,9 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
// 获取患者ID
Encounter encounter = encounterService.getById(encounterId);
// 创建体温单统计列表
List<DocStatisticsDto> data =
((List<DocStatisticsDto>)docStatisticsAppService.queryByEncounterId(encounterId).getData()).stream()
.filter(item -> DocDefinitionEnum.ADMISSION_VITAL_SIGNS.getValue().equals(item.getSource())).toList();
List<DocStatisticsDto> data
= ((List<DocStatisticsDto>) docStatisticsAppService.queryByEncounterId(encounterId).getData()).stream()
.filter(item -> DocDefinitionEnum.ADMISSION_VITAL_SIGNS.getValue().equals(item.getSource())).toList();
List<DocStatisticsDto> list = new ArrayList<>(data);
map.keySet().forEach(key -> {
if (map.get(key) != null && !map.get(key).isEmpty()) {
@@ -713,6 +684,5 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
if (!list.isEmpty()) {
docStatisticsAppService.saveOrUpdateAdmissionSigns(list);
}
>>>>>>> v1.3
}
}

View File

@@ -30,14 +30,8 @@ import com.openhis.web.inhospitalnursestation.dto.MedicineDispenseFormDto;
import com.openhis.web.inhospitalnursestation.dto.MedicineSummaryFormDto;
import com.openhis.web.inhospitalnursestation.dto.MedicineSummaryParam;
import com.openhis.web.inhospitalnursestation.mapper.MedicineSummaryAppMapper;
<<<<<<< HEAD
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
import com.openhis.workflow.domain.InventoryItem;
=======
import com.openhis.web.pharmacymanage.dto.DispenseInitDto;
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
>>>>>>> v1.3
import com.openhis.workflow.service.ISupplyDeliveryService;
import com.openhis.workflow.service.ISupplyRequestService;
@@ -72,59 +66,6 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
private ReturnMedicineMapper returnMedicineMapper;
/**
<<<<<<< HEAD
* 查询发药单信息
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求
* @return 发药单信息
*/
@Override
public R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
// 初始化查询参数
String encounterIds = dispenseFormSearchParam.getEncounterIds();
dispenseFormSearchParam.setEncounterIds(null);
// 构建查询条件
QueryWrapper<DispenseFormSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam, null, null, request);
// 手动拼接住院患者id条件
if (encounterIds != null && !encounterIds.isEmpty()) {
List<Long> encounterIdList =
Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
}
// 领药信息列表
Page<MedicineDispenseFormDto> medicineDispenseFormPage =
medicineSummaryAppMapper.selectMedicineDispenseFormPage(new Page<>(pageNo, pageSize), queryWrapper,
RequestStatus.COMPLETED.getValue(), EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.BED.getValue(), ParticipantType.ADMITTING_DOCTOR.getCode(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
DispenseStatus.SUMMARIZED.getValue());
medicineDispenseFormPage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
// 是否为注射药物
e.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getInjectFlag()));
// 医嘱类型
e.setTherapyEnum_enumText(EnumUtils.getInfoByValue(TherapyTimeType.class, e.getTherapyEnum()));
// 性别枚举
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 计算年龄
if (e.getBirthDate() != null) {
e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate()));
}
});
return R.ok(medicineDispenseFormPage);
}
/**
* 查询药品汇总单
=======
* 药品汇总单初始化
*
* @return 初始化信息
@@ -133,17 +74,17 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
public R<?> getMedicineSummaryInit() {
DispenseInitDto initDto = new DispenseInitDto();
// 未发药原因下拉选列表
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions
= Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
// 发药状态
List<DispenseInitDto.DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.PREPARATION.getValue(),
DispenseStatus.PREPARATION.getInfo()));
DispenseStatus.PREPARATION.getInfo()));
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
DispenseStatus.COMPLETED.getInfo()));
DispenseStatus.COMPLETED.getInfo()));
initDto.setNotPerformedReasonOptions(notPerformedReasonOptions).setDispenseStatusOptions(dispenseStatusOptions);
return R.ok(initDto);
@@ -151,69 +92,37 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
/**
* 查询发药单信息
>>>>>>> v1.3
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
<<<<<<< HEAD
* @param searchKey 模糊查询关键字
* @param request 请求
* @return 药品汇总单
*/
@Override
public R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<DispenseFormSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam,
searchKey, new HashSet<>(List.of(CommonConstants.FieldName.BusNo)), request);
// 汇总单分页列表
Page<MedicineSummaryFormDto> medicineSummaryFormPage = medicineSummaryAppMapper.selectMedicineSummaryFormPage(
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
DispenseStatus.IN_PROGRESS.getValue(), SupplyType.SUMMARY_DISPENSE.getValue());
medicineSummaryFormPage.getRecords().forEach(e -> {
// 发药状态
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getStatusEnum()));
});
return R.ok(medicineSummaryFormPage);
}
/**
* 查询药品汇总单详情
*
* @param summaryNo 汇总单号
* @return 药品汇总单详情
*/
@Override
=======
* @param request 请求
* @return 发药单信息
*/
@Override
public R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
Integer pageSize, HttpServletRequest request) {
// 初始化查询参数
String encounterIds = dispenseFormSearchParam.getEncounterIds();
dispenseFormSearchParam.setEncounterIds(null);
// 构建查询条件
QueryWrapper<DispenseFormSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam, null, null, request);
QueryWrapper<DispenseFormSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam, null, null, request);
// 手动拼接住院患者id条件
if (encounterIds != null && !encounterIds.isEmpty()) {
List<Long> encounterIdList =
Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
List<Long> encounterIdList
= Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
}
// 领药信息列表
Page<MedicineDispenseFormDto> medicineDispenseFormPage =
medicineSummaryAppMapper.selectMedicineDispenseFormPage(new Page<>(pageNo, pageSize), queryWrapper,
RequestStatus.COMPLETED.getValue(), EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.BED.getValue(), ParticipantType.ADMITTING_DOCTOR.getCode(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
DispenseStatus.SUMMARIZED.getValue());
Page<MedicineDispenseFormDto> medicineDispenseFormPage
= medicineSummaryAppMapper.selectMedicineDispenseFormPage(new Page<>(pageNo, pageSize), queryWrapper,
RequestStatus.COMPLETED.getValue(), EncounterActivityStatus.ACTIVE.getValue(),
LocationForm.BED.getValue(), ParticipantType.ADMITTING_DOCTOR.getCode(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
DispenseStatus.SUMMARIZED.getValue());
medicineDispenseFormPage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));
@@ -243,15 +152,15 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
*/
@Override
public R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageSize, String searchKey, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<DispenseFormSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam,
searchKey, new HashSet<>(List.of(CommonConstants.FieldName.BusNo)), request);
searchKey, new HashSet<>(List.of(CommonConstants.FieldName.BusNo)), request);
// 汇总单分页列表
Page<MedicineSummaryFormDto> medicineSummaryFormPage = medicineSummaryAppMapper.selectMedicineSummaryFormPage(
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), SupplyType.SUMMARY_DISPENSE.getValue());
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), SupplyType.SUMMARY_DISPENSE.getValue());
medicineSummaryFormPage.getRecords().forEach(e -> {
// 发药状态
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getStatusEnum()));
@@ -266,7 +175,6 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
* @return 药品汇总单详情
*/
@Override
>>>>>>> v1.3
public R<?> getMedicineSummaryFormDetail(String summaryNo) {
// 药品汇总单详情
return R.ok(medicineSummaryAppMapper.selectMedicineSummaryFormDetail(summaryNo));
@@ -287,23 +195,23 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
// 申请人
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 药品发放id
List<Long> medDispenseIdList =
medicineSummaryParamList.stream().map(MedicineSummaryParam::getDispenseId).toList();
List<Long> medDispenseIdList
= medicineSummaryParamList.stream().map(MedicineSummaryParam::getDispenseId).toList();
// 药品发放信息列表
List<MedicationDispense> medicationDispenseList = medicationDispenseService.listByIds(medDispenseIdList);
if (medicationDispenseList == null || medicationDispenseList.isEmpty()) {
throw new ServiceException("未找到药品发放信息");
}
if (medicationDispenseList.stream().map(MedicationDispense::getStatusEnum)
.anyMatch(x -> x.equals(DispenseStatus.SUMMARIZED.getValue()))) {
.anyMatch(x -> x.equals(DispenseStatus.SUMMARIZED.getValue()))) {
throw new ServiceException("药品已汇总,请勿重复汇总");
}
// 查询药品信息
List<MedicationDefinition> medicationDefinitions = medicationDefinitionService
.listByIds(medicationDispenseList.stream().map(MedicationDispense::getMedicationId).toList());
.listByIds(medicationDispenseList.stream().map(MedicationDispense::getMedicationId).toList());
// 根据发放药房分组
Map<Long, List<MedicationDispense>> medicationLocationMap =
medicationDispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getLocationId));
Map<Long, List<MedicationDispense>> medicationLocationMap
= medicationDispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getLocationId));
// 循环每个药房
for (Map.Entry<Long, List<MedicationDispense>> entry : medicationLocationMap.entrySet()) {
// 汇总单据号
@@ -312,9 +220,9 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
List<MedicationDispense> medicationDispenses = entry.getValue();
// 根据相同批号的同一药品进行汇总
Map<String, List<MedicationDispense>> medicationSummaryInfoMap = medicationDispenses.stream().collect(
Collectors.groupingBy(x -> x.getMedicationId() + CommonConstants.Common.DASH + x.getLotNumber()));
Collectors.groupingBy(x -> x.getMedicationId() + CommonConstants.Common.DASH + x.getLotNumber()));
for (Map.Entry<String, List<MedicationDispense>> medicationSummaryInfoList : medicationSummaryInfoMap
.entrySet()) {
.entrySet()) {
List<MedicationDispense> medicationSummaryList = medicationSummaryInfoList.getValue();
MedicationDispense medicationDispense = medicationSummaryList.get(0);
Long medicationId = medicationDispense.getMedicationId();
@@ -328,8 +236,8 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
// 单位
String unitCode = null;
// 根据药品id获取对应的药品信息
Optional<MedicationDefinition> medicationDefinition =
medicationDefinitions.stream().filter(x -> x.getId().equals(medicationId)).findFirst();
Optional<MedicationDefinition> medicationDefinition
= medicationDefinitions.stream().filter(x -> x.getId().equals(medicationId)).findFirst();
if (medicationDefinition.isPresent()) {
partPercent = medicationDefinition.get().getPartPercent();
minUnitCode = medicationDefinition.get().getMinUnitCode();
@@ -349,89 +257,15 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
minQuantity = minQuantity.add(quantity);
}
Long supplyRequestId = supplyRequestService.createSummarySupplyRequest(medicationId, locationId,
lotNumber, patientId, minQuantity, minUnitCode, practitionerId, now, busNo);
lotNumber, patientId, minQuantity, minUnitCode, practitionerId, now, busNo);
supplyDeliveryService.createSummarySupplyDelivery(medicationId, lotNumber, patientId, minQuantity,
minUnitCode, receiverId, supplyRequestId);
minUnitCode, receiverId, supplyRequestId);
}
// 药品发放状态更新
medicationDispenseService.updateDispenseStatusSummarized(
medicationDispenses.stream().map(MedicationDispense::getId).toList(), busNo);
medicationDispenses.stream().map(MedicationDispense::getId).toList(), busNo);
}
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"汇总申请"}));
}
/**
* 取消汇总
*
* @param summaryNo 汇总单号
* @return 处理结果
*/
@Override
<<<<<<< HEAD
public R<?> checkInventoryItem(List<Long> devDispenseId, List<Long> medDispenseId) {
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseId, medDispenseId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个药品分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit().equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
}
}
=======
public R<?> cancelSummary(String summaryNo) {
// 取消汇总申请(软删除)
List<Long> requestIdList = supplyRequestService.cancelSummarySupplyRequest(List.of(summaryNo));
if (requestIdList.isEmpty()) {
return R.fail("取消汇总申请失败");
}
// 软删除汇总发放
supplyDeliveryService.deleteSupplyDeliveryByReqId(requestIdList);
// 取消药品汇总
boolean result = medicationDispenseService.cancelMedicationSummary(List.of(summaryNo));
if (!result) {
return R.fail("取消汇总申请失败");
>>>>>>> v1.3
}
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"取消"}));
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"汇总申请"}));
}
/**
@@ -454,7 +288,30 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService
if (!result) {
return R.fail("取消汇总申请失败");
}
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"取消"}));
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"取消"}));
}
/**
* 取消汇总
*
* @param summaryNo 汇总单号
* @return 处理结果
*/
@Override
public R<?> cancelSummary(String summaryNo) {
// 取消汇总申请(软删除)
List<Long> requestIdList = supplyRequestService.cancelSummarySupplyRequest(List.of(summaryNo));
if (requestIdList.isEmpty()) {
return R.fail("取消汇总申请失败");
}
// 软删除汇总发放
supplyDeliveryService.deleteSupplyDeliveryByReqId(requestIdList);
// 取消药品汇总
boolean result = medicationDispenseService.cancelMedicationSummary(List.of(summaryNo));
if (!result) {
return R.fail("取消汇总申请失败");
}
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"取消"}));
}
}

View File

@@ -1,37 +1,5 @@
package com.openhis.web.inhospitalnursestation.appservice.impl;
<<<<<<< HEAD
import com.core.common.core.domain.R;
import com.core.common.core.domain.model.LoginUser;
import com.core.common.exception.ServiceException;
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.SecurityUtils;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.administration.service.IChargeItemService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.*;
import com.openhis.web.doctorstation.dto.AdviceSaveDto;
import com.openhis.web.doctorstation.utils.AdviceUtils;
import com.openhis.web.inhospitalnursestation.appservice.INurseBillingAppService;
import com.openhis.web.regdoctorstation.dto.RegAdviceSaveDto;
import com.openhis.web.regdoctorstation.dto.RegAdviceSaveParam;
import com.openhis.workflow.domain.DeviceRequest;
import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IServiceRequestService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 住院护士站划价服务实现类
* 核心功能:临时耗材/诊疗活动划价签发、关联费用项管理、库存校验、医嘱删除(已收费校验)等
=======
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
@@ -83,56 +51,13 @@ import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IServiceRequestService;
/**
* 住院护士站划价服务实现类 核心职责: 1. 临时耗材划价签发(含耗材请求生成、发放记录创建、费用项关联) 2. 诊疗活动划价签发(含服务请求生成、子项处理、费用项关联) 3. 划价参数校验(非空校验、库房校验等) 4.
* 已收费项目删除限制(避免误删已结算数据) 5. 关联数据一致性管理(请求表、执行表、费用表、发放表联动)
>>>>>>> v1.3
* 住院护士站划价服务实现类 核心职责: 1. 临时耗材划价签发(含耗材请求生成、发放记录创建、费用项关联) 2.
* 诊疗活动划价签发(含服务请求生成、子项处理、费用项关联) 3. 划价参数校验(非空校验、库房校验等) 4. 已收费项目删除限制(避免误删已结算数据) 5.
* 关联数据一致性管理(请求表、执行表、费用表、发放表联动)
*/
@Service
public class NurseBillingAppService implements INurseBillingAppService {
<<<<<<< HEAD
// 依赖注入:保留@Resource注解按原有方式注入依赖
@Resource
private AdviceUtils adviceUtils;
@Resource
private AssignSeqUtil assignSeqUtil;
@Resource
private IDeviceRequestService iDeviceRequestService;
@Resource
private IServiceRequestService iServiceRequestService;
@Resource
private IChargeItemService iChargeItemService;
@Resource
private IDeviceDispenseService iDeviceDispenseService;
// 常量提取:避免魔法值,提高代码可维护性和可读性
/** 耗材请求服务表名(关联费用项使用) */
private static final String SERVICE_TABLE_DEVICE_REQUEST = CommonConstants.TableName.WOR_DEVICE_REQUEST;
private static final String SERVICE_TABLE_SERVICE_REQUEST = CommonConstants.TableName.WOR_SERVICE_REQUEST;
/** 费用项业务编号前缀 */
private static final String CHARGE_ITEM_BUS_NO_PREFIX = AssignSeqEnum.CHARGE_ITEM_NO.getPrefix();
/** 耗材申请单号序列号长度(按日生成) */
private static final int DEVICE_RES_NO_SEQ_LENGTH = 4;
/** 医嘱签发编码序列号长度 */
private static final int ADVICE_SIGN_SEQ_LENGTH = 10;
/**
* 新增住院护士站划价
* 完整流程:参数初始化 → 入参校验 → 医嘱分类(耗材/诊疗活动)→ 生成签发编码 → 处理耗材划价 → 处理诊疗活动划价
*
* @param regAdviceSaveParam 划价请求参数含患者信息、医嘱列表、科室ID等核心数据
* @return R<?> 划价结果响应(成功/失败信息、状态码)
*/
@Override
@Transactional(rollbackFor = Exception.class) // 事务管理:划价相关操作原子性,任一环节失败整体回滚
public R<?> addInNurseBilling(RegAdviceSaveParam regAdviceSaveParam) {
// 1. 时间参数初始化:默认使用当前时间,支持入参指定
Date curDate = new Date();
Date startTime = regAdviceSaveParam.getStartTime() == null ? curDate : regAdviceSaveParam.getStartTime();
Date authoredTime = regAdviceSaveParam.getAuthoredTime() == null ? curDate : regAdviceSaveParam.getAuthoredTime();
// 2. 入参校验:非空校验 + 库存校验,校验失败直接返回错误响应
=======
// ======================== 常量定义(关联表名/编码规则)========================
/**
* 耗材请求服务关联表名(用于费用项关联数据源)
@@ -215,11 +140,12 @@ public class NurseBillingAppService implements INurseBillingAppService {
private IOrganizationService organizationService;
// ======================== 核心业务方法(划价新增)========================
/**
* 新增住院护士站划价(核心入口方法) 完整流程:参数初始化 → 入参校验 → 医嘱分类 → 生成全局签发编码 → 分类处理划价 → 返回结果 事务特性:所有操作原子化,任一环节失败则整体回滚(避免数据不一致)
* 新增住院护士站划价(核心入口方法) 完整流程:参数初始化 → 入参校验 → 医嘱分类 → 生成全局签发编码 → 分类处理划价 → 返回结果
* 事务特性:所有操作原子化,任一环节失败则整体回滚(避免数据不一致)
*
* @param regAdviceSaveParam 划价请求参数体 包含患者ID、就诊ID、住院科室ID、医嘱列表耗材/诊疗活动)、操作时间等核心数据
* @param regAdviceSaveParam 划价请求参数体
* 包含患者ID、就诊ID、住院科室ID、医嘱列表耗材/诊疗活动)、操作时间等核心数据
* @return R<?> 划价结果响应 成功返回操作成功提示编码M00002 失败:返回具体错误信息(如参数缺失、库房为空等)
*/
@Override
@@ -231,295 +157,18 @@ public class NurseBillingAppService implements INurseBillingAppService {
// 1. 时间参数初始化:优先使用入参指定时间,无则默认当前系统时间
Date curDate = new Date();
Date startTime = regAdviceSaveParam.getStartTime() == null ? curDate : regAdviceSaveParam.getStartTime();
Date authoredTime =
regAdviceSaveParam.getAuthoredTime() == null ? curDate : regAdviceSaveParam.getAuthoredTime();
Date authoredTime
= regAdviceSaveParam.getAuthoredTime() == null ? curDate : regAdviceSaveParam.getAuthoredTime();
// 2. 入参校验:校验不通过直接返回错误响应(避免后续无效处理)
>>>>>>> v1.3
R<?> checkResult = checkNurseBillingParam(regAdviceSaveParam);
if (checkResult.getCode() != R.SUCCESS) {
return checkResult;
}
<<<<<<< HEAD
// 3. 提取核心业务参数
Long organizationId = regAdviceSaveParam.getOrganizationId(); // 患者住院科室ID
List<RegAdviceSaveDto> allAdviceList = regAdviceSaveParam.getRegAdviceSaveList(); // 所有待处理医嘱列表
// 4. 按医嘱类型分类:拆分耗材类和诊疗活动类(分别处理)
List<RegAdviceSaveDto> deviceAdviceList = filterDeviceAdvice(allAdviceList); // 耗材类医嘱
List<RegAdviceSaveDto> activityAdviceList = filterActivityAdvice(allAdviceList); // 诊疗活动类医嘱
// 5. 生成全局唯一的医嘱签发编码
String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), ADVICE_SIGN_SEQ_LENGTH);
// 6. 处理耗材类医嘱划价(新增/修改/删除逻辑)
handleDeviceBilling(deviceAdviceList, null, signCode, organizationId, curDate);
// 7. 处理诊疗活动类医嘱划价(原代码未实现,保留扩展入口)
handleActivityBilling(activityAdviceList, signCode, organizationId, curDate, startTime, authoredTime);
// 8. 划价成功返回响应
return R.ok("住院划价签发成功");
}
/**
* 筛选耗材类医嘱
* 按医嘱类型枚举ItemType.DEVICE过滤仅保留耗材相关医嘱
*
* @param allAdviceList 所有待处理医嘱列表
* @return List<RegAdviceSaveDto> 耗材类医嘱列表
*/
private List<RegAdviceSaveDto> filterDeviceAdvice(List<RegAdviceSaveDto> allAdviceList) {
return allAdviceList.stream()
.filter(advice -> ItemType.DEVICE.getValue().equals(advice.getAdviceType()))
.collect(Collectors.toList());
}
/**
* 筛选诊疗活动类医嘱
* 按医嘱类型枚举ItemType.ACTIVITY过滤仅保留诊疗活动相关医嘱
*
* @param allAdviceList 所有待处理医嘱列表
* @return List<RegAdviceSaveDto> 诊疗活动类医嘱列表
*/
private List<RegAdviceSaveDto> filterActivityAdvice(List<RegAdviceSaveDto> allAdviceList) {
return allAdviceList.stream()
.filter(advice -> ItemType.ACTIVITY.getValue().equals(advice.getAdviceType()))
.collect(Collectors.toList());
}
/**
* 处理耗材类医嘱划价
* 核心流程:筛选临时耗材 → 处理删除(已收费校验)→ 新增/修改耗材记录 → 同步发放+费用项
*
* @param deviceAdviceList 耗材类医嘱列表
* @param deleteList 待删除的耗材医嘱列表可为null暂无删除场景传null
* @param signCode 医嘱签发编码(全局唯一)
* @param organizationId 患者住院科室ID
* @param curDate 当前操作时间
*/
private void handleDeviceBilling(List<RegAdviceSaveDto> deviceAdviceList, List<AdviceSaveDto> deleteList,
String signCode, Long organizationId, Date curDate) {
// 1. 筛选临时类型耗材仅处理临时医嘱TherapyTimeType.TEMPORARY的新增/修改
List<AdviceSaveDto> tempDeviceList = deviceAdviceList.stream()
.filter(advice -> TherapyTimeType.TEMPORARY.getValue().equals(advice.getTherapyEnum()))
.collect(Collectors.toList());
// 2. 处理耗材删除:校验已收费状态 + 关联数据删除
handleDelRequest(deleteList,SERVICE_TABLE_DEVICE_REQUEST);
// 3. 处理耗材新增/修改:同步保存耗材请求、发放记录、费用项
handleDeviceInsertOrUpdate(tempDeviceList, organizationId, curDate);
}
/**
* 处理诊疗活动类医嘱划价
* (扩展入口:原代码未实现,可参考耗材处理逻辑,关联服务请求表、费用项等)
*
* @param activityAdviceList 诊疗活动类医嘱列表
* @param signCode 医嘱签发编码
* @param organizationId 住院科室ID
* @param curDate 当前操作时间
* @param startTime 医嘱开始时间
* @param authoredTime 医嘱签发时间
*/
private void handleActivityBilling(List<RegAdviceSaveDto> activityAdviceList, String signCode,
Long organizationId, Date curDate, Date startTime, Date authoredTime) {
// 注:诊疗活动划价逻辑待实现,建议流程:
// 1. 筛选临时类型诊疗活动
// 2. 处理删除(如需)
// 3. 新增/修改服务请求记录IServiceRequestService
// 4. 同步生成/更新费用项IChargeItemService
}
/**
* 处理耗材删除逻辑
* 关键校验:已收费的耗材项目不允许删除
* 关联删除:耗材请求表 → 耗材发放记录 → 费用项表(级联删除关联数据)
*
* @param deleteList 待删除的耗材医嘱列表可为null
*/
private void handleDelRequest(List<AdviceSaveDto> deleteList,String serviceTable) {
// 空列表直接返回,避免无效循环和查询
if (deleteList == null || deleteList.isEmpty()) {
return;
}
// 提取待删除请求ID列表用于查询费用状态
List<Long> delRequestIds = deleteList.stream()
.map(AdviceSaveDto::getRequestId)
.collect(Collectors.toList());
// 校验:待删除项是否已收费,已收费则抛出异常阻止删除
checkDeletedDeviceChargeStatus(delRequestIds);
// 执行级联删除:循环处理每个待删除项的关联数据
for (AdviceSaveDto deleteDto : deleteList) {
Long requestId = deleteDto.getRequestId();
if (serviceTable.equals(SERVICE_TABLE_DEVICE_REQUEST)){
iDeviceRequestService.removeById(requestId); // 删除耗材请求主记录
iDeviceDispenseService.deleteDeviceDispense(requestId); // 删除关联的耗材发放记录
}
// 删除关联的费用项(按服务表+服务ID关联
iChargeItemService.deleteByServiceTableAndId(SERVICE_TABLE_DEVICE_REQUEST, requestId);
}
}
/**
* 校验待删除耗材的费用状态
* 查询待删除项对应的费用项若存在已收费ChargeItemStatus.BILLED状态则抛出业务异常
*
* @param delRequestIds 待删除的耗材请求ID列表
*/
private void checkDeletedDeviceChargeStatus(List<Long> delRequestIds) {
if (delRequestIds.isEmpty()) {
return;
}
// 查询待删除耗材对应的费用项列表
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(delRequestIds);
if (chargeItemList == null || chargeItemList.isEmpty()) {
return; // 无关联费用项,直接允许删除
}
// 校验是否存在已收费项使用stream.anyMatch简化循环判断
boolean hasBilledItem = chargeItemList.stream()
.anyMatch(ci -> ChargeItemStatus.BILLED.getValue().equals(ci.getStatusEnum()));
if (hasBilledItem) {
throw new ServiceException("删除失败:部分项目已完成收费,不支持直接删除,请联系收费人员处理后重试");
}
}
/**
* 处理耗材新增/修改
* 流程:构建耗材请求对象 → 保存/更新 → 处理耗材发放 → 构建费用项 → 保存/更新费用项
*
* @param tempDeviceList 临时耗材医嘱列表(新增/修改)
* @param organizationId 住院科室ID
* @param curDate 当前操作时间
*/
private void handleDeviceInsertOrUpdate(List<AdviceSaveDto> tempDeviceList, Long organizationId, Date curDate) {
if (tempDeviceList.isEmpty()) {
return; // 无临时耗材需处理,直接返回
}
// 循环处理每个临时耗材医嘱
for (AdviceSaveDto adviceDto : tempDeviceList) {
// 1. 构建耗材请求对象DeviceRequest并执行保存/更新
if (adviceDto.getRequestId() == null) {
adviceDto.setDbOpType(DbOpType.INSERT.getCode()); // 新增时设置操作类型
}else {
adviceDto.setDbOpType(DbOpType.UPDATE.getCode()); // 修改时设置操作类型
}
DeviceRequest deviceRequest = buildDeviceRequest(adviceDto, curDate);
iDeviceRequestService.saveOrUpdate(deviceRequest);
// 2. 同步处理耗材发放:根据操作类型(新增/修改)执行发放逻辑
iDeviceDispenseService.handleDeviceDispense(deviceRequest, adviceDto.getDbOpType());
// 3. 构建费用项对象ChargeItem并执行保存/更新
ChargeItem chargeItem = buildChargeItem(adviceDto, deviceRequest, curDate);
iChargeItemService.saveOrUpdate(chargeItem);
}
}
/**
* 构建耗材请求对象DeviceRequest
* 功能将医嘱DTOAdviceSaveDto的属性映射到耗材请求实体设置默认状态和业务编号
*
* @param adviceDto 耗材医嘱DTO含请求参数
* @param curDate 当前操作时间
* @return DeviceRequest 构建完成的耗材请求实体
*/
private DeviceRequest buildDeviceRequest(AdviceSaveDto adviceDto, Date curDate) {
DeviceRequest deviceRequest = new DeviceRequest();
// 基础配置:主键、状态、业务编号
deviceRequest.setId(adviceDto.getRequestId()); // 主键ID新增为null修改为已有ID
deviceRequest.setStatusEnum(RequestStatus.ACTIVE.getValue()); // 划价时直接签发,状态为"激活"
// 按日生成业务编号:前缀+4位序列号确保每日唯一
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), DEVICE_RES_NO_SEQ_LENGTH));
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源:医生处方
// 业务属性映射从DTO映射到实体
deviceRequest.setQuantity(adviceDto.getQuantity()); // 请求数量
deviceRequest.setUnitCode(adviceDto.getUnitCode()); // 单位编码
deviceRequest.setLotNumber(adviceDto.getLotNumber()); // 产品批号
deviceRequest.setCategoryEnum(adviceDto.getCategoryEnum()); // 请求类型(枚举)
deviceRequest.setDeviceDefId(adviceDto.getAdviceDefinitionId()); // 耗材定义ID
deviceRequest.setPatientId(adviceDto.getPatientId()); // 患者ID
deviceRequest.setRequesterId(adviceDto.getPractitionerId()); // 开方医生ID
deviceRequest.setOrgId(adviceDto.getFounderOrgId()); // 开方人科室ID
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
deviceRequest.setPerformLocation(adviceDto.getLocationId()); // 发放耗材房ID
deviceRequest.setEncounterId(adviceDto.getEncounterId()); // 就诊ID
deviceRequest.setPackageId(adviceDto.getPackageId()); // 组套ID
deviceRequest.setContentJson(adviceDto.getContentJson()); // 请求内容JSON扩展信息
deviceRequest.setYbClassEnum(adviceDto.getYbClassEnum()); // 医保类别编码
deviceRequest.setConditionId(adviceDto.getConditionId()); // 诊断ID
deviceRequest.setEncounterDiagnosisId(adviceDto.getEncounterDiagnosisId()); // 就诊诊断ID
return deviceRequest;
}
/**
* 构建费用项对象ChargeItem
* 功能关联耗材请求实体和医嘱DTO映射费用相关属性设置默认状态和业务编号
*
* @param adviceDto 耗材医嘱DTO含费用参数
* @param deviceRequest 已保存的耗材请求实体关联服务ID
* @param curDate 当前操作时间
* @return ChargeItem 构建完成的费用项实体
*/
private ChargeItem buildChargeItem(AdviceSaveDto adviceDto, DeviceRequest deviceRequest,Date curDate) {
ChargeItem chargeItem = new ChargeItem();
// 基础配置:主键、状态、业务编号
chargeItem.setId(adviceDto.getChargeItemId()); // 费用项ID新增为null修改为已有ID
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 初始状态:草稿(未收费)
// 业务编号:费用项前缀+耗材请求编号(确保与耗材请求一一关联)
chargeItem.setBusNo(CHARGE_ITEM_BUS_NO_PREFIX.concat(deviceRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源:医生处方
// 业务属性映射:患者、就诊、定价相关信息
chargeItem.setPatientId(adviceDto.getPatientId()); // 患者ID
chargeItem.setContextEnum(adviceDto.getAdviceType()); // 费用类型(耗材)
chargeItem.setEncounterId(adviceDto.getEncounterId()); // 就诊ID
chargeItem.setDefinitionId(adviceDto.getDefinitionId()); // 费用定价ID
chargeItem.setDefDetailId(adviceDto.getDefinitionDetailId()); // 定价子表主键(明细定价)
chargeItem.setEntererId(adviceDto.getPractitionerId()); // 开立人ID开方医生
chargeItem.setRequestingOrgId(SecurityUtils.getLoginUser().getOrgId()); // 开立科室ID
chargeItem.setEnteredDate(curDate); // 开立时间
chargeItem.setServiceTable(SERVICE_TABLE_DEVICE_REQUEST); // 医疗服务类型(关联耗材请求表)
chargeItem.setServiceId(deviceRequest.getId()); // 医疗服务ID关联耗材请求ID
chargeItem.setProductTable(SERVICE_TABLE_DEVICE_REQUEST);// 产品所在表(耗材表)
chargeItem.setProductId(adviceDto.getAdviceDefinitionId());// 产品ID耗材定义ID
chargeItem.setAccountId(adviceDto.getAccountId()); // 关联账户ID患者账户
chargeItem.setConditionId(adviceDto.getConditionId()); // 诊断ID
chargeItem.setEncounterDiagnosisId(adviceDto.getEncounterDiagnosisId()); // 就诊诊断ID
// 费用核心属性:数量、单位、单价、总价
chargeItem.setQuantityValue(adviceDto.getQuantity()); // 数量(与耗材请求一致)
chargeItem.setQuantityUnit(adviceDto.getUnitCode()); // 单位(与耗材请求一致)
chargeItem.setUnitPrice(adviceDto.getUnitPrice()); // 单价从DTO传入已定价
chargeItem.setTotalPrice(adviceDto.getTotalPrice()); // 总价数量×单价DTO已计算
return chargeItem;
}
/**
* 划价入参校验
* 校验规则1. 参数非空 2. 科室ID非空 3. 医嘱列表非空 4. 临时耗材库存校验
*
* @param regAdviceSaveParam 划价请求参数
* @return R<?> 校验结果成功返回R.ok()失败返回R.fail()
*/
private R<?> checkNurseBillingParam(RegAdviceSaveParam regAdviceSaveParam) {
// 1. 整体参数非空校验
=======
// 3. 提取核心业务参数住院科室ID优先入参无则取登录用户所属科室
Long organizationId = regAdviceSaveParam.getOrganizationId() == null ? loginUser.getOrgId()
: regAdviceSaveParam.getOrganizationId();
: regAdviceSaveParam.getOrganizationId();
// 待处理医嘱列表(含耗材、诊疗活动两种类型)
List<RegAdviceSaveDto> allAdviceList = regAdviceSaveParam.getRegAdviceSaveList();
@@ -539,11 +188,12 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
// 7. 划价成功:返回统一成功提示(通过国际化工具类拼接提示信息)
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"住院护士划价"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"住院护士划价"}));
}
/**
* 删除住院划价记录(核心实现) 流程:参数校验 → 分类筛选医嘱 → 已收费状态校验 → 级联删除关联数据 → 返回结果 事务特性:所有删除操作原子化,任一环节失败整体回滚
* 删除住院划价记录(核心实现) 流程:参数校验 → 分类筛选医嘱 → 已收费状态校验 → 级联删除关联数据 → 返回结果
* 事务特性:所有删除操作原子化,任一环节失败整体回滚
*
* @return R<?> 删除结果响应
*/
@@ -556,15 +206,15 @@ public class NurseBillingAppService implements INurseBillingAppService {
List<Long> activityRequestIds = Collections.emptyList();
if (paramList != null && !paramList.isEmpty()) {
activityRequestIds = paramList.stream().filter(e -> e != null // 避免单个参数对象为null
&& ItemType.ACTIVITY.getValue().equals(e.getAdviceType()) && e.getRequestId() != null) // 避免requestId为null按需添加
.map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
&& ItemType.ACTIVITY.getValue().equals(e.getAdviceType()) && e.getRequestId() != null) // 避免requestId为null按需添加
.map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
}
// 耗材ids
List<Long> deviceRequestIds = Collections.emptyList();
if (paramList != null && !paramList.isEmpty()) {
deviceRequestIds = paramList.stream().filter(e -> e != null // 避免单个参数对象为null
&& ItemType.DEVICE.getValue().equals(e.getAdviceType()) && e.getRequestId() != null) // 避免requestId为null按需添加
.map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
&& ItemType.DEVICE.getValue().equals(e.getAdviceType()) && e.getRequestId() != null) // 避免requestId为null按需添加
.map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
}
this.handleDel(deviceRequestIds, SERVICE_TABLE_DEVICE);
this.handleDel(activityRequestIds, SERVICE_TABLE_SERVICE);
@@ -581,31 +231,31 @@ public class NurseBillingAppService implements INurseBillingAppService {
*/
@Override
public R<?> getInNurseBillingPage(InpatientAdviceParam inpatientAdviceParam, Integer pageNo, Integer pageSize,
LocalDateTime startTime, LocalDateTime endTime) {
LocalDateTime startTime, LocalDateTime endTime) {
// 初始化查询参数
String encounterIds = inpatientAdviceParam.getEncounterIds();
inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null);
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
// 手动拼接住院患者id条件
if (encounterIds != null && !encounterIds.isEmpty()) {
List<Long> encounterIdList =
Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
List<Long> encounterIdList
= Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
}
// 患者医嘱分页列表
Page<InpatientAdviceDto> inpatientAdvicePage =
nurseBillingAppMapper.getInNurseBillingPage(new Page<>(pageNo, pageSize), queryWrapper,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
RequestStatus.DRAFT.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.NURSE_PRICING.getValue(), startTime, endTime);
Page<InpatientAdviceDto> inpatientAdvicePage
= nurseBillingAppMapper.getInNurseBillingPage(new Page<>(pageNo, pageSize), queryWrapper,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
RequestStatus.DRAFT.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.NURSE_PRICING.getValue(), startTime, endTime);
inpatientAdvicePage.getRecords().forEach(e -> {
// 医嘱类型
e.setTherapyEnum_enumText(EnumUtils.getInfoByValue(TherapyTimeType.class, e.getTherapyEnum()));
@@ -622,112 +272,47 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
// ======================== 入参校验方法 ========================
/**
* 划价入参校验(通用校验逻辑) 校验规则1. 参数非空 2. 住院科室ID非空 3. 医嘱列表非空 4. 隐含库房校验(耗材类单独校验) 校验失败直接返回错误响应,不进入后续业务逻辑
* 划价入参校验(通用校验逻辑) 校验规则1. 参数非空 2. 住院科室ID非空 3. 医嘱列表非空 4. 隐含库房校验(耗材类单独校验)
* 校验失败直接返回错误响应,不进入后续业务逻辑
*
* @param regAdviceSaveParam 划价请求参数体
* @return R<?> 校验结果成功返回R.ok()失败返回R.fail(错误信息)
*/
private R<?> checkNurseBillingParam(RegAdviceSaveParam regAdviceSaveParam) {
// 1. 整体参数非空校验请求体为null直接返回失败
>>>>>>> v1.3
if (regAdviceSaveParam == null) {
return R.fail("划价请求失败:未获取到有效请求数据,请重新提交");
}
<<<<<<< HEAD
// 2. 核心字段非空校验患者住院科室ID
=======
// 2. 核心字段非空校验患者住院科室ID不能为空
>>>>>>> v1.3
if (regAdviceSaveParam.getOrganizationId() == null) {
return R.fail("划价请求失败:患者住院科室信息缺失,请确认患者科室后重试");
}
<<<<<<< HEAD
// 3. 医嘱列表非空校验
=======
// 3. 医嘱列表非空校验:必须选择至少一个待划价项目
>>>>>>> v1.3
List<RegAdviceSaveDto> adviceList = regAdviceSaveParam.getRegAdviceSaveList();
if (adviceList == null || adviceList.isEmpty()) {
return R.fail("划价请求失败:未选择任何待划价项目,请添加医嘱后提交");
}
<<<<<<< HEAD
// 4. 临时耗材库存校验:仅校验非删除、非诊疗活动的临时医嘱
=======
// 4. 库存校验:临时注释(当前需求:划价不校验库存,实际发放时校验)
// 若后续需要恢复库存校验,可解除以下注释
/*
>>>>>>> v1.3
List<AdviceSaveDto> needCheckInventoryList = adviceList.stream()
.filter(advice -> TherapyTimeType.TEMPORARY.getValue().equals(advice.getTherapyEnum())
&& !DbOpType.DELETE.getCode().equals(advice.getDbOpType())
&& !ItemType.ACTIVITY.getValue().equals(advice.getAdviceType()))
.collect(Collectors.toList());
<<<<<<< HEAD
// 调用工具类校验库存返回非null则表示库存不足
String inventoryTip = adviceUtils.checkInventory(new ArrayList<>(needCheckInventoryList));
if (inventoryTip != null) {
// 库存提示已包含具体耗材名称和短缺数量,直接拼接操作建议
return R.fail("划价失败:" + inventoryTip + ",请联系库房确认库存或调整申请数量");
}
=======
String inventoryTip = adviceUtils.checkInventory(new ArrayList<>(needCheckInventoryList));
if (inventoryTip != null) {
return R.fail("划价失败:" + inventoryTip + ",请联系库房确认库存或调整申请数量");
}
*/
>>>>>>> v1.3
*/
// 所有校验通过
return R.ok();
}
<<<<<<< HEAD
// ======================== 以下方法原代码未实现,保留接口方法签名 ========================
@Override
public R<?> getBillingListByEncounterId() {
// 功能根据就诊ID查询划价列表待实现
return null;
}
@Override
public R<?> deleteInNurseBilling() {
// 功能:删除住院划价记录(待实现)
// List<AdviceSaveDto> deleteList
return null;
}
@Override
public R<?> addOrderBilling() {
// 功能:新增订单划价(待实现)
return null;
}
@Override
public R<?> deleteOrderBilling() {
// 功能:删除订单划价(待实现)
return null;
}
@Override
public R<?> updateOrderBilling() {
// 功能:修改订单划价(待实现)
return null;
}
@Override
public R<?> getOrderBillingByRequestId() {
// 功能根据请求ID查询订单划价待实现
return null;
}
=======
// ======================== 医嘱分类工具方法 ========================
/**
@@ -738,7 +323,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
*/
private List<RegAdviceSaveDto> filterDeviceAdvice(List<RegAdviceSaveDto> allAdviceList) {
return allAdviceList.stream().filter(advice -> ItemType.DEVICE.getValue().equals(advice.getAdviceType()))
.collect(Collectors.toList());
.collect(Collectors.toList());
}
/**
@@ -749,13 +334,13 @@ public class NurseBillingAppService implements INurseBillingAppService {
*/
private List<RegAdviceSaveDto> filterActivityAdvice(List<RegAdviceSaveDto> allAdviceList) {
return allAdviceList.stream().filter(advice -> ItemType.ACTIVITY.getValue().equals(advice.getAdviceType()))
.collect(Collectors.toList());
.collect(Collectors.toList());
}
// ======================== 耗材类划价处理 ========================
/**
* 处理耗材类医嘱划价(核心子流程) 流程:筛选临时耗材 → 校验发放库房 → 生成耗材请求 → 生成执行记录 → 生成耗材发放 → 生成费用项 特殊规则:临时耗材划价不校验库存、不预减库存(仅记录发放需求,实际发放时扣库)
* 处理耗材类医嘱划价(核心子流程) 流程:筛选临时耗材 → 校验发放库房 → 生成耗材请求 → 生成执行记录 → 生成耗材发放 → 生成费用项
* 特殊规则:临时耗材划价不校验库存、不预减库存(仅记录发放需求,实际发放时扣库)
*
* @param deviceAdviceList 耗材类医嘱列表(已筛选)
* @param signCode 全局签发编码(关联同一批次划价)
@@ -763,7 +348,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @param curDate 当前操作时间(用于填充创建时间/执行时间)
*/
private void handleAddDeviceBilling(List<RegAdviceSaveDto> deviceAdviceList, String signCode, Long organizationId,
Date curDate) {
Date curDate) {
// 1. 筛选临时类型耗材仅处理临时医嘱TherapyTimeType.TEMPORARY且请求ID不为空
List<AdviceSaveDto> tempDeviceList = deviceAdviceList.stream().collect(Collectors.toList());
@@ -780,30 +365,30 @@ public class NurseBillingAppService implements INurseBillingAppService {
// 3.2 生成医嘱执行记录CLIN_PROCEDURE记录执行状态、执行科室、执行时间等
Long procedureId = this.addProcedureRecord(deviceRequest.getEncounterId(), // 就诊ID
deviceRequest.getPatientId(), // 患者ID
deviceRequest.getId(), // 耗材请求ID关联执行记录与请求
SERVICE_TABLE_DEVICE, // 关联表名(耗材请求表)
EventStatus.COMPLETED, // 执行状态:已完成
ProcedureCategory.INPATIENT_NURSE_ADVICE, // 执行种类:住院护士医嘱
deviceRequest.getLocationId(), // 执行位置(发放库房)
curDate, null, null // 当前时间为执行时间,组号/取消ID为空
deviceRequest.getPatientId(), // 患者ID
deviceRequest.getId(), // 耗材请求ID关联执行记录与请求
SERVICE_TABLE_DEVICE, // 关联表名(耗材请求表)
EventStatus.COMPLETED, // 执行状态:已完成
ProcedureCategory.INPATIENT_NURSE_ADVICE, // 执行种类:住院护士医嘱
deviceRequest.getLocationId(), // 执行位置(发放库房)
curDate, null, null // 当前时间为执行时间,组号/取消ID为空
);
// 3.3 生成耗材发放记录WOR_DEVICE_DISPENSE状态设为待发放关联执行记录
Long dispenseId = iDeviceDispenseService.generateDeviceDispense(deviceRequest, procedureId,
deviceRequest.getLocationId(), curDate);
deviceRequest.getLocationId(), curDate);
// 3.4 生成费用项记录ADM_CHARGE_ITEM关联耗材请求、发放记录、执行记录状态设为待结算
ChargeItem chargeItem = buildChargeItem(adviceDto, deviceRequest.getBusNo(), deviceRequest.getId(),
SERVICE_TABLE_DEVICE, PRODUCT_TABLE_DEVICE, curDate, procedureId, dispenseId, WOR_DEVICE_DISPENSE);
SERVICE_TABLE_DEVICE, PRODUCT_TABLE_DEVICE, curDate, procedureId, dispenseId, WOR_DEVICE_DISPENSE);
iChargeItemService.saveOrUpdate(chargeItem);
}
}
// ======================== 诊疗活动类划价处理 ========================
/**
* 处理诊疗活动类医嘱划价(核心子流程) 流程:生成服务请求 → 生成执行记录 → 生成费用项 → 处理诊疗子项(如有) 特殊规则:诊疗活动可能包含子项(如套餐类活动),需递归处理子项划价
* 处理诊疗活动类医嘱划价(核心子流程) 流程:生成服务请求 → 生成执行记录 → 生成费用项 → 处理诊疗子项(如有)
* 特殊规则:诊疗活动可能包含子项(如套餐类活动),需递归处理子项划价
*
* @param activityAdviceList 诊疗活动类医嘱列表(已筛选)
* @param signCode 全局签发编码(关联同一批次划价)
@@ -813,27 +398,27 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @param authoredTime 医嘱签发时间
*/
private void handleAddActivityBilling(List<RegAdviceSaveDto> activityAdviceList, String signCode,
Long organizationId, Date curDate, Date startTime, Date authoredTime) {
Long organizationId, Date curDate, Date startTime, Date authoredTime) {
// 循环处理每个诊疗活动医嘱
for (AdviceSaveDto adviceDto : activityAdviceList) {
// 1. 生成诊疗活动请求记录WOR_SERVICE_REQUEST状态设为激活来源标记为护士划价
ServiceRequest serviceRequest =
this.buildActivityRequest(adviceDto, signCode, organizationId, curDate, startTime, authoredTime);
ServiceRequest serviceRequest
= this.buildActivityRequest(adviceDto, signCode, organizationId, curDate, startTime, authoredTime);
// 2. 生成医嘱执行记录CLIN_PROCEDURE关联服务请求记录执行状态
Long procedureId = this.addProcedureRecord(serviceRequest.getEncounterId(), // 就诊ID
serviceRequest.getPatientId(), // 患者ID
serviceRequest.getId(), // 服务请求ID关联执行记录与请求
SERVICE_TABLE_SERVICE, // 关联表名(服务请求表)
EventStatus.COMPLETED, // 执行状态:已完成
ProcedureCategory.INPATIENT_NURSE_ADVICE, // 执行种类:住院护士医嘱
serviceRequest.getLocationId(), // 执行位置(执行科室)
curDate, null, null // 当前时间为执行时间,组号/取消ID为空
serviceRequest.getPatientId(), // 患者ID
serviceRequest.getId(), // 服务请求ID关联执行记录与请求
SERVICE_TABLE_SERVICE, // 关联表名(服务请求表)
EventStatus.COMPLETED, // 执行状态:已完成
ProcedureCategory.INPATIENT_NURSE_ADVICE, // 执行种类:住院护士医嘱
serviceRequest.getLocationId(), // 执行位置(执行科室)
curDate, null, null // 当前时间为执行时间,组号/取消ID为空
);
// 3. 生成费用项记录ADM_CHARGE_ITEM关联服务请求、执行记录状态设为待结算
ChargeItem chargeItem = buildChargeItem(adviceDto, serviceRequest.getBusNo(), serviceRequest.getId(),
SERVICE_TABLE_SERVICE, PRODUCT_TABLE_ACTIVITY, curDate, procedureId, null, null);
SERVICE_TABLE_SERVICE, PRODUCT_TABLE_ACTIVITY, curDate, procedureId, null, null);
iChargeItemService.saveOrUpdate(chargeItem);
// 4. 处理诊疗子项(如活动包含子项配置,递归生成子项的划价数据)
@@ -842,7 +427,6 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
// ======================== 执行记录工具方法 ========================
/**
* 生成医嘱执行记录(通用方法,支持耗材/诊疗活动两种类型) 功能调用执行记录服务创建CLIN_PROCEDURE表记录关联请求数据与执行信息
*
@@ -859,15 +443,14 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @return Long 执行记录IDCLIN_PROCEDURE表主键
*/
private Long addProcedureRecord(Long encounterId, Long patientId, Long requestId, String requestTable,
EventStatus eventStatus, ProcedureCategory procedureCategory, Long locationId, Date exeDate, Long groupId,
Long refundId) {
EventStatus eventStatus, ProcedureCategory procedureCategory, Long locationId, Date exeDate, Long groupId,
Long refundId) {
// 调用执行记录服务创建记录返回执行记录主键ID
return iProcedureService.addProcedureRecord(encounterId, patientId, requestId, requestTable, eventStatus,
procedureCategory, locationId, exeDate, exeDate, groupId, refundId);
procedureCategory, locationId, exeDate, exeDate, groupId, refundId);
}
// ======================== 实体构建工具方法(请求/费用项)========================
/**
* 构建耗材请求实体DeviceRequest 功能将医嘱DTO参数映射为耗材请求实体填充默认配置状态、业务编号、来源等
*
@@ -883,7 +466,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
deviceRequest.setId(adviceDto.getRequestId());
// 业务编号:按日生成,前缀+4位序列号确保每日唯一
deviceRequest
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), DEVICE_RES_NO_SEQ_LENGTH));
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), DEVICE_RES_NO_SEQ_LENGTH));
// deviceRequest.setPrescriptionNo(null);//处方号
// deviceRequest.setActivityId(null);//诊疗ID
// deviceRequest.setPackageId(null);//组套id
@@ -900,9 +483,9 @@ public class NurseBillingAppService implements INurseBillingAppService {
deviceRequest.setDeviceDefId(adviceDto.getAdviceDefinitionId()); // 耗材定义ID关联ADM_DEVICE_DEFINITION
// deviceRequest.setDeviceSpecifications(null)//器材规格
deviceRequest.setRequesterId(
adviceDto.getPractitionerId() == null ? loginUser.getPractitionerId() : adviceDto.getPractitionerId());// 请求发起人
adviceDto.getPractitionerId() == null ? loginUser.getPractitionerId() : adviceDto.getPractitionerId());// 请求发起人
deviceRequest
.setOrgId(adviceDto.getFounderOrgId() == null ? loginUser.getOrgId() : adviceDto.getFounderOrgId());// 请求发起的科室
.setOrgId(adviceDto.getFounderOrgId() == null ? loginUser.getOrgId() : adviceDto.getFounderOrgId());// 请求发起的科室
deviceRequest.setLocationId(adviceDto.getLocationId());// 默认器材房
deviceRequest.setPerformLocation(adviceDto.getLocationId()); // 发放库房ID关联耗材发放位置
deviceRequest.setEncounterId(adviceDto.getEncounterId()); // 就诊ID关联患者本次住院记录
@@ -946,7 +529,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @return ServiceRequest 构建完成的诊疗活动请求实体(已保存到数据库)
*/
private ServiceRequest buildActivityRequest(AdviceSaveDto activityDto, String signCode, Long organizationId,
Date curDate, Date startTime, Date authoredTime) {
Date curDate, Date startTime, Date authoredTime) {
ServiceRequest serviceRequest = new ServiceRequest();
// 基础配置:主键、状态、业务编号、签发编码
@@ -989,7 +572,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @param organizationId 住院科室ID
*/
private void buidActivityRequestChild(ServiceRequest serviceRequest, Long chargeItemId, AdviceSaveDto activityDto,
Long organizationId) {
Long organizationId) {
// 1. 查询诊疗活动定义信息获取子项配置JSON
ActivityDefinition activityDefinition = iActivityDefinitionService.getById(activityDto.getAdviceDefinitionId());
String childrenJson = activityDefinition.getChildrenJson();
@@ -1011,7 +594,8 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
/**
* 构建费用项实体ChargeItem 功能:关联请求记录(耗材/诊疗与费用信息生成待结算的费用项ADM_CHARGE_ITEM表 通用性:支持耗材、诊疗活动两种类型的费用项构建
* 构建费用项实体ChargeItem 功能:关联请求记录(耗材/诊疗与费用信息生成待结算的费用项ADM_CHARGE_ITEM表
* 通用性:支持耗材、诊疗活动两种类型的费用项构建
*
* @param adviceDto 医嘱DTO含费用相关参数单价、总价等
* @param requestBusNo 关联请求的业务编号(耗材/服务请求的busNo
@@ -1025,8 +609,8 @@ public class NurseBillingAppService implements INurseBillingAppService {
* @return ChargeItem 构建完成的费用项实体(可直接保存)
*/
private ChargeItem buildChargeItem(AdviceSaveDto adviceDto, String requestBusNo, Long requestId,
String serviceTable, String productTable, Date curDate, Long procedureId, Long dispenseId,
String dispenseTable) {
String serviceTable, String productTable, Date curDate, Long procedureId, Long dispenseId,
String dispenseTable) {
ChargeItem chargeItem = new ChargeItem();
// TODO1、是否需跨批次 2、金额 精确到小数点后6位 、数量 计算
// 基础配置:主键、状态、业务编号
@@ -1066,9 +650,9 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
// ======================== 耗材删除相关方法 ========================
/**
* 处理耗材删除逻辑(级联删除关联数据) 核心规则:已收费的耗材项目不允许删除,未收费项目级联删除关联数据 级联删除顺序:耗材请求表 → 耗材发放表 → 费用项表
* 处理耗材删除逻辑(级联删除关联数据) 核心规则:已收费的耗材项目不允许删除,未收费项目级联删除关联数据 级联删除顺序:耗材请求表 → 耗材发放表
* → 费用项表
*
* @param requestIds 待删除的耗材医嘱列表可为null
* @param serviceTable 关联服务表名(此处为耗材请求表)
@@ -1083,8 +667,8 @@ public class NurseBillingAppService implements INurseBillingAppService {
// 软删除执行记录
List<Procedure> procedureList = iProcedureService.listByIds(requestIds);
List<Long> procedureIds = procedureList.stream().filter(Objects::nonNull) // 过滤掉null的Procedure对象
.map(Procedure::getId).filter(Objects::nonNull) // 过滤掉id为null的记录按需添加
.collect(Collectors.toList());
.map(Procedure::getId).filter(Objects::nonNull) // 过滤掉id为null的记录按需添加
.collect(Collectors.toList());
// 批量删除执行记录
iProcedureService.removeBatchByIds(procedureIds);
@@ -1123,15 +707,14 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
// 2. 校验是否存在已收费项状态为BILLED
boolean hasBilledItem =
chargeItemList.stream().anyMatch(ci -> ChargeItemStatus.BILLED.getValue().equals(ci.getStatusEnum()));
boolean hasBilledItem
= chargeItemList.stream().anyMatch(ci -> ChargeItemStatus.BILLED.getValue().equals(ci.getStatusEnum()));
if (hasBilledItem) {
throw new ServiceException("删除失败:部分项目已完成收费(结算),不支持直接删除,请联系收费人员处理后重试");
}
}
// ======================== 未实现接口方法(保留签名,待扩展)========================
/**
* 新增订单划价(待实现) 功能:针对订单类型的划价(如患者自主购买耗材/服务),生成对应的费用项
*
@@ -1174,19 +757,19 @@ public class NurseBillingAppService implements INurseBillingAppService {
*/
@Override
public R<List<CostDetailDto>> getCostDetails(CostDetailSearchParam costDetailSearchParam,
HttpServletRequest request) {
HttpServletRequest request) {
List<Long> encounterIds = costDetailSearchParam.getEncounterIds();
if (encounterIds == null || encounterIds.isEmpty()) {
return R.fail("就诊ID不能为空");
}
costDetailSearchParam.setEncounterIds(null);
QueryWrapper<CostDetailSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(costDetailSearchParam, null, null, request);
QueryWrapper<CostDetailSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(costDetailSearchParam, null, null, request);
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIds);
List<CostDetailDto> list = iChargeItemService.getCostDetails(queryWrapper, ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode());
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode());
return R.ok(list);
}
@@ -1198,7 +781,7 @@ public class NurseBillingAppService implements INurseBillingAppService {
*/
@Override
public void makeExcelFile(CostDetailSearchParam costDetailSearchParam, HttpServletRequest request,
HttpServletResponse response) {
HttpServletResponse response) {
R<List<CostDetailDto>> costDetails = getCostDetails(costDetailSearchParam, request);
if (costDetails.getData() != null) {
List<CostDetailDto> dataList = costDetails.getData();
@@ -1208,16 +791,16 @@ public class NurseBillingAppService implements INurseBillingAppService {
costDetailDto.setOrgName(organizationService.getById(orgId).getName());
});
// 根据EncounterId分组
Map<Long, List<CostDetailDto>> map =
dataList.stream().collect(Collectors.groupingBy(CostDetailDto::getEncounterId));
Map<Long, List<CostDetailDto>> map
= dataList.stream().collect(Collectors.groupingBy(CostDetailDto::getEncounterId));
map.forEach((key, value) -> {
// 新加一条小计
value.add(new CostDetailDto().setEncounterId(key).setChargeName("小计").setTotalPrice(
value.stream().map(CostDetailDto::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add)));
value.stream().map(CostDetailDto::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add)));
});
// 收集要导出的数据
List<CostDetailExcelOutDto> excelOutList =
map.entrySet().stream().map(entry -> new CostDetailExcelOutDto(entry.getKey(), entry.getValue(),
List<CostDetailExcelOutDto> excelOutList
= map.entrySet().stream().map(entry -> new CostDetailExcelOutDto(entry.getKey(), entry.getValue(),
entry.getValue().get(0).getPatientName())).toList();
try {
// 住院记账-费用明细 导出
@@ -1229,5 +812,4 @@ public class NurseBillingAppService implements INurseBillingAppService {
}
}
>>>>>>> v1.3
}
}

View File

@@ -8,26 +8,16 @@ import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.DateUtils;
import com.core.common.utils.SecurityUtils;
import com.openhis.common.constant.CommonConstants;
<<<<<<< HEAD
import com.openhis.common.enums.AssignSeqEnum;
import com.openhis.common.enums.PublicationStatus;
import com.openhis.common.utils.HisQueryUtils;
=======
import com.openhis.common.enums.*;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.common.appservice.impl.CommonServiceImpl;
import com.openhis.web.common.dto.LocationDto;
>>>>>>> v1.3
import com.openhis.web.common.dto.UnitDto;
import com.openhis.web.inhospitalnursestation.appservice.IOrgDeviceStockTakeAppService;
import com.openhis.web.inhospitalnursestation.dto.OrgDeviceDto;
import com.openhis.web.inhospitalnursestation.dto.OrgDeviceSummaryFromDto;
import com.openhis.web.inhospitalnursestation.dto.OrgDeviceSummaryParam;
import com.openhis.web.inhospitalnursestation.mapper.OrgDeviceStockTakeAppMapper;
<<<<<<< HEAD
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
=======
>>>>>>> v1.3
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.mapper.InventoryItemMapper;
import com.openhis.workflow.service.IDeviceDispenseService;
@@ -39,10 +29,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
<<<<<<< HEAD
import java.time.LocalDate;
=======
>>>>>>> v1.3
import java.util.*;
import java.util.stream.Collectors;
@@ -76,8 +62,6 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
@Resource
private InventoryItemMapper inventoryItemMapper;
<<<<<<< HEAD
=======
@Resource
private CommonServiceImpl commonService;
@@ -92,16 +76,10 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
return R.ok(inventoryPharmacyList);
}
>>>>>>> v1.3
/**
* 查询科室耗材汇总
*
* @param orgDeviceSummaryParam 查询条件
<<<<<<< HEAD
* @param startTime 开始时间
* @param endTime 结束时间
=======
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -109,115 +87,24 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
* @return 科室耗材汇总单
*/
@Override
<<<<<<< HEAD
public R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam, String startTime,
String endTime, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
=======
public R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
>>>>>>> v1.3
Integer pageSize, String searchKey, HttpServletRequest request) {
pageSize = Integer.MAX_VALUE;
QueryWrapper<OrgDeviceDto> queryWrapper = HisQueryUtils.buildQueryWrapper(orgDeviceSummaryParam, searchKey,
new HashSet<>(List.of(CommonConstants.FieldName.ItemName)), request);
<<<<<<< HEAD
if (!(startTime == null || endTime == null)) {
queryWrapper.between(CommonConstants.FieldName.ApplyTime, LocalDate.parse(startTime),
LocalDate.parse(endTime));
}
new HashSet<>(List.of(CommonConstants.FieldName.ItemName)), request);
Page<OrgDeviceDto> orgDeviceDtoPage =
orgDeviceStockTakeAppMapper.selectOrgDeviceInfo(new Page<>(pageNo, pageSize), queryWrapper);
List<OrgDeviceDto> orgDeviceList =
new ArrayList<>(orgDeviceDtoPage.getRecords()).stream().filter(x -> x.getDispenseId() != null).toList();
=======
Page<OrgDeviceDto> orgDeviceDtoPage =
orgDeviceStockTakeAppMapper.selectOrgDeviceInfo(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.IMP.getValue(), RequestStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), ChargeItemStatus.BILLABLE.getValue());
Page<OrgDeviceDto> orgDeviceDtoPage
= orgDeviceStockTakeAppMapper.selectOrgDeviceInfo(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.IMP.getValue(), RequestStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), ChargeItemStatus.BILLABLE.getValue());
List<OrgDeviceDto> orgDeviceList = new ArrayList<>(orgDeviceDtoPage.getRecords());
>>>>>>> v1.3
// 根据项目id + 批次号 + 库房号分组
Map<String, List<OrgDeviceDto>> orgDeviceGroupBy =
orgDeviceList.stream().collect(Collectors.groupingBy(item -> item.getItemId() + CommonConstants.Common.DASH
Map<String, List<OrgDeviceDto>> orgDeviceGroupBy
= orgDeviceList.stream().collect(Collectors.groupingBy(item -> item.getItemId() + CommonConstants.Common.DASH
+ item.getLotNumber() + CommonConstants.Common.DASH + item.getSourceLocationId()));
<<<<<<< HEAD
ArrayList<OrgDeviceSummaryFromDto> orgDeviceSummaryFromDtoList = new ArrayList<>();
orgDeviceGroupBy.forEach((k, v) -> {
OrgDeviceSummaryFromDto orgDeviceSummaryFromDto = new OrgDeviceSummaryFromDto();
String itemId = k.split(CommonConstants.Common.DASH)[0];
String lotNumber = k.split(CommonConstants.Common.DASH)[1];
String sourceLocationId = k.split(CommonConstants.Common.DASH)[2];
OrgDeviceDto orgDeviceDtoFirst = v.get(0);
// 拆零比例
BigDecimal partPercent = orgDeviceDtoFirst.getPartPercent();
// 最小单位
String minUnitCode = orgDeviceDtoFirst.getMinUnitCode();
// 常规单位
String unitCode = orgDeviceDtoFirst.getMaxUnitCode();
if (minUnitCode == null || unitCode == null || partPercent == null) {
throw new ServiceException("耗材信息有误,请联系管理员");
}
List<Long> dispenseIdList = new ArrayList<>();
// 最小单位数量
BigDecimal minQuantity = BigDecimal.ZERO;
for (OrgDeviceDto orgDeviceDto : v) {
BigDecimal quantity = orgDeviceDto.getQuantity();
if (unitCode.equals(orgDeviceDto.getUnitCode())) {
// 转换为小单位进行累加
quantity = orgDeviceDto.getQuantity().multiply(partPercent);
}
minQuantity = minQuantity.add(quantity);
dispenseIdList.add(orgDeviceDto.getDispenseId());
}
List<UnitDto> unitList = new ArrayList<>();
UnitDto unitDto = new UnitDto();
// 单位列表
unitDto.setUnitCode(orgDeviceDtoFirst.getUnitCode()).setMinUnitCode(minUnitCode);
unitList.add(unitDto);
orgDeviceSummaryFromDto.setItemId(Long.valueOf(itemId)) // 器材id
.setName(orgDeviceDtoFirst.getItemName()) // 器材名称
.setTotalVolume(orgDeviceDtoFirst.getTotalVolume()) // 规格
.setManufacturer(orgDeviceDtoFirst.getManufacturer()) // 厂家
.setLotNumber(lotNumber) // 批号
.setUnitPrice(orgDeviceDtoFirst.getUnitPrice()) // 单价
.setDispenseQuantity(minQuantity) // 发放数量
.setUnitCode(orgDeviceDtoFirst.getUnitCode()) // 单位
.setMinUnitCode(minUnitCode) // 最小单位
.setPartPercent(partPercent) // 拆零比
.setUnitCode_dictText(orgDeviceDtoFirst.getUnitCode_dictText()) // 单位文字
.setSourceLocationId(Long.valueOf(sourceLocationId)) // 发放地点
.setDispenseIdList(dispenseIdList) // 发放id列表
.setUnitList(unitList); // 单位列表
orgDeviceSummaryFromDtoList.add(orgDeviceSummaryFromDto);
});
List<Long> itemIdList = orgDeviceSummaryFromDtoList.stream().map(OrgDeviceSummaryFromDto::getItemId).toList();
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemIdList(itemIdList, 1);
for (InventoryItem inventoryItem : inventoryItemList)
for (OrgDeviceSummaryFromDto orgDeviceSummaryFromDto : orgDeviceSummaryFromDtoList)
if (orgDeviceSummaryFromDto.getItemId().equals(inventoryItem.getItemId())
&& orgDeviceSummaryFromDto.getLotNumber().equals(inventoryItem.getLotNumber())
&& orgDeviceSummaryFromDto.getSourceLocationId().equals(inventoryItem.getLocationId())) {
// 库存数量
orgDeviceSummaryFromDto.setQuantity(inventoryItem.getQuantity());
// 库存id
orgDeviceSummaryFromDto.setInventoryItemId(inventoryItem.getId());
}
=======
List<OrgDeviceSummaryFromDto> orgDeviceSummaryFromDtoList = new ArrayList<>();
// 对分组后的数量进行汇总
@@ -268,19 +155,19 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
unitList.add(unitDto);
orgDeviceSummaryFromDto.setItemId(Long.valueOf(itemId)) // 器材id
.setName(orgDeviceDtoFirst.getItemName()) // 器材名称
.setTotalVolume(orgDeviceDtoFirst.getTotalVolume()) // 规格
.setManufacturer(orgDeviceDtoFirst.getManufacturer()) // 厂家
.setLotNumber(lotNumber) // 批号
.setUnitPrice(orgDeviceDtoFirst.getUnitPrice()) // 单价
.setDispenseQuantity(minQuantity) // 发放数量
.setUnitCode(orgDeviceDtoFirst.getUnitCode()) // 单位
.setMinUnitCode(minUnitCode) // 最小单位
.setPartPercent(partPercent) // 拆零比
.setUnitCode_dictText(orgDeviceDtoFirst.getUnitCode_dictText()) // 单位文字
.setSourceLocationId(Long.valueOf(sourceLocationId)) // 发放地点
.setDispenseIdList(dispenseIdList) // 发放id列表
.setUnitList(unitList); // 单位列表
.setName(orgDeviceDtoFirst.getItemName()) // 器材名称
.setTotalVolume(orgDeviceDtoFirst.getTotalVolume()) // 规格
.setManufacturer(orgDeviceDtoFirst.getManufacturer()) // 厂家
.setLotNumber(lotNumber) // 批号
.setUnitPrice(orgDeviceDtoFirst.getUnitPrice()) // 单价
.setDispenseQuantity(minQuantity) // 发放数量
.setUnitCode(orgDeviceDtoFirst.getUnitCode()) // 单位
.setMinUnitCode(minUnitCode) // 最小单位
.setPartPercent(partPercent) // 拆零比
.setUnitCode_dictText(orgDeviceDtoFirst.getUnitCode_dictText()) // 单位文字
.setSourceLocationId(Long.valueOf(sourceLocationId)) // 发放地点
.setDispenseIdList(dispenseIdList) // 发放id列表
.setUnitList(unitList); // 单位列表
orgDeviceSummaryFromDtoList.add(orgDeviceSummaryFromDto);
}
@@ -290,19 +177,20 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
List<Long> itemIdList = orgDeviceSummaryFromDtoList.stream().map(OrgDeviceSummaryFromDto::getItemId).toList();
if (!itemIdList.isEmpty()) {
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemIdList(itemIdList,
SecurityUtils.getLoginUser().getTenantId());
for (InventoryItem inventoryItem : inventoryItemList)
for (OrgDeviceSummaryFromDto orgDeviceSummaryFromDto : orgDeviceSummaryFromDtoList)
SecurityUtils.getLoginUser().getTenantId());
for (InventoryItem inventoryItem : inventoryItemList) {
for (OrgDeviceSummaryFromDto orgDeviceSummaryFromDto : orgDeviceSummaryFromDtoList) {
if (orgDeviceSummaryFromDto.getItemId().equals(inventoryItem.getItemId())
&& orgDeviceSummaryFromDto.getLotNumber().equals(inventoryItem.getLotNumber())
&& orgDeviceSummaryFromDto.getSourceLocationId().equals(inventoryItem.getLocationId())) {
&& orgDeviceSummaryFromDto.getLotNumber().equals(inventoryItem.getLotNumber())
&& orgDeviceSummaryFromDto.getSourceLocationId().equals(inventoryItem.getLocationId())) {
// 库存数量
orgDeviceSummaryFromDto.setQuantity(inventoryItem.getQuantity());
// 库存id
orgDeviceSummaryFromDto.setInventoryItemId(inventoryItem.getId());
}
}
}
}
>>>>>>> v1.3
return R.ok(orgDeviceSummaryFromDtoList);
}
@@ -313,77 +201,11 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
* @return 科室耗材汇总单
*/
@Override
<<<<<<< HEAD
public R<?> orgDeviceSummary(OrgDeviceSummaryParam orgDeviceSummaryParam) {
=======
public R<?> orgDeviceSummary(List<OrgDeviceSummaryParam> orgDeviceSummaryParamList) {
>>>>>>> v1.3
// 申请时间
Date now = DateUtils.getNowDate();
// 申请人
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
<<<<<<< HEAD
// 汇总单据号
String busNo = assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_SUMMARY_NO.getPrefix(), 4);
// 数量
BigDecimal stockTakeQuantity = orgDeviceSummaryParam.getStockTakeQuantity();
// 使用单位
String useUnitCode = orgDeviceSummaryParam.getUseUnitCode();
// 最小单位
String minUnitCode = orgDeviceSummaryParam.getMinUnitCode();
// 拆零比
BigDecimal partPercent = orgDeviceSummaryParam.getPartPercent();
// 发放id列表
List<Long> dispenseIdList = orgDeviceSummaryParam.getDispenseIdList();
if (orgDeviceSummaryParam.getInventoryItemId() == null) {
return R.ok("未匹配到库存");
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
InventoryItem inventoryItem = inventoryItemMapper.selectById(orgDeviceSummaryParam.getInventoryItemId());
if (inventoryItem != null) {
if (PublicationStatus.ACTIVE.getValue().equals(inventoryItem.getInventoryStatusEnum())) {
// 库存数量判定
if (useUnitCode.equals(inventoryItem.getUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = inventoryItem.getQuantity().subtract(stockTakeQuantity);
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail("当前库存数量不足");
} else {
inventoryItem.setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = inventoryItem.getQuantity().subtract(partPercent.multiply(stockTakeQuantity));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail("当前库存数量不足");
} else {
inventoryItem.setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 添加汇总单
Long supplyRequestId = supplyRequestService.createDeviceSummarySupplyRequest(
orgDeviceSummaryParam.getItemId(), orgDeviceSummaryParam.getSourceLocationId(),
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, practitionerId, now, busNo);
supplyDeliveryService.createDeviceSummarySupplyDelivery(orgDeviceSummaryParam.getItemId(),
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, supplyRequestId);
// 耗材发放状态更新
deviceDispenseService.updateDispenseStatusSummarized(dispenseIdList, busNo);
return R.ok("盘点成功");
}
return R.fail("未找到对应库存数据");
=======
for (OrgDeviceSummaryParam orgDeviceSummaryParam : orgDeviceSummaryParamList) {
// 汇总单据号
@@ -424,8 +246,8 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity =
inventoryItem.getQuantity().subtract(partPercent.multiply(stockTakeQuantity));
BigDecimal quantity
= inventoryItem.getQuantity().subtract(partPercent.multiply(stockTakeQuantity));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
@@ -441,10 +263,10 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
// 添加汇总单
Long supplyRequestId = supplyRequestService.createDeviceSummarySupplyRequest(
orgDeviceSummaryParam.getItemId(), orgDeviceSummaryParam.getSourceLocationId(),
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, practitionerId, now, busNo);
orgDeviceSummaryParam.getItemId(), orgDeviceSummaryParam.getSourceLocationId(),
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, practitionerId, now, busNo);
supplyDeliveryService.createDeviceSummarySupplyDelivery(orgDeviceSummaryParam.getItemId(),
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, supplyRequestId);
orgDeviceSummaryParam.getLotNumber(), stockTakeQuantity, minUnitCode, supplyRequestId);
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
@@ -452,7 +274,6 @@ public class OrgDeviceStockTakeAppServiceImpl implements IOrgDeviceStockTakeAppS
return R.fail("未查询到" + orgDeviceSummaryParam.getName() + "对应库存数据");
}
return R.ok("盘点成功");
>>>>>>> v1.3
}
}

View File

@@ -54,9 +54,9 @@ public class ATDManageController {
*/
@GetMapping(value = "/admission-patient")
public R<?> getAdmissionPatientPage(AdmissionPageParam admissionPageParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return atdManageAppService.getAdmissionPatientPage(admissionPageParam, pageNo, pageSize, searchKey, request);
}
@@ -70,8 +70,8 @@ public class ATDManageController {
*/
@GetMapping(value = "/admission-bed")
public R<?> getAdmissionBedPage(AdmissionPageParam admissionPageParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return atdManageAppService.getAdmissionBedPage(admissionPageParam, pageNo, pageSize);
}
@@ -88,16 +88,7 @@ public class ATDManageController {
/**
* 住院患者待处理信息列表
<<<<<<< HEAD
*
* @param encounterId 住院id
* @return 待处理信息列表
*/
@GetMapping(value = "/patient-pending")
public R<?> getInPatientPendingList(Long encounterId) {
return atdManageAppService.getInPatientPendingList(encounterId);
=======
*
* @param inpatientAdviceParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -105,10 +96,9 @@ public class ATDManageController {
*/
@GetMapping(value = "/patient-pending")
public R<?> getInPatientPendingList(InpatientAdviceParam inpatientAdviceParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return atdManageAppService.getInPatientPendingList(inpatientAdviceParam, pageNo, pageSize);
>>>>>>> v1.3
}
/**
@@ -125,11 +115,7 @@ public class ATDManageController {
/**
* 转科
*
<<<<<<< HEAD
* @param encounterId 住院id
=======
* @param encounterId 住院患者id
>>>>>>> v1.3
* @return 结果
*/
@PutMapping(value = "/transfer-department")
@@ -140,19 +126,13 @@ public class ATDManageController {
/**
* 出院
*
<<<<<<< HEAD
* @param encounterId 住院id
=======
* @param encounterId 住院患者id
>>>>>>> v1.3
* @return 结果
*/
@PutMapping(value = "/hospital-discharge")
public R<?> hospitalDischarge(Long encounterId) {
return atdManageAppService.hospitalDischarge(encounterId);
}
<<<<<<< HEAD
=======
/**
* 清床
@@ -167,10 +147,11 @@ public class ATDManageController {
/**
* 诊断个人账户金额信息获取
*
*
* @param encounterId 诊断id
* @return EncounterAccountDto 诊断账户金额
**/
*
*/
@GetMapping(value = "/get-amount")
public R<?> getAmount(Long encounterId) {
return atdManageAppService.getAmount(encounterId);
@@ -178,13 +159,13 @@ public class ATDManageController {
/**
* 获取待配/退药
*
*
* @param encounterId 诊断id
* @return PendingMedicationDto 待配/退药
**/
*
*/
@GetMapping(value = "/get-dr-medication")
public R<?> getPendingMedication(Long encounterId) {
return atdManageAppService.getPendingMedication(encounterId);
}
>>>>>>> v1.3
}

View File

@@ -31,26 +31,6 @@ public class MedicineSummaryController {
public IMedicineSummaryAppService medicineSummaryAppService;
/**
<<<<<<< HEAD
* 查询发药单信息
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求
* @return 发药单信息
*/
@GetMapping(value = "/dispensing-form")
public R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return medicineSummaryAppService.getMedicineDispenseFormPage(dispenseFormSearchParam, pageNo, pageSize,
request);
}
/**
* 查询药品汇总单
=======
* 药品汇总单初始化
*
* @return 初始化信息
@@ -62,41 +42,19 @@ public class MedicineSummaryController {
/**
* 查询发药单信息
>>>>>>> v1.3
*
* @param dispenseFormSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
<<<<<<< HEAD
* @param searchKey 模糊查询关键字
* @param request 请求
* @return 药品汇总单
*/
@GetMapping(value = "/summary-form")
public R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
return medicineSummaryAppService.getMedicineSummaryFormPage(dispenseFormSearchParam, pageNo, pageSize,
searchKey, request);
}
/**
* 查询药品汇总单详情
*
* @param summaryNo 汇总单号
* @return 药品汇总单详情
*/
=======
* @param request 请求
* @return 发药单信息
*/
@GetMapping(value = "/dispensing-form")
public R<?> getMedicineDispenseFormPage(DispenseFormSearchParam dispenseFormSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return medicineSummaryAppService.getMedicineDispenseFormPage(dispenseFormSearchParam, pageNo, pageSize,
request);
request);
}
/**
@@ -111,11 +69,11 @@ public class MedicineSummaryController {
*/
@GetMapping(value = "/summary-form")
public R<?> getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
return medicineSummaryAppService.getMedicineSummaryFormPage(dispenseFormSearchParam, pageNo, pageSize,
searchKey, request);
searchKey, request);
}
/**
@@ -124,7 +82,6 @@ public class MedicineSummaryController {
* @param summaryNo 汇总单号
* @return 药品汇总单详情
*/
>>>>>>> v1.3
@GetMapping(value = "/summary-form-detail")
public R<?> getMedicineSummaryFormDetail(String summaryNo) {
return medicineSummaryAppService.getMedicineSummaryFormDetail(summaryNo);

View File

@@ -1,26 +1,5 @@
package com.openhis.web.inhospitalnursestation.controller;
<<<<<<< HEAD
import com.core.common.core.domain.R;
import com.openhis.web.regdoctorstation.dto.RegAdviceSaveParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author whm
* @date 2025/11/10 16:00
* @description 住院护士 患者划价、医嘱计费
*/
@RestController
@RequestMapping("/inhospitalnursestation/innursebilling")
@Slf4j
@AllArgsConstructor
public class NurseBillingController {
// TODO: Implement InNurseBillingController
=======
import java.time.LocalDateTime;
import java.util.List;
@@ -44,70 +23,28 @@ import lombok.extern.slf4j.Slf4j;
/**
* 住院护士 患者划价、医嘱计费
*/
@RestController
@RequestMapping("/inhospitalnursestation/nursebilling")
@Slf4j
@AllArgsConstructor
public class NurseBillingController {
@Resource
private INurseBillingAppService iNurseBillingAppService;
>>>>>>> v1.3
/*
* 新增住院护士划价
* @return
*/
<<<<<<< HEAD
public R<?> addInNurseBilling(RegAdviceSaveParam regAdviceSaveParam) {
return R.ok();
}
/*
* 住院护士 划价列表 根据护士encounterId查询
* @return
*/
public R<?> getBillingListByEncounterId() {
return R.ok();
}
=======
@PostMapping("/add-billing")
public R<?> addInNurseBilling(@RequestBody RegAdviceSaveParam regAdviceSaveParam) {
return iNurseBillingAppService.addInNurseBilling(regAdviceSaveParam);
}
>>>>>>> v1.3
/*
* 住院护士撤销划价
* @return
*/
<<<<<<< HEAD
public R<?> deleteInNurseBilling() {
return R.ok();
}
/*
* 医嘱计费添加 诊疗 耗材
*/
public R<?> addOrderBilling() {
return R.ok();
}
/*
* 医嘱计费删除 诊疗 耗材
*/
public R<?> deleteOrderBilling() {
return R.ok();
}
/*
* 医嘱计费修改 诊疗 耗材
*/
public R<?> updateOrderBilling() {
return R.ok();
}
/*
根据医嘱id查询已计费的 耗材列表
* @return
*/
public R<?> getOrderBillingByRequestId() {
=======
@PostMapping("/del-billing")
public R<?> deleteInNurseBilling(@RequestBody List<AdviceBatchOpParam> paramList) {
return iNurseBillingAppService.deleteInNurseBilling(paramList);
@@ -123,12 +60,12 @@ public class NurseBillingController {
*/
@GetMapping(value = "/innurse-billing-list/")
public R<?> getInNurseBillingPage(InpatientAdviceParam inpatientAdviceParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
return iNurseBillingAppService.getInNurseBillingPage(inpatientAdviceParam, pageNo, pageSize, startTime,
endTime);
endTime);
}
/**
@@ -145,14 +82,14 @@ public class NurseBillingController {
/**
* 费用明细导出
*
*
* @param costDetailSearchParam 查询条件
* @param request request请求
* @param response response响应
*/
@GetMapping("/excel-out")
public void makeExcelFile(CostDetailSearchParam costDetailSearchParam, HttpServletRequest request,
HttpServletResponse response) {
HttpServletResponse response) {
iNurseBillingAppService.makeExcelFile(costDetailSearchParam, request, response);
}
@@ -174,7 +111,6 @@ public class NurseBillingController {
* 医嘱计费修改 诊疗 耗材
*/
public R<?> updateOrderBilling() {
>>>>>>> v1.3
return R.ok();
}

View File

@@ -1,16 +1,5 @@
package com.openhis.web.inhospitalnursestation.controller;
<<<<<<< HEAD
import com.core.common.core.domain.R;
import com.openhis.web.inhospitalnursestation.appservice.IOrgDeviceStockTakeAppService;
import com.openhis.web.inhospitalnursestation.dto.OrgDeviceSummaryParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
=======
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -24,7 +13,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
>>>>>>> v1.3
/**
* 科室耗材盘点
@@ -33,11 +21,7 @@ import java.util.List;
* @date 2025/11/05
*/
@RestController
<<<<<<< HEAD
@RequestMapping("/nurse-station/orgdevice-stocktake")
=======
@RequestMapping("/nurse-station/org-device-stockTake")
>>>>>>> v1.3
@Slf4j
@AllArgsConstructor
public class OrgDeviceStockTakeController {
@@ -46,13 +30,6 @@ public class OrgDeviceStockTakeController {
private IOrgDeviceStockTakeAppService orgDeviceStockTakeService;
/**
<<<<<<< HEAD
* 查询科室耗材汇总
*
* @param orgDeviceSummaryParam 查询条件
* @param startTime 开始时间
* @param endTime 结束时间
=======
* 页面初始化
*
* @return 初始化信息
@@ -66,7 +43,6 @@ public class OrgDeviceStockTakeController {
* 查询科室耗材汇总
*
* @param orgDeviceSummaryParam 查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -74,21 +50,12 @@ public class OrgDeviceStockTakeController {
* @return 科室耗材汇总单
*/
@GetMapping(value = "/summary-from")
<<<<<<< HEAD
public R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam, String startTime,
String endTime, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
return orgDeviceStockTakeService.getOrgDeviceSummaryFromPage(orgDeviceSummaryParam, startTime, endTime, pageNo,
pageSize, searchKey, request);
=======
public R<?> getOrgDeviceSummaryFromPage(OrgDeviceSummaryParam orgDeviceSummaryParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, String searchKey,
HttpServletRequest request) {
return orgDeviceStockTakeService.getOrgDeviceSummaryFromPage(orgDeviceSummaryParam, pageNo, pageSize, searchKey,
request);
>>>>>>> v1.3
request);
}
/**
@@ -96,15 +63,9 @@ public class OrgDeviceStockTakeController {
*
* @return 科室耗材汇总单
*/
<<<<<<< HEAD
@PutMapping(value = "/orgdevice-summary")
public R<?> orgDeviceSummary(OrgDeviceSummaryParam orgDeviceSummaryParam) {
return orgDeviceStockTakeService.orgDeviceSummary(orgDeviceSummaryParam);
=======
@PutMapping(value = "/org-device-summary")
public R<?> orgDeviceSummary(@RequestBody List<OrgDeviceSummaryParam> orgDeviceSummaryParamList) {
return orgDeviceStockTakeService.orgDeviceSummary(orgDeviceSummaryParamList);
>>>>>>> v1.3
}
}

View File

@@ -21,38 +21,52 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class AdviceExecuteDetailParam {
/** 医嘱请求id */
/**
* 医嘱请求id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId;
/** 就诊Id */
/**
* 就诊Id
*/
private Long encounterId;
/** 患者Id */
/**
* 患者Id
*/
private Long patientId;
/** 账号id */
/**
* 账号id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long accountId;
/** 执行id */
/**
* 执行id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long procedureId;
/** 医嘱类型 */
/**
* 医嘱类型
*/
private Integer therapyEnum;
/** 医嘱请求所在表 */
/**
* 医嘱请求所在表
*/
private String adviceTable;
/** 组号 */
/**
* 组号
*/
private Long groupId;
<<<<<<< HEAD
/** 执行时间点集合 */
=======
/** 预计执行时间点集合 */
>>>>>>> v1.3
/**
* 预计执行时间点集合
*/
private List<String> executeTimes;
}

View File

@@ -22,33 +22,46 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class DispenseFormSearchParam implements Serializable {
/** 汇总状态 */
/**
* 汇总状态
*/
private Integer SummaryStatus;
/** 中药标识 */
/**
* 中药标识
*/
private Integer tcmFlag;
/** 医嘱类型 */
/**
* 医嘱类型
*/
private Integer therapyEnum;
/** 就诊ids */
/**
* 就诊ids
*/
@JsonSerialize(using = ToStringSerializer.class)
private String encounterIds;
/** 发放药房id */
/**
* 发放药房id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long locationId;
/** 执行时间 */
/**
* 执行时间
*/
private Date exeTime;
/** 汇总人id */
/**
* 汇总人id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long applicantId;
<<<<<<< HEAD
=======
/** 发放状态 */
/**
* 发放状态
*/
private Integer statusEnum;
>>>>>>> v1.3
}

View File

@@ -47,7 +47,9 @@ public class MedicineSummaryInfoDto {
*/
private String totalVolume;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/**
@@ -56,8 +58,6 @@ public class MedicineSummaryInfoDto {
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
<<<<<<< HEAD
=======
/**
* 药品类型
@@ -70,5 +70,4 @@ public class MedicineSummaryInfoDto {
* 生产厂家
*/
private String manufacturerText;
>>>>>>> v1.3
}

View File

@@ -18,57 +18,67 @@ import java.util.List;
@Data
@Accessors(chain = true)
public class OrgDeviceSummaryParam {
<<<<<<< HEAD
=======
/** 发放地点 */
/**
* 发放地点
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long sourceLocationId;
>>>>>>> v1.3
/** 项目id */
/**
* 项目id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long itemId;
<<<<<<< HEAD
=======
/** 器材名称 */
/**
* 器材名称
*/
private String name;
>>>>>>> v1.3
/** 库存id */
/**
* 库存id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long inventoryItemId;
/** 发放数量 */
/**
* 发放数量
*/
private BigDecimal dispenseQuantity;
/** 盈亏数量 */
/**
* 盈亏数量
*/
private BigDecimal stockTakeQuantity;
/** 批号 */
/**
* 批号
*/
private String lotNumber;
<<<<<<< HEAD
/** 发放地点 */
@JsonSerialize(using = ToStringSerializer.class)
private Long sourceLocationId;
=======
>>>>>>> v1.3
/** 使用单位 */
/**
* 使用单位
*/
@Dict(dictCode = "unit_code")
private String useUnitCode;
private String useUnitCode_dictText;
/** 最小单位 */
/**
* 最小单位
*/
@Dict(dictCode = "unit_code")
private String minUnitCode;
private String minUnitCode_dictText;
/** 拆零比 */
/**
* 拆零比
*/
private BigDecimal partPercent;
/** 发放id列表 */
/**
* 发放id列表
*/
private List<Long> dispenseIdList;
}

View File

@@ -36,11 +36,11 @@ public interface MedicineSummaryAppMapper {
* @return 领药列表
*/
Page<MedicineDispenseFormDto> selectMedicineDispenseFormPage(@Param("page") Page<MedicineDispenseFormDto> page,
@Param(Constants.WRAPPER) QueryWrapper<DispenseFormSearchParam> queryWrapper,
@Param("completed") Integer completed, @Param("active") Integer active, @Param("bed") Integer bed,
@Param("admittingDoctor") String admittingDoctor, @Param("personalCashAccount") String personalCashAccount,
@Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunded") Integer refunded,
@Param("summarized") Integer summarized);
@Param(Constants.WRAPPER) QueryWrapper<DispenseFormSearchParam> queryWrapper,
@Param("completed") Integer completed, @Param("active") Integer active, @Param("bed") Integer bed,
@Param("admittingDoctor") String admittingDoctor, @Param("personalCashAccount") String personalCashAccount,
@Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunded") Integer refunded,
@Param("summarized") Integer summarized);
/**
* 查询汇总单分页列表
@@ -48,22 +48,14 @@ public interface MedicineSummaryAppMapper {
* @param page 分页信息
* @param queryWrapper 查询条件
* @param completed 发药状态:已完成
<<<<<<< HEAD
* @param inProgress 发药状态:待发药
=======
* @param preparation 发药状态:待配药
>>>>>>> v1.3
* @param summaryDispense 单据类型:汇总发药
* @return 汇总单列表
*/
Page<MedicineSummaryFormDto> selectMedicineSummaryFormPage(@Param("page") Page<MedicineSummaryFormDto> page,
@Param(Constants.WRAPPER) QueryWrapper<DispenseFormSearchParam> queryWrapper,
<<<<<<< HEAD
@Param("completed") Integer completed, @Param("inProgress") Integer inProgress,
=======
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
>>>>>>> v1.3
@Param("summaryDispense") Integer summaryDispense);
@Param(Constants.WRAPPER) QueryWrapper<DispenseFormSearchParam> queryWrapper,
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
@Param("summaryDispense") Integer summaryDispense);
/**
* 获取汇总单详情

View File

@@ -1,11 +1,5 @@
package com.openhis.web.inhospitalnursestation.mapper;
<<<<<<< HEAD
import org.springframework.stereotype.Repository;
@Repository
public interface NurseBillingAppMapper {
=======
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -45,12 +39,11 @@ public interface NurseBillingAppMapper {
* @return 医嘱分页列表
*/
Page<InpatientAdviceDto> getInNurseBillingPage(@Param("page") Page<InpatientAdviceDto> page,
@Param(Constants.WRAPPER) QueryWrapper<InpatientAdviceParam> queryWrapper,
@Param("worDeviceRequest") String worDeviceRequest, @Param("worServiceRequest") String worServiceRequest,
@Param("draft") Integer draft, @Param("active") Integer active, @Param("bed") Integer bed,
@Param("admittingDoctor") String admittingDoctor, @Param("personalCashAccount") String personalCashAccount,
@Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunded") Integer refunded,
@Param("imp") Integer imp, @Param("generateSourceEnum") Integer generateSourceEnum,
@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
>>>>>>> v1.3
@Param(Constants.WRAPPER) QueryWrapper<InpatientAdviceParam> queryWrapper,
@Param("worDeviceRequest") String worDeviceRequest, @Param("worServiceRequest") String worServiceRequest,
@Param("draft") Integer draft, @Param("active") Integer active, @Param("bed") Integer bed,
@Param("admittingDoctor") String admittingDoctor, @Param("personalCashAccount") String personalCashAccount,
@Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunded") Integer refunded,
@Param("imp") Integer imp, @Param("generateSourceEnum") Integer generateSourceEnum,
@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}

View File

@@ -18,11 +18,7 @@ public interface OrgDeviceStockTakeAppMapper {
* @return 科室耗材信息
*/
Page<OrgDeviceDto> selectOrgDeviceInfo(@Param("page") Page<OrgDeviceDto> page,
<<<<<<< HEAD
@Param(Constants.WRAPPER) QueryWrapper<OrgDeviceDto> queryWrapper);
=======
@Param(Constants.WRAPPER) QueryWrapper<OrgDeviceDto> queryWrapper, @Param("imp") Integer imp,
@Param("requestStatus") Integer requestStatus, @Param("dispenseStatus") Integer dispenseStatus,
@Param("chargeItemStatus") Integer chargeItemStatus);
>>>>>>> v1.3
@Param(Constants.WRAPPER) QueryWrapper<OrgDeviceDto> queryWrapper, @Param("imp") Integer imp,
@Param("requestStatus") Integer requestStatus, @Param("dispenseStatus") Integer dispenseStatus,
@Param("chargeItemStatus") Integer chargeItemStatus);
}

View File

@@ -32,7 +32,7 @@ public interface ILossReportFormAppService {
* @return 商品调拨单据分页列表
*/
R<?> getPage(LossReportSearchParam lossReportSearchParam, Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request);
HttpServletRequest request);
/**
* 报损单页面初始化
@@ -99,9 +99,7 @@ public interface ILossReportFormAppService {
* @return 单据详情
*/
R<?> getMonthlySettlementDetail(Long locationId, String startTime, String endTime, Integer pageNo,
Integer pageSize);
<<<<<<< HEAD
=======
Integer pageSize);
/**
* 报损单据明细导出
@@ -118,5 +116,4 @@ public interface ILossReportFormAppService {
* @return 报损单据详情(DTO : LossReceiptDetailDto)
*/
R<List<LossReceiptDetailDto>> getLossDetail(String busNo);
>>>>>>> v1.3
}

View File

@@ -3,11 +3,6 @@ package com.openhis.web.inventorymanage.appservice;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
import com.core.common.core.domain.R;
import com.openhis.web.inventorymanage.dto.ProductDetailSearchParam;
=======
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.web.inventorymanage.dto.ProductDetailPageDto;
@@ -15,7 +10,6 @@ import com.openhis.web.inventorymanage.dto.ProductDetailSearchParam;
import java.util.List;
>>>>>>> v1.3
/**
* 库存商品明细 appService
*
@@ -41,75 +35,35 @@ public interface IProductDetailAppService {
* @param request 请求数据
* @return 库存商品明细分页列表
*/
<<<<<<< HEAD
R<?> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
/**
* 操作:停供
*
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
R<?> stopSupplyById(Long inventoryId);
/**
* 操作:取消停供
*
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
R<?> cancelSupplyById(Long inventoryId);
/**
* 库存明细表导出
=======
R<Page<ProductDetailPageDto>> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
R<?> getProductDetailStatistics(ProductDetailSearchParam productDetailSearchParam, String searchKey,
HttpServletRequest request);
HttpServletRequest request);
/**
* 查询库存备份商品明细分页列表
>>>>>>> v1.3
*
* @param productDetailSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
<<<<<<< HEAD
* @param response 响应数据
*/
void makeExcelFile(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request, HttpServletResponse response);
/**
* 查询库存商品明细统计数据
=======
* @return 库存备份商品明细
*/
R<Page<ProductDetailPageDto>> getProductDetailBackupPage(ProductDetailSearchParam productDetailSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
/**
* 查询库存商品备份明细统计数据
>>>>>>> v1.3
*
* @param productDetailSearchParam 查询条件
* @param searchKey 模糊查询关键字
* @param request 请求数据
<<<<<<< HEAD
* @return 库存商品明细统计数据
*/
R<?> getProductDetailStatistics(ProductDetailSearchParam productDetailSearchParam, String searchKey, HttpServletRequest request);
=======
* @return 库存商品备份明细统计数据
*/
R<?> getProductDetailBackupStatistics(ProductDetailSearchParam productDetailSearchParam, String searchKey,
HttpServletRequest request);
HttpServletRequest request);
/**
* 操作:停供
@@ -136,8 +90,7 @@ public interface IProductDetailAppService {
* @param response 响应数据
*/
void makeExcelFile(ProductDetailSearchParam productDetailSearchParam, String searchKey, HttpServletRequest request,
HttpServletResponse response);
HttpServletResponse response);
void exportExcel(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request, HttpServletResponse response);
>>>>>>> v1.3
}

View File

@@ -25,11 +25,7 @@ import com.openhis.administration.service.IChargeItemDefDetailService;
import com.openhis.administration.service.IChargeItemDefinitionService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.ConditionCode;
<<<<<<< HEAD
import com.openhis.common.enums.DelFlag;
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import com.openhis.common.enums.SupplyStatus;
import com.openhis.common.enums.SupplyType;
import com.openhis.common.utils.EnumUtils;
@@ -49,9 +45,11 @@ import com.openhis.web.inventorymanage.mapper.InventoryAdjustPriceMapper;
* @Author raymond
* @Date 2025/10/23 14:57
* @Version 1.0
**/
*
*/
@Service
public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceService {
@Resource
private IChargeItemDefinitionService chargeItemDefinitionService;
@Resource
@@ -65,19 +63,19 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
@Override
public R<?> getPageByExamineList(AdjustPriceManagerSearchParam adjustPriceManagerSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageSize, String searchKey, HttpServletRequest request) {
// 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>();
searchFields.add(CommonConstants.FieldName.SupplyBusNo);
QueryWrapper<ReceiptApprovalSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(adjustPriceManagerSearchParam, searchKey, searchFields, request);
QueryWrapper<ReceiptApprovalSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(adjustPriceManagerSearchParam, searchKey, searchFields, request);
// 查询单据分页列表
Page<ChangePricePageDto> receiptPage = inventoryAdjustPriceMapper.searchPageByExamine(
new Page<>(pageNo, pageSize), queryWrapper, SupplyStatus.APPROVAL.getValue(), SupplyStatus.AGREE.getValue(),
SupplyStatus.REJECT.getValue(), SupplyType.REQUEST_MEDICATION_CHANGE_PRICE.getValue(),
SupplyType.REQUEST_DEVICE_CHANGE_PRICE.getValue(), SupplyType.REQUEST_ACTIVITY_CHANGE_PRICE.getValue(),
SupplyType.REQUEST_HEALTH_CHANGE_PRICE.getValue());
new Page<>(pageNo, pageSize), queryWrapper, SupplyStatus.APPROVAL.getValue(), SupplyStatus.AGREE.getValue(),
SupplyStatus.REJECT.getValue(), SupplyType.REQUEST_MEDICATION_CHANGE_PRICE.getValue(),
SupplyType.REQUEST_DEVICE_CHANGE_PRICE.getValue(), SupplyType.REQUEST_ACTIVITY_CHANGE_PRICE.getValue(),
SupplyType.REQUEST_HEALTH_CHANGE_PRICE.getValue());
receiptPage.getRecords().forEach(e -> {
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
@@ -89,8 +87,8 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
@Override
public R<?> updateExamineByRejected(String busNo) {
List<ChangePriceRecord> changePriceRecordList =
this.changePriceRecordService.searchChangePriceDataForBusNo(busNo);
List<ChangePriceRecord> changePriceRecordList
= this.changePriceRecordService.searchChangePriceDataForBusNo(busNo);
if (changePriceRecordList.isEmpty()) {
return R.fail();
}
@@ -110,8 +108,8 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
ReceiptInitDto initDto = new ReceiptInitDto();
// 审批状态
List<ReceiptInitDto.supplyStatusOption> supplyStatusOptions = Stream.of(SupplyStatus.values())
.map(supplyStatus -> new ReceiptInitDto.supplyStatusOption(supplyStatus.getValue(), supplyStatus.getInfo()))
.collect(Collectors.toList());
.map(supplyStatus -> new ReceiptInitDto.supplyStatusOption(supplyStatus.getValue(), supplyStatus.getInfo()))
.collect(Collectors.toList());
initDto.setSupplyStatusOptions(supplyStatusOptions);
return R.ok(initDto);
}
@@ -119,8 +117,8 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
@Override
@Transactional(rollbackFor = Exception.class)
public R<?> updateExamineByApproved(String busNo) {
List<ChangePriceRecord> changePriceRecordList =
this.changePriceRecordService.searchChangePriceDataForBusNo(busNo);
List<ChangePriceRecord> changePriceRecordList
= this.changePriceRecordService.searchChangePriceDataForBusNo(busNo);
if (changePriceRecordList.isEmpty()) {
return R.fail();
}
@@ -141,10 +139,11 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
* @Author raymond
* @Date 22:16 2025/10/18
* @return com.core.common.core.domain.R<?>
**/
*
*/
public void executeBusiness(String busNo) {
List<ChangePriceDataDto> changePriceDataDtoList =
this.changePriceRecordService.searchChangePriceRecordDataByBusNo(busNo, SupplyStatus.APPROVAL.getValue());
List<ChangePriceDataDto> changePriceDataDtoList
= this.changePriceRecordService.searchChangePriceRecordDataByBusNo(busNo, SupplyStatus.APPROVAL.getValue());
// 零售价
List<ChargeItemDefDetail> itemDefDetailRetailList = new LinkedList<>();
// 进货价
@@ -157,16 +156,16 @@ public class IInventoryAdjustPriceServiceImpl implements IInventoryAdjustPriceSe
chargeItemDefinition.setPrice(data.getNewRetailPrice());
this.chargeItemDefinitionService.updateById(chargeItemDefinition);
// 零售价
List<ChargeItemDefDetail> defDetailRetailList =
this.chargeItemDefDetailService.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(),
ConditionCode.LOT_NUMBER_PRICE.getCode(), data.getLotNumber());
List<ChargeItemDefDetail> defDetailRetailList
= this.chargeItemDefDetailService.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(),
ConditionCode.LOT_NUMBER_PRICE.getCode(), data.getLotNumber());
// 进货价
List<ChargeItemDefDetail> defDetailBuyingList =
this.chargeItemDefDetailService.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(),
ConditionCode.LOT_NUMBER_COST.getCode(), data.getLotNumber());
List<ChargeItemDefDetail> defDetailBuyingList
= this.chargeItemDefDetailService.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(),
ConditionCode.LOT_NUMBER_COST.getCode(), data.getLotNumber());
// 采购价
List<ChargeItemDefDetail> purchasePriceList = this.chargeItemDefDetailService
.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(), ConditionCode.PURCHASE.getCode(), null);
.searchChargeItemDefDetailByIds(chargeItemDefinition.getId(), ConditionCode.PURCHASE.getCode(), null);
if (!defDetailRetailList.isEmpty()) {
for (ChargeItemDefDetail detail : defDetailRetailList) {
detail.setDeleteFlag(DelFlag.YES.getCode());

View File

@@ -10,12 +10,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
import com.core.common.utils.poi.ExcelUtil;
=======
import com.core.common.utils.*;
import com.openhis.web.inventorymanage.dto.ProductTransferPageDto;
>>>>>>> v1.3
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -25,14 +21,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.core.common.core.domain.R;
import com.core.common.core.domain.model.LoginUser;
import com.core.common.enums.TenantOptionDict;
<<<<<<< HEAD
import com.core.common.utils.DateUtils;
import com.core.common.utils.MessageUtils;
import com.core.common.utils.SecurityUtils;
=======
import com.core.common.exception.NonCaptureException;
import com.core.common.utils.poi.ExcelUtil;
>>>>>>> v1.3
import com.core.web.util.TenantOptionUtil;
import com.openhis.administration.domain.ChargeItemDefDetail;
import com.openhis.administration.service.IChargeItemDefDetailService;
@@ -47,10 +37,6 @@ import com.openhis.web.inventorymanage.dto.ProductDetailInitDto;
import com.openhis.web.inventorymanage.dto.ProductDetailPageDto;
import com.openhis.web.inventorymanage.dto.ProductDetailSearchParam;
import com.openhis.web.inventorymanage.mapper.ProductDetailAppMapper;
<<<<<<< HEAD
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
=======
>>>>>>> v1.3
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.mapper.InventoryItemMapper;
@@ -62,7 +48,7 @@ import com.openhis.workflow.mapper.InventoryItemMapper;
*/
@Service
public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper, InventoryItem>
implements IProductDetailAppService {
implements IProductDetailAppService {
@Resource
private ProductDetailAppMapper productDetailsMapper;
@@ -80,8 +66,8 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
ProductDetailInitDto productDetailInitDto = new ProductDetailInitDto();
// 医保等级List
List<ProductDetailInitDto.statusEnumOption> chrgitmLvOptions = Stream.of(InsuranceLevel.values())
.map(status -> new ProductDetailInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new ProductDetailInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
productDetailInitDto.setChrgitmLvOptions(chrgitmLvOptions);
return R.ok(productDetailInitDto);
}
@@ -97,19 +83,12 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
* @return 库存商品明细分页列表
*/
@Override
<<<<<<< HEAD
public R<?> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
// 项目类型
Integer categoryCode = productDetailSearchParam.getCategoryCode();
=======
public R<Page<ProductDetailPageDto>> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
// 药品类型
List<String> medCategoryCodes = productDetailSearchParam.getMedCategoryCodes();
// 药品类型
List<String> devCategoryCodes = productDetailSearchParam.getDevCategoryCodes();
>>>>>>> v1.3
// 库存是否为零
Integer zeroFlag = productDetailSearchParam.getZeroFlag();
// 过期天数
@@ -118,38 +97,19 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
List<Long> locationIds = productDetailSearchParam.getLocationIds();
// 供应商
List<Long> supplierIds = productDetailSearchParam.getSupplierIds();
<<<<<<< HEAD
productDetailSearchParam.setCategoryCode(null).setZeroFlag(null).setRemainingDays(null).setLocationIds(null)
.setSupplierIds(null);
=======
productDetailSearchParam.setZeroFlag(null).setRemainingDays(null).setLocationIds(null).setSupplierIds(null)
.setMedCategoryCodes(null).setDevCategoryCodes(null);
>>>>>>> v1.3
.setMedCategoryCodes(null).setDevCategoryCodes(null);
// 构建查询条件
QueryWrapper<ProductDetailSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
// 根据不同分类拼接查询条件
<<<<<<< HEAD
if (categoryCode != null) {
if (categoryCode.equals(ItemCategoryCode.CHINESE_PATENT_DRUG.getValue())
|| categoryCode.equals(ItemCategoryCode.WESTERN_MEDICINE.getValue())
|| categoryCode.equals(ItemCategoryCode.EXTERNALLY_PROCURED_DRUGS.getValue())
|| categoryCode.equals(ItemCategoryCode.CHINESE_HERBAL_MEDICINE.getValue())) {
queryWrapper.eq(CommonConstants.FieldName.ItemTable,
CommonConstants.TableName.MED_MEDICATION_DEFINITION);
queryWrapper.eq(CommonConstants.FieldName.MedCategoryCode, categoryCode.toString());
} else if (categoryCode.equals(ItemCategoryCode.DEVICE.getValue())) {
queryWrapper.eq(CommonConstants.FieldName.ItemTable, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
}
=======
if (medCategoryCodes != null && !medCategoryCodes.isEmpty()) {
queryWrapper.in(CommonConstants.FieldName.MedCategoryCode, medCategoryCodes);
}
if (devCategoryCodes != null && !devCategoryCodes.isEmpty()) {
queryWrapper.in(CommonConstants.FieldName.DevCategoryCode, devCategoryCodes);
>>>>>>> v1.3
}
// 库存是否为零
if (zeroFlag != null) {
@@ -173,8 +133,8 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
}
// 查询库存商品明细分页列表
Page<ProductDetailPageDto> productDetailsPage = productDetailsMapper.selectProductDetailsPage(
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ConditionCode.LOT_NUMBER_COST.getCode());
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ConditionCode.LOT_NUMBER_COST.getCode());
// 库存明细
List<ProductDetailPageDto> productDetailList = productDetailsPage.getRecords();
if (productDetailList != null && !productDetailList.isEmpty()) {
@@ -183,29 +143,25 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 批次售价需查询定价子表
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
// 收集所有定价ID
List<Long> chargeItemDefIdList =
productDetailList.stream().map(ProductDetailPageDto::getChargeItemDefId).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
List<Long> chargeItemDefIdList
= productDetailList.stream().map(ProductDetailPageDto::getChargeItemDefId).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
// 查询批次售价信息
if (!chargeItemDefIdList.isEmpty()) {
List<ChargeItemDefDetail> lotNumberPriceList =
chargeItemDefDetailService.getLotNumberPriceByDefIds(chargeItemDefIdList);
List<ChargeItemDefDetail> lotNumberPriceList
= chargeItemDefDetailService.getLotNumberPriceByDefIds(chargeItemDefIdList);
if (lotNumberPriceList != null && !lotNumberPriceList.isEmpty()) {
// 创建批次号到售价的映射
Map<String, BigDecimal> lotPriceMap =
lotNumberPriceList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getConditionValue,
ChargeItemDefDetail::getAmount, (existing, replacement) -> existing)); // 处理重复键的情况
Map<String, BigDecimal> lotPriceMap
= lotNumberPriceList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getConditionValue,
ChargeItemDefDetail::getAmount, (existing, replacement) -> existing)); // 处理重复键的情况
// 更新原始列表中的售价
for (ProductDetailPageDto productDetail : productDetailList) {
BigDecimal price = lotPriceMap.get(productDetail.getLotNumber());
if (price != null) {
<<<<<<< HEAD
productDetail.setTotalSalePrice(price);
=======
productDetail.setSalePrice(price);
>>>>>>> v1.3
}
}
}
@@ -215,14 +171,14 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
for (ProductDetailPageDto productDetailPageDto : productDetailList) {
// 医保等级
productDetailPageDto.setChrgitmLv_enumText(
EnumUtils.getInfoByValue(YbChrgitmLv.class, productDetailPageDto.getChrgitmLv()));
EnumUtils.getInfoByValue(YbChrgitmLv.class, productDetailPageDto.getChrgitmLv()));
// 停供状态
productDetailPageDto.setInventoryStatusEnum_enumText(
EnumUtils.getInfoByValue(PublicationStatus.class, productDetailPageDto.getInventoryStatusEnum()));
EnumUtils.getInfoByValue(PublicationStatus.class, productDetailPageDto.getInventoryStatusEnum()));
// 计算包装单位数量
BigDecimal[] results =
productDetailPageDto.getQuantity().divideAndRemainder(productDetailPageDto.getPartPercent());
BigDecimal[] results
= productDetailPageDto.getQuantity().divideAndRemainder(productDetailPageDto.getPartPercent());
// 整数
productDetailPageDto.setNumber(results[0]);
// 余数
@@ -231,18 +187,18 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 计算采购总额
if (productDetailPageDto.getPurchasePrice() != null) {
productDetailPageDto
.setTotalPurchasePrice(productDetailPageDto.getPurchasePrice().multiply(results[0])
.add(productDetailPageDto.getPurchasePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
.setTotalPurchasePrice(productDetailPageDto.getPurchasePrice().multiply(results[0])
.add(productDetailPageDto.getPurchasePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
}
// 计算售价总额
if (productDetailPageDto.getSalePrice() != null) {
productDetailPageDto.setTotalSalePrice(productDetailPageDto.getSalePrice().multiply(results[0])
.add(productDetailPageDto.getSalePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
.add(productDetailPageDto.getSalePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
}
}
}
@@ -250,8 +206,6 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
}
/**
<<<<<<< HEAD
=======
* 查询库存备份商品明细分页列表
*
* @param productDetailSearchParam 查询条件
@@ -263,7 +217,7 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
*/
@Override
public R<Page<ProductDetailPageDto>> getProductDetailBackupPage(ProductDetailSearchParam productDetailSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
// 药品类型
List<String> medCategoryCodes = productDetailSearchParam.getMedCategoryCodes();
// 药品类型
@@ -277,12 +231,12 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 供应商
List<Long> supplierIds = productDetailSearchParam.getSupplierIds();
productDetailSearchParam.setZeroFlag(null).setRemainingDays(null).setLocationIds(null).setSupplierIds(null)
.setMedCategoryCodes(null).setDevCategoryCodes(null);
.setMedCategoryCodes(null).setDevCategoryCodes(null);
// 构建查询条件
QueryWrapper<ProductDetailSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
// 根据不同分类拼接查询条件
if (medCategoryCodes != null && !medCategoryCodes.isEmpty()) {
queryWrapper.in(CommonConstants.FieldName.MedCategoryCode, medCategoryCodes);
@@ -311,20 +265,19 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
queryWrapper.le(CommonConstants.FieldName.RemainingDays, remainingDays);
}
// 查询库存商品备份明细分页列表
Page<ProductDetailPageDto> productDetailsBackupPage =
productDetailsMapper.selectProductDetailsBackupPage(new Page<>(pageNo, pageSize), queryWrapper);
Page<ProductDetailPageDto> productDetailsBackupPage
= productDetailsMapper.selectProductDetailsBackupPage(new Page<>(pageNo, pageSize), queryWrapper);
productDetailsBackupPage.getRecords().forEach(e -> {
// 医保等级
e.setChrgitmLv_enumText(EnumUtils.getInfoByValue(YbChrgitmLv.class, e.getChrgitmLv()));
// 停供状态
e.setInventoryStatusEnum_enumText(
EnumUtils.getInfoByValue(PublicationStatus.class, e.getInventoryStatusEnum()));
EnumUtils.getInfoByValue(PublicationStatus.class, e.getInventoryStatusEnum()));
});
return R.ok(productDetailsBackupPage);
}
/**
>>>>>>> v1.3
* 查询库存商品明细统计数据
*
* @param productDetailSearchParam 查询条件
@@ -334,40 +287,24 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
*/
@Override
public R<?> getProductDetailStatistics(ProductDetailSearchParam productDetailSearchParam, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
// 查询库存商品明细分页列表
<<<<<<< HEAD
R<?> result = this.getProductDetailPage(productDetailSearchParam, 1, 30000, searchKey, request);
ProductDetailPageDto productDetail = new ProductDetailPageDto();
if (result != null && result.getData() != null) {
Page<ProductDetailPageDto> productDetailPage = (Page<ProductDetailPageDto>)result.getData();
=======
Page<ProductDetailPageDto> productDetailPage =
this.getProductDetailPage(productDetailSearchParam, 1, 30000, searchKey, request).getData();
Page<ProductDetailPageDto> productDetailPage
= this.getProductDetailPage(productDetailSearchParam, 1, 30000, searchKey, request).getData();
ProductDetailPageDto productDetail = new ProductDetailPageDto();
if (productDetailPage != null && productDetailPage.getTotal() > 0) {
>>>>>>> v1.3
List<ProductDetailPageDto> productDetailList = productDetailPage.getRecords();
// 统计库房总金额
productDetail
.setPurchasePriceStatistics(productDetailList.stream().map(ProductDetailPageDto::getTotalPurchasePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add))
.setSalePriceStatistics(productDetailList.stream().map(ProductDetailPageDto::getTotalSalePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
.setPurchasePriceStatistics(productDetailList.stream().map(ProductDetailPageDto::getTotalPurchasePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add))
.setSalePriceStatistics(productDetailList.stream().map(ProductDetailPageDto::getTotalSalePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
}
return R.ok(productDetail);
}
/**
<<<<<<< HEAD
* 操作:停供
*
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
@Override
public R<?> stopSupplyById(Long inventoryId) {
=======
* 查询库存商品备份明细统计数据
*
* @param productDetailSearchParam 查询条件
@@ -377,20 +314,20 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
*/
@Override
public R<?> getProductDetailBackupStatistics(ProductDetailSearchParam productDetailSearchParam, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
// 查询库存商品备份明细分页列表
Page<ProductDetailPageDto> productDetailPage =
this.getProductDetailBackupPage(productDetailSearchParam, 1, 30000, searchKey, request).getData();
Page<ProductDetailPageDto> productDetailPage
= this.getProductDetailBackupPage(productDetailSearchParam, 1, 30000, searchKey, request).getData();
ProductDetailPageDto productDetailBackup = new ProductDetailPageDto();
if (productDetailPage != null && productDetailPage.getTotal() > 0) {
List<ProductDetailPageDto> productDetailBackupList = productDetailPage.getRecords();
// 统计库房总金额
productDetailBackup
.setPurchasePriceStatistics(
productDetailBackupList.stream().map(ProductDetailPageDto::getTotalPurchasePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add))
.setSalePriceStatistics(productDetailBackupList.stream().map(ProductDetailPageDto::getTotalSalePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
.setPurchasePriceStatistics(
productDetailBackupList.stream().map(ProductDetailPageDto::getTotalPurchasePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add))
.setSalePriceStatistics(productDetailBackupList.stream().map(ProductDetailPageDto::getTotalSalePrice)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
}
return R.ok(productDetailBackup);
}
@@ -403,7 +340,6 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
*/
@Override
public R<?> stopSupplyById(List<Long> inventoryIdList) {
>>>>>>> v1.3
// 获取当前时间
Date now = DateUtils.getNowDate();
@@ -412,34 +348,22 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 停供按钮压下,更新库存项目管理表的库存状态:已停供
int updateCount = baseMapper.update(null,
<<<<<<< HEAD
new LambdaUpdateWrapper<InventoryItem>().eq(InventoryItem::getId, inventoryId)
=======
new LambdaUpdateWrapper<InventoryItem>().in(InventoryItem::getId, inventoryIdList)
>>>>>>> v1.3
.set(InventoryItem::getUpdateTime, now).set(InventoryItem::getUpdateBy, loginUser.getUserId())
.set(InventoryItem::getInventoryStatusEnum, PublicationStatus.RETIRED.getValue()));
new LambdaUpdateWrapper<InventoryItem>().in(InventoryItem::getId, inventoryIdList)
.set(InventoryItem::getUpdateTime, now).set(InventoryItem::getUpdateBy, loginUser.getUserId())
.set(InventoryItem::getInventoryStatusEnum, PublicationStatus.RETIRED.getValue()));
return updateCount > 0 ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 操作:取消停供
*
<<<<<<< HEAD
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
@Override
public R<?> cancelSupplyById(Long inventoryId) {
=======
* @param inventoryIdList 库存项目管理ID
* @return 操作结果
*/
@Override
public R<?> cancelSupplyById(List<Long> inventoryIdList) {
>>>>>>> v1.3
// 获取当前时间
Date now = DateUtils.getNowDate();
@@ -448,50 +372,27 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 取消停供按钮压下,更新库存项目管理表的库存状态:未停供
int updateCount = baseMapper.update(null,
<<<<<<< HEAD
new LambdaUpdateWrapper<InventoryItem>().eq(InventoryItem::getId, inventoryId)
=======
new LambdaUpdateWrapper<InventoryItem>().in(InventoryItem::getId, inventoryIdList)
>>>>>>> v1.3
.set(InventoryItem::getUpdateTime, now).set(InventoryItem::getUpdateBy, loginUser.getUserId())
.set(InventoryItem::getInventoryStatusEnum, PublicationStatus.ACTIVE.getValue()));
new LambdaUpdateWrapper<InventoryItem>().in(InventoryItem::getId, inventoryIdList)
.set(InventoryItem::getUpdateTime, now).set(InventoryItem::getUpdateBy, loginUser.getUserId())
.set(InventoryItem::getInventoryStatusEnum, PublicationStatus.ACTIVE.getValue()));
return updateCount > 0 ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 库存明细表导出
*
* @param productDetailSearchParam 查询条件
<<<<<<< HEAD
* @param pageNo 当前页码
* @param pageSize 查询条数
=======
>>>>>>> v1.3
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @param response 响应数据
*/
<<<<<<< HEAD
public void makeExcelFile(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request, HttpServletResponse response) {
R<?> result = this.getProductDetailPageX(productDetailSearchParam, 1, 10000, searchKey, request);
if (result != null && result.getData() != null) {
Page<ProductDetailPageDto> pageData = (Page)result.getData();
List<ProductDetailPageDto> dataList = pageData.getRecords();
try {
for(ProductDetailPageDto productDetailPageDto : dataList) {
// 获取单位
String unitCode = productDetailPageDto.getUnitCodeDictText();
String minUnitCode = productDetailPageDto.getMinUnitCodeDictText();
//获取数量
=======
@Override
public void makeExcelFile(ProductDetailSearchParam productDetailSearchParam, String searchKey,
HttpServletRequest request, HttpServletResponse response) {
R<List<ProductDetailPageDto>> result =
this.getProductDetailPageAndTranslateField(productDetailSearchParam, searchKey, request);
HttpServletRequest request, HttpServletResponse response) {
R<List<ProductDetailPageDto>> result
= this.getProductDetailPageAndTranslateField(productDetailSearchParam, searchKey, request);
if (result.getData() != null) {
List<ProductDetailPageDto> dataList = result.getData();
try {
@@ -500,87 +401,48 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
String unitCode = productDetailPageDto.getUnitCodeDictText();
String minUnitCode = productDetailPageDto.getMinUnitCodeDictText();
// 获取数量
>>>>>>> v1.3
BigDecimal number = productDetailPageDto.getNumber();
BigDecimal remainder = productDetailPageDto.getRemainder();
// 拼接
if (remainder.compareTo(BigDecimal.ZERO) > 0) {
<<<<<<< HEAD
productDetailPageDto.setNumber_text(number.setScale(0, RoundingMode.HALF_UP) + unitCode + remainder.setScale(0, RoundingMode.HALF_UP) + minUnitCode);
} else {
productDetailPageDto.setNumber_text(number.setScale(0, RoundingMode.HALF_UP) + unitCode);
}
productDetailPageDto.setQuantity_text(productDetailPageDto.getQuantity().setScale(0, RoundingMode.HALF_UP) + minUnitCode);
// 金额字段拼接 ‘元’
=======
productDetailPageDto.setNumber_text(number.setScale(0, RoundingMode.HALF_UP) + unitCode
+ remainder.setScale(0, RoundingMode.HALF_UP) + minUnitCode);
+ remainder.setScale(0, RoundingMode.HALF_UP) + minUnitCode);
} else {
productDetailPageDto.setNumber_text(number.setScale(0, RoundingMode.HALF_UP) + unitCode);
}
productDetailPageDto.setQuantity_text(
productDetailPageDto.getQuantity().setScale(0, RoundingMode.HALF_UP) + minUnitCode);
productDetailPageDto.getQuantity().setScale(0, RoundingMode.HALF_UP) + minUnitCode);
// 金额字段拼接
>>>>>>> v1.3
BigDecimal purchasePrice = productDetailPageDto.getPurchasePrice();
BigDecimal salePrice = productDetailPageDto.getSalePrice();
BigDecimal totalPurchasePrice = productDetailPageDto.getTotalPurchasePrice();
BigDecimal totalSalePrice = productDetailPageDto.getTotalSalePrice();
if (salePrice != null) {
<<<<<<< HEAD
productDetailPageDto.setExcelSalePrice(salePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (purchasePrice != null) {
productDetailPageDto.setExcelPurchasePrice(purchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (totalPurchasePrice != null) {
productDetailPageDto.setExcelTotalPurchasePrice(totalPurchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (totalSalePrice != null) {
productDetailPageDto.setExcelTotalSalePrice(totalSalePrice.setScale(2, RoundingMode.HALF_UP) + "");
=======
productDetailPageDto.setExcelSalePrice(
salePrice.setScale(2, RoundingMode.HALF_UP) + "");
salePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (purchasePrice != null) {
productDetailPageDto.setExcelPurchasePrice(
purchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
purchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (totalPurchasePrice != null) {
productDetailPageDto.setExcelTotalPurchasePrice(
totalPurchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
totalPurchasePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
if (totalSalePrice != null) {
productDetailPageDto.setExcelTotalSalePrice(
totalSalePrice.setScale(2, RoundingMode.HALF_UP) + "");
>>>>>>> v1.3
totalSalePrice.setScale(2, RoundingMode.HALF_UP) + "");
}
// 判断项目类别
String devCategoryCodeDictText = productDetailPageDto.getDevCategoryCodeDictText();
String medCategoryCodeDictText = productDetailPageDto.getMedCategoryCodeDictText();
<<<<<<< HEAD
String categoryCodeDictText = devCategoryCodeDictText == null ? medCategoryCodeDictText : devCategoryCodeDictText;
productDetailPageDto.setCategoryCodeDictText(categoryCodeDictText);
}
//导出
ExcelUtil<ProductDetailPageDto> util = new ExcelUtil(ProductDetailPageDto.class);
util.exportExcel(response, dataList, "库存明细记录");
} catch (Exception e) {
e.printStackTrace();
System.out.printf("导出Excel失败" + e.getMessage());
=======
String categoryCodeDictText =
devCategoryCodeDictText == null ? medCategoryCodeDictText : devCategoryCodeDictText;
String categoryCodeDictText
= devCategoryCodeDictText == null ? medCategoryCodeDictText : devCategoryCodeDictText;
productDetailPageDto.setCategoryCodeDictText(categoryCodeDictText);
}
@@ -589,88 +451,21 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
util.exportExcel(response, dataList, CommonConstants.SheetName.INVENTORY_DETAIL_RECORD);
} catch (Exception e) {
throw new NonCaptureException(StringUtils.format("导出excel失败"), e);
>>>>>>> v1.3
}
}
}
<<<<<<< HEAD
/**
* 查询库存商品明细分页列表,联查数据字典
*
* @param productDetailSearchParam 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
=======
/**
* 查询库存商品明细分页列表,联查数据字典翻译单位字段
*
* @param productDetailSearchParam 查询条件
>>>>>>> v1.3
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 库存商品明细分页列表
*/
<<<<<<< HEAD
public R<?> getProductDetailPageX(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
Integer categoryCode = productDetailSearchParam.getCategoryCode();
Integer zeroFlag = productDetailSearchParam.getZeroFlag();
Integer remainingDays = productDetailSearchParam.getRemainingDays();
List<Long> locationIds = productDetailSearchParam.getLocationIds();
List<Long> supplierIds = productDetailSearchParam.getSupplierIds();
productDetailSearchParam.setCategoryCode((Integer)null).setZeroFlag((Integer)null).setRemainingDays((Integer)null).setLocationIds((List)null).setSupplierIds((List)null);
QueryWrapper<ProductDetailSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(productDetailSearchParam, searchKey, new HashSet(Arrays.asList("item_name", "bus_no", "py_str", "wb_str")), request);
if (categoryCode != null) {
if (!categoryCode.equals(ItemCategoryCode.CHINESE_PATENT_DRUG.getValue()) && !categoryCode.equals(ItemCategoryCode.WESTERN_MEDICINE.getValue()) && !categoryCode.equals(ItemCategoryCode.EXTERNALLY_PROCURED_DRUGS.getValue()) && !categoryCode.equals(ItemCategoryCode.CHINESE_HERBAL_MEDICINE.getValue())) {
if (categoryCode.equals(ItemCategoryCode.DEVICE.getValue())) {
queryWrapper.eq("item_table", "adm_device_definition");
}
} else {
queryWrapper.eq("item_table", "med_medication_definition");
queryWrapper.eq("med_category_code", categoryCode.toString());
}
}
if (zeroFlag != null) {
if (Whether.YES.getValue().equals(zeroFlag)) {
queryWrapper.eq("quantity", BigDecimal.ZERO);
} else {
queryWrapper.gt("quantity", BigDecimal.ZERO);
}
}
if (locationIds != null && !locationIds.isEmpty()) {
queryWrapper.in("location_id", locationIds);
}
if (supplierIds != null && !supplierIds.isEmpty()) {
queryWrapper.in("supplier_id", supplierIds);
}
if (remainingDays != null) {
queryWrapper.le("remaining_days", remainingDays);
}
Page<ProductDetailPageDto> productDetailsPage = this.productDetailsMapper.selectProductDetailsPageX(new Page((long)pageNo, (long)pageSize), queryWrapper, "med_medication_definition", "adm_device_definition", ConditionCode.LOT_NUMBER_COST.getCode());
List<ProductDetailPageDto> productDetailList = productDetailsPage.getRecords();
if (productDetailList != null && !productDetailList.isEmpty()) {
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
List<Long> chargeItemDefIdList = (List)productDetailList.stream().map(ProductDetailPageDto::getChargeItemDefId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
if (!chargeItemDefIdList.isEmpty()) {
List<ChargeItemDefDetail> lotNumberPriceList = this.chargeItemDefDetailService.getLotNumberPriceByDefIds(chargeItemDefIdList);
if (lotNumberPriceList != null && !lotNumberPriceList.isEmpty()) {
Map<String, BigDecimal> lotPriceMap = (Map)lotNumberPriceList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getConditionValue, ChargeItemDefDetail::getAmount, (existing, replacement) -> existing));
for(ProductDetailPageDto productDetail : productDetailList) {
BigDecimal price = (BigDecimal)lotPriceMap.get(productDetail.getLotNumber());
if (price != null) {
productDetail.setTotalSalePrice(price);
=======
private R<List<ProductDetailPageDto>> getProductDetailPageAndTranslateField(
ProductDetailSearchParam productDetailSearchParam, String searchKey, HttpServletRequest request) {
ProductDetailSearchParam productDetailSearchParam, String searchKey, HttpServletRequest request) {
// 药品类型
List<String> medCategoryCodes = productDetailSearchParam.getMedCategoryCodes();
// 药品类型
@@ -684,12 +479,12 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 供应商
List<Long> supplierIds = productDetailSearchParam.getSupplierIds();
productDetailSearchParam.setZeroFlag(null).setRemainingDays(null).setLocationIds(null).setSupplierIds(null)
.setMedCategoryCodes(null).setDevCategoryCodes(null);
.setMedCategoryCodes(null).setDevCategoryCodes(null);
// 构建查询条件
QueryWrapper<ProductDetailSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
productDetailSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.ItemName,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
// 根据不同分类拼接查询条件
if (medCategoryCodes != null && !medCategoryCodes.isEmpty()) {
queryWrapper.in(CommonConstants.FieldName.MedCategoryCode, medCategoryCodes);
@@ -719,72 +514,50 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
}
// 查询库存商品明细分页列表
List<ProductDetailPageDto> productDetailList = productDetailsMapper.getProductDetailPageAndTranslateField(
queryWrapper, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ConditionCode.LOT_NUMBER_COST.getCode());
queryWrapper, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ConditionCode.LOT_NUMBER_COST.getCode());
if (productDetailList != null && !productDetailList.isEmpty()) {
// 医嘱定价来源
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
// 批次售价需查询定价子表
if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) {
// 收集所有定价ID
List<Long> chargeItemDefIdList =
productDetailList.stream().map(ProductDetailPageDto::getChargeItemDefId).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
List<Long> chargeItemDefIdList
= productDetailList.stream().map(ProductDetailPageDto::getChargeItemDefId).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
// 查询批次售价信息
if (!chargeItemDefIdList.isEmpty()) {
List<ChargeItemDefDetail> lotNumberPriceList =
chargeItemDefDetailService.getLotNumberPriceByDefIds(chargeItemDefIdList);
List<ChargeItemDefDetail> lotNumberPriceList
= chargeItemDefDetailService.getLotNumberPriceByDefIds(chargeItemDefIdList);
if (lotNumberPriceList != null && !lotNumberPriceList.isEmpty()) {
// 创建批次号到售价的映射
Map<String, BigDecimal> lotPriceMap =
lotNumberPriceList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getConditionValue,
ChargeItemDefDetail::getAmount, (existing, replacement) -> existing)); // 处理重复键的情况
Map<String, BigDecimal> lotPriceMap
= lotNumberPriceList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getConditionValue,
ChargeItemDefDetail::getAmount, (existing, replacement) -> existing)); // 处理重复键的情况
// 更新原始列表中的售价
for (ProductDetailPageDto productDetail : productDetailList) {
BigDecimal price = lotPriceMap.get(productDetail.getLotNumber());
if (price != null) {
productDetail.setSalePrice(price);
>>>>>>> v1.3
}
}
}
}
}
<<<<<<< HEAD
for(ProductDetailPageDto productDetailPageDto : productDetailList) {
productDetailPageDto.setChrgitmLv_enumText(EnumUtils.getInfoByValue(YbChrgitmLv.class, productDetailPageDto.getChrgitmLv()));
productDetailPageDto.setInventoryStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, productDetailPageDto.getInventoryStatusEnum()));
BigDecimal[] results = productDetailPageDto.getQuantity().divideAndRemainder(productDetailPageDto.getPartPercent());
productDetailPageDto.setNumber(results[0]);
productDetailPageDto.setRemainder(results[1]);
if (productDetailPageDto.getPurchasePrice() != null) {
productDetailPageDto.setTotalPurchasePrice(productDetailPageDto.getPurchasePrice().multiply(results[0]).add(productDetailPageDto.getPurchasePrice().divide(productDetailPageDto.getPartPercent(), 4, RoundingMode.HALF_UP).multiply(results[1])));
}
if (productDetailPageDto.getSalePrice() != null) {
productDetailPageDto.setTotalSalePrice(productDetailPageDto.getSalePrice().multiply(results[0]).add(productDetailPageDto.getSalePrice().divide(productDetailPageDto.getPartPercent(), 4, RoundingMode.HALF_UP).multiply(results[1])));
}
}
}
return R.ok(productDetailsPage);
}
=======
for (ProductDetailPageDto productDetailPageDto : productDetailList) {
// 医保等级
productDetailPageDto.setChrgitmLv_enumText(
EnumUtils.getInfoByValue(YbChrgitmLv.class, productDetailPageDto.getChrgitmLv()));
EnumUtils.getInfoByValue(YbChrgitmLv.class, productDetailPageDto.getChrgitmLv()));
// 停供状态
productDetailPageDto.setInventoryStatusEnum_enumText(
EnumUtils.getInfoByValue(PublicationStatus.class, productDetailPageDto.getInventoryStatusEnum()));
EnumUtils.getInfoByValue(PublicationStatus.class, productDetailPageDto.getInventoryStatusEnum()));
// 计算包装单位数量
BigDecimal[] results =
productDetailPageDto.getQuantity().divideAndRemainder(productDetailPageDto.getPartPercent());
BigDecimal[] results
= productDetailPageDto.getQuantity().divideAndRemainder(productDetailPageDto.getPartPercent());
// 整数
productDetailPageDto.setNumber(results[0]);
// 余数
@@ -793,18 +566,18 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
// 计算采购总额
if (productDetailPageDto.getPurchasePrice() != null) {
productDetailPageDto
.setTotalPurchasePrice(productDetailPageDto.getPurchasePrice().multiply(results[0])
.add(productDetailPageDto.getPurchasePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
.setTotalPurchasePrice(productDetailPageDto.getPurchasePrice().multiply(results[0])
.add(productDetailPageDto.getPurchasePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
}
// 计算售价总额
if (productDetailPageDto.getSalePrice() != null) {
productDetailPageDto.setTotalSalePrice(productDetailPageDto.getSalePrice().multiply(results[0])
.add(productDetailPageDto.getSalePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
.add(productDetailPageDto.getSalePrice()
.divide(productDetailPageDto.getPartPercent(), 6, RoundingMode.HALF_UP)
.multiply(results[1])));
}
}
}
@@ -813,14 +586,14 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
@Override
public void exportExcel(ProductDetailSearchParam productDetailSearchParam, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request, HttpServletResponse response) {
R<Page<ProductDetailPageDto>> result = this.getProductDetailBackupPage(productDetailSearchParam,1,100000,searchKey,request);
if (result.getData() != null){
R<Page<ProductDetailPageDto>> result = this.getProductDetailBackupPage(productDetailSearchParam, 1, 100000, searchKey, request);
if (result.getData() != null) {
Page<ProductDetailPageDto> pageData = result.getData();
List<ProductDetailPageDto> dataList = pageData.getRecords();
for (ProductDetailPageDto productDetailPageDto : dataList) {
// 获取单位
String unitCode = DictUtils.getDictLabel("unit_code",productDetailPageDto.getUnitCode());
String minUnitCode = DictUtils.getDictLabel("unit_code",productDetailPageDto.getMinUnitCode());
String unitCode = DictUtils.getDictLabel("unit_code", productDetailPageDto.getUnitCode());
String minUnitCode = DictUtils.getDictLabel("unit_code", productDetailPageDto.getMinUnitCode());
// 获取数量
BigDecimal number = productDetailPageDto.getNumber();
BigDecimal remainder = productDetailPageDto.getRemainder();
@@ -860,24 +633,23 @@ public class ProductDetailAppServiceImpl extends ServiceImpl<InventoryItemMapper
}
// 判断项目类别
String devCategoryCodeDictText = DictUtils.getDictLabel("device_category_code",productDetailPageDto.getDevCategoryCode());
String medCategoryCodeDictText = DictUtils.getDictLabel("med_category_code",productDetailPageDto.getMedCategoryCode());
String devCategoryCodeDictText = DictUtils.getDictLabel("device_category_code", productDetailPageDto.getDevCategoryCode());
String medCategoryCodeDictText = DictUtils.getDictLabel("med_category_code", productDetailPageDto.getMedCategoryCode());
String categoryCodeDictText = StringUtils.isEmpty(devCategoryCodeDictText) ? medCategoryCodeDictText : devCategoryCodeDictText;
productDetailPageDto.setCategoryCodeDictText(categoryCodeDictText);
//剂型
String doseFormCodeDictText = DictUtils.getDictLabel("dose_form_code",productDetailPageDto.getDoseFormCode());
String doseFormCodeDictText = DictUtils.getDictLabel("dose_form_code", productDetailPageDto.getDoseFormCode());
productDetailPageDto.setDoseFormCodeDictText(doseFormCodeDictText);
}
try {
// 导出
NewExcelUtil<ProductDetailPageDto> newExcelUtil =
new NewExcelUtil<>(ProductDetailPageDto.class);
NewExcelUtil<ProductDetailPageDto> newExcelUtil
= new NewExcelUtil<>(ProductDetailPageDto.class);
newExcelUtil.exportExcel(response, dataList, CommonConstants.SheetName.INVENTORY_DETAIL_RECORD);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
>>>>>>> v1.3
}

View File

@@ -3,18 +3,9 @@
*/
package com.openhis.web.inventorymanage.appservice.impl;
<<<<<<< HEAD
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
=======
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
>>>>>>> v1.3
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -22,25 +13,15 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
=======
import com.openhis.administration.domain.Location;
import com.openhis.administration.service.impl.LocationServiceImpl;
>>>>>>> v1.3
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.exception.ServiceException;
<<<<<<< HEAD
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.DateUtils;
import com.core.common.utils.MessageUtils;
import com.core.common.utils.SecurityUtils;
=======
import com.core.common.utils.*;
>>>>>>> v1.3
import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.domain.Supplier;
@@ -99,27 +80,27 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
List<Practitioner> practitionerList = practitionerService.getList();
// 经手人信息
List<PurchaseInventoryInitDto.practitionerListOption> practitionerListOptions = practitionerList.stream()
.map(practitioner -> new PurchaseInventoryInitDto.practitionerListOption(practitioner.getId(),
.map(practitioner -> new PurchaseInventoryInitDto.practitionerListOption(practitioner.getId(),
practitioner.getName()))
.collect(Collectors.toList());
.collect(Collectors.toList());
// 供应商信息
List<PurchaseInventoryInitDto.supplierListOption> supplierListOptions = supplierList.stream()
.map(supplier -> new PurchaseInventoryInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
.map(supplier -> new PurchaseInventoryInitDto.supplierListOption(supplier.getId(), supplier.getName()))
.collect(Collectors.toList());
// 审批状态
List<PurchaseInventoryInitDto.supplyStatusOption> supplyStatusOptions = Stream.of(SupplyStatus.values())
.map(supplyStatus -> new PurchaseInventoryInitDto.supplyStatusOption(supplyStatus.getValue(),
.map(supplyStatus -> new PurchaseInventoryInitDto.supplyStatusOption(supplyStatus.getValue(),
supplyStatus.getInfo()))
.collect(Collectors.toList());
.collect(Collectors.toList());
// 单据类型
List<PurchaseInventoryInitDto.supplyTypeOption> supplyTypeOptions = new ArrayList<>();
supplyTypeOptions.add(new PurchaseInventoryInitDto.supplyTypeOption(SupplyType.PURCHASE_INVENTORY.getValue(),
SupplyType.PURCHASE_INVENTORY.getInfo()));
SupplyType.PURCHASE_INVENTORY.getInfo()));
supplyTypeOptions.add(new PurchaseInventoryInitDto.supplyTypeOption(SupplyType.PRODUCT_RETURN.getValue(),
SupplyType.PRODUCT_RETURN.getInfo()));
SupplyType.PRODUCT_RETURN.getInfo()));
initDto.setSupplierListOptions(supplierListOptions).setPractitionerListOptions(practitionerListOptions)
.setSupplyStatusOptions(supplyStatusOptions).setSupplyTypeOptions(supplyTypeOptions);
.setSupplyStatusOptions(supplyStatusOptions).setSupplyTypeOptions(supplyTypeOptions);
return R.ok(initDto);
}
@@ -149,18 +130,18 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
*/
@Override
public R<Page<ReceiptPageDto>> getPage(InventorySearchParam inventorySearchParam, Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
// 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>();
searchFields.add(CommonConstants.FieldName.SupplyBusNo);
// 构建查询条件
QueryWrapper<InventorySearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(inventorySearchParam, searchKey, searchFields, request);
QueryWrapper<InventorySearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inventorySearchParam, searchKey, searchFields, request);
// 查询入库单据分页列表
Page<ReceiptPageDto> inventoryReceiptPage = purchaseInventoryMapper.selectInventoryReceiptPage(
new Page<>(pageNo, pageSize), queryWrapper, SupplyType.PURCHASE_INVENTORY.getValue());
new Page<>(pageNo, pageSize), queryWrapper, SupplyType.PURCHASE_INVENTORY.getValue());
inventoryReceiptPage.getRecords().forEach(e -> {
// 单据状态
@@ -185,19 +166,19 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
if (receiptDetailList.isEmpty()) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
}
// 获取所有供应商ID
Set<Long> supplierIds = receiptDetailList.stream()
.filter(dto -> dto.getSupplierId() != null)
.map(ReceiptDetailDto::getSupplierId)
.collect(Collectors.toSet());
.filter(dto -> dto.getSupplierId() != null)
.map(ReceiptDetailDto::getSupplierId)
.collect(Collectors.toSet());
// 查询供应商信息并设置供应商名称
if (!supplierIds.isEmpty()) {
List<Supplier> suppliers = supplierService.listByIds(supplierIds);
Map<Long, String> supplierNameMap = suppliers.stream()
.collect(Collectors.toMap(Supplier::getId, Supplier::getName));
.collect(Collectors.toMap(Supplier::getId, Supplier::getName));
// 设置供应商名称
receiptDetailList.forEach(dto -> {
if (dto.getSupplierId() != null) {
@@ -205,7 +186,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
}
});
}
return R.ok(receiptDetailList);
}
@@ -227,8 +208,8 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
List<String> idList = new ArrayList<>();
// 单据号取得
List<String> busNoList =
purchaseInventoryDtoList.stream().map(PurchaseInventoryDto::getBusNo).collect(Collectors.toList());
List<String> busNoList
= purchaseInventoryDtoList.stream().map(PurchaseInventoryDto::getBusNo).collect(Collectors.toList());
// 请求数据取得
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
if (!requestList.isEmpty()) {
@@ -246,18 +227,18 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
// 生成待发送的入库单据
supplyRequest
// id
.setId(null)
// 单据分类:非库存供应
.setCategoryEnum(SupplyCategory.NON_STOCK.getValue())
// 单据类型:采购入库
.setTypeEnum(SupplyType.PURCHASE_INVENTORY.getValue())
// 制单人
.setApplicantId(SecurityUtils.getLoginUser().getPractitionerId())
// 申请时间
.setApplyTime(DateUtils.getNowDate());
// id
.setId(null)
// 单据分类:非库存供应
.setCategoryEnum(SupplyCategory.NON_STOCK.getValue())
// 单据类型:采购入库
.setTypeEnum(SupplyType.PURCHASE_INVENTORY.getValue())
// 制单人
.setApplicantId(SecurityUtils.getLoginUser().getPractitionerId())
// 申请时间
.setApplyTime(DateUtils.getNowDate());
supplyRequestList.add(supplyRequest);
}
// 保存
@@ -269,7 +250,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
List<Long> requestIdList = supplyRequestIdList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
for (Long list : requestIdList) {
idList.add(list.toString());
}
}
// 返回请求id
return R.ok(idList, null);
@@ -286,7 +267,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
// 删除单据
boolean result = supplyRequestService.removeByIds(supplyRequestIds);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -306,7 +287,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
// 单据提交审核
boolean result = supplyRequestService.submitApproval(busNo);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -320,7 +301,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
// 撤回审核
boolean result = supplyRequestService.withdrawApproval(busNo);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -335,13 +316,13 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
*/
@Override
public R<?> getMonthlySettlementDetail(Long locationId, String startTime, String endTime, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
Page<ReceiptDetailDto> receiptDetailList =
purchaseInventoryMapper.getMonthlySettlementDetail(new Page<>(pageNo, pageSize), locationId, startTime,
endTime, ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
Arrays.asList(SupplyType.PURCHASE_INVENTORY.getValue()), SupplyStatus.AGREE.getValue());
Page<ReceiptDetailDto> receiptDetailList
= purchaseInventoryMapper.getMonthlySettlementDetail(new Page<>(pageNo, pageSize), locationId, startTime,
endTime, ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(),
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
Arrays.asList(SupplyType.PURCHASE_INVENTORY.getValue()), SupplyStatus.AGREE.getValue());
return R.ok(receiptDetailList);
}

View File

@@ -117,12 +117,12 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
optionList.add(SupplyType.RETURN_ISSUE);
optionList.add(SupplyType.PRODUCT_BATCH_STOCKTAKING);
List<ReceiptInitDto.supplyTypeOption> supplyTypeOptions = optionList.stream()
.map(supplyType -> new ReceiptInitDto.supplyTypeOption(supplyType.getValue(), supplyType.getInfo()))
.collect(Collectors.toList());
.map(supplyType -> new ReceiptInitDto.supplyTypeOption(supplyType.getValue(), supplyType.getInfo()))
.collect(Collectors.toList());
// 审批状态
List<ReceiptInitDto.supplyStatusOption> supplyStatusOptions = Stream.of(SupplyStatus.values())
.map(supplyStatus -> new ReceiptInitDto.supplyStatusOption(supplyStatus.getValue(), supplyStatus.getInfo()))
.collect(Collectors.toList());
.map(supplyStatus -> new ReceiptInitDto.supplyStatusOption(supplyStatus.getValue(), supplyStatus.getInfo()))
.collect(Collectors.toList());
initDto.setSupplyTypeOptions(supplyTypeOptions).setSupplyStatusOptions(supplyStatusOptions);
return R.ok(initDto);
@@ -138,25 +138,25 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
*/
@Override
public void exportExcel(ReceiptApprovalSearchParam receiptSearchParam, String searchKey, HttpServletRequest request,
HttpServletResponse response) {
HttpServletResponse response) {
R<Page<ReceiptPageDto>> result = this.getPage(receiptSearchParam, 1, 10000, searchKey, request);
if (result != null && result.getData() != null) {
Page<ReceiptPageDto> pageData = result.getData();
List<ReceiptPageDto> dataList = pageData.getRecords();
List<Supplier> supplierList = supplierService.getList();
Map<Long, String> supplierToNameMap = supplierList.stream()
.collect(Collectors.toMap(Supplier::getId, Supplier::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
.collect(Collectors.toMap(Supplier::getId, Supplier::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
List<Practitioner> practitionerList = practitionerService.getList();
// 创建id到名字的映射
Map<Long, String> practitionerToNameMap = practitionerList.stream()
.collect(Collectors.toMap(Practitioner::getId, Practitioner::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
.collect(Collectors.toMap(Practitioner::getId, Practitioner::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
List<Location> locationList = locationService.getLocationList();
Map<Long, String> locationToNameMap = locationList.stream()
.collect(Collectors.toMap(Location::getId, Location::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
.collect(Collectors.toMap(Location::getId, Location::getName, (oldValue, newValue) -> oldValue // 冲突时保留旧值(第一个)
));
dataList.forEach(e -> {
// 经手人practitionerIdDictText
e.setPractitionerIdDictText(practitionerToNameMap.get(e.getPractitionerId()));
@@ -197,7 +197,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
*/
@Override
public R<Page<ReceiptPageDto>> getPage(ReceiptApprovalSearchParam receiptSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageSize, String searchKey, HttpServletRequest request) {
// 处理拼接状态
String typeEnum = receiptSearchParam.getTypeEnum();
@@ -212,8 +212,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
searchFields.add(CommonConstants.FieldName.SupplyBusNo);
// 构建查询条件
QueryWrapper<ReceiptApprovalSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(receiptSearchParam, searchKey, searchFields, request);
QueryWrapper<ReceiptApprovalSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(receiptSearchParam, searchKey, searchFields, request);
if (typeEnumList != null && !typeEnumList.isEmpty()) {
queryWrapper.in(CommonConstants.FieldName.TypeEnum, typeEnumList);
@@ -221,12 +221,12 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 查询单据分页列表
Page<ReceiptPageDto> receiptPage = receiptApprovalMapper.selectReceiptPage(new Page<>(pageNo, pageSize),
queryWrapper, SupplyStatus.APPROVAL.getValue(), SupplyStatus.AGREE.getValue(),
SupplyStatus.REJECT.getValue(), SupplyType.LOSS_REPORT_FORM.getValue(),
SupplyType.ISSUE_INVENTORY.getValue(), SupplyType.PRODUCT_BATCH_STOCKTAKING.getValue(),
SupplyType.PRODUCT_STOCKTAKING.getValue(), SupplyType.PRODUCT_RETURN.getValue(),
SupplyType.RETURN_ISSUE.getValue(), SupplyType.PRODUCT_TRANSFER.getValue(),
SupplyType.PRODUCT_BATCH_TRANSFER.getValue(), SupplyType.PURCHASE_INVENTORY.getValue());
queryWrapper, SupplyStatus.APPROVAL.getValue(), SupplyStatus.AGREE.getValue(),
SupplyStatus.REJECT.getValue(), SupplyType.LOSS_REPORT_FORM.getValue(),
SupplyType.ISSUE_INVENTORY.getValue(), SupplyType.PRODUCT_BATCH_STOCKTAKING.getValue(),
SupplyType.PRODUCT_STOCKTAKING.getValue(), SupplyType.PRODUCT_RETURN.getValue(),
SupplyType.RETURN_ISSUE.getValue(), SupplyType.PRODUCT_TRANSFER.getValue(),
SupplyType.PRODUCT_BATCH_TRANSFER.getValue(), SupplyType.PURCHASE_INVENTORY.getValue());
receiptPage.getRecords().forEach(e -> {
// 单据状态
@@ -319,8 +319,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
// 根据项目id,产品批号仓库id 查询仓库库存表信息
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
InventoryItem inventoryItemPurpose = null;
if (!inventoryItemList.isEmpty()) {
inventoryItemPurpose = inventoryItemList.get(0);
@@ -338,7 +338,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
// 源仓库库存+(调拨数量*拆零比)
minQuantity = minQuantity
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
// 供应申请的物品计量单位与最小单位相同
@@ -346,8 +346,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
}
// 更新源仓库库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
if (!aBoolean) {
throw new ServiceException("系统异常,请稍后重试");
@@ -356,7 +356,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// 新增追溯码记录
traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
SupplyType.PURCHASE_INVENTORY.getValue());
SupplyType.PURCHASE_INVENTORY.getValue());
if (!supplyList.isEmpty()) {
// 将供应项目的详细信息装配为库存项目
@@ -368,8 +368,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 调用医保商品采购接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.PURCHASE_IN, now, false);
List<String> uploadFailedNoList
= this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.PURCHASE_IN, now, false);
if (!uploadFailedNoList.isEmpty()) {
returnMsg = "3503商品采购上传错误错误项目编码" + uploadFailedNoList;
} else {
@@ -417,18 +417,18 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
if (!supplyItemDetailList.isEmpty()) {
// 获取盘盈列表itemQuantity > 0
List<SupplyItemDetailDto> positiveList = supplyItemDetailList.stream()
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) > 0)
.collect(Collectors.toList());
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) > 0)
.collect(Collectors.toList());
// 获取盘亏列表itemQuantity < 0
List<SupplyItemDetailDto> negativeList = supplyItemDetailList.stream()
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) < 0)
.collect(Collectors.toList());
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) < 0)
.collect(Collectors.toList());
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
// 根据id产品批号仓库 查询库存表信息
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
if (!inventoryItemList.isEmpty()) {
InventoryItem inventoryItem = inventoryItemList.get(0);
// 最小数量(最小单位库存数量)
@@ -444,8 +444,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
// }
// 更新库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
if (!aBoolean) {
throw new ServiceException("系统异常,请稍后重试");
}
@@ -460,13 +460,13 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
List<String> uploadFailedLossList = null;
if (!positiveList.isEmpty()) {
// 调用医保库存变更接口,盘盈
uploadFailedGainList =
this.ybInventoryIntegrated(positiveList, YbInvChgType.INVENTORY_GAIN, now, false);
uploadFailedGainList
= this.ybInventoryIntegrated(positiveList, YbInvChgType.INVENTORY_GAIN, now, false);
}
if (!negativeList.isEmpty()) {
// 调用医保库存变更接口,盘亏
uploadFailedLossList =
this.ybInventoryIntegrated(negativeList, YbInvChgType.INVENTORY_LOSS, now, false);
uploadFailedLossList
= this.ybInventoryIntegrated(negativeList, YbInvChgType.INVENTORY_LOSS, now, false);
}
if (uploadFailedGainList != null || uploadFailedLossList != null) {
changeReturnMsg = "3502库存变更上传错误错误项目编码" + uploadFailedGainList + uploadFailedLossList;
@@ -474,7 +474,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
}
return R.ok(stocktakingReturnMsg + changeReturnMsg,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
}
/**
@@ -526,10 +526,10 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
// supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
List<InventoryItem> filteredInventoryItems = inventoryItems.stream()
.filter(item -> item.getItemId().equals(supplyItemDetailDto.getItemId())
.filter(item -> item.getItemId().equals(supplyItemDetailDto.getItemId())
&& item.getLotNumber().equals(supplyItemDetailDto.getLotNumber())
&& item.getLocationId().equals(supplyItemDetailDto.getSourceLocationId()))
.collect(Collectors.toList());
.collect(Collectors.toList());
InventoryItem inventoryItemSource = new InventoryItem();
if (!filteredInventoryItems.isEmpty()) {
@@ -562,8 +562,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// }
// 更新源仓库库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
if (!aBoolean) {
throw new ServiceException("系统异常,请稍后重试");
}
@@ -576,8 +576,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 根据项目id,产品批号目的仓库id 查询目的仓库库存表信息
List<InventoryItem> inventoryItemPurposeList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
InventoryItem inventoryItemPurpose = null;
if (!inventoryItemPurposeList.isEmpty()) {
inventoryItemPurpose = inventoryItemPurposeList.get(0);
@@ -589,7 +589,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// todo:不理解的代码,可能会因为四舍五入影响总价值
// 采购单价=单价*拆零比
supplyItemDetailDto
.setPrice(supplyItemDetailDto.getPrice().multiply(supplyItemDetailDto.getPartPercent()));
.setPrice(supplyItemDetailDto.getPrice().multiply(supplyItemDetailDto.getPartPercent()));
}
// 新增库存信息
supplylList.add(supplyItemDetailDto);
@@ -609,8 +609,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
// }
// 更新目的仓库库存数量
Boolean bBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
Boolean bBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
if (!bBoolean) {
throw new ServiceException("系统异常,请稍后重试");
@@ -631,11 +631,11 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 处理出库追溯码
traceNoAppService.addTraceNoManage(outList, TraceNoStatus.OUT.getValue(),
SupplyType.PRODUCT_TRANSFER.getValue());
SupplyType.PRODUCT_TRANSFER.getValue());
// 处理入库追溯码
traceNoAppService.addTraceNoManage(inList, TraceNoStatus.IN.getValue(),
SupplyType.PRODUCT_TRANSFER.getValue());
SupplyType.PRODUCT_TRANSFER.getValue());
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
@@ -679,8 +679,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
// 根据项目id,产品批号目的仓库id 查询仓库库存表信息
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
InventoryItem inventoryItemSource;
if (!inventoryItemList.isEmpty()) {
inventoryItemSource = inventoryItemList.get(0);
@@ -696,7 +696,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
} else {
// 仓库库存-(退货数量*拆零比)
minQuantity = minQuantity.subtract(
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
}
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
@@ -710,8 +710,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// 更新仓库库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
if (!aBoolean) {
throw new ServiceException("系统异常,请稍后重试");
@@ -725,12 +725,12 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// 处理追溯码
traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
SupplyType.PRODUCT_RETURN.getValue());
SupplyType.PRODUCT_RETURN.getValue());
// 调用医保采购退货接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.RETURN_OUT, now, false);
List<String> uploadFailedNoList
= this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.RETURN_OUT, now, false);
if (!uploadFailedNoList.isEmpty()) {
returnMsg = "3504采购退货上传错误错误项目编码" + uploadFailedNoList;
}
@@ -776,8 +776,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
// 根据id产品批号仓库 查询库存表信息
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
InventoryItem inventoryItem = new InventoryItem();
if (!inventoryItemList.isEmpty()) {
inventoryItem = inventoryItemList.get(0);
@@ -793,7 +793,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
} else {
// 目的仓库库存-(报损数量*拆零比)
minQuantity = minQuantity.subtract(
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
}
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
@@ -806,8 +806,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
}
// 更新库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
if (!aBoolean) {
throw new ServiceException("系统异常,请稍后重试");
}
@@ -816,13 +816,13 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 追溯码管理表数据追加
// 处理追溯码
traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
SupplyType.LOSS_REPORT_FORM.getValue());
SupplyType.LOSS_REPORT_FORM.getValue());
// 调用医保库存变更接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.DESTRUCTION, now, false);
List<String> uploadFailedNoList
= this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.DESTRUCTION, now, false);
if (!uploadFailedNoList.isEmpty()) {
returnMsg = "3502库存变更上传错误错误项目编码" + uploadFailedNoList;
}
@@ -866,15 +866,15 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
if (!supplyItemDetailList.isEmpty()) {
// 根据项目id,产品批号源仓库id 查询源仓库库存表信息
List<InventoryItem> inventoryItemList =
inventoryItemService.list(new LambdaQueryWrapper<InventoryItem>().in(InventoryItem::getItemId,
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).toList()));
List<InventoryItem> inventoryItemList
= inventoryItemService.list(new LambdaQueryWrapper<InventoryItem>().in(InventoryItem::getItemId,
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).toList()));
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
if (!inventoryItemList.isEmpty()) {
for (InventoryItem inventoryItem : inventoryItemList) {
if (inventoryItem.getItemId().equals(supplyItemDetailDto.getItemId())
&& inventoryItem.getLotNumber().equals(supplyItemDetailDto.getLotNumber())
&& inventoryItem.getLocationId().equals(supplyItemDetailDto.getSourceLocationId())) {
&& inventoryItem.getLotNumber().equals(supplyItemDetailDto.getLotNumber())
&& inventoryItem.getLocationId().equals(supplyItemDetailDto.getSourceLocationId())) {
// 最小数量(最小单位库存数量)
BigDecimal minQuantity = inventoryItem.getQuantity();
@@ -886,7 +886,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
} else {
// 源仓库库存-(领用数量*拆零比)
minQuantity = minQuantity.subtract(supplyItemDetailDto.getPartPercent()
.multiply(supplyItemDetailDto.getItemQuantity()));
.multiply(supplyItemDetailDto.getItemQuantity()));
}
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
@@ -899,8 +899,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
}
// 更新源仓库库存数量
Boolean aBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
Boolean aBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
if (!aBoolean) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
@@ -912,14 +912,14 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// 处理追溯码
traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
SupplyType.ISSUE_INVENTORY.getValue());
SupplyType.ISSUE_INVENTORY.getValue());
// 返回信息
String returnMsg = null;
// 调用医保库存变更接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.OTHER_OUT, now, false);
List<String> uploadFailedNoList
= this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.OTHER_OUT, now, false);
if (!uploadFailedNoList.isEmpty()) {
returnMsg = "3502库存变更上传错误错误项目编码" + uploadFailedNoList;
}
@@ -966,8 +966,8 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
// 根据项目id,产品批号目的仓库id 查询目的仓库库存表信息
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
InventoryItem inventoryItemPurpose = null;
if (!inventoryItemList.isEmpty()) {
inventoryItemPurpose = inventoryItemList.get(0);
@@ -985,15 +985,15 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
// 源仓库库存+(退库数量*拆零比)
minQuantity = minQuantity
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
// 供应申请的物品计量单位与最小单位相同
// 源仓库库存+退库数量
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
}
// 更新目的仓库库存数量
Boolean bBoolean =
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
Boolean bBoolean
= inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
if (!bBoolean) {
throw new ServiceException("系统异常,请稍后重试");
}
@@ -1008,14 +1008,14 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
// 处理追溯码
traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
SupplyType.RETURN_ISSUE.getValue());
SupplyType.RETURN_ISSUE.getValue());
// 返回信息
String returnMsg = null;
// 调用医保库存变更接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.OTHER_IN, now, false);
List<String> uploadFailedNoList
= this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.OTHER_IN, now, false);
if (!uploadFailedNoList.isEmpty()) {
returnMsg = "3502库存变更上传错误错误项目编码" + uploadFailedNoList;
}
@@ -1036,7 +1036,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 驳回单据
boolean result = supplyRequestService.rejectRequest(busNo);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
@@ -1047,19 +1047,20 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
* @return 价格定义子表数据
*/
private List<ChargeItemDefDetail> creatChargeItemDetail(List<SupplyRequest> agreedList,
List<ItemChargeDetailDto> chargeDetailList) {
List<ItemChargeDetailDto> chargeDetailList) {
List<ChargeItemDefDetail> resultList = new ArrayList<>();
// 将各个项目的定价信息按项目id分组
Map<Long, List<ItemChargeDetailDto>> chargeDetailGroup =
chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId));
Map<Long, List<ItemChargeDetailDto>> chargeDetailGroup
= chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId));
for (SupplyRequest supplyRequest : agreedList) {
Long itemId = supplyRequest.getItemId();
// 通过供应项目id匹配项目定价
List<ItemChargeDetailDto> details = chargeDetailGroup.get(itemId);
if (details == null)
if (details == null) {
continue;
}
boolean shouldSkip = false;
for (ItemChargeDetailDto detail : details) {
@@ -1073,7 +1074,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
if (!shouldSkip) {
// 新增对应项目的价格定义子表
resultList.addAll(this.addChargeItemDefApp(supplyRequest.getLotNumber(), supplyRequest.getPrice(),
details.get(0).getDefinitionId()));
details.get(0).getDefinitionId()));
}
}
return resultList;
@@ -1088,17 +1089,17 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
* @return 子表信息
*/
private List<ChargeItemDefDetail> addChargeItemDefApp(String conditionValue, BigDecimal sellPrice,
Long definitionId) {
Long definitionId) {
List<ChargeItemDefDetail> resultList = new ArrayList<>();
// 创建成本价记录
ChargeItemDefDetail costDetail = new ChargeItemDefDetail();
costDetail.setConditionCode(ConditionCode.LOT_NUMBER_COST.getCode()).setConditionValue(conditionValue)
.setDefinitionId(definitionId).setAmount(sellPrice);
.setDefinitionId(definitionId).setAmount(sellPrice);
resultList.add(costDetail);
// 创建销售价记录
ChargeItemDefDetail priceDetail = new ChargeItemDefDetail();
priceDetail.setConditionCode(ConditionCode.LOT_NUMBER_PRICE.getCode()).setConditionValue(conditionValue)
.setDefinitionId(definitionId).setAmount(sellPrice);
.setDefinitionId(definitionId).setAmount(sellPrice);
resultList.add(priceDetail);
return resultList;
}
@@ -1113,7 +1114,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
* @return 上传失败的id集合
*/
public List<String> ybInventoryIntegrated(List<SupplyItemDetailDto> supplyItemDetailList, YbInvChgType ybInvChgType,
Date now, boolean saleFlag) {
Date now, boolean saleFlag) {
List<String> uploadFailedNoList = new ArrayList<>();
// 没有医保码的项目不调进销存
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
@@ -1145,11 +1146,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
// 所有类型都需要调用库存变更(特殊类型失败时跳过)
if (!skipInventoryUpdate) {
result = ybManager.updateInventoryCount(
<<<<<<< HEAD
getMedicalInventory3502Param(supplyItemDetailDto, now, ybInvChgType.getValue()));
=======
getMedicalInventory3502Param(supplyItemDetailDto, now, ybInvChgType.getValue(), saleFlag));
>>>>>>> v1.3
getMedicalInventory3502Param(supplyItemDetailDto, now, ybInvChgType.getValue(), saleFlag));
if (result.getCode() != 200) {
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
}
@@ -1161,13 +1158,13 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
private MedicalPurchase3504Param getMedicalPurchase3504Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
MedicalPurchase3504Param medicalPurchase3504Param = new MedicalPurchase3504Param();
medicalPurchase3504Param.setMedListCodg(supplyItemDetailDto.getYbNo())
.setFixmedinsBchno(supplyItemDetailDto.getSupplyId().toString())
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
.setSplerName(supplyItemDetailDto.getSupplierName()).setPurcInvoNo(supplyItemDetailDto.getInvoiceNo())
.setManuDate(supplyItemDetailDto.getStartTime()).setExpyEnd(supplyItemDetailDto.getEndTime())
.setPurcRetnCnt(supplyItemDetailDto.getItemQuantity()).setPurcRetnStoinTime(now)
.setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
.setFixmedinsBchno(supplyItemDetailDto.getSupplyId().toString())
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
.setSplerName(supplyItemDetailDto.getSupplierName()).setPurcInvoNo(supplyItemDetailDto.getInvoiceNo())
.setManuDate(supplyItemDetailDto.getStartTime()).setExpyEnd(supplyItemDetailDto.getEndTime())
.setPurcRetnCnt(supplyItemDetailDto.getItemQuantity()).setPurcRetnStoinTime(now)
.setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
medicalPurchase3504Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
@@ -1181,14 +1178,14 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
private Medical3503Param getMedical3503Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
Medical3503Param medical3503Param = new Medical3503Param();
medical3503Param.setMedListCodg(supplyItemDetailDto.getYbNo())
.setFixmedinsBchno(supplyItemDetailDto.getSupplyId().toString())
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
.setSplerName(supplyItemDetailDto.getSupplierName()).setManuLotnum(supplyItemDetailDto.getLotNumber())
.setProdentpName(supplyItemDetailDto.getManufacturerText())
.setAprvno(supplyItemDetailDto.getApprovalNumber()).setManuDate(supplyItemDetailDto.getStartTime())
.setExpyEnd(supplyItemDetailDto.getEndTime()).setPurcRetnCnt(supplyItemDetailDto.getItemQuantity())
.setPurcRetnStoinTime(now).setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
.setFixmedinsBchno(supplyItemDetailDto.getSupplyId().toString())
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
.setSplerName(supplyItemDetailDto.getSupplierName()).setManuLotnum(supplyItemDetailDto.getLotNumber())
.setProdentpName(supplyItemDetailDto.getManufacturerText())
.setAprvno(supplyItemDetailDto.getApprovalNumber()).setManuDate(supplyItemDetailDto.getStartTime())
.setExpyEnd(supplyItemDetailDto.getEndTime()).setPurcRetnCnt(supplyItemDetailDto.getItemQuantity())
.setPurcRetnStoinTime(now).setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
medical3503Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
@@ -1201,25 +1198,25 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
private MedicalInventory3502Param getMedicalInventory3502Param(SupplyItemDetailDto supplyItemDetailDto, Date now,
String ybInvChgType, boolean saleFlag) {
String ybInvChgType, boolean saleFlag) {
MedicalInventory3502Param medicalInventory3502Param = new MedicalInventory3502Param();
// 查库存信息
List<InventoryItem> inventoryItemList =
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
List<InventoryItem> inventoryItemList
= inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
// 查询商品价格信息
List<ItemChargeDetailDto> itemChargeDetailList =
receiptApprovalAppService.getItemChargeDetail(List.of(supplyItemDetailDto.getItemId()));
List<ItemChargeDetailDto> itemChargeDetailList
= receiptApprovalAppService.getItemChargeDetail(List.of(supplyItemDetailDto.getItemId()));
if (!inventoryItemList.isEmpty() && !itemChargeDetailList.isEmpty()) {
// 获取该项目所有的数量(最小单位)
BigDecimal totalQuantity = inventoryItemList.stream()
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 最小单位售卖价格
BigDecimal minPrice = BigDecimal.ZERO;
Optional<BigDecimal> price = itemChargeDetailList.stream()
.filter(x -> x.getConditionValue().equals(supplyItemDetailDto.getLotNumber()))
.map(ItemChargeDetailDto::getSellPrice).findFirst();
.filter(x -> x.getConditionValue().equals(supplyItemDetailDto.getLotNumber()))
.map(ItemChargeDetailDto::getSellPrice).findFirst();
if (price.isPresent()) {
if (supplyItemDetailDto.getPartPercent().compareTo(BigDecimal.ZERO) > 0) {
minPrice = price.get().divide(supplyItemDetailDto.getPartPercent(), RoundingMode.HALF_UP);
@@ -1229,10 +1226,10 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
JSONArray medicalTraceNo = new JSONArray();
List<String> inventoryTraceNoList = null;
if (!YbInvChgType.DESTRUCTION.getValue().equals(ybInvChgType)
|| !YbInvChgType.INVENTORY_LOSS.getValue().equals(ybInvChgType)) {
|| !YbInvChgType.INVENTORY_LOSS.getValue().equals(ybInvChgType)) {
// 获取同一批号下在库的追溯码信息
inventoryTraceNoList = traceNoManageService.getInventoryTraceNoList(supplyItemDetailDto.getItemId(),
supplyItemDetailDto.getLotNumber());
supplyItemDetailDto.getLotNumber());
}
// 转换成上传医保的格式
if (inventoryTraceNoList != null) {
@@ -1244,9 +1241,9 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
}
medicalInventory3502Param.setMedListCodg(supplyItemDetailDto.getYbNo()).setInvChgType(ybInvChgType)
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setPric(minPrice).setCnt(totalQuantity)
.setInvChgTime(now).setDrugtracinfo(medicalTraceNo);
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setPric(minPrice).setCnt(totalQuantity)
.setInvChgTime(now).setDrugtracinfo(medicalTraceNo);
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
medicalInventory3502Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
@@ -1267,19 +1264,19 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
private MedicalInventory3501Param getMedicalInventory3501Param(SupplyItemDetailDto supplyItemDetailDto, Date date) {
MedicalInventory3501Param medicalInventory3501Param = new MedicalInventory3501Param();
// 查库存信息
List<InventoryItem> inventoryItemList =
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
List<InventoryItem> inventoryItemList
= inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
if (!inventoryItemList.isEmpty()) {
// 获取该项目所有的数量(最小单位)
BigDecimal totalQuantity = inventoryItemList.stream()
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
medicalInventory3501Param.setMedListCodg(supplyItemDetailDto.getYbNo())
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setInvdate(date).setInvCnt(totalQuantity)
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setManuDate(supplyItemDetailDto.getStartTime())
.setExpyEnd(supplyItemDetailDto.getEndTime());
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setInvdate(date).setInvCnt(totalQuantity)
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setManuDate(supplyItemDetailDto.getStartTime())
.setExpyEnd(supplyItemDetailDto.getEndTime());
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
medicalInventory3501Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {

View File

@@ -45,9 +45,9 @@ public class LossReportFormController {
*/
@GetMapping(value = "/loss-report-form-page")
public R<?> getPage(LossReportSearchParam lossReportSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return lossReportFormAppService.getPage(lossReportSearchParam, pageNo, pageSize, searchKey, request);
}
@@ -143,9 +143,6 @@ public class LossReportFormController {
// @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
// return lossReportFormAppService.getMonthlySettlementDetail(locationId, startTime,endTime,pageNo,pageSize);
// }
<<<<<<< HEAD
=======
/**
* 报损单据明细导出
*
@@ -156,5 +153,4 @@ public class LossReportFormController {
public void exportExcel(@RequestParam String busNo, HttpServletResponse response) {
lossReportFormAppService.makeExcelFile(busNo, response);
}
>>>>>>> v1.3
}

View File

@@ -1,25 +1,17 @@
package com.openhis.web.inventorymanage.controller;
<<<<<<< HEAD
=======
import java.util.List;
>>>>>>> v1.3
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*;
<<<<<<< HEAD
import com.core.common.core.domain.R;
import com.openhis.web.inventorymanage.appservice.IProductDetailAppService;
=======
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.web.inventorymanage.appservice.IProductDetailAppService;
import com.openhis.web.inventorymanage.dto.ProductDetailPageDto;
>>>>>>> v1.3
import com.openhis.web.inventorymanage.dto.ProductDetailSearchParam;
import lombok.extern.slf4j.Slf4j;
@@ -59,21 +51,15 @@ public class ProductDetailController {
* @return 库存商品明细分页列表
*/
@GetMapping(value = "/product-page")
<<<<<<< HEAD
public R<?> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam,
=======
public R<Page<ProductDetailPageDto>> getProductDetailPage(ProductDetailSearchParam productDetailSearchParam,
>>>>>>> v1.3
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return productDetailsAppService.getProductDetailPage(productDetailSearchParam, pageNo, pageSize, searchKey,
request);
request);
}
/**
<<<<<<< HEAD
=======
* 查询库存商品备份明细分页列表
*
* @param productDetailSearchParam 查询条件
@@ -85,15 +71,14 @@ public class ProductDetailController {
*/
@GetMapping(value = "/product-backup-page")
public R<Page<ProductDetailPageDto>> getProductDetailBackupPage(ProductDetailSearchParam productDetailSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return productDetailsAppService.getProductDetailBackupPage(productDetailSearchParam, pageNo, pageSize,
searchKey, request);
searchKey, request);
}
/**
>>>>>>> v1.3
* 查询库存商品明细统计数据
*
* @param productDetailSearchParam 查询条件
@@ -103,21 +88,11 @@ public class ProductDetailController {
*/
@GetMapping(value = "/product-statistics")
public R<?> getProductDetailStatistics(ProductDetailSearchParam productDetailSearchParam,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return productDetailsAppService.getProductDetailStatistics(productDetailSearchParam, searchKey, request);
}
/**
<<<<<<< HEAD
* 操作:停供
*
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
@PutMapping("/stop-supply")
public R<?> stopSupplyById(@RequestBody Long inventoryId) {
return productDetailsAppService.stopSupplyById(inventoryId);
=======
* 查询库存商品备份明细统计数据
*
* @param productDetailSearchParam 查询条件
@@ -127,7 +102,7 @@ public class ProductDetailController {
*/
@GetMapping(value = "/product-backup-statistics")
public R<?> getProductDetailBackupStatistics(ProductDetailSearchParam productDetailSearchParam,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return productDetailsAppService.getProductDetailBackupStatistics(productDetailSearchParam, searchKey, request);
}
@@ -140,54 +115,31 @@ public class ProductDetailController {
@PutMapping("/stop-supply")
public R<?> stopSupplyById(@RequestBody List<Long> inventoryIdList) {
return productDetailsAppService.stopSupplyById(inventoryIdList);
>>>>>>> v1.3
}
/**
* 操作:取消停供
*
<<<<<<< HEAD
* @param inventoryId 库存项目管理ID
* @return 操作结果
*/
@PutMapping("/cancel-supply")
public R<?> cancelSupplyById(@RequestBody Long inventoryId) {
return productDetailsAppService.cancelSupplyById(inventoryId);
=======
* @param inventoryIdList 库存项目管理ID
* @return 操作结果
*/
@PutMapping("/cancel-supply")
public R<?> cancelSupplyById(@RequestBody List<Long> inventoryIdList) {
return productDetailsAppService.cancelSupplyById(inventoryIdList);
>>>>>>> v1.3
}
/**
* 库存明细表导出
*
* @param productDetailSearchParam 查询条件
<<<<<<< HEAD
* @param pageNo 当前页码
* @param pageSize 查询条数
=======
>>>>>>> v1.3
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @param response 响应数据
*/
@GetMapping(value = "/excel-out")
public void makeExcelFile(ProductDetailSearchParam productDetailSearchParam,
<<<<<<< HEAD
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
HttpServletResponse response) {
productDetailsAppService.makeExcelFile(productDetailSearchParam, pageNo, pageSize, searchKey, request,
response);
=======
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
HttpServletResponse response) {
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
HttpServletResponse response) {
productDetailsAppService.makeExcelFile(productDetailSearchParam, searchKey, request, response);
}
@@ -201,11 +153,10 @@ public class ProductDetailController {
*/
@GetMapping(value = "/export-excel")
public void exportExcel(ProductDetailSearchParam productDetailSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
HttpServletResponse response) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
HttpServletResponse response) {
productDetailsAppService.exportExcel(productDetailSearchParam, pageNo, pageSize, searchKey, request, response);
>>>>>>> v1.3
}
}

View File

@@ -23,193 +23,265 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class ProductDetailPageDto {
/** 库存项目管理ID停供用 */
/**
* 库存项目管理ID停供用
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long inventoryId;
/** 生产日期 */
/**
* 生产日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", sort = 19, dateFormat = "yyyy-MM-dd")
private Date productionDate;
/** 失效日期 */
/**
* 失效日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
@Excel(name = "有效期至", sort = 20, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
/** 库存状态 */
/**
* 库存状态
*/
private Integer inventoryStatusEnum;
private String inventoryStatusEnum_enumText;
/** 仓库 */
/**
* 仓库
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long locationId;
/** 仓库名称 */
/**
* 仓库名称
*/
@Excel(name = "仓库", sort = 4)
private String locationName;
/** 货位 */
/**
* 货位
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long locationStoreId;
/** 货位名称 */
/**
* 货位名称
*/
@Excel(name = "货位", sort = 22)
private String locationStoreName;
/** 生产批号 */
/**
* 生产批号
*/
@Excel(name = "生产批号", sort = 7)
private String lotNumber;
/** 库存数量 */
/**
* 库存数量
*/
private BigDecimal quantity;
@Excel(name = "库存(最小单位)", sort = 9)
private String quantity_text;
/** 包装单位数量(整数部分) */
/**
* 包装单位数量(整数部分)
*/
private BigDecimal number;
@Excel(name = "库存(包装单位)", sort = 8)
private String number_text;
/** 包装单位数量(余数部分) */
/**
* 包装单位数量(余数部分)
*/
private BigDecimal remainder;
/** 供应商 */
/**
* 供应商
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long supplierId;
/** 供应商名称 */
/**
* 供应商名称
*/
@Excel(name = "供应商", sort = 17)
private String supplierName;
<<<<<<< HEAD
=======
/** 项目id */
/**
* 项目id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long itemId;
>>>>>>> v1.3
/** 项目名称 */
/**
* 项目名称
*/
@Excel(name = "项目名称", sort = 2)
private String itemName;
/** 项目名称 */
/**
* 项目名称
*/
private String itemTable;
/** 项目编码 */
/**
* 项目编码
*/
@Excel(name = "药品编码", sort = 1)
private String busNo;
/** 耗材类型 */
/**
* 耗材类型
*/
@Dict(dictCode = "device_category_code")
private String devCategoryCode;
private String devCategoryCode_dictText;
private String devCategoryCodeDictText;
/** 药品类型 */
/**
* 药品类型
*/
@Dict(dictCode = "med_category_code")
private String medCategoryCode;
private String medCategoryCode_dictText;
private String medCategoryCodeDictText;
/** 项目类别 */
/**
* 项目类别
*/
@Excel(name = "项目类别", sort = 3)
private String CategoryCodeDictText;
/** 医保等级 */
/**
* 医保等级
*/
private Integer chrgitmLv;
@Excel(name = "医保等级", sort = 18)
private String chrgitmLv_enumText;
/** 厂家 */
/**
* 厂家
*/
@Excel(name = "厂家/产地", sort = 6)
private String manufacturerText;
/** 医保码 */
/**
* 医保码
*/
private String ybNo;
/** 五笔码 */
/**
* 五笔码
*/
private String wbStr;
/** 拼音码 */
/**
* 拼音码
*/
private String pyStr;
/** 包装单位 */
/**
* 包装单位
*/
@Dict(dictCode = "unit_code")
private String unitCode;
private String unitCode_dictText;
private String unitCodeDictText;
/** 库存单位 */
/**
* 库存单位
*/
@Dict(dictCode = "unit_code")
private String minUnitCode;
private String minUnitCode_dictText;
private String minUnitCodeDictText;
/** 拆零比 */
/**
* 拆零比
*/
@Excel(name = "拆零比", sort = 10, scale = 0)
private BigDecimal partPercent;
/** 批准文号/国药准字 */
/**
* 批准文号/国药准字
*/
@Excel(name = "国药准字", sort = 16)
private String approvalNumber;
/** 剂型 */
/**
* 剂型
*/
@Dict(dictCode = "dose_form_code")
private String doseFormCode;
private String doseFormCode_dictText;
@Excel(name = "剂型", sort = 15)
private String doseFormCodeDictText;
/** 规格 */
/**
* 规格
*/
@Excel(name = "规格", sort = 5)
private String totalVolume;
/** 零售价 */
/**
* 零售价
*/
private BigDecimal salePrice;
@Excel(name = "零售价", sort = 12)
private String excelSalePrice = "";
/** 定价id */
/**
* 定价id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long chargeItemDefId;
/** 进价 */
/**
* 进价
*/
private BigDecimal purchasePrice;
@Excel(name = "采购价格", sort = 11)
private String excelPurchasePrice = "";
/** 剩余过期天数 */
/**
* 剩余过期天数
*/
@Excel(name = "剩余过期天数", sort = 21)
private Integer remainingDays;
/** 总零售价 */
/**
* 总零售价
*/
private BigDecimal totalSalePrice;
@Excel(name = "零售价总额", sort = 14)
private String excelTotalSalePrice = "";
/** 总进价 */
/**
* 总进价
*/
private BigDecimal totalPurchasePrice;
<<<<<<< HEAD
@Excel(name = "进价总额", sort = 13, scale = 2)
=======
@Excel(name = "进价总额", sort = 13)
>>>>>>> v1.3
private String excelTotalPurchasePrice = "";
/** 售价统计 */
/**
* 售价统计
*/
private BigDecimal salePriceStatistics;
/** 进价统计 */
/**
* 进价统计
*/
private BigDecimal purchasePriceStatistics;
<<<<<<< HEAD
=======
/** 备份时间 */
/**
* 备份时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private Date backUpDate;
>>>>>>> v1.3
// 设置统计金额默认值为零
public ProductDetailPageDto() {
this.totalSalePrice = BigDecimal.ZERO;

View File

@@ -1,9 +1,6 @@
package com.openhis.web.inventorymanage.dto;
<<<<<<< HEAD
=======
import java.util.Date;
>>>>>>> v1.3
import java.util.List;
import lombok.Data;
@@ -19,41 +16,53 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class ProductDetailSearchParam {
/** 剩余过期天数 */
/**
* 剩余过期天数
*/
private Integer remainingDays;
<<<<<<< HEAD
/** 项目类型 */
private Integer categoryCode;
=======
/** 药品类型 */
/**
* 药品类型
*/
private List<String> medCategoryCodes;
/** 耗材类型 */
/**
* 耗材类型
*/
private List<String> devCategoryCodes;
>>>>>>> v1.3
/** 医保等级 */
/**
* 医保等级
*/
private Integer chrgitmLv;
/** 仓库药房列表 */
/**
* 仓库药房列表
*/
private List<Long> locationIds;
/** 供应商列表 */
/**
* 供应商列表
*/
private List<Long> supplierIds;
/** 是否为零 */
/**
* 是否为零
*/
private Integer zeroFlag;
/** 停用状态 */
/**
* 停用状态
*/
private Integer inventoryStatusEnum;
/** 项目所在表 */
/**
* 项目所在表
*/
private String itemTable;
<<<<<<< HEAD
=======
/** 备份时间 */
/**
* 备份时间
*/
private Date backUpDate;
>>>>>>> v1.3
}

View File

@@ -6,14 +6,9 @@ package com.openhis.web.inventorymanage.dto;
import java.math.BigDecimal;
import java.util.Date;
<<<<<<< HEAD
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
=======
import org.springframework.format.annotation.DateTimeFormat;
import com.core.common.annotation.Excel;
>>>>>>> v1.3
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@@ -21,11 +16,6 @@ import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
<<<<<<< HEAD
import org.apache.poi.hpsf.Decimal;
import org.springframework.format.annotation.DateTimeFormat;
=======
>>>>>>> v1.3
/**
* 单据分页列表 dto
@@ -37,24 +27,34 @@ import org.springframework.format.annotation.DateTimeFormat;
@Accessors(chain = true)
public class ReceiptPageDto {
/** 单据号 */
/**
* 单据号
*/
@Excel(name = "单据号", sort = 1)
private String supplyBusNo;
/** 状态 */
/**
* 状态
*/
private Integer statusEnum;
// @Excel(name = "审批状态", sort = 2)
private String statusEnum_enumText;
/** 退货状态 */
/**
* 退货状态
*/
private Integer returnStatus;
/** 类型 */
/**
* 类型
*/
private Integer typeEnum;
@Excel(name = "单据类型", sort = 3)
private String typeEnum_enumText;
/** 供应商 */
/**
* 供应商
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
@JsonSerialize(using = ToStringSerializer.class)
private Long supplierId;
@@ -62,7 +62,9 @@ public class ReceiptPageDto {
@Excel(name = "供应商", sort = 5)
private String supplierIdDictText;
/** 目的仓库 */
/**
* 目的仓库
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_location")
@JsonSerialize(using = ToStringSerializer.class)
private Long purposeLocationId;
@@ -70,16 +72,22 @@ public class ReceiptPageDto {
@Excel(name = "目的仓库", sort = 6)
private String purposeLocationIdDictText;
/** 目的仓位 */
/**
* 目的仓位
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_location")
@JsonSerialize(using = ToStringSerializer.class)
private Long purposeLocationStoreId;
private String purposeLocationStoreId_dictText;
/** 盈亏金额 */
/**
* 盈亏金额
*/
private BigDecimal breakevenPrice;
/** 经手人 */
/**
* 经手人
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
@JsonSerialize(using = ToStringSerializer.class)
private Long practitionerId;
@@ -87,18 +95,24 @@ public class ReceiptPageDto {
@Excel(name = "经手人", sort = 4)
private String practitionerIdDictText;
/** 审批人 */
/**
* 审批人
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
private Long approverId;
private String approverId_dictText;
@Excel(name = "审批人", sort = 10)
private String approverIdDictText;
/** 审批时间 */
/**
* 审批时间
*/
@Excel(name = "审批时间", sort = 11, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date approvalTime;
/** 申请人 */
/**
* 申请人
*/
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
@JsonSerialize(using = ToStringSerializer.class)
private Long applicantId;
@@ -106,38 +120,46 @@ public class ReceiptPageDto {
@Excel(name = "申请人", sort = 8)
private String applicantIdDictText;
/** 申请时间 */
/**
* 申请时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
<<<<<<< HEAD
=======
// @Excel(name = "申请时间", sort = 9, dateFormat = "yyyy-MM-dd HH:mm:ss")
>>>>>>> v1.3
private Date applyTime;
/** 制单日期 */
/**
* 制单日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
<<<<<<< HEAD
=======
// @Excel(name = "申请时间", sort = 9, dateFormat = "yyyy-MM-dd HH:mm:ss")
>>>>>>> v1.3
private Date createTime;
/** 备注 */
/**
* 备注
*/
private String remake;
/** 项目所在表名 */
/**
* 项目所在表名
*/
private String itemTable;
/** 药品类型 */
/**
* 药品类型
*/
private Integer itemType;
/** 目的仓库类型 */
/**
* 目的仓库类型
*/
private Integer purposeTypeEnum;
private String purposeTypeEnum_enumText;
/** 追溯码 */
/**
* 追溯码
*/
private String traceNo;
/**
* 24、药品
@@ -148,12 +170,8 @@ public class ReceiptPageDto {
/*
* 总金额
*/
<<<<<<< HEAD
private BigDecimal totalAmount;
=======
@Excel(name = "总金额", sort = 7,scale = 2)
@Excel(name = "总金额", sort = 7, scale = 2)
private BigDecimal totalAmount;
private String totalAmountText;
>>>>>>> v1.3
}

View File

@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.adjustprice.dto.ChangePricePageDto;
import com.openhis.web.inventorymanage.dto.ReceiptApprovalSearchParam;
import com.openhis.web.inventorymanage.dto.ReceiptPageDto;
<<<<<<< HEAD
=======
import org.springframework.stereotype.Repository;
>>>>>>> v1.3
/**
* @ClassName AdjustPriceMapper
@@ -20,13 +17,11 @@ import org.springframework.stereotype.Repository;
* @Author raymond
* @Date 2025/10/23 14:41
* @Version 1.0
**/
<<<<<<< HEAD
@Component
=======
*
*/
@Repository
>>>>>>> v1.3
public interface InventoryAdjustPriceMapper {
/**
* 查询单据审批分页列表
*
@@ -38,8 +33,8 @@ public interface InventoryAdjustPriceMapper {
* @return 单据审批分页列表
*/
Page<ChangePricePageDto> searchPageByExamine(@Param("page") Page<ReceiptPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<ReceiptApprovalSearchParam> queryWrapper,
@Param("approval") Integer approval, @Param("agree") Integer agree, @Param("reject") Integer reject,
@Param("medCategory") Integer medTypeEnum, @Param("deviceCategory") Integer deviceTypeEnum,
@Param("activityCategory") Integer activityTypeEnum, @Param("healthCategory") Integer healthTypeEnum);
@Param(Constants.WRAPPER) QueryWrapper<ReceiptApprovalSearchParam> queryWrapper,
@Param("approval") Integer approval, @Param("agree") Integer agree, @Param("reject") Integer reject,
@Param("medCategory") Integer medTypeEnum, @Param("deviceCategory") Integer deviceTypeEnum,
@Param("activityCategory") Integer activityTypeEnum, @Param("healthCategory") Integer healthTypeEnum);
}

View File

@@ -3,11 +3,8 @@
*/
package com.openhis.web.inventorymanage.mapper;
<<<<<<< HEAD
=======
import java.util.List;
>>>>>>> v1.3
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -28,7 +25,7 @@ public interface ProductDetailAppMapper {
/**
* 查询库存商品明细分页列表
*
*
* @param page 分页
* @param queryWrapper 查询条件
* @param medMedicationDefinition 药品
@@ -37,36 +34,23 @@ public interface ProductDetailAppMapper {
* @return 库存商品明细分页列表
*/
Page<ProductDetailPageDto> selectProductDetailsPage(@Param("page") Page<ProductDetailPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("lotNumberCost") String lotNumberCost);
<<<<<<< HEAD
/**
* 查询库存商品明细分页列表,联查数据字典
*
* @param page 分页
=======
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("lotNumberCost") String lotNumberCost);
/**
* 查询库存商品明细分页列表,联查数据字典翻译单位字段
*
>>>>>>> v1.3
* @param queryWrapper 查询条件
* @param medMedicationDefinition 药品
* @param admDeviceDefinition 耗材
* @param lotNumberCost 批号进价
* @return 库存商品明细分页列表
*/
<<<<<<< HEAD
Page<ProductDetailPageDto> selectProductDetailsPageX(@Param("page") Page<ProductDetailPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("lotNumberCost") String lotNumberCost);
=======
List<ProductDetailPageDto> getProductDetailPageAndTranslateField(
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("lotNumberCost") String lotNumberCost);
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("lotNumberCost") String lotNumberCost);
/**
* 查询库存商品备份明细分页列表
@@ -76,6 +60,5 @@ public interface ProductDetailAppMapper {
* @return 库存商品备份明细分页列表
*/
Page<ProductDetailPageDto> selectProductDetailsBackupPage(@Param("page") Page<ProductDetailPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper);
>>>>>>> v1.3
@Param(Constants.WRAPPER) QueryWrapper<ProductDetailSearchParam> queryWrapper);
}

View File

@@ -26,7 +26,7 @@ public interface IGfStudentListAppService {
* @return 学生名单分页
*/
R<IPage<GfStudentListDto>> getPage(GfStudentListDto searchParam, String searchKey, Integer pageNo,
Integer pageSize);
Integer pageSize);
/**
* 查询学生名单详情
@@ -38,7 +38,7 @@ public interface IGfStudentListAppService {
/**
* 添加学生名单
*
*
* @param gfStudentListDto 学生名单Dto
* @return 结果
*/
@@ -74,13 +74,10 @@ public interface IGfStudentListAppService {
* @param response 响应
*/
void importTemplate(HttpServletResponse response);
<<<<<<< HEAD
=======
/**
* peis数据同步
*/
R<?> synPeis();
>>>>>>> v1.3
}

View File

@@ -5,10 +5,7 @@ import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
<<<<<<< HEAD
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -19,10 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
<<<<<<< HEAD
import com.core.common.enums.DeleteFlag;
=======
>>>>>>> v1.3
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.DateUtils;
import com.core.common.utils.SecurityUtils;
@@ -83,18 +76,18 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
*/
@Override
public R<IPage<GfRatioApplicationRecordDto>> getPage(GfRatioApplicationRecordDto searchParam, String printable,
String searchKey, Integer pageNo, Integer pageSize) {
String searchKey, Integer pageNo, Integer pageSize) {
// 构造查询条件
QueryWrapper<GfRatioApplicationRecordDto> queryWrapper = HisQueryUtils.buildQueryWrapper(searchParam, searchKey,
new HashSet<>(Set.of("application_no", "bus_no", "name", "py_str", "wb_str", "yb_no")), null);
new HashSet<>(Set.of("application_no", "bus_no", "name", "py_str", "wb_str", "yb_no")), null);
// 可打印筛选
if (Whether.YES.getCode().equals(printable)) {
queryWrapper.eq("application_status", GfApplicationStatus.PROCESSING.getValue()).eq("final_approval_result",
GfApplicationStatus.PROCESSING.getValue());
GfApplicationStatus.PROCESSING.getValue());
}
// 查询比例调整申请记录分页
IPage<GfRatioApplicationRecordDto> page = gfRatioApplicationRecordAppMapper
.selectGfRatioApplicationRecordPage(new Page<>(pageNo, pageSize), queryWrapper);
.selectGfRatioApplicationRecordPage(new Page<>(pageNo, pageSize), queryWrapper);
for (GfRatioApplicationRecordDto r : page.getRecords()) {
// 翻译非字典枚举
GfItemType gfItemType = GfItemType.getByValue(r.getItemType());
@@ -125,68 +118,68 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
String ybNo = null;
if (GfItemType.MEDICATION.getValue().equals(gfRatioApplication.getItemType())) {
// 如果是药品,获取并设置药品定义信息
MedicationDefinition medicationDefinition =
medicationDefinitionService.getById(gfRatioApplication.getDefinitionId());
MedicationDefinition medicationDefinition
= medicationDefinitionService.getById(gfRatioApplication.getDefinitionId());
if (medicationDefinition != null) {
gfRatioApplicationRecordDto.setBusNo(medicationDefinition.getBusNo())
.setName(medicationDefinition.getName()).setYbNo(medicationDefinition.getYbNo())
// 公费项目分类:药品
.setItemTypeName(GfItemType.MEDICATION.getInfo());
chrgitmLv =
Optional.of(medicationDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue()).toString();
.setName(medicationDefinition.getName()).setYbNo(medicationDefinition.getYbNo())
// 公费项目分类:药品
.setItemTypeName(GfItemType.MEDICATION.getInfo());
chrgitmLv
= Optional.of(medicationDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue()).toString();
ybNo = medicationDefinition.getYbNo();
}
} else if (GfItemType.ACTIVITY.getValue().equals(gfRatioApplication.getItemType())) {
// 如果是诊疗,获取并设置诊疗定义信息
ActivityDefinition activityDefinition =
activityDefinitionService.getById(gfRatioApplication.getDefinitionId());
ActivityDefinition activityDefinition
= activityDefinitionService.getById(gfRatioApplication.getDefinitionId());
if (activityDefinition != null) {
gfRatioApplicationRecordDto.setBusNo(activityDefinition.getBusNo())
.setName(activityDefinition.getName()).setYbNo(activityDefinition.getYbNo())
// 公费项目分类:诊疗
.setItemTypeName(GfItemType.ACTIVITY.getInfo());
chrgitmLv =
Optional.of(activityDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue()).toString();
.setName(activityDefinition.getName()).setYbNo(activityDefinition.getYbNo())
// 公费项目分类:诊疗
.setItemTypeName(GfItemType.ACTIVITY.getInfo());
chrgitmLv
= Optional.of(activityDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue()).toString();
ybNo = activityDefinition.getYbNo();
}
defTableName = CommonConstants.TableName.WOR_ACTIVITY_DEFINITION;
}
YbChrgitmLv ybChrgitmLv = YbChrgitmLv.getByCode(chrgitmLv);
// 查询原支付比例
Pair<Pair<BigDecimal, BigDecimal>, BigDecimal> oldRatiosAndPrice =
this.getOldRatiosAndPrice(gfRatioApplication.getDefinitionId(), defTableName, chrgitmLv);
Pair<Pair<BigDecimal, BigDecimal>, BigDecimal> oldRatiosAndPrice
= this.getOldRatiosAndPrice(gfRatioApplication.getDefinitionId(), defTableName, chrgitmLv);
// Dto赋值返回
gfRatioApplicationRecordDto.setId(gfRatioApplication.getId()).setApplicationNo(gfRatioApplication.getBusNo())
.setItemType(gfRatioApplication.getItemType())
// 医保编号
.setYbNo(ybNo)
// 医保等级名称
.setChrgitmLvName(ybChrgitmLv == null ? null : ybChrgitmLv.getInfo())
.setApplicationRatio(gfRatioApplication.getApplicationRatio())
.setOldRatio(oldRatiosAndPrice.getLeft().getLeft()).setTotalPrice(oldRatiosAndPrice.getRight())
// 价格差:计算得出
.setPriceDiff(oldRatiosAndPrice.getLeft().getLeft() != null
&& gfRatioApplication.getApplicationRatio() != null && oldRatiosAndPrice.getRight() != null
? gfRatioApplication.getApplicationRatio().subtract(oldRatiosAndPrice.getLeft().getLeft())
.multiply(oldRatiosAndPrice.getRight()).divide(new BigDecimal(100), RoundingMode.UNNECESSARY)
: null)
.setTwiceRatio(gfRatioApplication.getTwiceRatio()).setOldTwiceRatio(oldRatiosAndPrice.getLeft().getRight())
.setStartDate(gfRatioApplication.getStartDate()).setEndDate(gfRatioApplication.getEndDate())
.setApplicationStatus(gfRatioApplication.getApplicationStatus())
.setApplicant(gfRatioApplication.getApplicant()).setApplicationTime(gfRatioApplication.getApplicationTime())
.setApplicationReason(gfRatioApplication.getApplicationReason())
.setInitialApprover(gfRatioApplication.getInitialApprover())
.setInitialApprovalResult(gfRatioApplication.getInitialApprovalResult())
.setInitialApprovalTime(gfRatioApplication.getInitialApprovalTime())
.setInitialApprovalOpinion(gfRatioApplication.getInitialApprovalOpinion())
.setFinanceApprover(gfRatioApplication.getFinanceApprover())
.setFinanceApprovalResult(gfRatioApplication.getFinanceApprovalResult())
.setFinanceApprovalTime(gfRatioApplication.getFinanceApprovalTime())
.setFinanceApprovalOpinion(gfRatioApplication.getFinanceApprovalOpinion())
.setFinalRecorder(gfRatioApplication.getFinalRecorder())
.setFinalApprovalResult(gfRatioApplication.getFinalApprovalResult())
.setFinalRecordTime(gfRatioApplication.getFinalRecordTime())
.setFinalApprovalOpinion(gfRatioApplication.getFinalApprovalOpinion());
.setItemType(gfRatioApplication.getItemType())
// 医保编号
.setYbNo(ybNo)
// 医保等级名称
.setChrgitmLvName(ybChrgitmLv == null ? null : ybChrgitmLv.getInfo())
.setApplicationRatio(gfRatioApplication.getApplicationRatio())
.setOldRatio(oldRatiosAndPrice.getLeft().getLeft()).setTotalPrice(oldRatiosAndPrice.getRight())
// 价格差:计算得出
.setPriceDiff(oldRatiosAndPrice.getLeft().getLeft() != null
&& gfRatioApplication.getApplicationRatio() != null && oldRatiosAndPrice.getRight() != null
? gfRatioApplication.getApplicationRatio().subtract(oldRatiosAndPrice.getLeft().getLeft())
.multiply(oldRatiosAndPrice.getRight()).divide(new BigDecimal(100), RoundingMode.UNNECESSARY)
: null)
.setTwiceRatio(gfRatioApplication.getTwiceRatio()).setOldTwiceRatio(oldRatiosAndPrice.getLeft().getRight())
.setStartDate(gfRatioApplication.getStartDate()).setEndDate(gfRatioApplication.getEndDate())
.setApplicationStatus(gfRatioApplication.getApplicationStatus())
.setApplicant(gfRatioApplication.getApplicant()).setApplicationTime(gfRatioApplication.getApplicationTime())
.setApplicationReason(gfRatioApplication.getApplicationReason())
.setInitialApprover(gfRatioApplication.getInitialApprover())
.setInitialApprovalResult(gfRatioApplication.getInitialApprovalResult())
.setInitialApprovalTime(gfRatioApplication.getInitialApprovalTime())
.setInitialApprovalOpinion(gfRatioApplication.getInitialApprovalOpinion())
.setFinanceApprover(gfRatioApplication.getFinanceApprover())
.setFinanceApprovalResult(gfRatioApplication.getFinanceApprovalResult())
.setFinanceApprovalTime(gfRatioApplication.getFinanceApprovalTime())
.setFinanceApprovalOpinion(gfRatioApplication.getFinanceApprovalOpinion())
.setFinalRecorder(gfRatioApplication.getFinalRecorder())
.setFinalApprovalResult(gfRatioApplication.getFinalApprovalResult())
.setFinalRecordTime(gfRatioApplication.getFinalRecordTime())
.setFinalApprovalOpinion(gfRatioApplication.getFinalApprovalOpinion());
return R.ok(gfRatioApplicationRecordDto);
}
@@ -200,37 +193,33 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
public R<?> add(GfRatioApplicationRecordDto gfRatioApplicationRecordDto) {
// 查询指定项目现行比例
List<GfRatio> gfRatioList = gfRatioService.list(new LambdaQueryWrapper<GfRatio>()
.eq(GfRatio::getDefinitionId, gfRatioApplicationRecordDto.getDefinitionId())
<<<<<<< HEAD
.eq(GfRatio::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
.eq(GfRatio::getDefinitionId, gfRatioApplicationRecordDto.getDefinitionId())
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
// 验证时间是否重叠
if (!gfRatioList.isEmpty()) {
for (GfRatio r : gfRatioList) {
if (!r.getStartDate().after(gfRatioApplicationRecordDto.getEndDate())
&& !r.getEndDate().before(gfRatioApplicationRecordDto.getStartDate())) {
&& !r.getEndDate().before(gfRatioApplicationRecordDto.getStartDate())) {
return R.fail("该项目此次申请的开始结束时间与现行比例开始结束时间有重叠,请确认");
}
}
}
// 创建申请
GfRatioApplication gfRatioApplication = new GfRatioApplication()
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.GF_RATIO_APPLICATION.getPrefix(), 4))
.setItemType(gfRatioApplicationRecordDto.getItemType())
.setApplicationRatio(gfRatioApplicationRecordDto.getApplicationRatio())
.setTwiceRatio(gfRatioApplicationRecordDto.getTwiceRatio())
.setStartDate(gfRatioApplicationRecordDto.getStartDate())
// 结束时间调整为当天23点59分59秒
.setEndDate(DateUtils.addSeconds(DateUtils.addDays(gfRatioApplicationRecordDto.getEndDate(), 1), -1))
// 申请状态:处理中
.setApplicationStatus(GfApplicationStatus.PROCESSING.getValue()).setApplicant(SecurityUtils.getNickName())
.setApplicationTime(DateUtils.getNowDate())
.setApplicationReason(gfRatioApplicationRecordDto.getApplicationReason())
// 测算通过or驳回处理中
.setInitialApprovalResult(GfApplicationStatus.PROCESSING.getValue())
.setDefinitionId(gfRatioApplicationRecordDto.getDefinitionId());
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.GF_RATIO_APPLICATION.getPrefix(), 4))
.setItemType(gfRatioApplicationRecordDto.getItemType())
.setApplicationRatio(gfRatioApplicationRecordDto.getApplicationRatio())
.setTwiceRatio(gfRatioApplicationRecordDto.getTwiceRatio())
.setStartDate(gfRatioApplicationRecordDto.getStartDate())
// 结束时间调整为当天23点59分59秒
.setEndDate(DateUtils.addSeconds(DateUtils.addDays(gfRatioApplicationRecordDto.getEndDate(), 1), -1))
// 申请状态:处理中
.setApplicationStatus(GfApplicationStatus.PROCESSING.getValue()).setApplicant(SecurityUtils.getNickName())
.setApplicationTime(DateUtils.getNowDate())
.setApplicationReason(gfRatioApplicationRecordDto.getApplicationReason())
// 测算通过or驳回处理中
.setInitialApprovalResult(GfApplicationStatus.PROCESSING.getValue())
.setDefinitionId(gfRatioApplicationRecordDto.getDefinitionId());
gfRatioApplicationService.save(gfRatioApplication);
return R.ok();
}
@@ -250,15 +239,15 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
}
// 状态验证
if (!GfApplicationStatus.PROCESSING.getValue().equals(gfRatioApplication.getApplicationStatus())
&& !GfApplicationStatus.PROCESSING.getValue().equals(gfRatioApplication.getInitialApprovalResult())) {
&& !GfApplicationStatus.PROCESSING.getValue().equals(gfRatioApplication.getInitialApprovalResult())) {
return R.fail("该申请已不可取消");
}
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(), new LambdaUpdateWrapper<GfRatioApplication>()
// 申请状态:取消
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.CANCELLED.getValue())
// 测算通过or驳回NULL
.set(GfRatioApplication::getInitialApprovalResult, null).eq(GfRatioApplication::getId, id));
// 申请状态:取消
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.CANCELLED.getValue())
// 测算通过or驳回NULL
.set(GfRatioApplication::getInitialApprovalResult, null).eq(GfRatioApplication::getId, id));
return null;
}
@@ -300,32 +289,32 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
if (GfApplicationStatus.APPROVED.getValue().equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(),
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getInitialApprover, loginUserName)
// 测算通过or驳回通过
.set(GfRatioApplication::getInitialApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getInitialApprovalTime, now)
.set(GfRatioApplication::getInitialApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 财务科通过or驳回处理中
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.PROCESSING.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getInitialApprover, loginUserName)
// 测算通过or驳回通过
.set(GfRatioApplication::getInitialApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getInitialApprovalTime, now)
.set(GfRatioApplication::getInitialApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 财务科通过or驳回处理中
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.PROCESSING.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
// 申请驳回
} else if (GfApplicationStatus.REJECTED.getValue()
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(),
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getInitialApprover, loginUserName)
// 测算通过or驳回驳回
.set(GfRatioApplication::getInitialApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getInitialApprovalTime, now)
.set(GfRatioApplication::getInitialApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getInitialApprover, loginUserName)
// 测算通过or驳回驳回
.set(GfRatioApplication::getInitialApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getInitialApprovalTime, now)
.set(GfRatioApplication::getInitialApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
} else {
return R.fail("通过or驳回指定错误");
}
@@ -340,32 +329,32 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
if (GfApplicationStatus.APPROVED.getValue().equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(),
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinanceApprover, loginUserName)
// 财务科通过or驳回通过
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getFinanceApprovalTime, now)
.set(GfRatioApplication::getFinanceApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 会议通过or驳回处理中
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.PROCESSING.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinanceApprover, loginUserName)
// 财务科通过or驳回通过
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getFinanceApprovalTime, now)
.set(GfRatioApplication::getFinanceApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 会议通过or驳回处理中
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.PROCESSING.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
// 申请驳回
} else if (GfApplicationStatus.REJECTED.getValue()
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(),
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinanceApprover, loginUserName)
// 财务科通过or驳回驳回
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getFinanceApprovalTime, now)
.set(GfRatioApplication::getFinanceApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinanceApprover, loginUserName)
// 财务科通过or驳回驳回
.set(GfRatioApplication::getFinanceApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getFinanceApprovalTime, now)
.set(GfRatioApplication::getFinanceApprovalOpinion,
gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
} else {
return R.fail("通过or驳回指定错误");
}
@@ -380,36 +369,36 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
if (GfApplicationStatus.APPROVED.getValue().equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(), new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinalRecorder, loginUserName)
// 会议通过or驳回通过
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getFinalRecordTime, now)
.set(GfRatioApplication::getFinalApprovalOpinion, gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:通过
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.APPROVED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
.set(GfRatioApplication::getFinalRecorder, loginUserName)
// 会议通过or驳回通过
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.APPROVED.getValue())
.set(GfRatioApplication::getFinalRecordTime, now)
.set(GfRatioApplication::getFinalApprovalOpinion, gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:通过
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.APPROVED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
// 创建现行自付比例
GfRatio gfRatio = new GfRatio()
// 比例类型:单项比例
.setRatioType(GfRatioType.INDIVIDUAL_RATIO.getValue()).setItemType(gfRatioApplication.getItemType())
.setSelfRatio(gfRatioApplication.getApplicationRatio())
.setTwiceRatio(gfRatioApplication.getTwiceRatio()).setStartDate(gfRatioApplication.getStartDate())
.setEndDate(gfRatioApplication.getEndDate()).setDefinitionId(gfRatioApplication.getDefinitionId());
// 比例类型:单项比例
.setRatioType(GfRatioType.INDIVIDUAL_RATIO.getValue()).setItemType(gfRatioApplication.getItemType())
.setSelfRatio(gfRatioApplication.getApplicationRatio())
.setTwiceRatio(gfRatioApplication.getTwiceRatio()).setStartDate(gfRatioApplication.getStartDate())
.setEndDate(gfRatioApplication.getEndDate()).setDefinitionId(gfRatioApplication.getDefinitionId());
gfRatioService.save(gfRatio);
// 申请驳回
} else if (GfApplicationStatus.REJECTED.getValue()
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
.equals(gfRatioApplicationProcessDto.getApprovalResult())) {
// 申请驳回,更新申请记录
gfRatioApplicationService.update(new GfRatioApplication(), new LambdaUpdateWrapper<GfRatioApplication>()
.set(GfRatioApplication::getFinalRecorder, loginUserName)
// 财务科通过or驳回驳回
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getFinalRecordTime, now)
.set(GfRatioApplication::getFinalApprovalOpinion, gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
.set(GfRatioApplication::getFinalRecorder, loginUserName)
// 财务科通过or驳回驳回
.set(GfRatioApplication::getFinalApprovalResult, GfApplicationStatus.REJECTED.getValue())
.set(GfRatioApplication::getFinalRecordTime, now)
.set(GfRatioApplication::getFinalApprovalOpinion, gfRatioApplicationProcessDto.getApprovalOpinion())
// 申请状态:驳回
.set(GfRatioApplication::getApplicationStatus, GfApplicationStatus.REJECTED.getValue())
.eq(GfRatioApplication::getId, gfRatioApplicationProcessDto.getId()));
} else {
return R.fail("通过or驳回指定错误");
}
@@ -431,14 +420,14 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
*/
@Override
public R<IPage<GfRatioApplicationDefinitionSelectDto>> getDefinitionSelectPage(
GfRatioApplicationDefinitionSelectDto searchParam, String searchKey, Integer itemType, Integer pageNo,
Integer pageSize) {
GfRatioApplicationDefinitionSelectDto searchParam, String searchKey, Integer itemType, Integer pageNo,
Integer pageSize) {
// 构造查询条件
QueryWrapper<GfRatioApplicationDefinitionSelectDto> queryWrapper = HisQueryUtils.buildQueryWrapper(searchParam,
searchKey, new HashSet<>(Set.of("bus_no", "name", "py_str", "wb_str", "yb_no")), null);
searchKey, new HashSet<>(Set.of("bus_no", "name", "py_str", "wb_str", "yb_no")), null);
// 查询比例调整申请记录分页
IPage<GfRatioApplicationDefinitionSelectDto> page = gfRatioApplicationRecordAppMapper
.selectGfRatioApplicationDefinitionSelectPage(itemType, new Page<>(pageNo, pageSize), queryWrapper);
.selectGfRatioApplicationDefinitionSelectPage(itemType, new Page<>(pageNo, pageSize), queryWrapper);
// 翻译非字典枚举
for (GfRatioApplicationDefinitionSelectDto dto : page.getRecords()) {
YbChrgitmLv ybChrgitmLv = YbChrgitmLv.getByValue(dto.getChrgitmLv());
@@ -461,7 +450,7 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
List<Long> idList;
try {
idList = Arrays.stream(ids.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf)
.collect(Collectors.toList());
.collect(Collectors.toList());
} catch (NumberFormatException e) {
return R.fail("传参有误");
}
@@ -469,9 +458,9 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
return R.ok(Collections.emptyList());
}
// 查询要打印的申请单
List<GfRatioApplication> applicationList =
gfRatioApplicationService.list(new LambdaQueryWrapper<GfRatioApplication>()
.in(GfRatioApplication::getId, idList).orderByDesc(GfRatioApplication::getId));
List<GfRatioApplication> applicationList
= gfRatioApplicationService.list(new LambdaQueryWrapper<GfRatioApplication>()
.in(GfRatioApplication::getId, idList).orderByDesc(GfRatioApplication::getId));
if (applicationList.isEmpty()) {
return R.ok(Collections.emptyList());
}
@@ -485,52 +474,52 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
String defTableName = CommonConstants.TableName.MED_MEDICATION_DEFINITION;
if (GfItemType.MEDICATION.getValue().equals(application.getItemType())) {
// 获取药品名称和医保等级
MedicationDefinition medicationDefinition =
medicationDefinitionService.getById(application.getDefinitionId());
MedicationDefinition medicationDefinition
= medicationDefinitionService.getById(application.getDefinitionId());
if (medicationDefinition != null) {
itemName = medicationDefinition.getName();
ybLv = Optional.of(medicationDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue())
.toString();
.toString();
}
} else if (GfItemType.ACTIVITY.getValue().equals(application.getItemType())) {
// 获取诊疗名称和医保等级
ActivityDefinition activityDefinition =
activityDefinitionService.getById(application.getDefinitionId());
ActivityDefinition activityDefinition
= activityDefinitionService.getById(application.getDefinitionId());
if (activityDefinition != null) {
itemName = activityDefinition.getName();
ybLv = Optional.of(activityDefinition.getChrgitmLv()).orElse(YbChrgitmLv.SELF_PAY.getValue())
.toString();
.toString();
}
defTableName = CommonConstants.TableName.WOR_ACTIVITY_DEFINITION;
}
YbChrgitmLv ybChrgitmLv = YbChrgitmLv.getByCode(ybLv);
// 查询原支付比例和价格(包括二次比例)
Pair<Pair<BigDecimal, BigDecimal>, BigDecimal> oldRatiosAndPrice =
this.getOldRatiosAndPrice(application.getDefinitionId(), defTableName, ybLv);
Pair<Pair<BigDecimal, BigDecimal>, BigDecimal> oldRatiosAndPrice
= this.getOldRatiosAndPrice(application.getDefinitionId(), defTableName, ybLv);
BigDecimal oldRatio = oldRatiosAndPrice.getLeft().getLeft();
BigDecimal oldTwiceRatio = oldRatiosAndPrice.getLeft().getRight();
BigDecimal totalPrice = oldRatiosAndPrice.getRight();
// 作成返回Dto
printDto.setItemName(itemName)
// 全价
.setTotalPrice(totalPrice == null ? "" : totalPrice.stripTrailingZeros().toPlainString())
// 医保等级
.setChrgitmLv(ybChrgitmLv == null ? "" : ybChrgitmLv.getInfo())
// 原支付比例
.setOldRatio(oldRatio == null ? "" : oldRatio.stripTrailingZeros().toPlainString())
// 新支付比例
.setNewRatio(application.getApplicationRatio() == null ? ""
: application.getApplicationRatio().stripTrailingZeros().toPlainString())
// 价格差
.setPriceDiff(oldRatio != null && application.getApplicationRatio() != null && totalPrice != null
? application.getApplicationRatio().subtract(oldRatio).multiply(totalPrice)
.divide(new BigDecimal(100), RoundingMode.UNNECESSARY).stripTrailingZeros().toPlainString()
: "")
// 原二次支付比例
.setOldTwiceRatio(oldTwiceRatio == null ? "" : oldTwiceRatio.stripTrailingZeros().toPlainString())
// 新二次支付比例
.setNewTwiceRatio(application.getTwiceRatio() == null ? ""
: application.getTwiceRatio().stripTrailingZeros().toPlainString());
// 全价
.setTotalPrice(totalPrice == null ? "" : totalPrice.stripTrailingZeros().toPlainString())
// 医保等级
.setChrgitmLv(ybChrgitmLv == null ? "" : ybChrgitmLv.getInfo())
// 原支付比例
.setOldRatio(oldRatio == null ? "" : oldRatio.stripTrailingZeros().toPlainString())
// 新支付比例
.setNewRatio(application.getApplicationRatio() == null ? ""
: application.getApplicationRatio().stripTrailingZeros().toPlainString())
// 价格差
.setPriceDiff(oldRatio != null && application.getApplicationRatio() != null && totalPrice != null
? application.getApplicationRatio().subtract(oldRatio).multiply(totalPrice)
.divide(new BigDecimal(100), RoundingMode.UNNECESSARY).stripTrailingZeros().toPlainString()
: "")
// 原二次支付比例
.setOldTwiceRatio(oldTwiceRatio == null ? "" : oldTwiceRatio.stripTrailingZeros().toPlainString())
// 新二次支付比例
.setNewTwiceRatio(application.getTwiceRatio() == null ? ""
: application.getTwiceRatio().stripTrailingZeros().toPlainString());
printDtoList.add(printDto);
}
return R.ok(printDtoList);
@@ -538,44 +527,36 @@ public class GfRatioApplicationRecordAppServiceImpl implements IGfRatioApplicati
/**
* 查询原支付比例和价格(包括二次比例)
*
*
* @param definitionId 定义ID
* @param definitionTableName 定义表名
* @param ybLv 医保等级
* @return 原支付比例和价格(包括二次比例)
*/
private Pair<Pair<BigDecimal, BigDecimal>, BigDecimal> getOldRatiosAndPrice(Long definitionId,
String definitionTableName, String ybLv) {
String definitionTableName, String ybLv) {
BigDecimal oldRatio = null;
BigDecimal price = null;
// 查询费用定价
List<ChargeItemDefinition> chargeItemDefinitionList = chargeItemDefinitionService
.list(new LambdaQueryWrapper<ChargeItemDefinition>().eq(ChargeItemDefinition::getInstanceId, definitionId)
.eq(ChargeItemDefinition::getInstanceTable, definitionTableName)
.orderByDesc(ChargeItemDefinition::getId));
.list(new LambdaQueryWrapper<ChargeItemDefinition>().eq(ChargeItemDefinition::getInstanceId, definitionId)
.eq(ChargeItemDefinition::getInstanceTable, definitionTableName)
.orderByDesc(ChargeItemDefinition::getId));
if (!chargeItemDefinitionList.isEmpty()) {
price = chargeItemDefinitionList.get(0).getPrice();
// 查询现行大类比例
List<GfRatio> typeRatioList = gfRatioService
.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getRatioType, GfRatioType.TYPE_RATIO.getValue())
.eq(GfRatio::getYbClass, chargeItemDefinitionList.get(0).getYbType()).eq(GfRatio::getYbLv, ybLv)
<<<<<<< HEAD
.eq(GfRatio::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getRatioType, GfRatioType.TYPE_RATIO.getValue())
.eq(GfRatio::getYbClass, chargeItemDefinitionList.get(0).getYbType()).eq(GfRatio::getYbLv, ybLv)
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
if (!typeRatioList.isEmpty()) {
oldRatio = typeRatioList.get(0).getSelfRatio();
}
}
// 查询历史小项比例
List<GfRatio> historicalRatioList =
gfRatioService.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getDefinitionId, definitionId)
<<<<<<< HEAD
.eq(GfRatio::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()).orderByDesc(GfRatio::getId));
=======
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()).orderByDesc(GfRatio::getId));
>>>>>>> v1.3
List<GfRatio> historicalRatioList
= gfRatioService.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getDefinitionId, definitionId)
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()).orderByDesc(GfRatio::getId));
BigDecimal oldTwiceRatio = null;
if (!historicalRatioList.isEmpty()) {
GfRatio latestRatio = historicalRatioList.get(0);

View File

@@ -12,11 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
<<<<<<< HEAD
import com.core.common.enums.DeleteFlag;
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import com.openhis.common.enums.GfItemType;
import com.openhis.common.enums.GfRatioType;
import com.openhis.common.enums.ybenums.YbChrgitmLv;
@@ -62,15 +58,11 @@ public class GfRatioManageAppServiceImpl implements IGfRatioManageAppService {
public R<?> saveTypeRatioList(List<GfTypeRatioDto> typeRatioList) {
// 查询DB中的所有大项比例
List<GfRatio> gfRatioList = gfRatioService
.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getRatioType, GfRatioType.TYPE_RATIO.getValue())
<<<<<<< HEAD
.eq(GfRatio::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
.list(new LambdaQueryWrapper<GfRatio>().eq(GfRatio::getRatioType, GfRatioType.TYPE_RATIO.getValue())
.eq(GfRatio::getDeleteFlag, DelFlag.NO.getCode()));
// 做成医保分项+医保等级拼接的Map
Map<String, GfRatio> gfRatioMap =
gfRatioList.stream().collect(Collectors.toMap(e -> e.getYbClass() + e.getYbLv(), Function.identity()));
Map<String, GfRatio> gfRatioMap
= gfRatioList.stream().collect(Collectors.toMap(e -> e.getYbClass() + e.getYbLv(), Function.identity()));
// 遍历输入项
List<GfRatio> addGfRatioList = new ArrayList<>();
List<GfRatio> editGfRatioList = new ArrayList<>();
@@ -82,7 +74,7 @@ public class GfRatioManageAppServiceImpl implements IGfRatioManageAppService {
if (editGfRatio == null) {
// DB不存在时新增
GfRatio addGfRatio = new GfRatio().setRatioType(GfRatioType.TYPE_RATIO.getValue())
.setYbClass(dto.getYbClass()).setYbLv(dto.getYbLv()).setSelfRatio(dto.getSelfRatio());
.setYbClass(dto.getYbClass()).setYbLv(dto.getYbLv()).setSelfRatio(dto.getSelfRatio());
addGfRatioList.add(addGfRatio);
} else {
// DB存在时修改
@@ -111,13 +103,13 @@ public class GfRatioManageAppServiceImpl implements IGfRatioManageAppService {
*/
@Override
public R<IPage<GfIndividualRatioDto>> getIndividualRatioPage(GfIndividualRatioDto searchParam, String searchKey,
Integer pageNo, Integer pageSize) {
Integer pageNo, Integer pageSize) {
// 构造查询条件
QueryWrapper<GfIndividualRatioDto> queryWrapper = HisQueryUtils.buildQueryWrapper(searchParam, searchKey,
new HashSet<>(Set.of("bus_no", "name", "py_str", "wb_str", "yb_no")), null);
new HashSet<>(Set.of("bus_no", "name", "py_str", "wb_str", "yb_no")), null);
// 查询单项比例分页
IPage<GfIndividualRatioDto> page =
gfRatioManageAppMapper.selectGfIndividualRatioPage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<GfIndividualRatioDto> page
= gfRatioManageAppMapper.selectGfIndividualRatioPage(new Page<>(pageNo, pageSize), queryWrapper);
// 设置公费项目分类名称
for (GfIndividualRatioDto dto : page.getRecords()) {
dto.setItemTypeName(GfItemType.getByValue(dto.getItemType()).getInfo());

View File

@@ -1,13 +1,5 @@
package com.openhis.web.nenu.appservice.impl;
<<<<<<< HEAD
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
=======
import java.io.IOException;
import java.time.format.DateTimeParseException;
import java.util.*;
@@ -34,7 +26,6 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
>>>>>>> v1.3
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@@ -45,11 +36,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
<<<<<<< HEAD
import com.core.common.enums.DeleteFlag;
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import com.core.common.utils.*;
import com.core.common.utils.poi.ExcelUtil;
import com.openhis.administration.domain.Patient;
@@ -96,13 +83,13 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
*/
@Override
public R<IPage<GfStudentListDto>> getPage(GfStudentListDto searchParam, String searchKey, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
// 构造查询条件
QueryWrapper<GfStudentListDto> queryWrapper = HisQueryUtils.buildQueryWrapper(searchParam, searchKey,
new HashSet<>(Set.of("name", "py_str", "wb_str", "student_id", "id_number")), null);
new HashSet<>(Set.of("name", "py_str", "wb_str", "student_id", "id_number")), null);
// 查询学生名单分页
IPage<GfStudentListDto> page =
gfStudentListAppMapper.selectGfStudentListPage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<GfStudentListDto> page
= gfStudentListAppMapper.selectGfStudentListPage(new Page<>(pageNo, pageSize), queryWrapper);
return R.ok(page);
}
@@ -121,15 +108,15 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
}
// 返回Dto赋值
GfStudentListDto gfStudentListDto = new GfStudentListDto().setId(patientStudent.getId())
.setName(patientStudent.getName()).setGender(patientStudent.getGender()).setAge(patientStudent.getAge())
.setStudentId(patientStudent.getStudentId()).setIdNumber(patientStudent.getIdNumber())
.setPhone(patientStudent.getPhone()).setCollege(patientStudent.getCollege())
.setMajor(patientStudent.getMajor()).setEducationLevel(patientStudent.getEducationLevel())
.setEnrollmentDate(patientStudent.getEnrollmentDate()).setGraduationDate(patientStudent.getGraduationDate())
.setGrade(patientStudent.getGrade()).setStudyMode(patientStudent.getStudyMode())
.setStudentStatus(patientStudent.getStudentStatus())
.setPhysicalExamResult(patientStudent.getPhysicalExamResult()).setCounselor(patientStudent.getCounselor())
.setCounselorPhone(patientStudent.getCounselorPhone()).setPatientId(patientStudent.getPatientId());
.setName(patientStudent.getName()).setGender(patientStudent.getGender()).setAge(patientStudent.getAge())
.setStudentId(patientStudent.getStudentId()).setIdNumber(patientStudent.getIdNumber())
.setPhone(patientStudent.getPhone()).setCollege(patientStudent.getCollege())
.setMajor(patientStudent.getMajor()).setEducationLevel(patientStudent.getEducationLevel())
.setEnrollmentDate(patientStudent.getEnrollmentDate()).setGraduationDate(patientStudent.getGraduationDate())
.setGrade(patientStudent.getGrade()).setStudyMode(patientStudent.getStudyMode())
.setStudentStatus(patientStudent.getStudentStatus())
.setPhysicalExamResult(patientStudent.getPhysicalExamResult()).setCounselor(patientStudent.getCounselor())
.setCounselorPhone(patientStudent.getCounselorPhone()).setPatientId(patientStudent.getPatientId());
return R.ok(gfStudentListDto);
}
@@ -143,28 +130,20 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
public R<?> add(GfStudentListDto gfStudentListDto) {
// 学号重复验证
List<PatientStudent> sameStudentIdStudents = patientStudentService.list(
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getStudentId, gfStudentListDto.getStudentId())
<<<<<<< HEAD
.eq(PatientStudent::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getStudentId, gfStudentListDto.getStudentId())
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
if (!sameStudentIdStudents.isEmpty()) {
return R.fail("学号" + gfStudentListDto.getStudentId() + "在系统中已存在");
}
// 学生信息重复校验
List<PatientStudent> sameIdNumberStudents = patientStudentService.list(
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getIdNumber, gfStudentListDto.getIdNumber())
<<<<<<< HEAD
.eq(PatientStudent::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getIdNumber, gfStudentListDto.getIdNumber())
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
Long existingPatientId = null;
if (!sameIdNumberStudents.isEmpty()) {
for (PatientStudent ps : sameIdNumberStudents) {
if (!ps.getEnrollmentDate().after(gfStudentListDto.getGraduationDate())
&& !ps.getGraduationDate().before(gfStudentListDto.getEnrollmentDate())) {
&& !ps.getGraduationDate().before(gfStudentListDto.getEnrollmentDate())) {
return R.fail("该身份证在系统中已录入过学生信息,此次录入的入校离校时间与既存数据有重叠,请确认");
}
}
@@ -185,39 +164,35 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
if (existingPatientId == null) {
// 判断患者信息是否有重复
List<Patient> sameIdNumberPatients = patientService
.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, gfStudentListDto.getIdNumber())
<<<<<<< HEAD
.eq(Patient::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(Patient::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, gfStudentListDto.getIdNumber())
.eq(Patient::getDeleteFlag, DelFlag.NO.getCode()));
if (!sameIdNumberPatients.isEmpty()) {
// 已存在则取存在的
existingPatientId = sameIdNumberPatients.get(0).getId();
} else {
// 不存在则新建患者
Patient patient =
new Patient().setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10))
.setName(gfStudentListDto.getName()).setGenderEnum(gfStudentListDto.getGender())
.setBirthDate(birthDate).setPhone(gfStudentListDto.getPhone())
.setIdCard(gfStudentListDto.getIdNumber()).setPyStr(pyStr).setWbStr(wbStr)
.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
Patient patient
= new Patient().setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10))
.setName(gfStudentListDto.getName()).setGenderEnum(gfStudentListDto.getGender())
.setBirthDate(birthDate).setPhone(gfStudentListDto.getPhone())
.setIdCard(gfStudentListDto.getIdNumber()).setPyStr(pyStr).setWbStr(wbStr)
.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
patientService.save(patient);
existingPatientId = patient.getId();
}
}
// 创建学生信息
PatientStudent patientStudent = new PatientStudent().setName(gfStudentListDto.getName()).setPyStr(pyStr)
.setWbStr(wbStr).setGender(gfStudentListDto.getGender()).setAge(age)
.setStudentId(gfStudentListDto.getStudentId()).setIdNumber(gfStudentListDto.getIdNumber())
.setPhone(gfStudentListDto.getPhone()).setCollege(gfStudentListDto.getCollege())
.setMajor(gfStudentListDto.getMajor()).setEducationLevel(gfStudentListDto.getEducationLevel())
.setEnrollmentDate(gfStudentListDto.getEnrollmentDate())
.setGraduationDate(gfStudentListDto.getGraduationDate()).setGrade(gfStudentListDto.getGrade())
.setStudyMode(gfStudentListDto.getStudyMode()).setStudentStatus(gfStudentListDto.getStudentStatus())
.setPhysicalExamResult(gfStudentListDto.getPhysicalExamResult())
.setCounselor(gfStudentListDto.getCounselor()).setCounselorPhone(gfStudentListDto.getCounselorPhone())
.setPatientId(existingPatientId);
.setWbStr(wbStr).setGender(gfStudentListDto.getGender()).setAge(age)
.setStudentId(gfStudentListDto.getStudentId()).setIdNumber(gfStudentListDto.getIdNumber())
.setPhone(gfStudentListDto.getPhone()).setCollege(gfStudentListDto.getCollege())
.setMajor(gfStudentListDto.getMajor()).setEducationLevel(gfStudentListDto.getEducationLevel())
.setEnrollmentDate(gfStudentListDto.getEnrollmentDate())
.setGraduationDate(gfStudentListDto.getGraduationDate()).setGrade(gfStudentListDto.getGrade())
.setStudyMode(gfStudentListDto.getStudyMode()).setStudentStatus(gfStudentListDto.getStudentStatus())
.setPhysicalExamResult(gfStudentListDto.getPhysicalExamResult())
.setCounselor(gfStudentListDto.getCounselor()).setCounselorPhone(gfStudentListDto.getCounselorPhone())
.setPatientId(existingPatientId);
patientStudentService.save(patientStudent);
return R.ok();
}
@@ -248,29 +223,29 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
String wbStr = ChineseConvertUtils.toWBFirstLetter(gfStudentListDto.getName());
// 更新学生信息
patientStudentService.update(new LambdaUpdateWrapper<PatientStudent>()
.set(PatientStudent::getName, gfStudentListDto.getName()).set(PatientStudent::getPyStr, pyStr)
.set(PatientStudent::getWbStr, wbStr).set(PatientStudent::getGender, gfStudentListDto.getGender())
.set(PatientStudent::getAge, age).set(PatientStudent::getStudentId, gfStudentListDto.getStudentId())
.set(PatientStudent::getIdNumber, gfStudentListDto.getIdNumber())
.set(PatientStudent::getPhone, gfStudentListDto.getPhone())
.set(PatientStudent::getCollege, gfStudentListDto.getCollege())
.set(PatientStudent::getMajor, gfStudentListDto.getMajor())
.set(PatientStudent::getEducationLevel, gfStudentListDto.getEducationLevel())
.set(PatientStudent::getEnrollmentDate, gfStudentListDto.getEnrollmentDate())
.set(PatientStudent::getGraduationDate, gfStudentListDto.getGraduationDate())
.set(PatientStudent::getGrade, gfStudentListDto.getGrade())
.set(PatientStudent::getStudyMode, gfStudentListDto.getStudyMode())
.set(PatientStudent::getStudentStatus, gfStudentListDto.getStudentStatus())
.set(PatientStudent::getPhysicalExamResult, gfStudentListDto.getPhysicalExamResult())
.set(PatientStudent::getCounselor, gfStudentListDto.getCounselor())
.set(PatientStudent::getCounselorPhone, gfStudentListDto.getCounselorPhone())
.eq(PatientStudent::getId, gfStudentListDto.getId()));
.set(PatientStudent::getName, gfStudentListDto.getName()).set(PatientStudent::getPyStr, pyStr)
.set(PatientStudent::getWbStr, wbStr).set(PatientStudent::getGender, gfStudentListDto.getGender())
.set(PatientStudent::getAge, age).set(PatientStudent::getStudentId, gfStudentListDto.getStudentId())
.set(PatientStudent::getIdNumber, gfStudentListDto.getIdNumber())
.set(PatientStudent::getPhone, gfStudentListDto.getPhone())
.set(PatientStudent::getCollege, gfStudentListDto.getCollege())
.set(PatientStudent::getMajor, gfStudentListDto.getMajor())
.set(PatientStudent::getEducationLevel, gfStudentListDto.getEducationLevel())
.set(PatientStudent::getEnrollmentDate, gfStudentListDto.getEnrollmentDate())
.set(PatientStudent::getGraduationDate, gfStudentListDto.getGraduationDate())
.set(PatientStudent::getGrade, gfStudentListDto.getGrade())
.set(PatientStudent::getStudyMode, gfStudentListDto.getStudyMode())
.set(PatientStudent::getStudentStatus, gfStudentListDto.getStudentStatus())
.set(PatientStudent::getPhysicalExamResult, gfStudentListDto.getPhysicalExamResult())
.set(PatientStudent::getCounselor, gfStudentListDto.getCounselor())
.set(PatientStudent::getCounselorPhone, gfStudentListDto.getCounselorPhone())
.eq(PatientStudent::getId, gfStudentListDto.getId()));
// 同步更新患者信息
patientService.update(new Patient(), new LambdaUpdateWrapper<Patient>()
.set(Patient::getName, gfStudentListDto.getName()).set(Patient::getPyStr, pyStr)
.set(Patient::getWbStr, wbStr).set(Patient::getGenderEnum, gfStudentListDto.getGender())
.set(Patient::getBirthDate, birthDate).set(Patient::getPhone, gfStudentListDto.getPhone())
.set(Patient::getIdCard, gfStudentListDto.getIdNumber()).eq(Patient::getId, patientStudent.getPatientId()));
.set(Patient::getName, gfStudentListDto.getName()).set(Patient::getPyStr, pyStr)
.set(Patient::getWbStr, wbStr).set(Patient::getGenderEnum, gfStudentListDto.getGender())
.set(Patient::getBirthDate, birthDate).set(Patient::getPhone, gfStudentListDto.getPhone())
.set(Patient::getIdCard, gfStudentListDto.getIdNumber()).eq(Patient::getId, patientStudent.getPatientId()));
return R.ok();
}
@@ -283,11 +258,7 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
@Override
public R<?> delete(Long id) {
patientStudentService.update(new LambdaUpdateWrapper<PatientStudent>()
<<<<<<< HEAD
.set(PatientStudent::getDeleteFlag, DeleteFlag.DELETED.getCode()).eq(PatientStudent::getId, id));
=======
.set(PatientStudent::getDeleteFlag, DelFlag.YES.getCode()).eq(PatientStudent::getId, id));
>>>>>>> v1.3
.set(PatientStudent::getDeleteFlag, DelFlag.YES.getCode()).eq(PatientStudent::getId, id));
return R.ok();
}
@@ -300,8 +271,8 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
@Override
public R<?> importData(MultipartFile file) {
// 读取文件
R<List<GfStudentListImportDto>> readResult =
CommonUtil.readImportedExcelFile(file, GfStudentListImportDto.class);
R<List<GfStudentListImportDto>> readResult
= CommonUtil.readImportedExcelFile(file, GfStudentListImportDto.class);
if (R.SUCCESS != readResult.getCode()) {
return readResult;
}
@@ -327,28 +298,28 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
String wbStr = ChineseConvertUtils.toWBFirstLetter(importDto.getName());
// 患者未创建时,创建患者
if (importDto.getPatientId() == null) {
Patient patient =
new Patient().setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10))
.setName(importDto.getName()).setGenderEnum(CommonUtil.tryParseInt(importDto.getGender()))
.setBirthDate(birthDate).setPhone(importDto.getPhone()).setIdCard(importDto.getIdNumber())
.setPyStr(pyStr).setWbStr(wbStr).setOrganizationId(orgId);
Patient patient
= new Patient().setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10))
.setName(importDto.getName()).setGenderEnum(CommonUtil.tryParseInt(importDto.getGender()))
.setBirthDate(birthDate).setPhone(importDto.getPhone()).setIdCard(importDto.getIdNumber())
.setPyStr(pyStr).setWbStr(wbStr).setOrganizationId(orgId);
patientService.save(patient);
importDto.setPatientId(patient.getId());
}
// 创建学生信息
PatientStudent patientStudent = new PatientStudent().setName(importDto.getName()).setPyStr(pyStr)
.setWbStr(wbStr).setGender(CommonUtil.tryParseInt(importDto.getGender())).setAge(age)
.setStudentId(importDto.getStudentId()).setIdNumber(importDto.getIdNumber())
.setPhone(importDto.getPhone()).setCollege(importDto.getCollege()).setMajor(importDto.getMajor())
.setEducationLevel(CommonUtil.tryParseInt(importDto.getEducationLevel()))
.setEnrollmentDate(importDto.getEnrollmentDate()).setGraduationDate(importDto.getGraduationDate())
.setGrade(importDto.getGrade()).setStudyMode(CommonUtil.tryParseInt(importDto.getStudyMode()))
// 在校状态:在校
.setStudentStatus(StudentStatus.IN_SCHOOL.getValue())
// 体检结果:体检合格
.setPhysicalExamResult(PhysicalExamResult.EXAMINATION_PASSED.getValue())
.setCounselor(importDto.getCounselor()).setCounselorPhone(importDto.getCounselorPhone())
.setPatientId(importDto.getPatientId());
.setWbStr(wbStr).setGender(CommonUtil.tryParseInt(importDto.getGender())).setAge(age)
.setStudentId(importDto.getStudentId()).setIdNumber(importDto.getIdNumber())
.setPhone(importDto.getPhone()).setCollege(importDto.getCollege()).setMajor(importDto.getMajor())
.setEducationLevel(CommonUtil.tryParseInt(importDto.getEducationLevel()))
.setEnrollmentDate(importDto.getEnrollmentDate()).setGraduationDate(importDto.getGraduationDate())
.setGrade(importDto.getGrade()).setStudyMode(CommonUtil.tryParseInt(importDto.getStudyMode()))
// 在校状态:在校
.setStudentStatus(StudentStatus.IN_SCHOOL.getValue())
// 体检结果:体检合格
.setPhysicalExamResult(PhysicalExamResult.EXAMINATION_PASSED.getValue())
.setCounselor(importDto.getCounselor()).setCounselorPhone(importDto.getCounselorPhone())
.setPatientId(importDto.getPatientId());
patientStudentService.save(patientStudent);
}
return R.ok();
@@ -431,7 +402,7 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
}
if (!lineValidateMsgList.isEmpty()) {
fieldValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
.add("■ 第" + importDto.getLineNumber() + "行:" + String.join("", lineValidateMsgList) + "");
}
}
if (!fieldValidateMsgList.isEmpty()) {
@@ -439,22 +410,22 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
}
// 重复校验(文件行重复)
List<String> lineRepeatedValidateMsgList = new ArrayList<>();
Map<String, List<GfStudentListImportDto>> fileSameStudentIdMap =
importDtoList.stream().collect(Collectors.groupingBy(GfStudentListImportDto::getStudentId));
Map<String, List<GfStudentListImportDto>> fileSameStudentIdMap
= importDtoList.stream().collect(Collectors.groupingBy(GfStudentListImportDto::getStudentId));
for (Map.Entry<String, List<GfStudentListImportDto>> entry : fileSameStudentIdMap.entrySet()) {
if (entry.getValue().size() > 1) {
lineRepeatedValidateMsgList
.add("■ 第" + entry.getValue().stream().map(GfStudentListImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(",")) + "行的学号重复;");
.add("■ 第" + entry.getValue().stream().map(GfStudentListImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(",")) + "行的学号重复;");
}
}
Map<String, List<GfStudentListImportDto>> fileSameIdNumberMap =
importDtoList.stream().collect(Collectors.groupingBy(GfStudentListImportDto::getIdNumber));
Map<String, List<GfStudentListImportDto>> fileSameIdNumberMap
= importDtoList.stream().collect(Collectors.groupingBy(GfStudentListImportDto::getIdNumber));
for (Map.Entry<String, List<GfStudentListImportDto>> entry : fileSameIdNumberMap.entrySet()) {
if (entry.getValue().size() > 1) {
lineRepeatedValidateMsgList
.add("■ 第" + entry.getValue().stream().map(GfStudentListImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(",")) + "行的身份证号重复;");
.add("■ 第" + entry.getValue().stream().map(GfStudentListImportDto::getLineNumber).sorted()
.map(Object::toString).collect(Collectors.joining(",")) + "行的身份证号重复;");
}
}
if (!lineRepeatedValidateMsgList.isEmpty()) {
@@ -464,28 +435,20 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
List<String> dbRepeatedValidateMsgList = new ArrayList<>();
for (GfStudentListImportDto importDto : importDtoList) {
List<PatientStudent> sameStudentIdStudents = patientStudentService.list(
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getStudentId, importDto.getStudentId())
<<<<<<< HEAD
.eq(PatientStudent::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getStudentId, importDto.getStudentId())
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
if (!sameStudentIdStudents.isEmpty()) {
dbRepeatedValidateMsgList.add("■ 第" + importDto.getLineNumber() + "行的学号在系统中已存在;");
}
List<PatientStudent> sameIdNumberStudents = patientStudentService
.list(new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getIdNumber, importDto.getIdNumber())
<<<<<<< HEAD
.eq(PatientStudent::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
=======
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
>>>>>>> v1.3
.list(new LambdaQueryWrapper<PatientStudent>().eq(PatientStudent::getIdNumber, importDto.getIdNumber())
.eq(PatientStudent::getDeleteFlag, DelFlag.NO.getCode()));
if (!sameIdNumberStudents.isEmpty()) {
for (PatientStudent ps : sameIdNumberStudents) {
if (!ps.getEnrollmentDate().after(importDto.getGraduationDate())
&& !ps.getGraduationDate().before(importDto.getEnrollmentDate())) {
&& !ps.getGraduationDate().before(importDto.getEnrollmentDate())) {
dbRepeatedValidateMsgList
.add("■ 第" + importDto.getLineNumber() + "行的身份证在系统中已录入过学生信息,此次录入的入校离校时间与既存数据有重叠,请确认;");
.add("■ 第" + importDto.getLineNumber() + "行的身份证在系统中已录入过学生信息,此次录入的入校离校时间与既存数据有重叠,请确认;");
}
}
importDto.setPatientId(sameIdNumberStudents.get(0).getPatientId());
@@ -497,8 +460,6 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
return R.ok();
}
<<<<<<< HEAD
=======
@Override
public R<?> synPeis() {
@@ -512,7 +473,6 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
}
//log.info("开始传输学生数据,总记录数: {}", totalCount);
// 2. 分批处理参数
int pageSize = 1000; // 每批大小
int pageNum = 1;
@@ -528,7 +488,7 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
})
.collect(Collectors.toList());
// 3. 分批处理
for (ArrayList<GfStudentPeisDto> list:lists) {
for (ArrayList<GfStudentPeisDto> list : lists) {
//log.info("开始处理第 {}/{} 批", pageNum, totalPages);
PeisStudentPatientDto peisStudentPatientDto = new PeisStudentPatientDto();
@@ -621,7 +581,7 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
CloseableHttpResponse response = null;
// 发送请求
try {
HttpPost httpPost = new HttpPost(TenantOptionUtil.getOptionContent(TenantOptionDict.PEIS_SERVER_URL)+"/wx/auth/syncHisInfo");
HttpPost httpPost = new HttpPost(TenantOptionUtil.getOptionContent(TenantOptionDict.PEIS_SERVER_URL) + "/wx/auth/syncHisInfo");
StringEntity stringEntity = new StringEntity(JSON.toJSONString(peisStudentPatientDto), ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
// 执行http请求
@@ -645,5 +605,4 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService {
// 可以根据业务需求决定是否重试
}
>>>>>>> v1.3
}

View File

@@ -35,9 +35,9 @@ public class GfStudentListController {
*/
@GetMapping("/page")
public R<IPage<GfStudentListDto>> getPage(GfStudentListDto searchParam,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return gfStudentListAppService.getPage(searchParam, searchKey, pageNo, pageSize);
}
@@ -105,8 +105,6 @@ public class GfStudentListController {
public void importTemplate(HttpServletResponse response) {
gfStudentListAppService.importTemplate(response);
}
<<<<<<< HEAD
=======
/**
* peis同步
@@ -116,5 +114,4 @@ public class GfStudentListController {
public R<?> synPeis() {
return gfStudentListAppService.synPeis();
}
>>>>>>> v1.3
}

View File

@@ -1,9 +1,6 @@
package com.openhis.web.nenu.mapper;
<<<<<<< HEAD
=======
import com.openhis.web.nenu.dto.GfStudentPeisDto;
>>>>>>> v1.3
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -13,11 +10,8 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.nenu.dto.GfStudentListDto;
<<<<<<< HEAD
=======
import java.util.List;
>>>>>>> v1.3
/**
* 公费医疗-学生名单管理 Mapper
*
@@ -35,16 +29,15 @@ public interface GfStudentListAppMapper {
* @return 学生名单分页
*/
IPage<GfStudentListDto> selectGfStudentListPage(@Param("page") Page<GfStudentListDto> page,
@Param(Constants.WRAPPER) QueryWrapper<GfStudentListDto> queryWrapper);
@Param(Constants.WRAPPER) QueryWrapper<GfStudentListDto> queryWrapper);
<<<<<<< HEAD
=======
/**
* 获取学生名单peis同步列表
*
* @return 学生名单peis同步列表
*/
List<GfStudentPeisDto> getPatientBusNoList(@Param("pageNum")int pageNum, @Param("pageSize")int pageSize);
List<GfStudentPeisDto> getPatientBusNoList(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
/**
* 获取学生名单peis同步列表
*
@@ -59,5 +52,4 @@ public interface GfStudentListAppMapper {
*/
Long getPatientBusNoCount();
>>>>>>> v1.3
}

View File

@@ -129,7 +129,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
*/
@Override
public R<?> getEncounterInfoListPage(OutpatientTreatmentEncounterDto outpatientTreatmentEncounterDto,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
// 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>();
@@ -137,20 +137,20 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
searchFields.add(CommonConstants.FieldName.PatientPyStr);
searchFields.add(CommonConstants.FieldName.PatientWbStr);
// 构建查询条件
QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
// 查询就诊病人列表
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto =
outpatientTreatmentAppMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.AMB.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.getValue());
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto
= outpatientTreatmentAppMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.AMB.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.getValue());
encounterInfoPageDto.getRecords().forEach(prescriptionPatientInfoDto -> {
// 性别
prescriptionPatientInfoDto.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
// 计算年龄
prescriptionPatientInfoDto.setAge(prescriptionPatientInfoDto.getBirthDate() != null
? AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()) : "");
? AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()) : "");
});
return R.ok(encounterInfoPageDto);
}
@@ -165,21 +165,21 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
*/
@Override
public R<?> getOutpatientTreatmentInfo(OutpatientTreatmentInfoDto outpatientTreatmentInfoDto, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
// 构建查询条件
QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientTreatmentInfoDto, null, null, null);
QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(outpatientTreatmentInfoDto, null, null, null);
// 查询处置单
IPage<OutpatientTreatmentInfoDto> treatmentInfo = outpatientTreatmentAppMapper.selectTreatmentInfoPage(
new Page<>(pageNo, pageSize), queryWrapper, RequestStatus.COMPLETED.getValue(),
DispenseStatus.DRAFT.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
new Page<>(pageNo, pageSize), queryWrapper, RequestStatus.COMPLETED.getValue(),
DispenseStatus.DRAFT.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
List<OutpatientTreatmentInfoDto> treatmentList = treatmentInfo.getRecords();
// 获取请求ids
List<Long> reqIds =
treatmentList.stream().map(OutpatientTreatmentInfoDto::getRequestId).collect(Collectors.toList());
List<Long> reqIds
= treatmentList.stream().map(OutpatientTreatmentInfoDto::getRequestId).collect(Collectors.toList());
Map<Long, List<Procedure>> procedureRecordGroup = new HashMap<>();
if (!reqIds.isEmpty()) {
// 查询执行记录
@@ -188,7 +188,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
if (procedureRecords != null && !procedureRecords.isEmpty()) {
// 根据服务请求id分组
procedureRecordGroup = procedureRecords.stream()
.collect(Collectors.groupingBy(Procedure::getRequestId, Collectors.toList()));
.collect(Collectors.groupingBy(Procedure::getRequestId, Collectors.toList()));
}
}
@@ -218,12 +218,12 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// 发放状态
if (treatment.getDispenseStatus() != null) {
treatment.setDispenseStatus_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, treatment.getDispenseStatus()));
EnumUtils.getInfoByValue(DispenseStatus.class, treatment.getDispenseStatus()));
}
// 收费状态
if (treatment.getChargeStatus() != null) {
treatment.setChargeStatus_enumText(
EnumUtils.getInfoByValue(ChargeItemStatus.class, treatment.getChargeStatus()));
EnumUtils.getInfoByValue(ChargeItemStatus.class, treatment.getChargeStatus()));
}
}
return R.ok(treatmentInfo);
@@ -242,7 +242,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
performRecordList.forEach(performRecordDto -> {
// 获取执行状态
performRecordDto
.setStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, performRecordDto.getStatusEnum()));
.setStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, performRecordDto.getStatusEnum()));
});
return R.ok(performRecordList);
}
@@ -261,7 +261,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
List<PerformInfoDto> devicePerformList = new ArrayList<>();
for (PerformInfoDto item : performInfoList) {
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
serviceMedPerformList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
devicePerformList.add(item);
@@ -270,18 +270,18 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// 分别处理诊疗/药品执行和耗材发放
if (!serviceMedPerformList.isEmpty()) {
List<ChargeItem> chargeItemList = chargeItemService.getChargeItemInfoByReqId(
serviceMedPerformList.stream().map(PerformInfoDto::getRequestId).collect(Collectors.toList()));
serviceMedPerformList.stream().map(PerformInfoDto::getRequestId).collect(Collectors.toList()));
if (chargeItemList == null || chargeItemList.isEmpty()) {
throw new ServiceException("未找到对应的收费项,请联系管理员");
}
// 按requestId分组收费项
Map<Long, List<ChargeItem>> chargeItemMap =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getServiceId));
Map<Long, List<ChargeItem>> chargeItemMap
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getServiceId));
// 过滤出已收费的执行项目
serviceMedPerformList = serviceMedPerformList.stream().filter(performInfo -> {
List<ChargeItem> chargeItems = chargeItemMap.get(performInfo.getRequestId());
return chargeItems != null && chargeItems.stream()
.anyMatch(chargeItem -> ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum()));
.anyMatch(chargeItem -> ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum()));
}).toList();
// 处理诊疗执行
for (PerformInfoDto performInfoDto : serviceMedPerformList) {
@@ -299,8 +299,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
exeCount = serviceRequest.getQuantity().intValue();
}
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(performInfoDto.getRequestTable())) {
MedicationRequest medicationRequest =
medicationRequestService.getById(performInfoDto.getRequestId());
MedicationRequest medicationRequest
= medicationRequestService.getById(performInfoDto.getRequestId());
if (medicationRequest != null) {
encounterId = medicationRequest.getEncounterId();
requestId = medicationRequest.getId();
@@ -310,7 +310,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
}
// 根据请求id查询执行记录
List<Procedure> procedureRecordList = procedureService
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
// 初始化计数器
int performCount = 0;
@@ -327,8 +327,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
if (performCount - cancelCount < exeCount) {
// 未执行则新增执行记录
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
ProcedureCategory.OUTPATIENT_ADVICE, null, null, DateUtils.getNowDate(), groupId, null);
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
ProcedureCategory.OUTPATIENT_ADVICE, null, null, DateUtils.getNowDate(), groupId, null);
if (procedureId == null) {
throw new ServiceException("执行失败,请联系管理员");
}
@@ -336,8 +336,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
} else {
// 新增执行记录
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
null, null, DateUtils.getNowDate(), groupId, null);
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
null, null, DateUtils.getNowDate(), groupId, null);
if (procedureId == null) {
throw new ServiceException("执行失败,请联系管理员");
}
@@ -352,22 +352,19 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// 获取耗材发放id列表
List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
<<<<<<< HEAD
=======
// 更新请求状态为已完成
LambdaUpdateWrapper<DeviceRequest> updateWrapper =
new LambdaUpdateWrapper<DeviceRequest>().in(DeviceRequest::getId, devRequestIdList)
.set(DeviceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue());
LambdaUpdateWrapper<DeviceRequest> updateWrapper
= new LambdaUpdateWrapper<DeviceRequest>().in(DeviceRequest::getId, devRequestIdList)
.set(DeviceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue());
deviceRequestService.update(updateWrapper);
>>>>>>> v1.3
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 获取耗材待发放id列表
List<Long> devUnDispenseIdList = new ArrayList<>();
if (dispenseList != null) {
List<DeviceDispense> unDispenseList = dispenseList.stream()
.filter(x -> DispenseStatus.PREPARATION.getValue().equals(x.getStatusEnum())).toList();
.filter(x -> DispenseStatus.PREPARATION.getValue().equals(x.getStatusEnum())).toList();
for (DeviceDispense deviceDispense : unDispenseList) {
// 耗材发放状态
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
@@ -379,7 +376,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
devUnDispenseIdList.add(deviceDispense.getId());
}
// 药品发放更新
@@ -387,74 +384,24 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
<<<<<<< HEAD
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个耗材分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(
unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
=======
// 获取药品待发放库存信息
List<UnDispenseInventoryDto> unDispenseInventoryList = returnMedicineMapper.selectInventoryInfoList(
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String,
List<UnDispenseInventoryDto>> unDispenseInventoryMap = unDispenseInventoryList.stream()
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap = unDispenseInventoryList.stream()
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLotNumber()
+ CommonConstants.Common.DASH + x.getLocationId()));
+ CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
if (!inventoryList.isEmpty()) {
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.anyMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
.anyMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 停供库存校验
throw new ServiceException(inventoryList.get(0).getItemName() + "库存已停供");
}
@@ -467,15 +414,15 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity = unDispenseInventoryDto.getQuantity()
.multiply(unDispenseInventoryDto.getPartPercent());
.multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
if (PublicationStatus.ACTIVE.getValue()
.equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
.equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
inventoryId = unDispenseInventoryDto.getInventoryId();
}
@@ -486,31 +433,13 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
} else {
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryId)
.setQuantity(inventoryQuantity.subtract(minQuantity)));
.setQuantity(inventoryQuantity.subtract(minQuantity)));
}
>>>>>>> v1.3
}
}
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
<<<<<<< HEAD
// 更新请求状态为已完成
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
// 调用医保商品销售接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
// 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
westernMedicineDispenseAppServiceImpl.ybMedicineIntegrated(null, devDispenseIdList);
if (uploadFailedNoList != null) {
returnMsg = "3505商品销售上传错误错误项目编码" + uploadFailedNoList;
} else {
returnMsg = "3505商品销售上传成功";
}
}
=======
// // 调用医保商品销售接口
// String ybSwitch =
@@ -525,7 +454,6 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// returnMsg = "3505商品销售上传成功";
// }
// }
>>>>>>> v1.3
}
return R.ok("执行成功");
}
@@ -543,7 +471,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
List<PerformInfoDto> deviceCancelList = new ArrayList<>();
for (PerformInfoDto item : performInfoList) {
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
serviceMedCancelList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
deviceCancelList.add(item);
@@ -555,7 +483,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
for (PerformInfoDto performInfoDto : serviceMedCancelList) {
// 根据请求id查询执行记录
List<Procedure> procedureRecordList = procedureService
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
Procedure procedure = procedureRecordList.get(0);
// 初始化计数器
@@ -573,9 +501,9 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
if (performCount - cancelCount > 0) {
// 已执行则新增取消执行记录
Long procedureId = procedureService.addProcedureRecord(procedure.getEncounterId(),
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
null, DateUtils.getNowDate(), performInfoDto.getGroupId(), null);
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
null, DateUtils.getNowDate(), performInfoDto.getGroupId(), null);
if (procedureId == null) {
throw new ServiceException("取消执行失败,请联系管理员");
}
@@ -597,8 +525,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
Long requestId = deviceRequest.getId();
// 查询待退的耗材请求
DeviceRequest deviceRefundRequest = deviceRequestService.getOne(new LambdaQueryWrapper<DeviceRequest>()
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
if (deviceRefundRequest != null) {
if (deviceRefundRequest.getStatusEnum().equals(RequestStatus.CANCELLED.getValue())) {
// 获取待退的耗材请求id
@@ -626,7 +554,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
if (!devRefundRequestIdList.isEmpty() && !devDispenseIdList.isEmpty()) {
// 耗材已发放信息查询
List<DeviceDispense> deviceDispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 根据发药单对应生成退药单
for (DeviceDispense deviceDispense : deviceDispenseList) {
// 耗材发放编码
@@ -648,51 +576,12 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// 药品退药请求状态变更(待退药→已完成)
deviceRequestService.updateCompletedStatusBatch(devRefundRequestIdList);
<<<<<<< HEAD
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList,
null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (UnDispenseInventoryDto inventory : inventoryList) {
// 库存表项目设定
InventoryItem inventoryItem = new InventoryItem();
// id
inventoryItem.setId(inventory.getInventoryId());
// 库存数量
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
inventoryItem
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
inventoryItem.setQuantity(inventory.getInventoryQuantity()
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
}
inventoryItemList.add(inventoryItem);
}
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 调用医保商品销售退货接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
if (!devRefundList.isEmpty()) {
List<String> uploadFailedNoList =
returnedMedicineAppServiceImpl.ybReturnIntegrated(new ArrayList<>(), devDispenseIdList);
if (uploadFailedNoList != null) {
returnMsg = "3506商品销售退货上传错误错误项目编码" + uploadFailedNoList;
} else {
returnMsg = "3506商品销售退货上传成功";
=======
// 扣库
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(
devDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
devDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (UnDispenseInventoryDto inventory : inventoryList) {
@@ -704,14 +593,13 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
inventoryItem
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
inventoryItem.setQuantity(inventory.getInventoryQuantity()
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
}
inventoryItemList.add(inventoryItem);
>>>>>>> v1.3
}
}
// 库存更新
@@ -743,11 +631,11 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
*/
@Override
public R<?> getBloodTransfusionPatch(Long requestId) {
BloodTransfusionPatchDto bloodTransfusionPatch =
outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
BloodTransfusionPatchDto bloodTransfusionPatch
= outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
// 性别枚举
bloodTransfusionPatch.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
// 计算年龄
if (bloodTransfusionPatch.getBirthDate() != null) {
bloodTransfusionPatch.setAge(AgeCalculatorUtil.getAge(bloodTransfusionPatch.getBirthDate()));

View File

@@ -32,7 +32,7 @@ public interface IPatientInformationService {
* @return 分页查询
*/
IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request);
Integer pageSize, HttpServletRequest request);
/**
* 修改病人信息
@@ -50,20 +50,9 @@ public interface IPatientInformationService {
R<?> addPatient(PatientBaseInfoDto patientInfoDto);
/**
<<<<<<< HEAD
* 检查患者是否存在
*
* @param name 患者姓名
* @param idCardNo 身份证号
* @return 是否存在
*/
boolean checkPatientExists(String name, String idCardNo);
=======
* 更新患者手机号
*
*
* @param patientBaseInfoDto 患者信息
*/
R<?> updatePatientPhone(PatientBaseInfoDto patientBaseInfoDto);
>>>>>>> v1.3
}

View File

@@ -71,48 +71,48 @@ public class PatientInformationServiceImpl implements IPatientInformationService
PatientInfoInitDto initDto = new PatientInfoInitDto();
// 获取婚姻状态列表
List<PatientInfoInitDto.statusEnumOption> maritalStatusOptions = Stream.of(MaritalStatus.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setMaritalStatus(maritalStatusOptions);
// 获取职业编码列表
List<PatientInfoInitDto.statusEnumOption> occupationTypeOptions = Stream.of(OccupationType.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setOccupationType(occupationTypeOptions);
// 获取性别列表
List<PatientInfoInitDto.statusEnumOption> sexOptions = new ArrayList<>();
sexOptions.add(new PatientInfoInitDto.statusEnumOption(AdministrativeGender.MALE.getValue(),
AdministrativeGender.MALE.getInfo()));
AdministrativeGender.MALE.getInfo()));
sexOptions.add(new PatientInfoInitDto.statusEnumOption(AdministrativeGender.FEMALE.getValue(),
AdministrativeGender.FEMALE.getInfo()));
AdministrativeGender.FEMALE.getInfo()));
initDto.setSex(sexOptions);
// 获取ABO血型列表
List<PatientInfoInitDto.statusEnumOption> bloodTypeABOOptions = Stream.of(BloodTypeABO.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setBloodTypeABO(bloodTypeABOOptions);
// 获取RH血型列表
List<PatientInfoInitDto.statusEnumOption> bloodTypeRHOptions = Stream.of(BloodTypeRH.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setBloodTypeRH(bloodTypeRHOptions);
// 获取家庭关系列表
List<PatientInfoInitDto.statusEnumOption> familyRelationshipType = Stream.of(FamilyRelationshipType.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setFamilyRelationshipType(familyRelationshipType);
// 获取是/否状态
List<PatientInfoInitDto.statusEnumOption> whetherOptions = new ArrayList<>();
whetherOptions.add(new PatientInfoInitDto.statusEnumOption(PublicationStatus.ACTIVE.getValue(),
PublicationStatus.ACTIVE.getInfo()));
PublicationStatus.ACTIVE.getInfo()));
whetherOptions.add(new PatientInfoInitDto.statusEnumOption(PublicationStatus.RETIRED.getValue(),
PublicationStatus.RETIRED.getInfo()));
PublicationStatus.RETIRED.getInfo()));
initDto.setWhetherStatus(whetherOptions);
return initDto;
@@ -129,26 +129,17 @@ public class PatientInformationServiceImpl implements IPatientInformationService
*/
@Override
public IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
<<<<<<< HEAD
// 构建查询条件 - 添加phone字段到搜索条件中
QueryWrapper<PatientInformationDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
patientInfoSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr,
CommonConstants.FieldName.Phone)), // 添加phone字段支持手机号搜索
=======
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<PatientBaseInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
patientBaseInfoDto, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
>>>>>>> v1.3
request);
IPage<PatientBaseInfoDto> patientInformationPage =
patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper);
patientBaseInfoDto, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
request);
IPage<PatientBaseInfoDto> patientInformationPage
= patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper);
// 患者id集合
List<Long> patientIdList =
patientInformationPage.getRecords().stream().map(PatientBaseInfoDto::getId).collect(Collectors.toList());
List<Long> patientIdList
= patientInformationPage.getRecords().stream().map(PatientBaseInfoDto::getId).collect(Collectors.toList());
// 患者身份信息
List<PatientIdInfoDto> patientIdInfo = patientManageMapper.getPatientIdInfo(patientIdList);
// 获取登录者信息
@@ -166,10 +157,10 @@ public class PatientInformationServiceImpl implements IPatientInformationService
e.setBloodRh_enumText(EnumUtils.getInfoByValue(BloodTypeRH.class, e.getBloodRh()));
// 家庭关系枚举类回显赋值
e.setLinkRelationCode_enumText(
EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode()));
EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode()));
// 患者身份子表信息
List<PatientIdInfoDto> idInfo = patientIdInfo.stream()
.filter(idInfoDto -> idInfoDto.getPatientId().equals(e.getId())).collect(Collectors.toList());
.filter(idInfoDto -> idInfoDto.getPatientId().equals(e.getId())).collect(Collectors.toList());
e.setPatientIdInfoList(idInfo);
// 登记医院
e.setOrganizationId(loginUser.getOrgId());
@@ -194,13 +185,13 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
}
// 身份证号是否存在
List<Patient> idCardList =
patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard())
.ne(patientInfoDto.getId() != null, Patient::getId, patientInfoDto.getId()));
List<Patient> idCardList
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard())
.ne(patientInfoDto.getId() != null, Patient::getId, patientInfoDto.getId()));
if (!idCardList.isEmpty()) {
Patient patient = idCardList.get(0);
if (patientInfoDto.getIdCard().equals(patient.getIdCard())
&& !patientInfoDto.getId().equals(patientInfoDto.getId())) {
&& !patientInfoDto.getId().equals(patientInfoDto.getId())) {
throw new ServiceException("身份证号:" + patientInfoDto.getIdCard() + "已经存在");
}
}
@@ -209,7 +200,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService
Patient patient = this.handlePatientInfo(patientInfoDto);
// 患者身份子表信息,先删除再新增
patientIdentifierService
.remove(new LambdaQueryWrapper<PatientIdentifier>().eq(PatientIdentifier::getPatientId, patient.getId()));
.remove(new LambdaQueryWrapper<PatientIdentifier>().eq(PatientIdentifier::getPatientId, patient.getId()));
if (patientInfoDto.getPatientIdInfoList() != null) {
// 新增患者身份子表信息
List<PatientIdInfoDto> patientIdInfoList = patientInfoDto.getPatientIdInfoList();
@@ -226,7 +217,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
}
return R.ok(patient.getIdCard(),
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"病人信息"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"病人信息"}));
}
/**
@@ -245,8 +236,8 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
}
// 身份证号是否存在
List<Patient> idCardList =
patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard()));
List<Patient> idCardList
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard()));
if (!idCardList.isEmpty()) {
throw new ServiceException("身份证号:" + patientInfoDto.getIdCard() + "已经存在");
}
@@ -269,21 +260,9 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
}
return R.ok(patient, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者信息"}));
return R.ok(patient, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[]{"患者信息"}));
}
<<<<<<< HEAD
@Override
public boolean checkPatientExists(String name, String idCardNo) {
QueryWrapper<Patient> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", name)
.eq("id_card", idCardNo)
.eq("delete_flag", "0");
return patientService.count(queryWrapper) > 0;
}
=======
/**
* 处理患者信息
*
@@ -327,7 +306,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService
/**
* 更新患者手机号
*
*
* @param patientBaseInfoDto 患者信息
*/
@Override
@@ -345,5 +324,4 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
return R.fail("更新患者手机号失败");
}
>>>>>>> v1.3
}

View File

@@ -45,7 +45,9 @@ public class PatientBaseInfoDto {
private Integer genderEnum;
private String genderEnum_enumText;
/** 活动标记 */
/**
* 活动标记
*/
private Integer activeFlag;
private Integer activeFlag_enumText;
@@ -68,18 +70,7 @@ public class PatientBaseInfoDto {
/**
* 联系方式
*/
<<<<<<< HEAD:openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInformationDto.java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
private Date deceasedDate;
/**
* 婚姻状态
*/
private Integer maritalStatusEnum;
private String maritalStatusEnum_enumText;
=======
private String phone;
>>>>>>> v1.3:openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientBaseInfoDto.java
/**
* 职业编码

View File

@@ -11,14 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
<<<<<<< HEAD
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
import com.openhis.web.paymentmanage.dto.InpatientPreSettleResultDto;
import com.openhis.web.paymentmanage.dto.NenuBpcPayDto;
import com.openhis.web.paymentmanage.dto.PaymentVO;
=======
import com.openhis.web.paymentmanage.dto.*;
>>>>>>> v1.3
import com.openhis.yb.dto.PaymentDetailDto;
import com.openhis.yb.dto.PaymentDto;
import com.openhis.yb.dto.PaymentInpatientDto;
@@ -31,9 +24,10 @@ import com.openhis.yb.dto.PrePaymentDto;
* @date 2025-03-29
*/
public interface IPaymentRecService {
/**
* 付款
*
*
* @param paymentDto 入参
* @return 结果
*/
@@ -41,7 +35,7 @@ public interface IPaymentRecService {
/**
* 取消付款
*
*
* @param cancelPaymentDto 入参
* @return 结果
*/
@@ -57,7 +51,7 @@ public interface IPaymentRecService {
/**
* 支付列表
*
*
* @param searchKey 查询条件
* @param pageNo 分页参数
* @param pageSize 分页参数
@@ -65,11 +59,11 @@ public interface IPaymentRecService {
* @return 结果
*/
IPage<PaymentVO> getPage(String searchKey, Integer kingEnum, String invoiceNo, Integer pageNo, Integer pageSize,
HttpServletRequest request);
HttpServletRequest request);
/**
* 获取支付详情
*
*
* @param paymentDto 入参
* @return 结果
*/
@@ -77,7 +71,7 @@ public interface IPaymentRecService {
/**
* 预结算
*
*
* @param prePaymentDto 预结算入参
* @return 预结算结果
*/
@@ -85,7 +79,7 @@ public interface IPaymentRecService {
/**
* 挂号预结算
*
*
* @param outpatientRegistrationAddParam 挂号参数
* @return 预结算结果
*/
@@ -93,16 +87,16 @@ public interface IPaymentRecService {
/**
* 挂号结算
*
*
* @param outpatientRegistrationSettleParam 挂号参数
* @return 预结算结果
*/
R<?> regPay(OutpatientRegistrationSettleParam outpatientRegistrationSettleParam, String chrgBchno,
List<PaymentDetailDto> paymentDetails);
List<PaymentDetailDto> paymentDetails);
/**
* 取消预结算
*
*
* @param encounterId 就诊id
* @return 操作结果
*/
@@ -110,7 +104,7 @@ public interface IPaymentRecService {
/**
* 住院预结算
*
*
* @param prePaymentDto 预结算参数
* @return 预结算结果
*/
@@ -118,7 +112,7 @@ public interface IPaymentRecService {
/**
* 住院结算
*
*
* @param paymentDto 住院结算参数
* @return 操作结果
*/
@@ -134,14 +128,11 @@ public interface IPaymentRecService {
/**
* BPC支付
*
*
* @param nenuBpcPayDto bpc支付参数
* @return 结果
*/
String nenuBpcPay(NenuBpcPayDto nenuBpcPayDto);
<<<<<<< HEAD
=======
List<PaymentDetailDto> cancelPreReg(Long encounterId);
>>>>>>> v1.3
}

View File

@@ -3,11 +3,8 @@ package com.openhis.web.paymentmanage.appservice;
import com.core.common.core.domain.R;
import com.openhis.yb.dto.ThreePartPayDto;
<<<<<<< HEAD
=======
import javax.servlet.http.HttpServletRequest;
>>>>>>> v1.3
/**
* 第三方支付应用层Service
*
@@ -15,11 +12,10 @@ import javax.servlet.http.HttpServletRequest;
* @date 2025-03-29
*/
public interface ThreePartPayService {
<<<<<<< HEAD
R<?> payFor(ThreePartPayDto threePartPayDto);
=======
/**
* 付款
*
* @param threePartPayDto 前台参数
* @return 结果
*/
@@ -27,26 +23,29 @@ public interface ThreePartPayService {
/**
* 签到
*
* @return 结果
*/
R<?> sign();
/**
* 签出
*
* @return 结果
*/
R<?> signOut();
/**
* 支付结果查询
*
* @param id 参数
* @return 结果
*/
R<?> payQuery(Long id);
/**
* 当天退费
*
* @param paymentId 参数
* @return 结果
*/
@@ -54,6 +53,7 @@ public interface ThreePartPayService {
/**
* 隔天退货
*
* @param paymentId 参数
* @return 结果
*/
@@ -61,6 +61,7 @@ public interface ThreePartPayService {
/**
* 退费结果查询
*
* @param id
* @return
*/
@@ -68,6 +69,7 @@ public interface ThreePartPayService {
/**
* 网银支付记录
*
* @param searchKey 模糊查询
* @param pageNo 页码
* @param pageSize 页容量
@@ -78,9 +80,9 @@ public interface ThreePartPayService {
/**
* 付款(师大中银)
*
* @param threePartPayDto 前台参数
* @return 结果
*/
R<?> payForNenu(ThreePartPayDto threePartPayDto);
>>>>>>> v1.3
}

View File

@@ -78,6 +78,7 @@ import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class EleInvoiceServiceImpl implements IEleInvoiceService {
private static final BigDecimal ZERO = new BigDecimal("0.00");
Logger logger = LoggerFactory.getLogger(EleInvoiceServiceImpl.class);
@Resource
@@ -121,7 +122,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 创建Http请求
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
.setSocketTimeout(30000).build();
.setSocketTimeout(30000).build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response = null;
// 发送请求
@@ -129,7 +130,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
HttpPost httpPost = new HttpPost(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
System.out.println(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
StringEntity stringEntity = new StringEntity(com.alibaba.fastjson2.JSON.toJSONString(eleInvioceBillDto),
ContentType.APPLICATION_JSON);
ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
// 执行http请求
response = httpClient.execute(httpPost);
@@ -170,8 +171,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 拼接成完整 URL作为路径
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
.replaceAll("\\s+", "")// 去除首尾引号
.replaceAll("\"", ""); // 去除中间引号
.replaceAll("\\s+", "")// 去除首尾引号
.replaceAll("\"", ""); // 去除中间引号
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
String appKey = optionJson.getString(CommonConstants.Option.KEY);
@@ -225,13 +226,13 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
String rmd5 = DigestUtils.md5Hex(str1.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
String rsign = resultData.get("sign").toString();
System.out.println("验签-》" + (StringUtils.equals(rsign, rmd5)));
String busData =
new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
String busData
= new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
System.out.println("返回业务数据--》" + busData);
Map busDataMap = new ObjectMapper().readValue(busData, Map.class);
System.out
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
StandardCharsets.UTF_8));
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
StandardCharsets.UTF_8));
JSONObject resobj = JSONObject.parseObject(busData);
result.put("success", true);
@@ -259,8 +260,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取付款信息
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
List<Long> idList = Arrays.stream(paymentReconciliation.getChargeItemIds().split(",")).map(String::trim) // 去除可能的空格
.map(Long::parseLong) // 转换为 Long
.collect(Collectors.toList());
.map(Long::parseLong) // 转换为 Long
.collect(Collectors.toList());
// 获取费用项信息
List<ChargeItem> chargeItem = chargeItemService.getChargeItemInfo(idList);
@@ -312,30 +313,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -372,7 +373,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// chargeDetail 收费项目明细 JSONArray 不限 是
// 获取收费项目明细
// 医疗收费项目类别 13挂号费
List<String> ybTypeList = new ArrayList<>(Arrays.asList("13","02"));
List<String> ybTypeList = new ArrayList<>(Arrays.asList("13", "02"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -380,7 +381,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
chargeItemIds.add(Long.parseLong(part.trim())); // trim() 去除空格
} // todo 若挂号绑诊察的话,方法需要改
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
JSONArray chargeDetails = new JSONArray();
Integer sortNo = 1;
@@ -395,8 +396,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
// 精确表示,避免科学计数法
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
@@ -414,7 +415,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
JSONArray listDetails = new JSONArray();
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getRegListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
for (EleInvoiceListDetailDto detail : details) {
JSONObject listDetail = new JSONObject();
@@ -504,7 +505,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -553,30 +554,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -589,7 +590,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("busType", "02");
// ------就诊信息------
// patientCategory 就诊科室 String 60 是
bill.put("patientCategory", patientInfo.getPatientCategory());
// patientCategoryCode 就诊科室编码 String 60 是
@@ -606,11 +606,11 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
clinicSettle
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
// otherfundPay 其它医保支付
bill.put("otherfundPay",
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
// ownAcBalance 个人账户余额 Number 14,2 否
bill.put("ownAcBalance", clinicSettle.getBalc());
// balancedNumber 医保结算号 String 100 否 HIS和医保实时结算时医保生成的唯一业务流水号
@@ -675,7 +675,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 医疗收费项目类别
// 01 床位费,02 诊察费,03 检查费,04 化验费,05 治疗费,06 手术费,07 护理费,08 卫生材料费,09 西药费,10 中药饮片费,11 中成药费,12 一般诊疗费,13 挂号费,14 其他费
List<String> ybTypeList = new ArrayList<>(
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14"));
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -685,7 +685,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取收费项目明细
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
// chargeDetail 收费项目明细 JSONArray 不限 是 详见A-1,JSON格式列表
JSONArray chargeDetails = new JSONArray();
@@ -701,8 +701,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
chargeDetail.put("number", detail.getNumber());
@@ -719,7 +719,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
for (EleInvoiceListDetailDto detail : details) {
JSONObject listDetail = new JSONObject();
@@ -735,9 +735,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
listDetail.put("name", detail.getName());
// unit 计量单位 String 20 是
String unit = "";
if(detail.getUnit()==null||StringUtils.isEmpty(detail.getUnit())){
if (detail.getUnit() == null || StringUtils.isEmpty(detail.getUnit())) {
unit = "";
}else{
} else {
unit = detail.getUnit();
}
listDetail.put("unit", unit);
@@ -767,12 +767,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
String srcmsg;
System.out.println(JSON.toJSONString(bill));
JSONObject resobj;
<<<<<<< HEAD
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("门诊信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/invoiceEBillOutpatient");
} else {
@@ -815,7 +812,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -867,30 +864,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.IMP.getValue(), OrganizationClass.INPATIENT.getValue());
EncounterClass.IMP.getValue(), OrganizationClass.INPATIENT.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -905,7 +902,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("checker", user.getName());
// ------就诊信息------
// medCareAreaCode 医保行政区划码 String 6 否 医保结算时必须填写
bill.put("medCareAreaCode", patientInfo.getMedCareAreaCode());
// category 入院科室名称 String 50 是 如:入院科室不存在,填写出院科室
@@ -934,10 +930,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
clinicSettle
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
// otherfundPay 其它医保支付 Number 14,2 是
bill.put("otherfundPay",
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
// balancedNumber 医保结算号 String 100 否
bill.put("balancedNumber", clinicSettle.getSetlId() == null ? "" : clinicSettle.getSetlId());
// otherInfo 其它扩展信息列表 JSONArray 不限 是
@@ -990,7 +986,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 医疗收费项目类别
// 01 床位费,02 诊察费,03 检查费,04 化验费,05 治疗费,06 手术费,07 护理费,08 卫生材料费,09 西药费,10 中药饮片费,11 中成药费,12 一般诊疗费,13 挂号费,14 其他费
List<String> ybTypeList = new ArrayList<>(
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14"));
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -999,7 +995,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
JSONArray listDetails = new JSONArray();
@@ -1017,9 +1013,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
listDetail.put("name", detail.getName());
// unit 计量单位 String 20 是
String unit = "";
if(detail.getUnit()==null||StringUtils.isEmpty(detail.getUnit())){
if (detail.getUnit() == null || StringUtils.isEmpty(detail.getUnit())) {
unit = "";
}else{
} else {
unit = detail.getUnit();
}
listDetail.put("unit", unit);
@@ -1044,7 +1040,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取收费项目明细
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
// chargeDetail 收费项目明细 JSONArray 不限 是
JSONArray chargeDetails = new JSONArray();
@@ -1061,8 +1057,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
// 精确表示,避免科学计数法
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
@@ -1077,19 +1073,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("chargeDetail", chargeDetails);
// --------------------请求业务参数 data--------------------END
JSONObject redata = new JSONObject();
String redata64;
String srcdata;
String srcmsg;
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
JSONObject resobj;
<<<<<<< HEAD
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("住院信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
} else {
@@ -1132,7 +1124,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -1160,9 +1152,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
* @param clinicSettle 医保结算记录
* @return 返回值
*/
private JSONObject commomSet(EleInvoicePatientInfoDto patientInfo, EleInvoicePaymentInfoDto paymentInfo,
InvoiceBaseInfoDto clinicSettle) throws ParseException {
InvoiceBaseInfoDto clinicSettle) throws ParseException {
// 日期格式化:定义多种时间格式,用于生成业务流水号、时间戳等。
SimpleDateFormat sdfday = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
@@ -1266,7 +1257,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 360 老红军医疗保障 //370 企业补充医疗保险
// 380 新型农村合作医疗 //390 城乡居民基本医疗保险
// 391 城镇居民基本医疗保险 //392 城乡居民大病医疗保险 //399 其他特殊人员医疗保障
// 01 职工基本医疗保险 06 全公费
// 02 居民基本医疗保险 07 全自费
// 03 新型农村合作医疗 90 城乡居民医疗保险
@@ -1337,15 +1327,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
//BigDecimal overLmtSelfpay = clinicSettle.getOverlmtSelfpay()==null?ZERO:clinicSettle.getOverlmtSelfpay();
//全自费
clinicSettle
.setFulamtOwnpayAmt(clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt());
.setFulamtOwnpayAmt(clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt());
// 个人自负
clinicSettle.setPsnPartAmt(clinicSettle.getPsnPartAmt() == null ? ZERO : clinicSettle.getPsnPartAmt());
// 超限价
clinicSettle
.setOverlmtSelfpay(clinicSettle.getOverlmtSelfpay() == null ? ZERO : clinicSettle.getOverlmtSelfpay());
.setOverlmtSelfpay(clinicSettle.getOverlmtSelfpay() == null ? ZERO : clinicSettle.getOverlmtSelfpay());
//先行自付
clinicSettle
.setPreselfpayAmt(clinicSettle.getPreselfpayAmt() == null ? ZERO : clinicSettle.getPreselfpayAmt());
.setPreselfpayAmt(clinicSettle.getPreselfpayAmt() == null ? ZERO : clinicSettle.getPreselfpayAmt());
// 个人现金支付
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
@@ -1357,10 +1347,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("fundPay", df.format(clinicSettle.getHifpPay()));
// ownPay 自费金额 Number 14,2 是 2025/12/25 朝阳红旗中医院:电子发票个人自费=医保丙类+超限价)
// 2021-12-15 医保回复:个人自付 = PAY_COST医保账户+psn_part_amt个人现金+ (HIFMI_PAY)大病 -(fulamt_ownpay_amt)个人自费
BigDecimal acctPay = clinicSettle.getAcctPay()==null?ZERO:clinicSettle.getAcctPay();
BigDecimal psnPartAmt = clinicSettle.getPsnPartAmt()==null?ZERO:clinicSettle.getPsnPartAmt();
BigDecimal hifmiPay = clinicSettle.getHifmiPay()==null?ZERO:clinicSettle.getHifmiPay();
BigDecimal fulamtOwnpayAmt = clinicSettle.getFulamtOwnpayAmt()==null?ZERO:clinicSettle.getFulamtOwnpayAmt();
BigDecimal acctPay = clinicSettle.getAcctPay() == null ? ZERO : clinicSettle.getAcctPay();
BigDecimal psnPartAmt = clinicSettle.getPsnPartAmt() == null ? ZERO : clinicSettle.getPsnPartAmt();
BigDecimal hifmiPay = clinicSettle.getHifmiPay() == null ? ZERO : clinicSettle.getHifmiPay();
BigDecimal fulamtOwnpayAmt = clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt();
bill.put("ownPay", df.format(acctPay.add(psnPartAmt).add(hifmiPay).subtract(fulamtOwnpayAmt)));
// selfConceitedAmt 个人自负 Number 14,2 是 2025/12/25 朝阳红旗中医院:电子发票个人自付=医保乙类后患者自付的部分)
@@ -1384,17 +1374,17 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
paymentInfo.setDebitPayAmount(paymentInfo.getDebitPayAmount() == null ? ZERO : paymentInfo.getDebitPayAmount());
// 个人现金支付金额
paymentInfo
.setRmbCashPayAmount(paymentInfo.getRmbCashPayAmount() == null ? ZERO : paymentInfo.getRmbCashPayAmount());
.setRmbCashPayAmount(paymentInfo.getRmbCashPayAmount() == null ? ZERO : paymentInfo.getRmbCashPayAmount());
// 个人医保账户支付
paymentInfo.setZhPayAmount(paymentInfo.getZhPayAmount() == null ? ZERO : paymentInfo.getZhPayAmount());
// 基金支付总额
paymentInfo
.setYbFundPayAmount(paymentInfo.getYbFundPayAmount() == null ? ZERO : paymentInfo.getYbFundPayAmount());
.setYbFundPayAmount(paymentInfo.getYbFundPayAmount() == null ? ZERO : paymentInfo.getYbFundPayAmount());
// 其他(如医院负担金额)
paymentInfo.setOtherPayAmount(paymentInfo.getOtherPayAmount() == null ? ZERO : paymentInfo.getOtherPayAmount());
// 账户共济支付金额
paymentInfo
.setAelfYbZhGjValue(paymentInfo.getAelfYbZhGjValue() == null ? ZERO : paymentInfo.getAelfYbZhGjValue());
.setAelfYbZhGjValue(paymentInfo.getAelfYbZhGjValue() == null ? ZERO : paymentInfo.getAelfYbZhGjValue());
if (medCareTypeCode.equals("07")) {// 全自费
if (paymentInfo.getWxPayAmount().compareTo(ZERO) > 0) {
payChannelDetail = new JSONObject();
@@ -1423,8 +1413,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetail = new JSONObject();
payChannelDetail.put("payChannelCode", "02");// 02 现金
payChannelDetail.put("payChannelValue",
df.format(paymentInfo.getTotalAmt().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount())));
df.format(paymentInfo.getTotalAmt().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount())));
payChannelDetails.add(payChannelDetail);
}
} else {
@@ -1434,16 +1424,11 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetail.put("payChannelCode", "11");
// payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount().add(paymentInfo
// .getOtherPayAmount().add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue()))));
<<<<<<< HEAD
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
.add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue())));
=======
//payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
// .add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue())));
// 根据这几个医院的实际情况,医保支付金额先后刨除掉其他支付共济支付金额两项
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
.add(paymentInfo.getZhPayAmount())));
>>>>>>> v1.3
payChannelDetails.add(payChannelDetail);
// 现金
@@ -1472,7 +1457,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetails.add(payChannelDetail);
} else {
BigDecimal cashpay = clinicSettle.getPsnCashPay().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount());
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount());
if (cashpay.compareTo(ZERO) > 0) {
payChannelDetail = new JSONObject();
payChannelDetail.put("payChannelCode", "02");// 02 现金
@@ -1512,8 +1497,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
return R.fail(PromptMsgConstant.invoice.M00004);
}
Invoice invoice =
invoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId, paymentId));
Invoice invoice
= invoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId, paymentId));
if (invoice.getStatusEnum() == null || invoice.getStatusEnum().equals(InvoiceStatus.DRAFT)) {
return R.fail(PromptMsgConstant.invoice.M00007);
@@ -1548,13 +1533,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
JSONObject resobj;
<<<<<<< HEAD
logger.info("冲红信息入参:" + JSON.toJSONString(bill));
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("冲红信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
} else {
@@ -1577,13 +1558,13 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
return R.fail(PromptMsgConstant.Common.M00011);
}
// 查询退款的支付id
List<PaymentReconciliation> paymentReconciliation =
paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum,
Arrays.asList(PaymentStatus.REFUND_ALL.getValue(),
PaymentStatus.REFUND_PART.getValue()))
.eq(PaymentReconciliation::getDeleteFlag, '0').last("LIMIT 1"));
List<PaymentReconciliation> paymentReconciliation
= paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum,
Arrays.asList(PaymentStatus.REFUND_ALL.getValue(),
PaymentStatus.REFUND_PART.getValue()))
.eq(PaymentReconciliation::getDeleteFlag, '0').last("LIMIT 1"));
if (paymentReconciliation == null) {
return R.fail(PromptMsgConstant.invoice.M00009);
}
@@ -1628,7 +1609,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
invoiceAdd.setPictureNetUrl(redata.getString("pictureNetUrl"));
// 票据营业日期
//invoiceAdd.setBillBusDate(
//redata.getString("billBusDate") == "" ? null : sdf.parse(redata.getString("billBusDate")));
//redata.getString("billBusDate") == "" ? null : sdf.parse(redata.getString("billBusDate")));
Long invoiceIdAdd = invoiceService.addInvoice(invoiceAdd);
if (invoiceIdAdd == null) {
@@ -1636,7 +1617,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoiceAdd,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票冲红"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票冲红"}));
} else {
redata.put("result", rejson.getString("result").toString());
redata64 = rejson.getString("message").toString();
@@ -1665,7 +1646,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
//PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
List<PaymentRecDetail> details = paymentRecDetailService
.list(new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, paymentId));
.list(new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, paymentId));
InvoiceBaseInfoDto invoiceBaseInfoDto = initInvoiceBaseInfoDto();
@@ -1718,13 +1699,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
if (YbPayment.OVERLMT_SELFPAY.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setOverlmtSelfpay(detail.getAmount());
}
<<<<<<< HEAD
=======
// 先行自付费用
if (YbPayment.PRESELFPAY_AMT.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setPreselfpayAmt(detail.getAmount());
}
>>>>>>> v1.3
// 学校垫支
if (YbPayment.SCHOOL_GF_PAY.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setGfRatio(detail.getAmount());
@@ -1741,15 +1719,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
private InvoiceBaseInfoDto initInvoiceBaseInfoDto() {
InvoiceBaseInfoDto clinicSettle = new InvoiceBaseInfoDto();
return clinicSettle.setMedfeeSumamt(new BigDecimal("0.0")).setFulamtOwnpayAmt(new BigDecimal("0.0"))
.setOverlmtSelfpay(new BigDecimal("0.0")).setPreselfpayAmt(new BigDecimal("0.0"))
.setInscpScpAmt(new BigDecimal("0.0")).setActPayDedc(new BigDecimal("0.0"))
.setHifpPay(new BigDecimal("0.0")).setPoolPropSelfpay(new BigDecimal("0.0"))
.setCvlservPay(new BigDecimal("0.0")).setHifesPay(new BigDecimal("0.0")).setHifmiPay(new BigDecimal("0.0"))
.setHifobPay(new BigDecimal("0.00")).setMafPay(new BigDecimal("0.0")).setOthPay(new BigDecimal("0.0"))
.setFundPaySumamt(new BigDecimal("0.0")).setPsnPartAmt(new BigDecimal("0.0"))
.setAcctPay(new BigDecimal("0.0")).setPsnCashPay(new BigDecimal("0.0"))
.setHospPartAmt(new BigDecimal("0.0")).setBalc(new BigDecimal("0.0"))
.setAcctMulaidPay(new BigDecimal("0.0")).setHifdmPay(new BigDecimal("0.0"));
.setOverlmtSelfpay(new BigDecimal("0.0")).setPreselfpayAmt(new BigDecimal("0.0"))
.setInscpScpAmt(new BigDecimal("0.0")).setActPayDedc(new BigDecimal("0.0"))
.setHifpPay(new BigDecimal("0.0")).setPoolPropSelfpay(new BigDecimal("0.0"))
.setCvlservPay(new BigDecimal("0.0")).setHifesPay(new BigDecimal("0.0")).setHifmiPay(new BigDecimal("0.0"))
.setHifobPay(new BigDecimal("0.00")).setMafPay(new BigDecimal("0.0")).setOthPay(new BigDecimal("0.0"))
.setFundPaySumamt(new BigDecimal("0.0")).setPsnPartAmt(new BigDecimal("0.0"))
.setAcctPay(new BigDecimal("0.0")).setPsnCashPay(new BigDecimal("0.0"))
.setHospPartAmt(new BigDecimal("0.0")).setBalc(new BigDecimal("0.0"))
.setAcctMulaidPay(new BigDecimal("0.0")).setHifdmPay(new BigDecimal("0.0"));
}
@Override

View File

@@ -303,8 +303,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("insuplcAdmdvs", perinfo.getInsuplcAdmdvs());// 患者参保地区划
}
Contract contract =
contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
Contract contract
= contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
if (contract == null) {
throw new ServiceException("未查询到合同信息");
}
@@ -319,8 +319,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (encounterDiagnosis != null) {
Condition condition = iConditionService.getById(encounterDiagnosis.getConditionId());
if (condition != null) {
ConditionDefinition conditionDefinition =
iConditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
ConditionDefinition conditionDefinition
= iConditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
.eq(ConditionDefinition::getId, condition.getDefinitionId()));
if (conditionDefinition != null) {
map.put("conditionDefinition", conditionDefinition.getName());// 诊断名
@@ -349,9 +349,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = iChargeItemDefinitionService.getById(definitionId);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -467,35 +466,35 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// }
// 查询所有的支付详情
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> paymentIdList
= paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<PaymentRecDetail> paymentDetails = paymentRecDetailService
.list(new LambdaQueryWrapper<PaymentRecDetail>().in(PaymentRecDetail::getReconciliationId, paymentIdList)
.eq(PaymentRecDetail::getDeleteFlag, DelFlag.NO.getCode()).notIn(PaymentRecDetail::getPayEnum,
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(), YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
YbPayment.FULAMT_OWNPAY_AMT.getValue(), YbPayment.OVERLMT_SELFPAY.getValue(),
YbPayment.PRESELFPAY_AMT.getValue(), YbPayment.INSCP_SCP_AMT.getValue(),
YbPayment.ACT_PAY_DEDC.getValue(), YbPayment.POOL_PROP_SELFPAY.getValue(),
YbPayment.BALC.getValue(), YbPayment.BIRTH_FUND.getValue(), YbPayment.RETIREE_MEDICAL.getValue(),
YbPayment.MEDICAL_ASSISTANCE.getValue(), YbPayment.URBAN_SERIOUS_ILLNESS.getValue(),
YbPayment.URBAN_BASIC_MEDICAL.getValue(), YbPayment.GOVERNMENT_SUBSIDY.getValue(),
YbPayment.ACCIDENT_INSURANCE.getValue(), YbPayment.CARE_INSURANCE.getValue(),
YbPayment.FINANCIAL_FUND.getValue(), YbPayment.HOSPITAL_ADVANCE.getValue(),
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
YbPayment.BASIC_MEDICAL_INSURANCE_FOR_URBAN_EMPLOYEES.getValue(), YbPayment.E_WALLET.getValue(),
YbPayment.HEALTHCARE_PREPAYMENT.getValue()));
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(), YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
YbPayment.FULAMT_OWNPAY_AMT.getValue(), YbPayment.OVERLMT_SELFPAY.getValue(),
YbPayment.PRESELFPAY_AMT.getValue(), YbPayment.INSCP_SCP_AMT.getValue(),
YbPayment.ACT_PAY_DEDC.getValue(), YbPayment.POOL_PROP_SELFPAY.getValue(),
YbPayment.BALC.getValue(), YbPayment.BIRTH_FUND.getValue(), YbPayment.RETIREE_MEDICAL.getValue(),
YbPayment.MEDICAL_ASSISTANCE.getValue(), YbPayment.URBAN_SERIOUS_ILLNESS.getValue(),
YbPayment.URBAN_BASIC_MEDICAL.getValue(), YbPayment.GOVERNMENT_SUBSIDY.getValue(),
YbPayment.ACCIDENT_INSURANCE.getValue(), YbPayment.CARE_INSURANCE.getValue(),
YbPayment.FINANCIAL_FUND.getValue(), YbPayment.HOSPITAL_ADVANCE.getValue(),
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
YbPayment.BASIC_MEDICAL_INSURANCE_FOR_URBAN_EMPLOYEES.getValue(), YbPayment.E_WALLET.getValue(),
YbPayment.HEALTHCARE_PREPAYMENT.getValue()));
if (paymentDetails.isEmpty()) {
return getMap(map);
}
Map<Long, List<PaymentRecDetail>> paymentDetailsKV =
paymentDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
Map<Long, List<PaymentRecDetail>> paymentDetailsKV
= paymentDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
// 声明变量,符合要求的付款记录
Collection<PaymentReconciliation> PaymentReconciliationList;
List<Account> accountList = new ArrayList<>();
if (!StringUtils.isEmpty(contractNo)) {
// 查询账户信息用来区分省市医保
List<Long> accountIds =
paymentDetails.stream().map(PaymentRecDetail::getAccountId).collect(Collectors.toList());
List<Long> accountIds
= paymentDetails.stream().map(PaymentRecDetail::getAccountId).collect(Collectors.toList());
if (accountIds.isEmpty()) {
throw new ServiceException("查询账户信息为空");
}
@@ -505,8 +504,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
Map<Long, PaymentReconciliation> paymentMap = new HashMap<>();
for (PaymentRecDetail paymentDetail : paymentDetails) {
Optional<Account> first =
accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
Optional<Account> first
= accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
// 账户不符合要求的筛出掉
if (first.isEmpty() || !first.get().getContractNo().equals(contractNo)) {
continue;
@@ -545,7 +544,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(chargeItemId);
// System.out.println(",");
// }
List<ChargeItem> chargeItemList = chargeItemService.list(new LambdaQueryWrapper<ChargeItem>()
.in(ChargeItem::getId, chargeItemIds).eq(ChargeItem::getDeleteFlag, DelFlag.NO.getCode()));
if (paymentDetails.isEmpty()) {
@@ -558,20 +556,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(JSON.toJSONString(chargeItem));
// }
// }
// 查询收费定义列表
List<Long> chargeItemDefinitionIdList =
chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> chargeItemDefinitionIdList
= chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (chargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
List<ChargeItemDefinition> chargeItemDefinitions =
iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
List<ChargeItemDefinition> chargeItemDefinitions
= iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
if (chargeItemDefinitions.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
// 查询医保结算id
List<String> settleIds = new ArrayList<>();
@@ -602,8 +599,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
for (PaymentRecDetail paymentDetail : paymentDetails) {
if (!StringUtils.isEmpty(contractNo)) {
Optional<Account> first =
accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
Optional<Account> first
= accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
if (first.isEmpty() || !first.get().getContractNo().equals(contractNo)) {
continue;
}
@@ -646,14 +643,14 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
}
if (!returnPaymentList.isEmpty()) {
List<Long> returnIds =
returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> returnIds
= returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliation paymentReconciliation : returnPaymentList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
@@ -719,8 +716,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -799,10 +796,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
throw new ServiceException("收费定义未设置财务分类提示信息chargeItemDefinitionId" + chargeItemDefinition.getId());
}
}
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> stringListEntry : chargeItemDefMapByTypeCode.entrySet()) {
String key = stringListEntry.getKey();
@@ -863,16 +860,15 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// }
// }
// }
// 查询所有的支付详情
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> paymentIdList
= paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
// List<PaymentRecDetail> paymentDetails = paymentRecDetailService
// .list(new LambdaQueryWrapper<PaymentRecDetail>().in(PaymentRecDetail::getReconciliationId, paymentIdList)
// .eq(PaymentRecDetail::getDeleteFlag, DelFlag.NO.getCode()));
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList =
paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList
= paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
if (PaymentRecDetailAccountResultList.isEmpty()) {
return getMap(map);
}
@@ -935,7 +931,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// throw new ServiceException("收费项:" + chargeItem.getId());
// }
// }
// 根据省市医保分组
Map<String, List<PaymentRecDetailAccountResult>> paymentDetailsMapByContract = PaymentRecDetailAccountResultList
.stream().collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
@@ -964,20 +959,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(JSON.toJSONString(chargeItem));
// }
// }
// 查询收费定义列表
List<Long> chargeItemDefinitionIdList =
chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> chargeItemDefinitionIdList
= chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (chargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
List<ChargeItemDefinition> chargeItemDefinitions =
iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
List<ChargeItemDefinition> chargeItemDefinitions
= iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
if (chargeItemDefinitions.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
// 查询医保结算id
List<String> settleIds = new ArrayList<>();
@@ -1011,8 +1005,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
BigDecimal YbCashSum = BigDecimal.ZERO;// 医保现金总额
// 长大版本要显示出来省市医保的区别
List<Contract> redisContractList = iContractService.getRedisContractList();
Map<String, List<Contract>> contractMapByBusNo =
redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
Map<String, List<Contract>> contractMapByBusNo
= redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
for (Map.Entry<String, List<PaymentRecDetailAccountResult>> stringListEntry : paymentDetailsMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -1122,11 +1116,11 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<ChargeItemDefinition> beforeChargeItemDefinitions = new ArrayList<>();
List<ChargeItem> beforeChargeItemList = new ArrayList<>();
if (!returnPaymentList.isEmpty()) {
List<Long> returnIds =
returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> returnIds
= returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
// 查原付款单子
List<Long> relationIdList =
returnPaymentList.stream().map(PaymentReconciliation::getRelationId).collect(Collectors.toList());
List<Long> relationIdList
= returnPaymentList.stream().map(PaymentReconciliation::getRelationId).collect(Collectors.toList());
if (relationIdList.isEmpty() || returnPaymentList.size() != relationIdList.size()) {
throw new ServiceException("数据异常,存在无法关联到原单的退款单,请联系工程师");
}
@@ -1142,8 +1136,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
if (!beforeList.isEmpty()) {
// 拆解所有的chargeItemId拼装成一个集合
List<String> chargeItemIdList =
beforeList.stream().map(PaymentReconciliation::getChargeItemIds).collect(Collectors.toList());
List<String> chargeItemIdList
= beforeList.stream().map(PaymentReconciliation::getChargeItemIds).collect(Collectors.toList());
List<Long> beforeChargeItemIds = new ArrayList<>();
for (String chargeItemId : chargeItemIdList) {
if (StringUtils.isNotEmpty(chargeItemId)) {
@@ -1158,8 +1152,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (beforeChargeItemList.isEmpty()) {
throw new ServiceException("数据异常,查找不到退费收费项信息");
}
List<Long> beforeChargeItemDefinitionIdList =
beforeChargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> beforeChargeItemDefinitionIdList
= beforeChargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (beforeChargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("数据异常,查找不到收费项的定义信息");
}
@@ -1180,8 +1174,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -1233,13 +1227,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliation paymentReconciliation : returnPaymentList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
List<PaymentRecDetailAccountResult> paymentRecDetails =
paymentDetailsKV.get(paymentReconciliation.getId());
List<PaymentRecDetailAccountResult> paymentRecDetails
= paymentDetailsKV.get(paymentReconciliation.getId());
for (PaymentRecDetailAccountResult paymentRecDetail : paymentRecDetails) {
if (YbPayment.SELF_CASH_PAY.getValue().equals(paymentRecDetail.getPayEnum())) {
returnBillVO.setPaidAmount(paymentRecDetail.getAmount());
@@ -1286,8 +1280,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -1367,10 +1361,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
}
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> stringListEntry : chargeItemDefMapByTypeCode.entrySet()) {
String key = stringListEntry.getKey();
@@ -1389,10 +1383,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 超本时间段的退费单统计
if (!beforeChargeItemDefinitions.isEmpty() && !beforeChargeItemList.isEmpty()) {
Map<String, List<ChargeItemDefinition>> beforeChargeItemDefMapByTypeCode =
beforeChargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> beforeChargeItemMapByDefinitionId =
beforeChargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> beforeChargeItemDefMapByTypeCode
= beforeChargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> beforeChargeItemMapByDefinitionId
= beforeChargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> longListEntry : beforeChargeItemDefMapByTypeCode
.entrySet()) {
BigDecimal bigDecimal = map.get(longListEntry.getKey()) == null ? BigDecimal.ZERO
@@ -1413,8 +1407,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract =
list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -1428,7 +1422,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
* 长大门诊日结单(最终版) ps小范围区间内通用版本需要时间检验
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @param entererId 参与人id
* @return 参数
*/
@@ -1473,10 +1467,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("amount", amount);// 应收金额
// 查询所有的支付详情(业务注释:收集并统计不同支付渠道支付的费用)
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList =
paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
List<Long> paymentIdList
= paymentReconciliationList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList
= paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
if (PaymentRecDetailAccountResultList.isEmpty()) {
return getMap(map);
@@ -1503,8 +1497,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
BigDecimal discountSum = BigDecimal.ZERO;// 优惠金额
// 长大版本要显示出来省市医保的区别
List<Contract> redisContractList = iContractService.getRedisContractList();
Map<String, List<Contract>> contractMapByBusNo =
redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
Map<String, List<Contract>> contractMapByBusNo
= redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
for (Map.Entry<String, List<PaymentRecDetailAccountResult>> stringListEntry : paymentDetailsMapByContract
.entrySet()) {
@@ -1584,15 +1578,15 @@ public class IChargeBillServiceImpl implements IChargeBillService {
Map<Long, List<PaymentReconciliationAccountDel>> returnPaymentMapByRelationId = new HashMap<>();
if (!returnList.isEmpty()) {
returnPaymentMapByRelationId =
returnList.stream().collect(Collectors.groupingBy(PaymentReconciliationAccountDel::getRelationId));
returnPaymentMapByRelationId
= returnList.stream().collect(Collectors.groupingBy(PaymentReconciliationAccountDel::getRelationId));
}
List<String> addChargeItemIds = new ArrayList<>();
List<String> subChargeItemIds = new ArrayList<>();
for (PaymentReconciliationAccountDel paymentReconciliation : paymentList) {
List<PaymentReconciliationAccountDel> paymentReconciliations =
returnPaymentMapByRelationId.get(paymentReconciliation.getId());
List<PaymentReconciliationAccountDel> paymentReconciliations
= returnPaymentMapByRelationId.get(paymentReconciliation.getId());
if (paymentReconciliations != null && !paymentReconciliations.isEmpty()) {
// 情况a
if (PaymentStatus.SUCCESS.getValue().equals(paymentReconciliation.getStatusEnum())) {
@@ -1646,8 +1640,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (chargeItemDefInfoByIds.isEmpty()) {
throw new ServiceException("数据异常,该时间段内未查询到收费项");
}
Map<Long, List<ChargeItemDefInfo>> chargeItemDefInfoKVById =
chargeItemDefInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemDefInfo::getId));
Map<Long, List<ChargeItemDefInfo>> chargeItemDefInfoKVById
= chargeItemDefInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemDefInfo::getId));
// 省名变量
BigDecimal bedFee = BigDecimal.ZERO;// 床位费
@@ -1805,15 +1799,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("GENERAL_CONSULTATION_FEE", generalConsultationFee);// 一般诊疗费
map.put("REGISTRATION_FEE", registrationFee);// 挂号费
map.put("OTHER_FEE", otherFee);// 其他费用
<<<<<<< HEAD
sum = bedFee.add(diagnosticFee).add(checkFee).add(diagnosticTestFee).add(medicalExpenseFee).add(operationFee)
.add(nursingFee).add(sanitaryMaterialsFee).add(westMedicine).add(chineseMedicineFee)
.add(chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee).subtract(discountSum);
=======
sum = bedFee.add(diagnosticFee).add(checkFee).add(diagnosticTestFee).add(outDiagnosticTestFee).add(medicalExpenseFee).add(operationFee)
.add(nursingFee).add(sanitaryMaterialsFee).add(westMedicine).add(chineseMedicineFee).add(
chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee);
>>>>>>> v1.3
chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee);
map.put("SUM", sum);// 合计费用
Map<String, List<ChargeItemDefInfo>> chargeItemDefKVByTypeCode = chargeItemDefInfoByIds.stream()
@@ -1848,11 +1836,11 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ReturnBillVO returnBillVO;
if (!returnList.isEmpty()) {
List<Long> returnIds =
returnList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<Long> returnIds
= returnList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
// 查原付款单子
List<Long> relationIdList =
returnList.stream().map(PaymentReconciliationAccountDel::getRelationId).collect(Collectors.toList());
List<Long> relationIdList
= returnList.stream().map(PaymentReconciliationAccountDel::getRelationId).collect(Collectors.toList());
if (relationIdList.isEmpty() || returnList.size() != relationIdList.size()) {
throw new ServiceException("数据异常,存在无法关联到原单的退款单,请联系工程师");
}
@@ -1860,13 +1848,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliationAccountDel paymentReconciliation : returnList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
List<PaymentRecDetailAccountResult> paymentRecDetails =
paymentDetailsKV.get(paymentReconciliation.getId());
List<PaymentRecDetailAccountResult> paymentRecDetails
= paymentDetailsKV.get(paymentReconciliation.getId());
for (PaymentRecDetailAccountResult paymentRecDetail : paymentRecDetails) {
if (YbPayment.SELF_CASH_PAY.getValue().equals(paymentRecDetail.getPayEnum())) {
returnBillVO.setPaidAmount(paymentRecDetail.getAmount());
@@ -1894,11 +1882,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// map.put("tcSum", tcSum);// 基本统筹
// map.put("zhSum", zhSum);// 账户支付
// map.put("fundSum", fundSum);// 基金支付总额
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract =
list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -2032,8 +2019,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_SLICES_FEE:
tyChineseMedicineSlicesFee =
tyChineseMedicineSlicesFee.add(chargeItem.getSystemDiscountPrice() == null
tyChineseMedicineSlicesFee
= tyChineseMedicineSlicesFee.add(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_FEE:
@@ -2109,8 +2096,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_SLICES_FEE:
tyChineseMedicineSlicesFee =
tyChineseMedicineSlicesFee.subtract(chargeItem.getSystemDiscountPrice() == null
tyChineseMedicineSlicesFee
= tyChineseMedicineSlicesFee.subtract(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_FEE:
@@ -2118,8 +2105,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case GENERAL_CONSULTATION_FEE:
tyGeneralConsultationFee =
tyGeneralConsultationFee.subtract(chargeItem.getSystemDiscountPrice() == null
tyGeneralConsultationFee
= tyGeneralConsultationFee.subtract(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case REGISTRATION_FEE:
@@ -2149,8 +2136,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("TY_REGISTRATION_FEE", tyRegistrationFee);// 挂号费
map.put("TY_OTHER_FEE", tyOtherFee);// 其他费用
tySum = tyBedFee.add(tyDiagnosticFee).add(tyCheckFee).add(tyDiagnosticTestFee).add(tyOutDiagnosticTestFee).add(tyMedicalExpenseFee).add(
tyOperationFee).add(tyNursingFee).add(tySanitaryMaterialsFee).add(tyWestMedicine).add(
tyChineseMedicineSlicesFee).add(tyChineseMedicineFee).add(tyGeneralConsultationFee).add(tyRegistrationFee)
tyOperationFee).add(tyNursingFee).add(tySanitaryMaterialsFee).add(tyWestMedicine).add(
tyChineseMedicineSlicesFee).add(tyChineseMedicineFee).add(tyGeneralConsultationFee).add(tyRegistrationFee)
.add(tyOtherFee);
map.put("TY_SUM", tySum);// 合计费用
@@ -2236,13 +2223,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
.map(Long::valueOf) // 转换为Long
.collect(Collectors.toList());
List<ChargeItemExtendInfoDto> ChargeItemExtendInfoDtoList =
chargeBillMapper.selectChargeItemExtendInfoList(chargeItemIds, chargeSummaryDto.getOrgIdList());
List<ChargeItemExtendInfoDto> ChargeItemExtendInfoDtoList
= chargeBillMapper.selectChargeItemExtendInfoList(chargeItemIds, chargeSummaryDto.getOrgIdList());
Map<Long, List<ChargeItemExtendInfoDto>> chargeItemExtendInfoDtoListGroupByOrgIdMap =
ChargeItemExtendInfoDtoList.stream().collect(Collectors.groupingBy(ChargeItemExtendInfoDto::getOrgId));
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper =
new LambdaQueryWrapper<Organization>().eq(Organization::getTypeEnum, OrganizationType.DEPARTMENT.getValue())
Map<Long, List<ChargeItemExtendInfoDto>> chargeItemExtendInfoDtoListGroupByOrgIdMap
= ChargeItemExtendInfoDtoList.stream().collect(Collectors.groupingBy(ChargeItemExtendInfoDto::getOrgId));
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper
= new LambdaQueryWrapper<Organization>().eq(Organization::getTypeEnum, OrganizationType.DEPARTMENT.getValue())
.eq(Organization::getDeleteFlag, DelFlag.NO.getCode()).orderByDesc(Organization::getDisplayOrder);
if (chargeSummaryDto.getOrgIdList() != null && !chargeSummaryDto.getOrgIdList().isEmpty()) {
organizationLambdaQueryWrapper.in(Organization::getId, chargeSummaryDto.getOrgIdList());
@@ -2256,8 +2243,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
for (Organization organization : organizationList) {
orgIncomeDto = new OrgIncomeDto();
orgIncomeDto.setOrgName(organization.getName());
List<ChargeItemExtendInfoDto> chargeItemExtendInfoDtos =
chargeItemExtendInfoDtoListGroupByOrgIdMap.get(organization.getId());
List<ChargeItemExtendInfoDto> chargeItemExtendInfoDtos
= chargeItemExtendInfoDtoListGroupByOrgIdMap.get(organization.getId());
if (chargeItemExtendInfoDtos == null) {
orgIncomeList.add(orgIncomeDto);
continue;
@@ -2380,7 +2367,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
Invoice invoice = iInvoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId,
paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue()).orderByDesc(Invoice::getCreateTime)
paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue()).orderByDesc(Invoice::getCreateTime)
.last(YbCommonConstants.sqlConst.LIMIT1));
if (invoice != null) {
map.put("invoiceNo", invoice.getBillNo());// 支付详细
@@ -2388,7 +2375,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
List<Long> chargeItemIds = Arrays.stream(paymentReconciliation.getChargeItemIds().split(",")).map(
Long::parseLong) // 将字符串转换为 Long
Long::parseLong) // 将字符串转换为 Long
.collect(Collectors.toList());
List<ChargeItemBaseInfoDto> chargeItemBaseInfoByIds = chargeItemService.getChargeItemBaseInfoByIds(
chargeItemIds);
@@ -2434,7 +2421,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("regNo", encounter.getBusNo());// 门诊号
InfoPerson perinfo = iPerinfoService.getOne(new LambdaQueryWrapper<InfoPerson>().eq(InfoPerson::getCertno,
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
.orderByDesc(InfoPerson::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (perinfo != null) {
map.put("personType", perinfo.getInsutype());// 人员类别:职工医保,居民医保等;如果为空显示自费或其他
@@ -2444,8 +2431,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 查询主诊断信息
EncounterDiagnosis encounterDiagnosis = iEncounterDiagnosisService.getOne(
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getEncounterId, encounter.getId()).eq(
EncounterDiagnosis::getMaindiseFlag, Whether.YES.getValue()).eq(EncounterDiagnosis::getDeleteFlag,
DelFlag.NO.getCode()).orderByDesc(EncounterDiagnosis::getDiagSrtNo)
EncounterDiagnosis::getMaindiseFlag, Whether.YES.getValue()).eq(EncounterDiagnosis::getDeleteFlag,
DelFlag.NO.getCode()).orderByDesc(EncounterDiagnosis::getDiagSrtNo)
.last(YbCommonConstants.sqlConst.LIMIT1));
if (encounterDiagnosis != null) {
@@ -2495,7 +2482,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
InfoPerson perinfo = iPerinfoService.getOne(new LambdaQueryWrapper<InfoPerson>().eq(InfoPerson::getCertno,
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
.orderByDesc(InfoPerson::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (perinfo != null) {
YbMdcsType byCode = YbMdcsType.getByCode(perinfo.getInsutype());
@@ -2527,9 +2514,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// PaymentStatus.SUCCESS.getValue()).in(PaymentReconciliation::getId,paymentIdList));
List<PaymentReconciliation> list = paymentReconciliationService.list(
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getDeleteFlag,
DelFlag.NO.getCode()).eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.between(PaymentReconciliation::getBillDate, Date.from(LocalDateTime.parse("2025-12-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())
, Date.from(LocalDateTime.parse("2025-12-31 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())));
DelFlag.NO.getCode()).eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.between(PaymentReconciliation::getBillDate, Date.from(LocalDateTime.parse("2025-12-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant()),
Date.from(LocalDateTime.parse("2025-12-31 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())));
for (PaymentReconciliation paymentReconciliation : list) {
@@ -2598,7 +2585,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// BigDecimal b = BigDecimal.ZERO;// 实付金额与药品金额差值即待分配金额
// BigDecimal c = BigDecimal.ZERO;// 诊疗检查等项目的合计金额
// BigDecimal d = paymentReconciliation.getTenderedAmount().subtract(paymentRecDetail.getAmount());// 实际交款金额
List<ChargeItem> newChargeItemList = new ArrayList<>();
for (ChargeItemDefInfo chargeItemDefInfo : chargeItemDefInfoByIdList) {

View File

@@ -2,22 +2,14 @@ package com.openhis.web.paymentmanage.appservice.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
<<<<<<< HEAD
=======
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.constant.Constants;
>>>>>>> v1.3
import com.core.common.core.domain.R;
import com.core.common.enums.TenantOptionDict;
import com.core.common.exception.ServiceException;
import com.core.common.utils.SecurityUtils;
<<<<<<< HEAD
import com.core.web.util.TenantOptionUtil;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IPractitionerService;
=======
import com.core.common.utils.StringUtils;
import com.core.web.util.TenantOptionUtil;
import com.openhis.administration.domain.Practitioner;
@@ -25,19 +17,15 @@ import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.PaymentStatus;
import com.openhis.common.utils.HisQueryUtils;
>>>>>>> v1.3
import com.openhis.financial.domain.PaymentReconciliation;
import com.openhis.financial.domain.ThreePartPayCallBack;
import com.openhis.financial.service.IPaymentRecDetailService;
import com.openhis.financial.service.IPaymentReconciliationService;
import com.openhis.financial.service.ThreePartPayCallBackService;
import com.openhis.web.paymentmanage.appservice.ThreePartPayService;
<<<<<<< HEAD
=======
import com.openhis.web.paymentmanage.dto.PaymentVO;
import com.openhis.web.paymentmanage.dto.ThreePartCallBackVo;
import com.openhis.web.paymentmanage.mapper.PaymentMapper;
>>>>>>> v1.3
import com.openhis.yb.dto.BaseInfo;
import com.openhis.yb.dto.BaseParam;
import com.openhis.yb.dto.PaymentDetailDto;
@@ -52,15 +40,6 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
<<<<<<< HEAD
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
=======
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,43 +54,27 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.function.Consumer;
>>>>>>> v1.3
@Component
@Slf4j
public class ThreePartPayServiceImpl implements ThreePartPayService {
<<<<<<< HEAD
=======
Logger logger = LoggerFactory.getLogger(ThreePartPayServiceImpl.class);
>>>>>>> v1.3
@Autowired
private IPractitionerService practitionerService;
@Autowired
private IPaymentRecDetailService paymentRecDetailService;
@Autowired
<<<<<<< HEAD
=======
private PaymentMapper paymentMapper;
@Autowired
>>>>>>> v1.3
private IPaymentReconciliationService paymentReconciliationService;
@Autowired
private ThreePartPayCallBackService threePartPayCallBackService;
@Autowired
private ThreePartSimpleFieldMappingService threePartSimpleFieldMappingService;
@Override
<<<<<<< HEAD
public R<?> payFor(ThreePartPayDto threePartPayDto) {
String threePartUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_PAY_URL);
//String threePartUrl = "http://127.0.0.1:19994/?MSG=EXEC&yylx=02&posjh=&posygh=&jylx=00&je={je}&yjyrq=&yjyckh=&ypzh=&lrcjy=&cm={cm}&ysddh=&erpddh=&body=";
String threePartParam = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_PARAM);
JSONObject jsonObject = JSON.parseObject(threePartParam);
=======
public R<?> sign() {
// A.获取配置信息
String threePartUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_SIGN_URL);
@@ -132,7 +95,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付签到失败!");
}
@@ -161,7 +124,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付签出失败!");
}
@@ -180,7 +143,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
JSONObject jsonObject = JSON.parseObject(activeParam);
//B.基础信息查询
>>>>>>> v1.3
//订单号及订单信息
Long paymentId = threePartPayDto.getId();
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
@@ -188,21 +150,12 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//金额处理
BigDecimal amount = BigDecimal.ZERO;
for (PaymentDetailDto paymentDetail : threePartPayDto.getPaymentDetails()) {
<<<<<<< HEAD
if(threePartPayDto.getIndex().equals(paymentDetail.getPayEnum())){
amount = paymentDetail.getAmount();
}
}
amount = amount.multiply(new BigDecimal("100"));
String amountResult = String.format("%010d", Integer.parseInt(amount.toString()));
=======
//if(threePartPayDto.getIndex().equals(paymentDetail.getPayEnum())){
amount = amount.add(paymentDetail.getAmount());
amount = amount.add(paymentDetail.getAmount());
//}
}
amount = amount.multiply(new BigDecimal("100"));
String amountResult = String.format("%010d", amount.intValue());
>>>>>>> v1.3
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
@@ -210,31 +163,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//获取支付码
String txtCode = threePartPayDto.getTxtCode();
<<<<<<< HEAD
//获取参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, null, paymentReconciliation, amountResult, txtCode);
//获取完整url
String url = renderTemplateSafe(threePartUrl, paramMap);
String result = httpGet(url);
String threePartMapping = threePartSimpleFieldMappingService.reverseMap("threePartMapping", result);
threePartPayCallBackService.save(JSON.parseObject(threePartMapping,ThreePartPayCallBack.class));
return R.ok();
}
=======
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, null, paymentReconciliation, amountResult, txtCode);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付失败!");
}
@@ -244,18 +179,18 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
//红旗临时处理这个if后续可删除
if(threePartPayDto.getId()==null){
if (threePartPayDto.getId() == null) {
threePartPayDto.setId(1l);
}
threePartPayCallBack.setPaymentId(threePartPayDto.getId());
threePartPayCallBackService.save(threePartPayCallBack);
if(threePartPayCallBack!=null&&threePartPayCallBack.getPayResult()!=null&&"00".equals(threePartPayCallBack.getPayResult())){
return R.ok("成功支付"+new BigDecimal(threePartPayCallBack.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack != null && threePartPayCallBack.getPayResult() != null && "00".equals(threePartPayCallBack.getPayResult())) {
return R.ok("成功支付" + new BigDecimal(threePartPayCallBack.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack==null?"支付失败,详见日志文件":threePartPayCallBack.getErrMsg());
return R.fail(threePartPayCallBack == null ? "支付失败,详见日志文件" : threePartPayCallBack.getErrMsg());
}
@@ -286,7 +221,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -297,11 +232,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
//threePartPayCallBackService.save(threePartPayCallBack1);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功支付"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功支付" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack1==null?"查询失败,详见日志文件":threePartPayCallBack1.getErrMsg());
return R.fail(threePartPayCallBack1 == null ? "查询失败,详见日志文件" : threePartPayCallBack1.getErrMsg());
}
@@ -324,14 +259,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, paymentReconciliation, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -341,11 +275,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
threePartPayCallBackService.save(threePartPayCallBack1);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功退费"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功退费" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack1==null?"退费失败,详见日志文件":threePartPayCallBack1.getErrMsg());
return R.fail(threePartPayCallBack1 == null ? "退费失败,详见日志文件" : threePartPayCallBack1.getErrMsg());
}
@@ -368,14 +302,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, paymentReconciliation, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -387,7 +320,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
threePartPayCallBackService.save(threePartPayCallBack1);
if("00".equals(threePartPayCallBack1.getPayResult())){
if ("00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok();
}
@@ -408,20 +341,18 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//B.基础信息查询
//PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
ThreePartPayCallBack threePartPayCallBack = threePartPayCallBackService.getById(id);
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, null, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -431,11 +362,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//threePartPayCallBackService.save(JSON.parseObject(threePartMapping,ThreePartPayCallBack.class));
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功退费:"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功退费:" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP) + "");
}
return R.ok(threePartPayCallBack1==null?"退费失败详见日志!":threePartPayCallBack1.getErrMsg());
return R.ok(threePartPayCallBack1 == null ? "退费失败详见日志!" : threePartPayCallBack1.getErrMsg());
}
@Override
@@ -446,20 +377,20 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PaymentNo)),
request);
IPage<ThreePartCallBackVo> ThreePartCallBackVoIPage =
paymentMapper.getThreePartCallBackVoPage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<ThreePartCallBackVo> ThreePartCallBackVoIPage
= paymentMapper.getThreePartCallBackVoPage(new Page<>(pageNo, pageSize), queryWrapper);
ThreePartCallBackVoIPage.getRecords().forEach(e->{
ThreePartCallBackVoIPage.getRecords().forEach(e -> {
e.setIdStr(e.getId().toString());
//e.setPaymentIdStr(e.getPaymentId()==null?null:e.getPaymentId().toString());
});
return R.ok(ThreePartCallBackVoIPage);
}
>>>>>>> v1.3
/**
* 拼接参数
*
* @param jsonObject 配置信息
* @param practitioner 款员信息
* @param threePartPayCallBack 原订单
@@ -467,92 +398,94 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
* @param txtCode 支付码
* @return
*/
private Map<String,String> getParamMap(JSONObject jsonObject,Practitioner practitioner, ThreePartPayCallBack threePartPayCallBack,PaymentReconciliation paymentReconciliation,String amountResult,String txtCode){
private Map<String, String> getParamMap(JSONObject jsonObject, Practitioner practitioner, ThreePartPayCallBack threePartPayCallBack, PaymentReconciliation paymentReconciliation, String amountResult, String txtCode) {
Map<String, String> paramMap = new HashMap<>();
//款员信息
if(practitioner!=null){
if (practitioner != null) {
String posNoKey = jsonObject.getString("posNo");//pos机编码
if(posNoKey!=null){
paramMap.put(posNoKey,practitioner.getPosNo());
if (posNoKey != null) {
paramMap.put(posNoKey, practitioner.getPosNo());
}
String userIdKey = jsonObject.getString("userId");
if(userIdKey!=null){
paramMap.put(userIdKey,practitioner.getId().toString());
if (userIdKey != null) {
paramMap.put(userIdKey, practitioner.getId().toString());
}
String userNameKey = jsonObject.getString("userName");
if(userNameKey!=null){
paramMap.put(userNameKey,practitioner.getName());
if (userNameKey != null) {
paramMap.put(userNameKey, practitioner.getName());
}
}
//原账单信息
if(threePartPayCallBack!=null){
if (threePartPayCallBack != null) {
String bankOrderIdKey = jsonObject.getString("bankOrderId");
if(bankOrderIdKey!=null){
paramMap.put(bankOrderIdKey,threePartPayCallBack.getTradeNo());//银行订单号
if (bankOrderIdKey != null) {
paramMap.put(bankOrderIdKey, threePartPayCallBack.getTradeNo());//银行订单号
}
String payWayOrderIdKey = jsonObject.getString("payWayOrderId");
if(payWayOrderIdKey!=null){
paramMap.put(payWayOrderIdKey,threePartPayCallBack.getTransNo());//支付渠道订单号
if (payWayOrderIdKey != null) {
paramMap.put(payWayOrderIdKey, threePartPayCallBack.getTransNo());//支付渠道订单号
}
String tranTypeKey = jsonObject.getString("tranType");
if(tranTypeKey!=null){
paramMap.put(tranTypeKey,threePartPayCallBack.getTranType());//交易类型
if (tranTypeKey != null) {
paramMap.put(tranTypeKey, threePartPayCallBack.getTranType());//交易类型
}
String payTypeKey = jsonObject.getString("payType");
if(payTypeKey!=null){
paramMap.put(payTypeKey,threePartPayCallBack.getPayType());//支付方式
if (payTypeKey != null) {
paramMap.put(payTypeKey, threePartPayCallBack.getPayType());//支付方式
}
String traceNoKey = jsonObject.getString("traceNo");
if(payWayOrderIdKey!=null){
paramMap.put(traceNoKey,threePartPayCallBack.getTraceNo());//终端流水号
if (payWayOrderIdKey != null) {
paramMap.put(traceNoKey, threePartPayCallBack.getTraceNo());//终端流水号
}
String txnTimeKey = jsonObject.getString("txnTime");
if(payWayOrderIdKey!=null){
paramMap.put(txnTimeKey,threePartPayCallBack.getTxnTime());//交易时间
if (payWayOrderIdKey != null) {
paramMap.put(txnTimeKey, threePartPayCallBack.getTxnTime());//交易时间
}
String merTradeNoKey = jsonObject.getString("merTradeNo");
if(payWayOrderIdKey!=null){
paramMap.put(merTradeNoKey,threePartPayCallBack.getMerTradeNo());//商户系统订单号
if (payWayOrderIdKey != null) {
paramMap.put(merTradeNoKey, threePartPayCallBack.getMerTradeNo());//商户系统订单号
}
<<<<<<< HEAD
=======
String tradeNoKey = jsonObject.getString("tradeNo");
if(tradeNoKey!=null){
paramMap.put(tradeNoKey,threePartPayCallBack.getTradeNo());//商户系统订单号
if (tradeNoKey != null) {
paramMap.put(tradeNoKey, threePartPayCallBack.getTradeNo());//商户系统订单号
}
String txnAmtKey = jsonObject.getString("txnAmt");
if(txnAmtKey!=null){
paramMap.put(txnAmtKey,threePartPayCallBack.getTxnAmt());//金额
if (txnAmtKey != null) {
paramMap.put(txnAmtKey, threePartPayCallBack.getTxnAmt());//金额
}
>>>>>>> v1.3
}
if(paymentReconciliation!=null){
if (paymentReconciliation != null) {
String paymentIdKey = jsonObject.getString("paymentId");
if(paymentIdKey!=null){
paramMap.put(paymentIdKey,paymentReconciliation.getId().toString());//his系统订单号
if (paymentIdKey != null) {
paramMap.put(paymentIdKey, paymentReconciliation.getId().toString());//his系统订单号
}
}
String amountResultKey = jsonObject.getString("amountResult");
String txtCodeKey = jsonObject.getString("txtCode");
if(amountResult!=null){
paramMap.put(amountResultKey,amountResult);//金额
if (amountResult != null) {
paramMap.put(amountResultKey, amountResult);//金额
}
if(txtCode!=null){
paramMap.put(txtCodeKey,txtCode);//扫码
if (txtCode != null) {
paramMap.put(txtCodeKey, txtCode);//扫码
}
return paramMap;
}
/**
* 安全替换,避免空指针
*/
private String renderTemplateSafe(String template, Map<String, String> params) {
if (template == null) return "";
if (params == null) params = new HashMap<>();
if (template == null) {
return "";
}
if (params == null) {
params = new HashMap<>();
}
String result = template;
for (Map.Entry<String, String> entry : params.entrySet()) {
@@ -566,55 +499,53 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
}
/**
<<<<<<< HEAD
=======
* 执行请求
*
* @param method 请求类型
* @param threePartUrl 路径参数
* @param staticParam 静态参数
* @param map 可变参数
* @return
*/
private String executeRequest(String method,String threePartUrl,String staticParam,Map<String,String> map){
private String executeRequest(String method, String threePartUrl, String staticParam, Map<String, String> map) {
String requestResult = "";
if(CommonConstants.Common.REQUEST_MAPPING_METHOD_GET.equals(method)){
if (CommonConstants.Common.REQUEST_MAPPING_METHOD_GET.equals(method)) {
//获取完整url
String url = renderTemplateSafe(threePartUrl, map);
System.out.println("三方支付请求入参:"+url);
logger.info("三方支付请求入参:"+url);
System.out.println("三方支付请求入参:" + url);
logger.info("三方支付请求入参:" + url);
//发送请求
requestResult = httpGet(url);
}else if(CommonConstants.Common.REQUEST_MAPPING_METHOD_POST.equals(method)){
} else if (CommonConstants.Common.REQUEST_MAPPING_METHOD_POST.equals(method)) {
JSONObject data = new JSONObject();
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
data.put(stringStringEntry.getKey(),stringStringEntry.getValue());
data.put(stringStringEntry.getKey(), stringStringEntry.getValue());
}
if(staticParam!=null&& !StringUtils.isEmpty(staticParam)){
if (staticParam != null && !StringUtils.isEmpty(staticParam)) {
JSONObject staticDta = JSON.parseObject(staticParam);
data.putAll(staticDta);
}
System.out.println("三方支付请求入参:"+data.toJSONString());
logger.info("三方支付请求入参:"+data.toJSONString());
System.out.println("三方支付请求入参:" + data.toJSONString());
logger.info("三方支付请求入参:" + data.toJSONString());
requestResult = httpPost(threePartUrl,data.toJSONString());
requestResult = httpPost(threePartUrl, data.toJSONString());
}
System.out.println("三方支付请求出参:"+requestResult);
logger.info("三方支付请求出参:"+requestResult);
System.out.println("三方支付请求出参:" + requestResult);
logger.info("三方支付请求出参:" + requestResult);
return requestResult;
}
/**
>>>>>>> v1.3
* 发送http请求2025/05/02经测试若以自带的工具类发送请求失败故使用原peis系统中成功调用的写法重新封装
*
* @param url 路径
@@ -632,10 +563,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
HttpGet httpGet = new HttpGet(url);
// 执行http请求
response = httpClient.execute(httpGet);
<<<<<<< HEAD
=======
System.out.println("回复信息:"+JSON.toJSONString(response));
>>>>>>> v1.3
System.out.println("回复信息:" + JSON.toJSONString(response));
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
@@ -649,8 +577,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
}
return resultString;
}
<<<<<<< HEAD
=======
/**
* 发送http请求2025/05/02经测试若以自带的工具类发送请求失败故使用原peis系统中成功调用的写法重新封装
@@ -691,9 +617,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
@Override
public R<?> payForNenu(ThreePartPayDto threePartPayDto) {
return null;
}
>>>>>>> v1.3
}

View File

@@ -1,6 +1,5 @@
package com.openhis.web.paymentmanage.appservice.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.openhis.web.paymentmanage.util.ReverseMappingProperties;
@@ -16,17 +15,11 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
<<<<<<< HEAD
@ConfigurationProperties(prefix = "threepart.mapping")
=======
>>>>>>> v1.3
@Data
@Slf4j
public class ThreePartSimpleFieldMappingService {
@Autowired
private ReverseMappingProperties properties;
@@ -38,11 +31,7 @@ public class ThreePartSimpleFieldMappingService {
public String reverseMap(String businessType, String sourceJson) {
try {
// 1. 获取映射配置
<<<<<<< HEAD
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
=======
Map<String, String> mappingConfig = properties.getReverseMappings().get(businessType);
>>>>>>> v1.3
if (mappingConfig.isEmpty()) {
log.warn("未找到业务类型[{}]的映射配置", businessType);
return sourceJson; // 返回原JSON
@@ -50,14 +39,12 @@ public class ThreePartSimpleFieldMappingService {
// 2. 解析源JSON
Map<String, Object> sourceMap;
<<<<<<< HEAD
=======
// 修复BOM问题
if (sourceJson.startsWith("\uFEFF")) {
sourceJson = sourceJson.substring(1);
}
>>>>>>> v1.3
sourceMap = objectMapper.readValue(sourceJson, new TypeReference<Map<String,Object>>(){});
sourceMap = objectMapper.readValue(sourceJson, new TypeReference<Map<String, Object>>() {
});
// 3. 执行反向映射
Map<String, Object> resultMap = reverseMap(mappingConfig, sourceMap);
@@ -83,7 +70,7 @@ public class ThreePartSimpleFieldMappingService {
* 核心映射逻辑
*/
private Map<String, Object> reverseMap(Map<String, String> mappingConfig,
Map<String, Object> sourceMap) {
Map<String, Object> sourceMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : sourceMap.entrySet()) {
@@ -111,7 +98,7 @@ public class ThreePartSimpleFieldMappingService {
* 批量处理
*/
public List<Map<String, Object>> reverseMapBatch(String businessType,
List<Map<String, Object>> sourceList) {
List<Map<String, Object>> sourceList) {
return sourceList.stream()
.map(source -> reverseMap(businessType, source))
.collect(Collectors.toList());

View File

@@ -85,7 +85,7 @@ public class PaymentReconciliationController {
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
@@ -115,13 +115,13 @@ public class PaymentReconciliationController {
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
return result;
} else {
R<?> eleResult =
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
R<?> eleResult
= eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
if (eleResult.getCode() != 200) {
// 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
@@ -143,10 +143,10 @@ public class PaymentReconciliationController {
*/
@GetMapping("/page")
public R<?> paymentPage(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "kinsEnum", defaultValue = "") Integer kinsEnum,
@RequestParam(value = "invoiceNo", defaultValue = "") String invoiceNo,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
@RequestParam(value = "kinsEnum", defaultValue = "") Integer kinsEnum,
@RequestParam(value = "invoiceNo", defaultValue = "") String invoiceNo,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return R.ok(paymentReconciliationService.getPage(searchKey, kinsEnum, invoiceNo, pageNo, pageSize, request));
}
@@ -179,14 +179,14 @@ public class PaymentReconciliationController {
* @return 操做结果
*/
@PostMapping("/reg-pay")
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationAddParam){
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationAddParam) {
R<?> result = paymentReconciliationService.regPay(outpatientRegistrationAddParam,
outpatientRegistrationAddParam.getChrgBchno(), outpatientRegistrationAddParam.getPaymentDetails());
outpatientRegistrationAddParam.getChrgBchno(), outpatientRegistrationAddParam.getPaymentDetails());
// 付款成功后,开具发票
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
Long encounterId = paymentRecon.getEncounterId();
@@ -228,7 +228,7 @@ public class PaymentReconciliationController {
if (r.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(r.getData().getClass())) {
paymentRecon = (PaymentReconciliation)r.getData();
paymentRecon = (PaymentReconciliation) r.getData();
}
Long encounterId = paymentRecon.getEncounterId();
R<?> eleResult = eleInvoiceService.invoiceZYMake(paymentRecon.getId(), encounterId);
@@ -255,10 +255,10 @@ public class PaymentReconciliationController {
if (r.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(r.getData().getClass())) {
paymentRecon = (PaymentReconciliation)r.getData();
paymentRecon = (PaymentReconciliation) r.getData();
}
R<?> eleResult =
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentInpatientDto.getReason());
R<?> eleResult
= eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentInpatientDto.getReason());
if (eleResult.getCode() != 200) {
// 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
@@ -277,8 +277,6 @@ public class PaymentReconciliationController {
public R<?> nenuBpcPay(@RequestBody NenuBpcPayDto nenuBpcPayDto) {
return R.ok(paymentReconciliationService.nenuBpcPay(nenuBpcPayDto));
}
<<<<<<< HEAD
=======
/**
* 退号查询
@@ -287,8 +285,7 @@ public class PaymentReconciliationController {
* @return 操作结果
*/
@GetMapping("/pre-cancel-reg")
public R<?> cancelPreReg(@RequestParam(name = "encounterId" ) Long encounterId) {
public R<?> cancelPreReg(@RequestParam(name = "encounterId") Long encounterId) {
return R.ok(paymentReconciliationService.cancelPreReg(encounterId));
}
>>>>>>> v1.3
}

View File

@@ -20,17 +20,9 @@ import com.openhis.yb.dto.ThreePartPayDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
<<<<<<< HEAD
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
=======
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
>>>>>>> v1.3
import java.math.BigDecimal;
import java.security.Security;
import java.util.HashMap;
@@ -53,96 +45,95 @@ public class ThreePartPayController {
/**
* 扫码付款
*
* @return
*/
<<<<<<< HEAD
=======
@PostMapping("/sign")
public R<?> sign(){
public R<?> sign() {
return threePartPayService.sign();
}
/**
* 扫码付款
*
* @return
*/
@PostMapping("/sign-out")
public R<?> signOut(){
public R<?> signOut() {
return threePartPayService.signOut();
}
/**
* 扫码付款
*
* @return
*/
>>>>>>> v1.3
@PostMapping("/pay-for")
public R<?> payFor(@RequestBody ThreePartPayDto threePartPayDto){
public R<?> payFor(@RequestBody ThreePartPayDto threePartPayDto) {
return threePartPayService.payFor(threePartPayDto);
}
<<<<<<< HEAD
=======
/**
* 扫码付款(师大)
*
* @return
*/
@PostMapping("/pay-for-nenu")
public R<?> payForNenu(@RequestBody ThreePartPayDto threePartPayDto){
public R<?> payForNenu(@RequestBody ThreePartPayDto threePartPayDto) {
return threePartPayService.payForNenu(threePartPayDto);
}
/**
* 扫码付款结果查询(预结算窗口)
*
* @return
*/
@GetMapping("/pay-query")
public R<?> payQuery(@RequestParam("paymentId") Long paymentId){
public R<?> payQuery(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.payQuery(paymentId);
//return threePartPayService.returnQuery(threePartPayDto.getId());
}
/**
* 当天退费
*
* @return
*/
@GetMapping("/return-bill")
public R<?> returnBill(@RequestParam("paymentId") Long paymentId){
public R<?> returnBill(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.returnBill(paymentId);
}
/**
* 隔天退费
*
* @return
*/
@GetMapping("/return-goods")
public R<?> returnGoods(@RequestParam("paymentId") Long paymentId){
public R<?> returnGoods(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.returnGoods(paymentId);
}
/**
* 退费结果查询
*
* @return
*/
@GetMapping("/return-query")
public R<?> returnQuery(@RequestParam("id") Long id){
public R<?> returnQuery(@RequestParam("id") Long id) {
return threePartPayService.returnQuery(id);
}
/**
* 网银支付参数
*
* @return
*/
@GetMapping("/page")
public R<?> page(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request){
return threePartPayService.getPage(searchKey,pageNo,pageSize,request);
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return threePartPayService.getPage(searchKey, pageNo, pageSize, request);
}
>>>>>>> v1.3
}

View File

@@ -8,11 +8,7 @@ import java.util.HashMap;
import java.util.Map;
@Configuration
<<<<<<< HEAD
@ConfigurationProperties(prefix = "threepaymapping")
=======
@ConfigurationProperties(prefix = "mapping.reverse-mappings")
>>>>>>> v1.3
@Data
public class ReverseMappingProperties {
@@ -31,4 +27,4 @@ public class ReverseMappingProperties {
public Map<String, Map<String, String>> getAllMappings() {
return reverseMappings;
}
}
}

View File

@@ -2,16 +2,7 @@ package com.openhis.web.pharmacymanage.appservice;
import java.util.List;
<<<<<<< HEAD
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.core.common.core.domain.R;
import com.openhis.web.inhospitalnursestation.dto.AdmissionPageParam;
import com.openhis.web.pharmacymanage.dto.*;
=======
import com.core.common.core.domain.R;
>>>>>>> v1.3
/**
* 住院汇总发药 应用实现接口
@@ -24,98 +15,14 @@ public interface ISummaryDispenseMedicineAppService {
/**
* 汇总发药
*
<<<<<<< HEAD
* @return 初始化信息
*/
R<?> init();
/**
* 分页查询住院病人列表
*
* @param admissionPageParam 查询条件
* @param startTime 开始时间
* @param endTime 结束时间
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
* @return 病人列表
*/
R<?> getEncounterInfoListPage(AdmissionPageParam admissionPageParam, String startTime, String endTime,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
void makeExcelFile(MedicineSummarySearchParam searchParam, Integer pageNo,
Integer pageSize, String searchKey,
HttpServletRequest request, HttpServletResponse response);
/**
* 住院汇总药品
*
* @param searchParam 查询信息
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 药品汇总
*/
R<?> getSummaryMedicationInfo(MedicineSummarySearchParam searchParam, Integer pageNo, Integer pageSize);
/**
* 住院汇总发药单
*
* @param searchParam 查询信息
* @param startTime 开始时间
* @param endTime 结束时间
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
* @return 药品汇总
*/
R<?> getSummaryFromInfo(FromSummarySearchParam searchParam, String startTime, String endTime, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 住院药品汇总发药单详细
*
* @param searchParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
*/
R<?> getOrderInfo(FromSearchParam searchParam, String searchKey, Integer pageNo, Integer pageSize,
HttpServletRequest request);
/**
* 处方单核对发药
*
* @param dispenseMedicineList 发药信息
* @return 处理结果
*/
R<?> SummaryDispenseMedicine(List<DispenseItemDto> dispenseMedicineList);
=======
* @param summaryNoList 汇总单列表
* @return 处理结果
*/
R<?> SummaryDispenseMedicine(List<String> summaryNoList);
>>>>>>> v1.3
/**
* 作废
*
<<<<<<< HEAD
* @param dispenseMedicineList 作废信息
* @return 处理结果
*/
R<?> dispenseCancel(List<DispenseItemDto> dispenseMedicineList);
/**
* 退药处理
*
* @param dispenseMedicineList 退药清单
* @return 处理结果
*/
R<?> medicineReturn(List<DispenseItemDto> dispenseMedicineList);
=======
* @param summaryNoList 汇总单列表
* @return 处理结果
*/
@@ -144,10 +51,4 @@ public interface ISummaryDispenseMedicineAppService {
// */
// void takeExcelField(FromSearchParam searchParam, String searchKey, Integer pageNo, Integer pageSize,
// HttpServletRequest request, HttpServletResponse response);
>>>>>>> v1.3
}

View File

@@ -95,35 +95,35 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
DispenseInitDto initDto = new DispenseInitDto();
// 获取科室下拉选列表
List<Organization> organizationList =
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<Organization> organizationList
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
// 获取配药人下拉选列表
List<Practitioner> preparerDoctorList =
medicalDeviceDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
List<Practitioner> preparerDoctorList
= medicalDeviceDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
List<DispenseInitDto.PreparerDoctorOption> preparerDoctorOptions = preparerDoctorList.stream()
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
.collect(Collectors.toList());
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
.collect(Collectors.toList());
// 未发药原因下拉选列表
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions
= Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
// 发药状态
List<DispenseInitDto.DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
DispenseStatus.IN_PROGRESS.getInfo()));
DispenseStatus.IN_PROGRESS.getInfo()));
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
DispenseStatus.COMPLETED.getInfo()));
DispenseStatus.COMPLETED.getInfo()));
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions);
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions);
return R.ok(initDto);
}
@@ -139,28 +139,28 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
*/
@Override
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 发药状态初始化
Integer statusEnum = encounterInfoSearchParam.getStatusEnum();
encounterInfoSearchParam.setStatusEnum(null);
// 构建查询条件
QueryWrapper<EncounterInfoSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
QueryWrapper<EncounterInfoSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
// 查询就诊病人列表
Page<EncounterInfoDto> encounterInfoPage =
medicalDeviceDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
Page<EncounterInfoDto> encounterInfoPage
= medicalDeviceDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
encounterInfoPage.getRecords().forEach(encounterInfo -> {
// 性别
encounterInfo.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
// 发药状态
encounterInfo
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
if (encounterInfo.getBirthDate() != null) {
// 计算年龄
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
@@ -179,22 +179,22 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
*/
@Override
public R<?> getDeviceDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
// 发药状态初始化
Integer dispenseStatus = itemDispenseOrderDto.getStatusEnum();
itemDispenseOrderDto.setStatusEnum(null);
// 构建查询条件
QueryWrapper<ItemDispenseOrderDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
QueryWrapper<ItemDispenseOrderDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
// 处方单信息查询
Page<ItemDispenseOrderDto> deviceDispenseOrderPage =
medicalDeviceDispenseMapper.selectDeviceDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
Page<ItemDispenseOrderDto> deviceDispenseOrderPage
= medicalDeviceDispenseMapper.selectDeviceDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
deviceDispenseOrderPage.getRecords().forEach(deviceDispenseOrder -> {
// 发药状态
deviceDispenseOrder.setStatusEnum_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, deviceDispenseOrder.getStatusEnum()));
EnumUtils.getInfoByValue(DispenseStatus.class, deviceDispenseOrder.getStatusEnum()));
// 设置所在表名
deviceDispenseOrder.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
});
@@ -211,59 +211,17 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
public R<?> deviceDispense(List<DispenseItemDto> dispenseDeviceList) {
// 配药人检查
if (dispenseDeviceList.get(0).getPreparerId() == null
|| dispenseDeviceList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|| dispenseDeviceList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
return R.fail("请选择调配药师");
}
// 获取发药单id列表
List<Long> devDispenseIdList =
dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
<<<<<<< HEAD
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个药品分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit().equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
=======
List<Long> devDispenseIdList
= dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
// 获取耗材待发放库存信息
List<UnDispenseInventoryDto> unDispenseInventoryList =
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
List<UnDispenseInventoryDto> unDispenseInventoryList
= returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
@@ -271,15 +229,15 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
if (!inventoryList.isEmpty()) {
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 停供库存校验
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
}
@@ -292,17 +250,16 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity =
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
quantity
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
inventoryId = unDispenseInventoryDto.getInventoryId();
>>>>>>> v1.3
}
}
if (minQuantity.compareTo(inventoryQuantity) > 0) {
@@ -311,7 +268,7 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
} else {
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryId)
.setQuantity(inventoryQuantity.subtract(minQuantity)));
.setQuantity(inventoryQuantity.subtract(minQuantity)));
}
}
}
@@ -319,14 +276,14 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
// 材料发放信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 追溯码列表
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
TraceNoManage traceNoManage;
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
if (dispenseList != null) {
if (dispenseList.stream().map(DeviceDispense::getStatusEnum)
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
throw new ServiceException("耗材发放失败,请检查发耗材单状态");
} else {
for (DeviceDispense deviceDispense : dispenseList) {
@@ -344,13 +301,13 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
deviceDispense.setPreparerId(dispenseDeviceList.get(0).getPreparerId());
// 设置库存变更参数
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(deviceDispense.getDeviceDefId())
.setLotNumber(deviceDispense.getLotNumber())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setDispenseId(deviceDispense.getId()));
.setLotNumber(deviceDispense.getLotNumber())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setDispenseId(deviceDispense.getId()));
if (deviceDispense.getTraceNo() == null) {
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
} else {
// 使用逗号分割追溯码并转换为List
String[] traceNoList = deviceDispense.getTraceNo().split(CommonConstants.Common.COMMA);
@@ -358,22 +315,22 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
traceNoManage = new TraceNoManage();
// 追溯码处理
traceNoManage.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
// 项目id
.setItemId(deviceDispense.getDeviceDefId())
// 仓库类型
.setLocationTypeEnum(LocationForm.WAREHOUSE.getValue())
// 仓库
.setLocationId(deviceDispense.getLocationId())
// 产品批号
.setLotNumber(deviceDispense.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.OUT.getValue())
// 追溯码单位
.setUnitCode(deviceDispense.getUnitCode())
// 操作类型
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
// 项目id
.setItemId(deviceDispense.getDeviceDefId())
// 仓库类型
.setLocationTypeEnum(LocationForm.WAREHOUSE.getValue())
// 仓库
.setLocationId(deviceDispense.getLocationId())
// 产品批号
.setLotNumber(deviceDispense.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.OUT.getValue())
// 追溯码单位
.setUnitCode(deviceDispense.getUnitCode())
// 操作类型
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
tracesNoManageList.add(traceNoManage);
}
}
@@ -432,8 +389,8 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
@Override
public R<?> dispenseMedicalConsumables(List<Long> chargeItemIds) {
// 查看所属医院
String fixmedinsCode =
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsCode
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
if (!HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
return R.ok();
}
@@ -443,59 +400,17 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
}
// 获取发申请id列表
List<Long> devRequestIdList =
chargeItemList.stream().map(ChargeItem::getServiceId).collect(Collectors.toList());
List<Long> devRequestIdList
= chargeItemList.stream().map(ChargeItem::getServiceId).collect(Collectors.toList());
// 获取耗材发放id列表
List<Long> devDispenseIdList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList))
.stream().map(DeviceDispense::getId).collect(Collectors.toList());
<<<<<<< HEAD
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个耗材分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit().equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
=======
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList))
.stream().map(DeviceDispense::getId).collect(Collectors.toList());
// 获取耗材待发放库存信息
List<UnDispenseInventoryDto> unDispenseInventoryList =
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
List<UnDispenseInventoryDto> unDispenseInventoryList
= returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
@@ -503,15 +418,15 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
if (!inventoryList.isEmpty()) {
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 停供库存校验
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
}
@@ -524,17 +439,16 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity =
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
quantity
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
inventoryId = unDispenseInventoryDto.getInventoryId();
>>>>>>> v1.3
}
}
if (minQuantity.compareTo(inventoryQuantity) > 0) {
@@ -543,7 +457,7 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
} else {
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryId)
.setQuantity(inventoryQuantity.subtract(minQuantity)));
.setQuantity(inventoryQuantity.subtract(minQuantity)));
}
}
}
@@ -551,11 +465,11 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
if (dispenseList != null) {
if (dispenseList.stream().map(DeviceDispense::getStatusEnum)
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
throw new ServiceException("耗材已发放,请勿重复操作");
} else {
for (DeviceDispense deviceDispense : dispenseList) {
@@ -569,11 +483,11 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
deviceDispense.setPerformerId(CommonConstants.CCU.DisDeviceDoctor);
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
// 设置库存变更参数
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(deviceDispense.getDeviceDefId())
.setLotNumber(deviceDispense.getLotNumber())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION));
.setLotNumber(deviceDispense.getLotNumber())
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION));
}
// 药品发放更新
deviceDispenseService.updateBatchById(dispenseList);
@@ -627,11 +541,11 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
@Override
public R<?> deviceCancel(List<DispenseItemDto> dispenseDeviceList) {
// 获取发材料单id列表
List<Long> devDispenseIdList =
dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
List<Long> devDispenseIdList
= dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
// 材料发放信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
if (dispenseList != null) {
for (DeviceDispense medicationDispense : dispenseList) {
// 材料发放状态

View File

@@ -1,10 +1,5 @@
package com.openhis.web.pharmacymanage.appservice.impl;
<<<<<<< HEAD
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
=======
import static com.openhis.common.constant.CommonConstants.ExcelOut.*;
import static com.openhis.common.constant.CommonConstants.SheetName.SHEET_NAME_DRUG_DETAIL;
@@ -13,18 +8,12 @@ import java.math.RoundingMode;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
>>>>>>> v1.3
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
import com.core.common.utils.poi.ExcelUtil;
import com.openhis.web.inventorymanage.dto.ReceiptPageDto;
=======
>>>>>>> v1.3
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -32,23 +21,15 @@ 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.core.domain.entity.SysDictData;
<<<<<<< HEAD
=======
import com.core.common.exception.NonCaptureException;
import com.core.common.utils.StringUtils;
import com.core.common.utils.poi.ExcelUtil;
>>>>>>> v1.3
import com.core.system.service.ISysDictTypeService;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
<<<<<<< HEAD
import com.openhis.common.enums.DispenseStatus;
import com.openhis.common.enums.EncounterClass;
=======
import com.openhis.common.enums.ConditionCode;
import com.openhis.common.enums.DispenseStatus;
>>>>>>> v1.3
import com.openhis.common.enums.PublicationStatus;
import com.openhis.common.enums.RequestStatus;
import com.openhis.common.utils.HisQueryUtils;
@@ -80,11 +61,6 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
/**
* 获取页面初始化信息
*/
<<<<<<< HEAD
=======
>>>>>>> v1.3
@Override
public R<?> init() {
@@ -95,13 +71,13 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
initDto.setPractitionerList(list);
// 获取状态
List<MedDetailsInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new MedDetailsInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
.map(status -> new MedDetailsInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
// 结算状态
initDto.setStatusSettlementOptions(statusEnumOptions)
// 出院状态
.setStatusDischargeOptions(statusEnumOptions);
// 出院状态
.setStatusDischargeOptions(statusEnumOptions);
return R.ok(initDto);
@@ -119,7 +95,7 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
*/
@Override
public R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageSize, String searchKey, HttpServletRequest request) {
// 1:住院 2门诊
Integer flg = medDetailsSearchParam.getFlag();
medDetailsSearchParam.setFlag(null);
@@ -132,21 +108,13 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
medDetailsSearchParam.setInventoryScope(null);
// 构建查询条件
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
<<<<<<< HEAD
Page<MedDetailedAccountPageDto> medDetailsPage =
medicationDetailsMapper.selectAmbPractitionerDetailPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.AMB.getValue(), DispenseStatus.COMPLETED.getValue(), RequestStatus.COMPLETED.getValue(),
DispenseStatus.REFUNDED.getValue(), 1, flg, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
=======
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ConditionCode.LOT_NUMBER_COST.getCode());
>>>>>>> v1.3
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ConditionCode.LOT_NUMBER_COST.getCode());
return R.ok(medDetailsPage);
@@ -165,28 +133,12 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
*/
@Override
public void makeExcelFile(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletResponse response, HttpServletRequest request) {
String searchKey, HttpServletResponse response, HttpServletRequest request) {
R<?> result = this.getAmbPractitionerDetailPage(medDetailsSearchParam, 1, 10000, searchKey, request);
if (result != null && result.getData() != null) {
// 先获取Page对象再获取其中的记录列表
Page<MedDetailedAccountPageDto> pageData = (Page<MedDetailedAccountPageDto>)result.getData();
Page<MedDetailedAccountPageDto> pageData = (Page<MedDetailedAccountPageDto>) result.getData();
List<MedDetailedAccountPageDto> dataList = pageData.getRecords();
<<<<<<< HEAD
// 获取字典数据
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
String unitCode = medDetailedAccountPageDto.getUnitCode();
// 添加空值检查
if (unitCode != null && sysDictTypeService != null) {
// 缓存字典数据,避免重复查询
List<SysDictData> unitCodelist = sysDictTypeService.selectDictDataByType("unit_code");
if (unitCodelist != null) {
for (SysDictData dictData : unitCodelist) {
if (dictData != null && dictData.getDictValue() != null
&& dictData.getDictValue().equals(unitCode)) {
medDetailedAccountPageDto.setUnitCode_dictText(dictData.getDictLabel());
break;
=======
// 判断项目类别
try {
// 获取字典数据
@@ -195,120 +147,20 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
// 添加空值检查
if (unitCode != null && sysDictTypeService != null) {
// 缓存字典数据,避免重复查询
List<SysDictData> unitCodelist =
sysDictTypeService.selectDictDataByType(CommonConstants.FieldName.UnitCode);
List<SysDictData> unitCodelist
= sysDictTypeService.selectDictDataByType(CommonConstants.FieldName.UnitCode);
if (unitCodelist != null) {
for (SysDictData dictData : unitCodelist) {
if (dictData != null && dictData.getDictValue() != null
&& dictData.getDictValue().equals(unitCode)) {
&& dictData.getDictValue().equals(unitCode)) {
// 设置字典数据
medDetailedAccountPageDto.setUnitCode_dictText(dictData.getDictLabel());
break;
}
>>>>>>> v1.3
}
}
}
}
<<<<<<< HEAD
}
// 将发药数量与单位拼接
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
Integer dispenseQuantity = medDetailedAccountPageDto.getDispenseQuantity();
// 将发药数量与单位拼接
medDetailedAccountPageDto.setDispenseQuantitystr(dispenseQuantity + unitCode_dictText);
}
// 将退药数量与单位拼接
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
Integer refundQuantity = medDetailedAccountPageDto.getRefundQuantity();
// 添加完整的空值检查和默认值处理
String unitText = (unitCode_dictText != null) ? unitCode_dictText : "";
if (refundQuantity == null) {
medDetailedAccountPageDto.setRefundQuantitystr("0.00" + unitCode_dictText);
} else if (refundQuantity == 0) {
medDetailedAccountPageDto.setRefundQuantitystr("0.00" + unitCode_dictText);
} else {
medDetailedAccountPageDto.setRefundQuantitystr(refundQuantity.toString() + unitCode_dictText);
}
}
// 将退药金额
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
BigDecimal refundPrice = medDetailedAccountPageDto.getRefundPrice();
if (refundPrice == null) {
medDetailedAccountPageDto.setRefundPricestr("0.00" );
} else if (refundPrice.signum() == 0) {
medDetailedAccountPageDto.setRefundPricestr("0.00" );
} else {
refundPrice = refundPrice.setScale(6, RoundingMode.HALF_UP);
medDetailedAccountPageDto.setRefundPricestr(refundPrice.toString() );
}
}
//发药金额
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
BigDecimal dispensePrice = medDetailedAccountPageDto.getDispensePrice();
if (dispensePrice == null) {
medDetailedAccountPageDto.setDispensePricestr("0.00" );
} else if (dispensePrice.signum() == 0) {
medDetailedAccountPageDto.setDispensePricestr("0.00" );
} else {
dispensePrice = dispensePrice.setScale(6, RoundingMode.HALF_UP);
medDetailedAccountPageDto.setDispensePricestr(dispensePrice.toString() );
}
}
// 添加项目类别
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
String itemTable = medDetailedAccountPageDto.getItemTable();
if (itemTable != null) {
if(itemTable.equals("med_medication_definition")){
medDetailedAccountPageDto.setItemTable("药品");
}
if(itemTable.equals("adm_device_definition")){
medDetailedAccountPageDto.setItemTable("耗材");
}
}
else{
medDetailedAccountPageDto.setItemTable("未知类型");
}
}
//判断项目类别
try {
// 准备表头key对应DTO的字段名
//Map<String, String> headers = new LinkedHashMap<>();
// headers.put("practitionerName", "发药人");
// headers.put("dispenseNo", "发药单号");
// headers.put("medicationName", "药品项目");
// headers.put("itemTable", "项目类别");
// headers.put("busNo", "药品编码");
// headers.put("ybNo", "医保编码");
// headers.put("totalVolume", "规格");
// headers.put("dispenseQuantitystr", "发药数量");
// headers.put("dispensePricestr", "发药金额");
// headers.put("refundQuantitystr", "退药数量");
// headers.put("refundPricestr", "退药金额");
// headers.put("lotNumber", "生产批号");
// headers.put("manufacturerText", "厂家/产地");
// headers.put("supplierName", "供应商");
// headers.put("dispenseTime", "发药时间");
// 导出到Excel
// ExcelFillerUtil.makeExcelFile(response, dataList, headers, "发药明细", null);
// 导出到Excel
ExcelUtil<MedDetailedAccountPageDto> util = new ExcelUtil<MedDetailedAccountPageDto>(MedDetailedAccountPageDto.class);
util.exportExcel(response,dataList,"发药明细");
} catch (Exception e) {
e.printStackTrace();
System.out.printf("导出Excel失败" + e.getMessage());
}
=======
// 将发药数量与单位拼接
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
@@ -408,7 +260,6 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
throw new NonCaptureException(StringUtils.format("导出excel失败"), e);
}
>>>>>>> v1.3
}
}
@@ -424,7 +275,7 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
*/
@Override
public R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageSize, String searchKey, HttpServletRequest request) {
// 1:住院 2门诊
Integer flg = medDetailsSearchParam.getFlag();
@@ -438,21 +289,13 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
medDetailsSearchParam.setInventoryScope(null);
// 构建查询条件
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
<<<<<<< HEAD
Page<MedDetailedAccountPageDto> medDetailsPage =
medicationDetailsMapper.selectAmbPractitionerDetailPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.AMB.getValue(), DispenseStatus.COMPLETED.getValue(), RequestStatus.COMPLETED.getValue(),
DispenseStatus.REFUNDED.getValue(), 2, flg, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
=======
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ConditionCode.LOT_NUMBER_COST.getCode());
>>>>>>> v1.3
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
ConditionCode.LOT_NUMBER_COST.getCode());
return R.ok(medDetailsPage);

View File

@@ -8,10 +8,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
<<<<<<< HEAD
=======
import org.apache.commons.lang3.tuple.Pair;
>>>>>>> v1.3
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
@@ -135,18 +132,18 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
ReturnMedicineInitDto initDto = new ReturnMedicineInitDto();
// 获取科室下拉选列表
List<Organization> organizationList =
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<Organization> organizationList
= iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<ReturnMedicineInitDto.DepartmentOption> organizationOptions = organizationList.stream().map(
organization -> new ReturnMedicineInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
organization -> new ReturnMedicineInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
// 发药状态
List<ReturnMedicineInitDto.RefundStatusOption> refundStatusOptions = new ArrayList<>();
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.PENDING_REFUND.getValue(),
DispenseStatus.PENDING_REFUND.getInfo()));
DispenseStatus.PENDING_REFUND.getInfo()));
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.REFUNDED.getValue(),
DispenseStatus.REFUNDED.getInfo()));
DispenseStatus.REFUNDED.getInfo()));
initDto.setDepartmentOptions(organizationOptions).setRefundStatusOptions(refundStatusOptions);
return R.ok(initDto);
}
@@ -163,24 +160,24 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
*/
@Override
public R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<EncounterInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(encounterInfoDto, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
// 查询退药患者分页列表
Page<EncounterInfoDto> encounterInfoPage =
returnMedicineMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
Page<EncounterInfoDto> encounterInfoPage
= returnMedicineMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
encounterInfoPage.getRecords().forEach(encounterInfo -> {
// 性别
encounterInfo.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
// 年龄
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
// 退药状态
encounterInfo
.setRefundEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, encounterInfo.getRefundEnum()));
.setRefundEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, encounterInfo.getRefundEnum()));
});
return R.ok(encounterInfoPage);
}
@@ -196,16 +193,16 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
public R<?> getReturnMedicineInfo(Long encounterId, Integer refundStatus) {
// 获取退药信息
List<ReturnMedicineInfoDto> returnMedicineInfoList = returnMedicineMapper.selectReturnMedicineInfo(encounterId,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus,
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.REFUNDED.getValue());
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus,
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.REFUNDED.getValue());
returnMedicineInfoList.forEach(returnMedicineInfoDto -> {
// 退药状态
returnMedicineInfoDto.setRefundEnum_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, returnMedicineInfoDto.getRefundEnum()));
EnumUtils.getInfoByValue(DispenseStatus.class, returnMedicineInfoDto.getRefundEnum()));
// 退药请求状态
returnMedicineInfoDto.setReqStatus_enumText(
EnumUtils.getInfoByValue(RequestStatus.class, returnMedicineInfoDto.getReqStatus()));
EnumUtils.getInfoByValue(RequestStatus.class, returnMedicineInfoDto.getReqStatus()));
});
return R.ok(returnMedicineInfoList);
}
@@ -230,10 +227,12 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
medicineReturnList.forEach(item -> {
switch (item.getTableName()) {
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> returnMedicineList
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> returnDeviceList
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
returnMedicineList
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
case CommonConstants.TableName.WOR_DEVICE_REQUEST ->
returnDeviceList
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
}
});
// 进销存参数
@@ -244,11 +243,11 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
List<Long> medReturnIdList = new ArrayList<>();
if (!returnMedicineList.isEmpty()) {
// 获取药品退药id列表
medReturnIdList =
returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
medReturnIdList
= returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
// 获取药品退药请求id列表
List<Long> medRequestIdList =
returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
List<Long> medRequestIdList
= returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
if (medReturnIdList.isEmpty()) {
throw new ServiceException("请选择要退的药品");
}
@@ -264,7 +263,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
// 重复退药校验
if (refundMedList.stream().map(MedicationDispense::getStatusEnum)
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
throw new ServiceException("药品已退药,请勿重复退药");
}
@@ -290,7 +289,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
}
supplyItemDetailDto.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber());
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber());
supplyItemDetailList.add(supplyItemDetailDto);
// 追溯码表相关处理
@@ -301,24 +300,24 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
traceNoManage = new TraceNoManage();
// 追溯码处理
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
// 项目id
.setItemId(medicationDispense.getMedicationId())
// 仓库类型
.setLocationTypeEnum(null)
// 仓库
.setLocationId(medicationDispense.getLocationId())
// 仓位
.setLocationStoreId(null)
// 产品批号
.setLotNumber(medicationDispense.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.IN.getValue())
// 追溯码单位
.setUnitCode(medicationDispense.getUnitCode())
// 操作类型
.setOperationType(SupplyType.RETURN_MEDICATION.getValue());
// 项目id
.setItemId(medicationDispense.getMedicationId())
// 仓库类型
.setLocationTypeEnum(null)
// 仓库
.setLocationId(medicationDispense.getLocationId())
// 仓位
.setLocationStoreId(null)
// 产品批号
.setLotNumber(medicationDispense.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.IN.getValue())
// 追溯码单位
.setUnitCode(medicationDispense.getUnitCode())
// 操作类型
.setOperationType(SupplyType.RETURN_MEDICATION.getValue());
traceNoManageList.add(traceNoManage);
}
}
@@ -334,11 +333,11 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
List<Long> devReturnIdList = new ArrayList<>();
if (!returnDeviceList.isEmpty()) {
// 获取退耗材id列表
devReturnIdList =
returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
devReturnIdList
= returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
// 获取退耗材请求id列表
List<Long> devRequestIdList =
returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
List<Long> devRequestIdList
= returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
if (devReturnIdList.isEmpty()) {
throw new ServiceException("请选择要退的耗材");
}
@@ -352,7 +351,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
// 重复退耗材校验
if (refundDevList.stream().map(DeviceDispense::getStatusEnum)
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
throw new ServiceException("耗材已退,请勿重复操作");
}
// 更新退耗材单状态
@@ -365,8 +364,8 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
// 设置库存变更参数
supplyItemDetailList
.add(new SupplyItemDetailDto().setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setItemId(deviceDispense.getDeviceDefId()).setLotNumber(deviceDispense.getLotNumber()));
.add(new SupplyItemDetailDto().setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
.setItemId(deviceDispense.getDeviceDefId()).setLotNumber(deviceDispense.getLotNumber()));
// // 使用逗号分割追溯码并转换为List
// String[] traceNoList = deviceDispense.getTraceNo().split(CommonConstants.Common.COMMA);
// for (String item : traceNoList) {
@@ -402,34 +401,14 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
// 处理退库存
// 获取库存信息
<<<<<<< HEAD
List<UnDispenseInventoryDto> inventoryList =
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, medDispenseIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (UnDispenseInventoryDto inventory : inventoryList) {
// 库存表项目设定
InventoryItem inventoryItem = new InventoryItem();
// id
inventoryItem.setId(inventory.getInventoryId());
// 库存数量
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
inventoryItem.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
inventoryItem.setQuantity(inventory.getInventoryQuantity()
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
=======
List<UnDispenseInventoryDto> unDispenseInventoryList =
returnMedicineMapper.selectInventoryInfoList(devReturnIdList, medReturnIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
List<UnDispenseInventoryDto> unDispenseInventoryList
= returnMedicineMapper.selectInventoryInfoList(devReturnIdList, medReturnIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
@@ -441,18 +420,17 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity =
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
quantity
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
}
// 理论上不出bug的情况下以项目id批号仓库进行分组处理库存一定唯一所以get(0)
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryList.get(0).getInventoryId())
.setQuantity(inventoryList.get(0).getInventoryQuantity().add(minQuantity)));
>>>>>>> v1.3
.setQuantity(inventoryList.get(0).getInventoryQuantity().add(minQuantity)));
}
}
// 库存更新
@@ -473,34 +451,35 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
if (!returnMedicineList.isEmpty()) {
// 设置进销存参数
medicationDefinitions = medicationDefinitionService.listByIds(supplyItemDetailList.stream()
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION))
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION))
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
}
if (!returnDeviceList.isEmpty()) {
deviceDefinitions = deviceDefinitionService.listByIds(supplyItemDetailList.stream()
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION))
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION))
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
}
// 创建映射表,添加空集合保护
Map<Long, MedicationDefinition> medicationMap =
medicationDefinitions != null ? medicationDefinitions.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity())) : new HashMap<>();
Map<Long, MedicationDefinition> medicationMap
= medicationDefinitions != null ? medicationDefinitions.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity())) : new HashMap<>();
Map<Long, DeviceDefinition> deviceMap =
deviceDefinitions != null ? deviceDefinitions.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(DeviceDefinition::getId, Function.identity())) : new HashMap<>();
Map<Long, DeviceDefinition> deviceMap
= deviceDefinitions != null ? deviceDefinitions.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(DeviceDefinition::getId, Function.identity())) : new HashMap<>();
// 设置库存变更参数,添加完整判空
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
if (supplyItemDetailDto == null)
if (supplyItemDetailDto == null) {
continue;
}
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
if (supplyItemDetailDto.getItemId() != null) {
MedicationDefinition med = medicationMap.get(supplyItemDetailDto.getItemId());
if (med != null) {
supplyItemDetailDto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent())
.setRxFlag(med.getRxFlag()).setYbNo(med.getYbNo());
.setRxFlag(med.getRxFlag()).setYbNo(med.getYbNo());
}
}
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
@@ -508,14 +487,14 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
DeviceDefinition dev = deviceMap.get(supplyItemDetailDto.getItemId());
if (dev != null) {
supplyItemDetailDto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent())
.setRxFlag(dev.getRxFlag()).setYbNo(dev.getYbNo());
.setRxFlag(dev.getRxFlag()).setYbNo(dev.getYbNo());
}
}
}
}
uploadFailedNoList = this.ybReturnIntegrated(medReturnIdList, null);
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
if (uploadFailedNoList != null) {
returnMsg = "3506商品销售退货上传错误错误项目编码" + uploadFailedNoList;
} else {
@@ -523,7 +502,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
}
// 返回退药成功信息
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"退药"}));
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"退药"}));
}
/**
@@ -539,8 +518,8 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
if (!dispenseMedIdList.isEmpty() || !dispenseDevIdList.isEmpty()) {
// 查询退药项目相关信息
List<DispenseInventoryDto> dispenseInventoryList = returnMedicineMapper.selectReturnItemDetail(
dispenseDevIdList, dispenseMedIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
dispenseDevIdList, dispenseMedIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
if (dispenseInventoryDto.getYbNo() == null) {
continue;
@@ -550,7 +529,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
Contract contract = medical3506Pair.getRight();
if (contract != null) {
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
.equals(medical3506Pair.getRight().getBusNo())) {
.equals(medical3506Pair.getRight().getBusNo())) {
contract = null;
}
}
@@ -569,14 +548,14 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
// 查询费用结算信息
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
}
if (chargeItem == null) {
throw new ServiceException("未查询到收费项");
@@ -587,27 +566,27 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
throw new ServiceException("未查找到就诊诊断信息");
}
// 查询付款信息
PaymentReconciliation paymentReconciliation =
iPaymentReconciliationService.getOne(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, chargeItem.getEncounterId())
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.eq(PaymentReconciliation::getPatientId, chargeItem.getPatientId())
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue()));
PaymentReconciliation paymentReconciliation
= iPaymentReconciliationService.getOne(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, chargeItem.getEncounterId())
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.eq(PaymentReconciliation::getPatientId, chargeItem.getPatientId())
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue()));
if (paymentReconciliation == null) {
throw new ServiceException("未查询到收费");
}
// 查询账户信息
Account account = accountService
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, chargeItem.getEncounterId())
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, chargeItem.getEncounterId())
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
if (account == null) {
throw new ServiceException("未查询到账户");
}
// 查询合同实体
Contract contract =
iContractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
Contract contract
= iContractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
if (contract == null) {
throw new ServiceException("未查询到合同信息");
}
@@ -622,12 +601,12 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
// 查询就诊id
if (contract.getCategoryEnum().equals(Category.SELF.getValue())
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
medical3506Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo());
} else {
ClinicSettle clinicSettle = clinicSettleService.getOne(new LambdaQueryWrapper<ClinicSettle>()
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
if (clinicSettle != null) {
medical3506Param.setMdtrtSn(clinicSettle.getMdtrtId());
} else {
@@ -643,9 +622,9 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
JSONArray medicalTraceNo = new JSONArray();
// 获取追溯码信息
if (dispenseInventoryDto.getTraceNo() != null) {
List<String> traceNoList =
Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
.filter(s -> !s.isEmpty()).toList();
List<String> traceNoList
= Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
.filter(s -> !s.isEmpty()).toList();
for (String traceNo : traceNoList) {
Map<String, String> traceNoMap = new HashMap<>();
traceNoMap.put("drug_trac_codg", traceNo);
@@ -653,17 +632,17 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
}
}
medical3506Param.setMedListCodg(dispenseInventoryDto.getYbNo())
.setFixmedinsBchno(dispenseInventoryDto.getRefundId().toString())
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
.setManuDate(dispenseInventoryDto.getProductionDate())
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
.setDrugtracinfo(medicalTraceNo).setCertno(dispenseInventoryDto.getIdCard());
.setFixmedinsBchno(dispenseInventoryDto.getRefundId().toString())
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
.setManuDate(dispenseInventoryDto.getProductionDate())
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
.setDrugtracinfo(medicalTraceNo).setCertno(dispenseInventoryDto.getIdCard());
// 查看所属医院
String fixmedinsCode =
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsCode
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
if (dispenseInventoryDto.getPreparerName() == null && HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
medical3506Param.setSelRetnOpterName(CommonConstants.CCU.DisDeviceDoctorName);
} else {
@@ -686,22 +665,18 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
}
<<<<<<< HEAD
return medical3506Param;
=======
return Pair.of(medical3506Param, contract);
>>>>>>> v1.3
}
private MedicalInventory3511Param getMedical3511Param(DispenseInventoryDto dispenseInventoryDto) {
MedicalInventory3511Param medicalInventory3511Param = new MedicalInventory3511Param();
String fixmedinsCode =
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsCode
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
// TODO
medicalInventory3511Param.setFixmedinsCode(fixmedinsCode).setMedinsListCodg(dispenseInventoryDto.getYbNo())
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber()).setBegndate(dispenseInventoryDto.getDispenseTime())
.setEnddate(dispenseInventoryDto.getDispenseTime());
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber()).setBegndate(dispenseInventoryDto.getDispenseTime())
.setEnddate(dispenseInventoryDto.getDispenseTime());
return medicalInventory3511Param;
}

View File

@@ -129,42 +129,42 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
DispenseInitDto initDto = new DispenseInitDto();
// 获取科室下拉选列表
List<Organization> organizationList =
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<Organization> organizationList
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());
// 获取配药人下拉选列表
List<Practitioner> preparerDoctorList =
westernMedicineDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
List<Practitioner> preparerDoctorList
= westernMedicineDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
List<DispenseInitDto.PreparerDoctorOption> preparerDoctorOptions = preparerDoctorList.stream()
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
.collect(Collectors.toList());
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
.collect(Collectors.toList());
// 未发药原因下拉选列表
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions
= Stream.of(NotPerformedReasonEnum.values())
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
notPerformedReason.getInfo()))
.collect(Collectors.toList());
// 患者类型
List<DispenseInitDto.EncounterClassOption> encounterClassOptions = Stream.of(EncounterClass.values())
.map(encounterClass -> new DispenseInitDto.EncounterClassOption(encounterClass.getValue(),
.map(encounterClass -> new DispenseInitDto.EncounterClassOption(encounterClass.getValue(),
encounterClass.getInfo()))
.toList();
.toList();
// 发药状态
List<DispenseInitDto.DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
DispenseStatus.IN_PROGRESS.getInfo()));
DispenseStatus.IN_PROGRESS.getInfo()));
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
DispenseStatus.COMPLETED.getInfo()));
DispenseStatus.COMPLETED.getInfo()));
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions)
.setEncounterClassOptions(encounterClassOptions);
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions)
.setEncounterClassOptions(encounterClassOptions);
return R.ok(initDto);
}
@@ -180,28 +180,28 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
*/
@Override
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 发药状态初始化
Integer statusEnum = encounterInfoSearchParam.getStatusEnum();
encounterInfoSearchParam.setStatusEnum(null);
// 构建查询条件
QueryWrapper<EncounterInfoSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
QueryWrapper<EncounterInfoSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
request);
// 查询就诊病人列表
Page<EncounterInfoDto> encounterInfoPage =
westernMedicineDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
Page<EncounterInfoDto> encounterInfoPage
= westernMedicineDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
encounterInfoPage.getRecords().forEach(encounterInfo -> {
// 性别
encounterInfo.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
// 发药状态
encounterInfo
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
if (encounterInfo.getBirthDate() != null) {
// 计算年龄
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
@@ -220,23 +220,23 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
*/
@Override
public R<?> getMedicineDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo,
Integer pageSize) {
Integer pageSize) {
// 发药状态初始化
Integer dispenseStatus = itemDispenseOrderDto.getStatusEnum();
itemDispenseOrderDto.setStatusEnum(null);
// 构建查询条件
QueryWrapper<ItemDispenseOrderDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
QueryWrapper<ItemDispenseOrderDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
// 处方单信息查询
Page<ItemDispenseOrderDto> medicineDispenseOrderPage =
westernMedicineDispenseMapper.selectMedicineDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus,
PublicationStatus.ACTIVE.getValue());
Page<ItemDispenseOrderDto> medicineDispenseOrderPage
= westernMedicineDispenseMapper.selectMedicineDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus,
PublicationStatus.ACTIVE.getValue());
medicineDispenseOrderPage.getRecords().forEach(medicineDispenseOrder -> {
// 发药状态
medicineDispenseOrder.setStatusEnum_enumText(
EnumUtils.getInfoByValue(DispenseStatus.class, medicineDispenseOrder.getStatusEnum()));
EnumUtils.getInfoByValue(DispenseStatus.class, medicineDispenseOrder.getStatusEnum()));
// 设置所在表名
medicineDispenseOrder.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
});
@@ -252,12 +252,12 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
@Override
public R<?> medicinePrepare(List<DispenseItemDto> dispenseMedicineList) {
// 追溯码集合
List<String> traceNoList =
dispenseMedicineList.stream().map(DispenseItemDto::getTraceNo).collect(Collectors.toList());
List<String> traceNoList
= dispenseMedicineList.stream().map(DispenseItemDto::getTraceNo).collect(Collectors.toList());
// 非输液药品的已出库追溯码
List<String> outTraceNoList = westernMedicineDispenseMapper.getOutTraceNo(TraceNoStatus.OUT.getValue(),
Whether.YES.getValue(), SplitPropertyCode.OUTPATIENT_MIN_UNIT_CEIL.getValue(),
SplitPropertyCode.OUTPATIENT_MIN_UNIT_TOTAL_CEIL.getValue(), SupplyType.DISPENSE_MEDICATION.getValue());
Whether.YES.getValue(), SplitPropertyCode.OUTPATIENT_MIN_UNIT_CEIL.getValue(),
SplitPropertyCode.OUTPATIENT_MIN_UNIT_TOTAL_CEIL.getValue(), SupplyType.DISPENSE_MEDICATION.getValue());
// 取交集
if (!traceNoList.isEmpty() && !outTraceNoList.isEmpty()) {
List<String> list = traceNoList.stream().filter(outTraceNoList::contains).collect(Collectors.toList());
@@ -267,65 +267,19 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
}
// 配药人检查
if (dispenseMedicineList.get(0).getPreparerId() == null
|| dispenseMedicineList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|| dispenseMedicineList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
return R.fail("请选择调配药师");
}
// 获取发药单id列表
List<Long> medDispenseIdList =
dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
<<<<<<< HEAD
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList =
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个药品分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(
unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
}
}
}
}
}
=======
>>>>>>> v1.3
List<Long> medDispenseIdList
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
// 药品发药信息查询
List<MedicationDispense> dispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
if (dispenseList != null) {
if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
throw new ServiceException("配药失败,请检查发药单状态");
} else {
for (MedicationDispense medicationDispense : dispenseList) {
@@ -350,10 +304,10 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
}
// 查询对应的药品医嘱
List<MedicationRequest> medicationRequests = medicationRequestService.listByIds(
dispenseList.stream().map(MedicationDispense::getMedReqId).distinct().collect(Collectors.toList()));
dispenseList.stream().map(MedicationDispense::getMedReqId).distinct().collect(Collectors.toList()));
// 根据请求id做map
Map<Long, List<MedicationDispense>> dispenseMap =
dispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
Map<Long, List<MedicationDispense>> dispenseMap
= dispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
for (MedicationRequest medicationRequest : medicationRequests) {
List<MedicationDispense> medicationDispenseList = dispenseMap.get(medicationRequest.getId());
BigDecimal dispenseQuantity = BigDecimal.ZERO;
@@ -387,79 +341,33 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
@Override
public R<?> medicineDispense(List<DispenseItemDto> dispenseMedicineList) {
// 获取发药单id列表
List<Long> medDispenseIdList =
dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
<<<<<<< HEAD
// 获取药品发放库存信息
List<UnDispenseInventoryDto> inventoryList =
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个药品分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(
unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
=======
List<Long> medDispenseIdList
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
// 获取药品待发放库存信息
List<UnDispenseInventoryDto> unDispenseInventoryList =
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
List<UnDispenseInventoryDto> unDispenseInventoryList
= returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 发药单状态校验
if (unDispenseInventoryList.stream().map(UnDispenseInventoryDto::getDispenseStatus)
.anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
.anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
throw new ServiceException("发药失败,请检查发药单状态");
}
// 库存待更新列表
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 根据批号,发放项目,发放药房进行分组处理
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
if (!unDispenseInventoryMap.isEmpty()) {
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
if (!inventoryList.isEmpty()) {
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 停供库存校验
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
}
@@ -472,17 +380,16 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
if (!unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 转换为小单位进行累加
quantity =
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
quantity
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
}
minQuantity = minQuantity.add(quantity);
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
inventoryId = unDispenseInventoryDto.getInventoryId();
>>>>>>> v1.3
}
}
if (minQuantity.compareTo(inventoryQuantity) > 0) {
@@ -491,7 +398,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
} else {
// 设置待更新的库存信息
inventoryItemList.add(new InventoryItem().setId(inventoryId)
.setQuantity(inventoryQuantity.subtract(minQuantity)));
.setQuantity(inventoryQuantity.subtract(minQuantity)));
}
}
}
@@ -527,9 +434,9 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
// 设置库存变更参数
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(unDispenseInventoryDto.getItemId())
.setLotNumber(unDispenseInventoryDto.getLotNumber())
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setRequestId(unDispenseInventoryDto.getRequestId()));
.setLotNumber(unDispenseInventoryDto.getLotNumber())
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
.setRequestId(unDispenseInventoryDto.getRequestId()));
// 处理追溯码相关
// 使用逗号分割追溯码并转换为List
@@ -539,22 +446,22 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
traceNoManage = new TraceNoManage();
// 追溯码处理
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
// 项目id
.setItemId(unDispenseInventoryDto.getItemId())
// 仓库类型
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
// 仓库
.setLocationId(unDispenseInventoryDto.getLocationId())
// 产品批号
.setLotNumber(unDispenseInventoryDto.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.OUT.getValue())
// 追溯码单位
.setUnitCode(unDispenseInventoryDto.getDispenseUnit())
// 操作类型
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
// 项目id
.setItemId(unDispenseInventoryDto.getItemId())
// 仓库类型
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
// 仓库
.setLocationId(unDispenseInventoryDto.getLocationId())
// 产品批号
.setLotNumber(unDispenseInventoryDto.getLotNumber())
// 追溯码
.setTraceNo(item)
// 追溯码状态
.setStatusEnum(TraceNoStatus.OUT.getValue())
// 追溯码单位
.setUnitCode(unDispenseInventoryDto.getDispenseUnit())
// 操作类型
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
tracesNoManageList.add(traceNoManage);
}
}
@@ -575,23 +482,23 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
if (Whether.YES.getCode().equals(ybSwitch)) {
// 设置进销存参数
List<MedicationDefinition> medicationDefinitions = medicationDefinitionService.listByIds(
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
// 用itemId分组
Map<Long, MedicationDefinition> medicationMap = medicationDefinitions.stream()
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
// 设置库存变更参数
for (SupplyItemDetailDto dto : supplyItemDetailList) {
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dto.getItemTable())) {
MedicationDefinition med = medicationMap.get(dto.getItemId());
if (med != null) {
dto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent()).setRxFlag(med.getRxFlag())
.setYbNo(med.getYbNo());
.setYbNo(med.getYbNo());
}
}
}
uploadFailedNoList = this.ybMedicineIntegrated(medDispenseIdList, null);
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
if (uploadFailedNoList != null) {
returnMsg = "3505商品销售上传错误错误项目编码" + uploadFailedNoList;
} else {
@@ -610,11 +517,11 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
@Override
public R<?> medicineCancel(List<DispenseItemDto> dispenseMedicineList) {
// 获取发药单id列表
List<Long> medDispenseIdList =
dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
List<Long> medDispenseIdList
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
// 药品发药信息查询
List<MedicationDispense> dispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
if (dispenseList != null) {
for (MedicationDispense medicationDispense : dispenseList) {
// 药品发放状态
@@ -640,15 +547,15 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
* @return 上传失败的编号集合
*/
public List<String> ybMedicineIntegrated(@Nullable List<Long> medDispenseIdList,
@Nullable List<Long> devDispenseIdList) {
@Nullable List<Long> devDispenseIdList) {
List<String> uploadFailedNoList = new ArrayList<>();
R<?> result;
if ((medDispenseIdList != null && !medDispenseIdList.isEmpty())
|| (devDispenseIdList != null && !devDispenseIdList.isEmpty())) {
|| (devDispenseIdList != null && !devDispenseIdList.isEmpty())) {
// 查询发药项目相关信息
List<DispenseInventoryDto> dispenseInventoryList = returnMedicineMapper.selectReturnItemDetail(
devDispenseIdList, medDispenseIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
devDispenseIdList, medDispenseIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
if (dispenseInventoryDto.getYbNo() == null) {
continue;
@@ -658,7 +565,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
Contract contract = medical3505Pair.getRight();
if (contract != null) {
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
.equals(medical3505Pair.getRight().getBusNo())) {
.equals(medical3505Pair.getRight().getBusNo())) {
contract = null;
}
}
@@ -677,14 +584,14 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
// 查询费用结算信息
chargeItem = chargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
chargeItem = chargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
}
if (chargeItem == null) {
@@ -696,29 +603,29 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
throw new ServiceException("未查找到就诊诊断信息");
}
// 查询付款信息
List<PaymentReconciliation> paymentReconciliationList =
paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, dispenseInventoryDto.getEncounterId())
.eq(PaymentReconciliation::getTenantId, SecurityUtils.getLoginUser().getTenantId())
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.eq(PaymentReconciliation::getPatientId, dispenseInventoryDto.getPatientId())
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue())
.orderByDesc(PaymentReconciliation::getBillDate));
List<PaymentReconciliation> paymentReconciliationList
= paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, dispenseInventoryDto.getEncounterId())
.eq(PaymentReconciliation::getTenantId, SecurityUtils.getLoginUser().getTenantId())
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.eq(PaymentReconciliation::getPatientId, dispenseInventoryDto.getPatientId())
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue())
.orderByDesc(PaymentReconciliation::getBillDate));
if (paymentReconciliationList == null || paymentReconciliationList.isEmpty()) {
throw new ServiceException("未查找到收费信息");
}
PaymentReconciliation paymentReconciliation = paymentReconciliationList.get(0);
// 查询账户信息
Account account = accountService
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, dispenseInventoryDto.getEncounterId())
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, dispenseInventoryDto.getEncounterId())
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
if (account == null) {
throw new ServiceException("未查找到账户信息");
}
// 查询合同实体
Contract contract =
contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
Contract contract
= contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
if (contract == null) {
throw new ServiceException("未查找到合同信息");
}
@@ -733,13 +640,13 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
}
// 查询就诊id
if (contract.getCategoryEnum().equals(Category.SELF.getValue())
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
medical3505Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo()).setMdtrtSetlType("2");
} else {
// todo虽然是医保挂号但是用什么结算的暂时未知先不做修改
ClinicSettle clinicSettle = clinicSettleService.getOne(new LambdaQueryWrapper<ClinicSettle>()
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
if (clinicSettle != null) {
medical3505Param.setMdtrtSn(clinicSettle.getMdtrtId()).setMdtrtSetlType("1");
} else {
@@ -755,9 +662,9 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
JSONArray medicalTraceNo = new JSONArray();
// 获取追溯码信息
if (dispenseInventoryDto.getTraceNo() != null) {
List<String> traceNoList =
Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
.filter(s -> !s.isEmpty()).toList();
List<String> traceNoList
= Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
.filter(s -> !s.isEmpty()).toList();
for (String traceNo : traceNoList) {
Map<String, String> traceNoMap = new HashMap<>();
traceNoMap.put("drug_trac_codg", traceNo);
@@ -765,25 +672,25 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
}
}
medical3505Param.setMedListCodg(dispenseInventoryDto.getYbNo())
.setFixmedinsBchno(dispenseInventoryDto.getReqId().toString())
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
.setPrscDrName(dispenseInventoryDto.getPractitionerName())
.setPharName(dispenseInventoryDto.getDispenseName())
.setPharPracCertNo(dispenseInventoryDto.getPharPracCertNo()).setPsnCertType(mdtrtCertType.getValue())
.setManuLotnum(dispenseInventoryDto.getLotNumber()).setManuDate(dispenseInventoryDto.getProductionDate())
.setRtalDocno(dispenseInventoryDto.getDispenseNo())
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
.setStooutNo(dispenseInventoryDto.getDispenseNo()).setDrugtracinfo(medicalTraceNo)
.setCertno(dispenseInventoryDto.getIdCard()).setPsnName(dispenseInventoryDto.getPatientName());
.setFixmedinsBchno(dispenseInventoryDto.getReqId().toString())
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
.setPrscDrName(dispenseInventoryDto.getPractitionerName())
.setPharName(dispenseInventoryDto.getDispenseName())
.setPharPracCertNo(dispenseInventoryDto.getPharPracCertNo()).setPsnCertType(mdtrtCertType.getValue())
.setManuLotnum(dispenseInventoryDto.getLotNumber()).setManuDate(dispenseInventoryDto.getProductionDate())
.setRtalDocno(dispenseInventoryDto.getDispenseNo())
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
.setStooutNo(dispenseInventoryDto.getDispenseNo()).setDrugtracinfo(medicalTraceNo)
.setCertno(dispenseInventoryDto.getIdCard()).setPsnName(dispenseInventoryDto.getPatientName());
if (dispenseInventoryDto.getInventoryUnitCode().equals(dispenseInventoryDto.getDispenseUnitCode())) {
medical3505Param.setTrdnFlag(Whether.YES.getCode());
} else {
medical3505Param.setTrdnFlag(Whether.NO.getCode());
}
// 查看所属医院
String fixmedinsCode =
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsCode
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
if (dispenseInventoryDto.getPreparerName() == null && HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
medical3505Param.setSelRetnOpterName(CommonConstants.CCU.DisDeviceDoctorName);
} else {

View File

@@ -55,11 +55,11 @@ public class MedicationDetailsController {
*/
@GetMapping(value = "/amb-practitioner-detail")
public R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return medicationDetailsAppService.getAmbPractitionerDetailPage(medDetailsSearchParam, pageNo, pageSize,
searchKey, request);
searchKey, request);
}
/**
@@ -74,11 +74,11 @@ public class MedicationDetailsController {
*/
@GetMapping(value = "/amb-medication-detail")
public R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return medicationDetailsAppService.getAmbMedicationDispenseDetailPage(medDetailsSearchParam, pageNo, pageSize,
searchKey, request);
searchKey, request);
}
// /**
@@ -118,10 +118,6 @@ public class MedicationDetailsController {
// return medicationDetailsAppService.getMedRunningAccountPage(medDetailsSearchParam, pageNo, pageSize, searchKey,
// request);
// }
<<<<<<< HEAD
=======
/**
* 发药明细导出
*
@@ -132,13 +128,12 @@ public class MedicationDetailsController {
* @param response 请求数据
* @param request 请求数据
*/
>>>>>>> v1.3
@GetMapping(value = "/excel-out")
public void exportExcel(MedDetailsSearchParam medDetailsSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey,
HttpServletRequest request, HttpServletResponse response) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey,
HttpServletRequest request, HttpServletResponse response) {
medicationDetailsAppService.makeExcelFile(medDetailsSearchParam, pageNo, pageSize, searchKey, response, request);
}

View File

@@ -3,21 +3,11 @@ package com.openhis.web.pharmacymanage.controller;
import java.util.List;
import javax.annotation.Resource;
<<<<<<< HEAD
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.openhis.web.inhospitalnursestation.dto.AdmissionPageParam;
import com.openhis.web.pharmacymanage.dto.*;
import org.springframework.web.bind.annotation.*;
=======
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
>>>>>>> v1.3
import com.core.common.core.domain.R;
import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppService;
@@ -25,7 +15,6 @@ import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppServ
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 住院汇总发药
*
@@ -42,98 +31,6 @@ public class SummaryDispenseMedicineController {
public ISummaryDispenseMedicineAppService medicineSummaryDispenseService;
/**
<<<<<<< HEAD
* 获取页面初始化信息
*
* @return 初始化信息
*/
@GetMapping(value = "/init")
public R<?> medicineDispenseInit() {
return medicineSummaryDispenseService.init();
}
/**
* 分页查询住院病人列表
*
* @param admissionPageParam 查询条件
* @param startTime 开始时间
* @param endTime 结束时间
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
* @return 病人列表
*/
@GetMapping("/encounter-list")
public R<?> getEncounterInfoList(AdmissionPageParam admissionPageParam, String startTime, String endTime,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return medicineSummaryDispenseService.getEncounterInfoListPage(admissionPageParam, startTime, endTime, pageNo,
pageSize, searchKey, request);
}
/**
* 住院汇总药品
*
* @param searchParam 查询信息
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 药品汇总
*/
@GetMapping("/medication_summary-list")
public R<?> getSummaryMedicationInfo(MedicineSummarySearchParam searchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return medicineSummaryDispenseService.getSummaryMedicationInfo(searchParam, pageNo, pageSize);
}
/**
* 住院汇总发药单
*
* @param searchParam 查询条件
* @param startTime 开始时间
* @param endTime 结束时间
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
* @return 汇总单汇总
*/
@GetMapping("/from_summary-list")
public R<?> getSummaryFromInfo(FromSummarySearchParam searchParam, String startTime, String endTime,
String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return medicineSummaryDispenseService.getSummaryFromInfo(searchParam, startTime, endTime, searchKey, pageNo,
pageSize, request);
}
/**
* 住院药品汇总发药单详细
*
* @param searchParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
*/
@GetMapping("/from-list")
public R<?> getFromInfo(FromSearchParam searchParam, String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return medicineSummaryDispenseService.getOrderInfo(searchParam, searchKey, pageNo, pageSize, request);
}
/**
* 药品发药
*
* @param dispenseMedicineList 发药信息
* @return 处理结果
*/
@PutMapping("/summary-dispense-medicine")
public R<?> SummaryDispenseMedicine(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
return medicineSummaryDispenseService.SummaryDispenseMedicine(dispenseMedicineList);
=======
* 汇总发药
*
* @param summaryNoList 汇总单列表
@@ -142,66 +39,11 @@ public class SummaryDispenseMedicineController {
@PutMapping("/summary-dispense-medicine")
public R<?> SummaryDispenseMedicine(@RequestBody List<String> summaryNoList) {
return medicineSummaryDispenseService.SummaryDispenseMedicine(summaryNoList);
>>>>>>> v1.3
}
/**
* 作废
*
<<<<<<< HEAD
* @param dispenseMedicineList 作废信息
* @return 处理结果
*/
@PutMapping("/dispense-cancel")
public R<?> dispenseCancel(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
return medicineSummaryDispenseService.dispenseCancel(dispenseMedicineList);
}
/**
* 退药处理
*
* @param dispenseMedicineList 退药清单
* @return 处理结果
*/
@PutMapping("/medicine-return")
public R<?> medicineReturn(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
return medicineSummaryDispenseService.medicineReturn(dispenseMedicineList);
}
/**
* 住院发药
*
* @param searchParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
*/
@GetMapping(value = "/excel-out")
public void excelOut(MedicineSummarySearchParam searchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10000") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey,
HttpServletRequest request,HttpServletResponse response) {
medicineSummaryDispenseService.makeExcelFile(searchParam, pageNo, pageSize, searchKey, request, response);
}
/**
* 住院药品汇总
*
* @param searchParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param request 请求数据
*/
=======
* @param summaryNoList 汇总单列表
* @return 处理结果
*/
@@ -245,5 +87,4 @@ public class SummaryDispenseMedicineController {
// HttpServletResponse response) {
// medicineSummaryDispenseService.takeExcelField(searchParam, searchKey, pageNo, pageSize, request, response);
// }
>>>>>>> v1.3
}

View File

@@ -21,29 +21,40 @@ import java.math.BigDecimal;
@Accessors(chain = true)
public class DispenseItemDto {
/** 配药人 */
/**
* 配药人
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long preparerId;
/** 发放ID */
/**
* 发放ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long dispenseId;
<<<<<<< HEAD
=======
/** 发药数量 */
/**
* 发药数量
*/
private BigDecimal quantity;
/** 批号 */
/**
* 批号
*/
private String lotNumber;
>>>>>>> v1.3
/** 单据号 */
/**
* 单据号
*/
private String busNo;
/** 追溯码 */
/**
* 追溯码
*/
private String traceNo;
/** 未发原因 */
/**
* 未发原因
*/
private Integer notPerformedReasonEnum;
}

View File

@@ -59,31 +59,19 @@ public class ItemDispenseOrderDto {
/**
* 发放药房
*/
<<<<<<< HEAD
@Excel(name = "发放药房",sort = 3)
=======
@Excel(name = "发放药房", sort = 3)
>>>>>>> v1.3
private String locationName;
/**
* 批次号
*/
<<<<<<< HEAD
@Excel(name = "批次号",sort = 4)
=======
@Excel(name = "批次号", sort = 4)
>>>>>>> v1.3
private String lotNumber;
/**
* 科室
*/
<<<<<<< HEAD
@Excel(name = "科室",sort = 5)
=======
@Excel(name = "科室", sort = 5)
>>>>>>> v1.3
private String departmentName;
/**
@@ -95,21 +83,13 @@ public class ItemDispenseOrderDto {
/**
* 开单医生
*/
<<<<<<< HEAD
@Excel(name = "开单医生",sort = 6)
=======
@Excel(name = "开单医生", sort = 6)
>>>>>>> v1.3
private String doctorName;
/**
* 发药医生
*/
<<<<<<< HEAD
@Excel(name = "发药医生",sort = 7)
=======
@Excel(name = "发药医生", sort = 7)
>>>>>>> v1.3
private String dispenseDoctorName;
/**
@@ -117,54 +97,32 @@ public class ItemDispenseOrderDto {
*/
@Dict(dictCode = "med_category_code")
private String itemType;
<<<<<<< HEAD
@Excel(name = "项目类型",sort = 8)
=======
@Excel(name = "项目类型", sort = 8)
>>>>>>> v1.3
private String itemType_dictText;
/**
* 发药状态
*/
private Integer statusEnum;
<<<<<<< HEAD
@Excel(name = "发药状态",sort = 9)
=======
@Excel(name = "发药状态", sort = 9)
>>>>>>> v1.3
private String statusEnum_enumText;
/**
* 诊断名称
*/
<<<<<<< HEAD
@Excel(name = "诊断名称",sort = 10)
=======
@Excel(name = "诊断名称", sort = 10)
>>>>>>> v1.3
private String conditionName;
/**
* 处方号
*/
<<<<<<< HEAD
@Excel(name = "处方号",sort = 11)
=======
@Excel(name = "处方号", sort = 11)
>>>>>>> v1.3
private String prescriptionNo;
/**
* 项目名称
*/
<<<<<<< HEAD
@Excel(name = "项目名称",sort = 1,width = 30)
=======
@Excel(name = "项目名称", sort = 1, width = 30)
>>>>>>> v1.3
private String itemName;
/**
@@ -175,21 +133,13 @@ public class ItemDispenseOrderDto {
/**
* 规格
*/
<<<<<<< HEAD
@Excel(name = "规格",sort = 2,width = 30)
=======
@Excel(name = "规格", sort = 2, width = 30)
>>>>>>> v1.3
private String totalVolume;
/**
* 单次剂量
*/
<<<<<<< HEAD
@Excel(name = "单次剂量",sort = 12)
=======
@Excel(name = "单次剂量", sort = 12)
>>>>>>> v1.3
private BigDecimal dose;
/**
@@ -202,11 +152,7 @@ public class ItemDispenseOrderDto {
*/
@Dict(dictCode = "rate_code")
private String rateCode;
<<<<<<< HEAD
@Excel(name = "用药频次",sort = 13)
=======
@Excel(name = "用药频次", sort = 13)
>>>>>>> v1.3
private String rateCode_dictText;
/**
@@ -214,60 +160,35 @@ public class ItemDispenseOrderDto {
*/
@Dict(dictCode = "method_code")
private String methodCode;
<<<<<<< HEAD
@Excel(name = "用法",sort = 14)
=======
@Excel(name = "用法", sort = 14)
>>>>>>> v1.3
private String methodCode_dictText;
/**
* 剂量单位
*/
@Dict(dictCode = "unit_code")
private String doseUnitCode;
<<<<<<< HEAD
@Excel(name = "剂量单位",sort = 15)
=======
@Excel(name = "剂量单位", sort = 15)
>>>>>>> v1.3
private String doseUnitCode_dictText;
/**
* 单位
*/
@Dict(dictCode = "unit_code")
private String unitCode;
<<<<<<< HEAD
@Excel(name = "单位",sort = 16)
=======
@Excel(name = "单位", sort = 16)
>>>>>>> v1.3
private String unitCode_dictText;
/**
* 单次发药数
*/
<<<<<<< HEAD
@Excel(name = "单次发药数",sort = 17)
=======
@Excel(name = "单次发药数", sort = 17)
>>>>>>> v1.3
private Integer dispensePerQuantity;
/**
* 每次发药供应天数
*/
<<<<<<< HEAD
@Excel(name = "每次发药供应天数",sort = 18)
=======
@Excel(name = "每次发药供应天数", sort = 18)
>>>>>>> v1.3
private Integer dispensePerDuration;
/**
@@ -278,32 +199,19 @@ public class ItemDispenseOrderDto {
/**
* 数量
*/
<<<<<<< HEAD
@Excel(name = "数量",sort = 19)
private Integer quantity;
=======
@Excel(name = "数量", sort = 19)
private BigDecimal quantity;
>>>>>>> v1.3
/**
* 单价
*/
<<<<<<< HEAD
@Excel(name = "单价",sort = 20)
=======
@Excel(name = "单价", sort = 20)
>>>>>>> v1.3
private BigDecimal unitPrice;
/**
* 金额
*/
<<<<<<< HEAD
@Excel(name = "金额",sort = 21)
=======
@Excel(name = "金额", sort = 21)
>>>>>>> v1.3
private BigDecimal totalPrice;
/**
* 组合号
@@ -315,66 +223,46 @@ public class ItemDispenseOrderDto {
* 就诊NO
*/
@JsonSerialize(using = ToStringSerializer.class)
<<<<<<< HEAD
@Excel(name = "就诊NO",sort = 24)
=======
@Excel(name = "就诊NO", sort = 24)
>>>>>>> v1.3
private String encounterBusNo;
/** 开具日期 */
/**
* 开具日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
<<<<<<< HEAD
@Excel(name = "开具日期",sort = 25, dateFormat = "yyyy-MM-dd HH:mm:ss",width = 25)
private Date reqAuthoredTime;
/** 皮试标志 */
@Excel(name = "皮试标志",sort = 26)
private Integer skinTestFlag;
/** 中药标识 */
@Excel(name = "中药标识",sort = 27)
private Integer tcmFlag;
/** 所在表 */
@Excel(name = "所在表",sort = 28,width = 30)
=======
@Excel(name = "开具日期", sort = 25, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 25)
private Date reqAuthoredTime;
/** 接收皮试标志 */
/**
* 接收皮试标志
*/
@Excel(name = "皮试标志", sort = 26)
private String skinTestFlagDesc;
private Integer skinTestFlag;
/** 接收中药标识 */
/**
* 接收中药标识
*/
@Excel(name = "中药标识", sort = 27)
private String tcmFlagDesc;
private Integer tcmFlag;
/** 所在表 */
/**
* 所在表
*/
@Excel(name = "所在表", sort = 28, width = 30)
>>>>>>> v1.3
private String itemTable;
/**
* 生产厂家
*/
<<<<<<< HEAD
@Excel(name = "生产厂家",sort = 22,width = 35)
=======
@Excel(name = "生产厂家", sort = 22, width = 35)
>>>>>>> v1.3
private String manufacturerText;
/**
* 追溯码
*/
<<<<<<< HEAD
@Excel(name = "追溯码",sort = 23)
=======
@Excel(name = "追溯码", sort = 23)
>>>>>>> v1.3
private String traceNo;
/**
@@ -384,12 +272,14 @@ public class ItemDispenseOrderDto {
private String medTypeCode;
private String medTypeCode_dictText;
/** 输液标志 */
/**
* 输液标志
*/
private Integer injectFlag;
/** 拆分属性 */
/**
* 拆分属性
*/
private Integer partAttributeEnum;
/**

View File

@@ -1,11 +1,5 @@
package com.openhis.web.pharmacymanage.dto;
<<<<<<< HEAD
import java.math.BigDecimal;
import java.util.Date;
=======
>>>>>>> v1.3
import com.core.common.annotation.Excel;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@@ -22,13 +16,10 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class MedDetailedAccountPageDto {
<<<<<<< HEAD
/** 门诊号 */
=======
/**
* 门诊号
*/
>>>>>>> v1.3
private String outpatientNo;
/**
@@ -41,37 +32,6 @@ public class MedDetailedAccountPageDto {
*/
private String patientName;
<<<<<<< HEAD
/** 项目类别 */
private String pinYin;
/** 接收发药数量 */
@Excel(name = "发药数量")
private String dispenseQuantitystr;
/** 接收发药金额 */
@Excel(name = "发药金额")
private String dispensePricestr;
/** 接收退药数量 */
@Excel(name = "退药数量")
private String refundQuantitystr;
/** 接收退药金额 */
@Excel(name = "退药金额")
private String refundPricestr;
/** 发药人 */
@JsonSerialize(using = ToStringSerializer.class)
private String practitionerId;
/** 发药人名称 */
@Excel(name = "发药人")
private String practitionerName;
/** 药品项目 */
@Excel(name = "药品项目")
=======
/**
* 接收发药数量
*/
@@ -117,7 +77,6 @@ public class MedDetailedAccountPageDto {
* 药品项目
*/
@Excel(name = "药品项目", sort = 3)
>>>>>>> v1.3
private String medicationName;
/**
@@ -125,22 +84,6 @@ public class MedDetailedAccountPageDto {
*/
private String pyStr;
<<<<<<< HEAD
/** 项目编码 */
@Excel(name = "药品编码")
private String busNo;
/** 发药编码 */
@Excel(name = "发药单号")
private String dispenseNo;
/** 医保编码 */
@Excel(name = "医保编码")
private String ybNo;
/** 规格 */
@Excel(name = "规格")
=======
/**
* 项目编码
*/
@@ -163,7 +106,6 @@ public class MedDetailedAccountPageDto {
* 规格
*/
@Excel(name = "规格", sort = 7, width = 30)
>>>>>>> v1.3
private String totalVolume;
/**
@@ -189,18 +131,6 @@ public class MedDetailedAccountPageDto {
* 成本金额
*/
<<<<<<< HEAD
/** 批号 */
@Excel(name = "生产批号")
private String lotNumber;
/** 厂商 */
@Excel(name = "厂家/产地")
private String manufacturerText;
/** 供应商 */
@Excel(name = "供应商")
=======
private BigDecimal costPrice;
/**
@@ -219,7 +149,6 @@ public class MedDetailedAccountPageDto {
* 供应商
*/
@Excel(name = "供应商", sort = 15, width = 35)
>>>>>>> v1.3
private String supplierName;
/**
@@ -236,14 +165,6 @@ public class MedDetailedAccountPageDto {
private String refundUnitCode;
private String refundUnitCode_dictText;
<<<<<<< HEAD
/** 发药时间 */
@Excel(name = "发药时间", dateFormat="yyyy-MM-dd HH:mm:ss")
private Date dispenseTime;
/** 项目所在表 */
// @Excel(name = "项目类别")
=======
/**
* 发药时间
*/
@@ -254,6 +175,5 @@ public class MedDetailedAccountPageDto {
* 项目所在表
*/
@Excel(name = "项目类别", sort = 4)
>>>>>>> v1.3
private String itemTable;
}

View File

@@ -15,36 +15,53 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class MedDetailsSearchParam {
/** 发药时间 */
/**
* 发药时间
*/
private Date dispenseTime;
/** 药房 */
/**
* 药房
*/
private Long locationId;
/** 患者姓名 */
/**
* 患者姓名
*/
private String patientName;
/** 发药人 */
/**
* 发药人
*/
private Long practitionerId;
/** 药品名称 */
/**
* 药品名称
*/
private String medicationName;
/** 药品项目(药品编码) */
/**
* 药品项目(药品编码)
*/
private String busNo;
/** 出院状态 */
/**
* 出院状态
*/
private Integer dischargeStatus;
/** 门诊住院flg */
/**
* 门诊住院flg
*/
private Integer flag;
/** 项目所在表 */
/**
* 项目所在表
*/
private String itemTable;
<<<<<<< HEAD
=======
/** 统计类型 */
/**
* 统计类型
*/
private Integer inventoryScope;
>>>>>>> v1.3
}

View File

@@ -5,10 +5,6 @@ package com.openhis.web.pharmacymanage.dto;
import java.math.BigDecimal;
import java.util.Date;
<<<<<<< HEAD
import java.util.List;
=======
>>>>>>> v1.3
import com.core.common.annotation.Excel;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -27,17 +23,22 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class MedicineSummaryDto {
/**
* 单据号
*/
@Excel(name = "单据号", sort = 8, width = 35)
private String busNo;
/** 供应请求id */
/**
* 供应请求id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId;
/** 供应发放id */
/**
* 供应发放id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long deliveryId;
@@ -51,7 +52,9 @@ public class MedicineSummaryDto {
@Excel(name = "项目名", sort = 2, width = 40)
private String itemName;
/** 项目id */
/**
* 项目id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long itemId;
@@ -91,33 +94,45 @@ public class MedicineSummaryDto {
private String unitCode;
private String unitCode_dictText;
/** 常规单位 */
/**
* 常规单位
*/
@Dict(dictCode = "unit_code")
private String maxUnitCode;
private String maxUnitCode_dictText;
/** 最小单位 */
/**
* 最小单位
*/
@Dict(dictCode = "unit_code")
private String minUnitCode;
private String minUnitCode_dictText;
/** 发放地点 */
/**
* 发放地点
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long sourceLocationId;
@Excel(name = "发放地点", sort = 6)
private String sourceLocationName;
/** 申请科室 */
/**
* 申请科室
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
private String orgName;
/** 领药人 */
/**
* 领药人
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long applicantId;
private String applicantName;
/** 申请时间 */
/**
* 申请时间
*/
private Date applyTime;
/**
@@ -126,6 +141,8 @@ public class MedicineSummaryDto {
private Integer statusEnum;
private String statusEnum_enumText;
/** 患者信息 */
/**
* 患者信息
*/
private String patientInfo;
}

View File

@@ -22,31 +22,19 @@ public interface MedicationDetailsMapper {
* @param queryWrapper 查询条件
* @param completed 发药状态:已发药
* @param refunded 发药状态:已退药
<<<<<<< HEAD
* @param dispenseEnum 统计类型
* @param medMedicationDefinition 药品
* @param admDeviceDefinition 耗材
=======
* @param statisticalType 统计类型
* @param flg 1:住院 2门诊
* @param medMedicationDefinition 药品
* @param admDeviceDefinition 耗材
* @param costEnum 命中条件枚举:产品批号进价
>>>>>>> v1.3
* @return 门诊人员发药明细表
*/
Page<MedDetailedAccountPageDto> selectAmbPractitionerDetailPage(@Param("page") Page<MedDetailedAccountPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper,
@Param("completed") Integer completed, @Param("agree") Integer agree, @Param("refunded") Integer refunded,
<<<<<<< HEAD
@Param("dispenseEnum") Integer dispenseEnum, @Param("flg") Integer flg,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition);
=======
@Param("statisticalType") Integer statisticalType, @Param("flg") Integer flg,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("costEnum") String costEnum);
>>>>>>> v1.3
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper,
@Param("completed") Integer completed, @Param("agree") Integer agree, @Param("refunded") Integer refunded,
@Param("statisticalType") Integer statisticalType, @Param("flg") Integer flg,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("costEnum") String costEnum);
// /**
// * 门诊发药明细流水账
@@ -62,5 +50,4 @@ public interface MedicationDetailsMapper {
// @Param("page") Page<MedDetailedAccountPageDto> page,
// @Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper, @Param("amb") Integer amb,
// @Param("completed") Integer completed, @Param("refunded") Integer refunded)
}

View File

@@ -27,11 +27,7 @@ public interface ReturnMedicineMapper {
* @return 退药患者分页列表
*/
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
<<<<<<< HEAD
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper, @Param("amb") Integer amb);
=======
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper);
>>>>>>> v1.3
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper);
/**
* 申请退药清单查询
@@ -47,10 +43,10 @@ public interface ReturnMedicineMapper {
* @return 申请退药清单
*/
List<ReturnMedicineInfoDto> selectReturnMedicineInfo(@Param("encounterId") Long encounterId,
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest,
@Param("medicine") Integer medicine, @Param("device") Integer device,
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
@Param("refunded") Integer refunded);
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest,
@Param("medicine") Integer medicine, @Param("device") Integer device,
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
@Param("refunded") Integer refunded);
/**
* 库存信息查询
@@ -62,13 +58,13 @@ public interface ReturnMedicineMapper {
* @return 待发药信息
*/
List<UnDispenseInventoryDto> selectInventoryInfoList(@Param("devDispenseIdList") List<Long> devDispenseIdList,
@Param("medDispenseIdList") List<Long> medDispenseIdList,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition);
@Param("medDispenseIdList") List<Long> medDispenseIdList,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition);
/**
* 退药详细信息查询
*
*
* @param devDispenseIdList 耗材发放ID列表
* @param medDispenseIdList 药品发放ID列表
* @param medMedicationDefinition 药品定义表
@@ -76,7 +72,7 @@ public interface ReturnMedicineMapper {
* @return 退药信息
*/
List<DispenseInventoryDto> selectReturnItemDetail(@Param("devDispenseIdList") List<Long> devDispenseIdList,
@Param("medDispenseIdList") List<Long> medDispenseIdList,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition);
@Param("medDispenseIdList") List<Long> medDispenseIdList,
@Param("medMedicationDefinition") String medMedicationDefinition,
@Param("admDeviceDefinition") String admDeviceDefinition);
}

View File

@@ -3,37 +3,8 @@
*/
package com.openhis.web.pharmacymanage.mapper;
<<<<<<< HEAD
import com.openhis.web.pharmacymanage.dto.FromSearchParam;
import org.apache.ibatis.annotations.Param;
=======
>>>>>>> v1.3
import org.springframework.stereotype.Repository;
@Repository
<<<<<<< HEAD
public interface SummaryDispenseMedicineMapper {
/**
* 汇总药品信息列表查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 汇总药品信息
*/
Page<MedicineSummaryDto> selectMedicationSummaryInfo(@Param("page") Page<MedicineSummaryDto> page,
@Param(Constants.WRAPPER) QueryWrapper<MedicineSummarySearchParam> queryWrapper);
/**
* 汇总药品信息列表查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 汇总药品信息
*/
Page<MedicineSummaryDto> selectOrderInfo(@Param("page") Page<MedicineSummaryDto> page,
@Param(Constants.WRAPPER) QueryWrapper<FromSearchParam> queryWrapper);
}
=======
public interface SummaryDispenseMedicineMapper {}
>>>>>>> v1.3

View File

@@ -80,58 +80,44 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
* 查询住院患者信息
*
* @param regPatientMainInfoDto 住院患者信息 dto
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @return 住院患者信息
*/
@Override
public IPage<RegPatientMainInfoDto> getRegPatientMainInfo(RegPatientMainInfoDto regPatientMainInfoDto,
<<<<<<< HEAD
Integer status, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<RegPatientMainInfoDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(regPatientMainInfoDto, searchKey,
new HashSet<>(Arrays.asList("bus_no", "patient_name", "inHospital_org_name", "house_name")), request);
IPage<RegPatientMainInfoDto> regPatientMainInfo = adviceManageAppMapper.getRegPatientMainInfo(
new Page<>(pageNo, pageSize), SecurityUtils.getLoginUser().getPractitionerId(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
EncounterActivityStatus.ACTIVE.getValue(), EncounterClass.IMP.getValue(), status, Whether.YES.getValue(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), queryWrapper);
=======
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<RegPatientMainInfoDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(regPatientMainInfoDto, searchKey,
new HashSet<>(Arrays.asList("bus_no", "patient_name", "in_hospital_org_name", "house_name")), request);
QueryWrapper<RegPatientMainInfoDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(regPatientMainInfoDto, searchKey,
new HashSet<>(Arrays.asList("bus_no", "patient_name", "in_hospital_org_name", "house_name")), request);
// 当前登录所属的科室
Long currentUserOrganizationId = SecurityUtils.getLoginUser().getOrgId();
// 住院医生站-只查询当前登录的科室相关的患者
queryWrapper.eq(currentUserOrganizationId != null, CommonConstants.FieldName.InHospitalOrgId,
currentUserOrganizationId);
currentUserOrganizationId);
IPage<RegPatientMainInfoDto> regPatientMainInfo = adviceManageAppMapper.getRegPatientMainInfo(
new Page<>(pageNo, pageSize), SecurityUtils.getLoginUser().getPractitionerId(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
EncounterActivityStatus.ACTIVE.getValue(), EncounterClass.IMP.getValue(), Whether.YES.getValue(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), EncounterZyStatus.TO_BE_REGISTERED.getValue(),
EncounterZyStatus.ALREADY_SETTLED.getValue(),EncounterZyStatus.REGISTERED.getValue(), queryWrapper);
new Page<>(pageNo, pageSize), SecurityUtils.getLoginUser().getPractitionerId(),
LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue(), LocationForm.BED.getValue(),
EncounterActivityStatus.ACTIVE.getValue(), EncounterClass.IMP.getValue(), Whether.YES.getValue(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), EncounterZyStatus.TO_BE_REGISTERED.getValue(),
EncounterZyStatus.ALREADY_SETTLED.getValue(), EncounterZyStatus.REGISTERED.getValue(), queryWrapper);
// 就诊ID集合
List<Long> encounterIds =
regPatientMainInfo.getRecords().stream().map(RegPatientMainInfoDto::getEncounterId).toList();
List<Long> encounterIds
= regPatientMainInfo.getRecords().stream().map(RegPatientMainInfoDto::getEncounterId).toList();
// 查询条件
QueryWrapper<EncounterAccountDto> wrapper = new QueryWrapper<>();
wrapper.in(!encounterIds.isEmpty(), CommonConstants.FieldName.EncounterId, encounterIds);
// 费用列表
List<EncounterAccountDto> list = adviceManageAppMapper.getAmount(AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), wrapper);
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), wrapper);
// 转换为Map,key = encounter_id
Map<Long, EncounterAccountDto> dtoMap =
list.stream().collect(Collectors.toMap(EncounterAccountDto::getEncounterId, e -> e));
>>>>>>> v1.3
Map<Long, EncounterAccountDto> dtoMap
= list.stream().collect(Collectors.toMap(EncounterAccountDto::getEncounterId, e -> e));
regPatientMainInfo.getRecords().forEach(e -> {
// 设置费用详情
if (dtoMap.containsKey(e.getEncounterId())) {
@@ -159,7 +145,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
* 住院保存医嘱
*
* @param regAdviceSaveParam 住院医嘱表单信息
* @param adviceOpType 医嘱操作类型
* @param adviceOpType 医嘱操作类型
* @return 结果
*/
@Override
@@ -183,22 +169,15 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
List<RegAdviceSaveDto> regAdviceSaveList = regAdviceSaveParam.getRegAdviceSaveList();
// 药品
List<RegAdviceSaveDto> medicineList = regAdviceSaveList.stream()
<<<<<<< HEAD
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
// 耗材
// List<RegAdviceSaveDto> deviceList = regAdviceSaveList.stream()
// .filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
=======
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
>>>>>>> v1.3
// 诊疗活动
List<RegAdviceSaveDto> activityList = regAdviceSaveList.stream()
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
// 保存时,校验临时医嘱库存
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
List<RegAdviceSaveDto> medUpdateList =
medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
List<RegAdviceSaveDto> medUpdateList
= medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList());
// 编辑时,释放本身占用的库存发放
for (RegAdviceSaveDto adviceSaveDto : medUpdateList) {
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
@@ -206,8 +185,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
List<RegAdviceSaveDto> tempCheckList = regAdviceSaveList.stream()
.filter(e -> TherapyTimeType.TEMPORARY.getValue().equals(e.getTherapyEnum())
&& !DbOpType.DELETE.getCode().equals(e.getDbOpType())
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType()))
&& !DbOpType.DELETE.getCode().equals(e.getDbOpType())
&& !ItemType.ACTIVITY.getValue().equals(e.getAdviceType()))
.collect(Collectors.toList());
List<AdviceSaveDto> needCheckList = new ArrayList<>(tempCheckList);
// 校验库存
@@ -222,8 +201,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
/**
* 处理药品请求
*/
List<String> medRequestIdList =
this.handMedication(medicineList, startTime, authoredTime, curDate, adviceOpType, organizationId, signCode);
List<String> medRequestIdList
= this.handMedication(medicineList, startTime, authoredTime, curDate, adviceOpType, organizationId, signCode);
/**
* 处理诊疗项目请求
@@ -244,24 +223,15 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
.in(ChargeItem::getServiceId, requestIds));
}
<<<<<<< HEAD
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"住院医嘱"}));
=======
return R.ok(medRequestIdList,
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"住院医嘱"}));
>>>>>>> v1.3
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"住院医嘱"}));
}
/**
* 处理药品
*/
<<<<<<< HEAD
private void handMedication(List<RegAdviceSaveDto> medicineList, Date startTime, Date authoredTime, Date curDate,
String adviceOpType, Long organizationId, String signCode) {
=======
private List<String> handMedication(List<RegAdviceSaveDto> medicineList, Date startTime, Date authoredTime,
Date curDate, String adviceOpType, Long organizationId, String signCode) {
>>>>>>> v1.3
Date curDate, String adviceOpType, Long organizationId, String signCode) {
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
// 保存操作
@@ -294,8 +264,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
MedicationRequest longMedicationRequest;
// 新增 + 修改 (长期医嘱)
List<RegAdviceSaveDto> longInsertOrUpdateList = medicineList.stream().filter(e -> TherapyTimeType.LONG_TERM
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList());
for (RegAdviceSaveDto regAdviceSaveDto : longInsertOrUpdateList) {
@@ -314,11 +284,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
if (is_save) {
longMedicationRequest.setEffectiveDoseStart(startTime); // 医嘱开始时间
longMedicationRequest
<<<<<<< HEAD
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
=======
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
>>>>>>> v1.3
longMedicationRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
longMedicationRequest.setQuantity(regAdviceSaveDto.getQuantity()); // 请求数量
longMedicationRequest.setExecuteNum(regAdviceSaveDto.getExecuteNum()); // 执行次数
@@ -363,8 +329,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
ChargeItem chargeItem;
// 新增 + 修改 (临时医嘱)
List<RegAdviceSaveDto> tempInsertOrUpdateList = medicineList.stream().filter(e -> TherapyTimeType.TEMPORARY
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList());
for (RegAdviceSaveDto regAdviceSaveDto : tempInsertOrUpdateList) {
boolean firstTimeSave = false;// 第一次保存
@@ -382,11 +348,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
if (is_save) {
tempMedicationRequest.setEffectiveDoseStart(startTime); // 医嘱开始时间
tempMedicationRequest
<<<<<<< HEAD
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
=======
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
>>>>>>> v1.3
tempMedicationRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
tempMedicationRequest.setQuantity(regAdviceSaveDto.getQuantity()); // 请求数量
tempMedicationRequest.setExecuteNum(regAdviceSaveDto.getExecuteNum()); // 执行次数
@@ -414,13 +376,6 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
tempMedicationRequest.setInfusionFlag(regAdviceSaveDto.getInjectFlag()); // 输液标志
tempMedicationRequest.setSortNumber(regAdviceSaveDto.getSortNumber()); // 排序号
}
<<<<<<< HEAD
iMedicationRequestService.saveOrUpdate(tempMedicationRequest);
if (is_save) {
// 处理药品发放
Long dispenseId = iMedicationDispenseService.handleMedicationDispense(tempMedicationRequest,
regAdviceSaveDto.getDbOpType());
=======
if (tempMedicationRequest.getId() == null) {
firstTimeSave = true;
}
@@ -432,8 +387,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
if (is_save) {
// 处理药品发放
Long dispenseId = iMedicationDispenseService.handleMedicationDispense(tempMedicationRequest,
regAdviceSaveDto.getDbOpType());
>>>>>>> v1.3
regAdviceSaveDto.getDbOpType());
// 保存药品费用项
chargeItem = new ChargeItem();
@@ -474,7 +428,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
* 处理诊疗
*/
private void handService(List<RegAdviceSaveDto> activityList, Date startTime, Date authoredTime, Date curDate,
String adviceOpType, Long organizationId, String signCode) {
String adviceOpType, Long organizationId, String signCode) {
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
// 保存操作
@@ -496,8 +450,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
ServiceRequest longServiceRequest;
// 新增 + 修改 (长期医嘱)
List<RegAdviceSaveDto> longInsertOrUpdateList = activityList.stream().filter(e -> TherapyTimeType.LONG_TERM
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList());
for (RegAdviceSaveDto regAdviceSaveDto : longInsertOrUpdateList) {
longServiceRequest = new ServiceRequest();
@@ -543,9 +497,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
ChargeItem chargeItem;
// 新增 + 修改 (临时医嘱)
List<RegAdviceSaveDto> tempInsertOrUpdateList = activityList.stream().filter(e -> TherapyTimeType.TEMPORARY
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.getValue().equals(e.getTherapyEnum())
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList());
for (RegAdviceSaveDto regAdviceSaveDto : tempInsertOrUpdateList) {
tempServiceRequest = new ServiceRequest();
@@ -615,8 +568,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
// 第一次保存时,处理诊疗套餐的子项信息
if (regAdviceSaveDto.getRequestId() == null) {
ActivityDefinition activityDefinition =
iActivityDefinitionService.getById(regAdviceSaveDto.getAdviceDefinitionId());
ActivityDefinition activityDefinition
= iActivityDefinitionService.getById(regAdviceSaveDto.getAdviceDefinitionId());
String childrenJson = activityDefinition.getChildrenJson();
if (childrenJson != null) {
// 诊疗子项参数类
@@ -648,15 +601,9 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 住院医嘱请求数据
List<RegRequestBaseDto> regRequestBaseInfo = adviceManageAppMapper.getRegRequestBaseInfo(encounterId, null,
<<<<<<< HEAD
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
=======
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
>>>>>>> v1.3
// 根据 requestId 过滤重复医嘱信息
List<RegRequestBaseDto> distinctList = regRequestBaseInfo.stream()
.collect(Collectors.toMap(RegRequestBaseDto::getRequestId, dto -> dto, (existing, replacement) -> existing // 如果key冲突保留已存在的第一条
@@ -686,7 +633,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
* 查询历史住院医嘱请求数据
*
* @param encounterId 就诊id
* @param patientId 病人id
* @param patientId 病人id
* @return 历史住院医嘱请求数据
*/
@Override
@@ -695,15 +642,9 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 住院医嘱请求数据
List<RegRequestBaseDto> regRequestBaseInfo = adviceManageAppMapper.getRegRequestBaseInfo(encounterId, patientId,
<<<<<<< HEAD
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
=======
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
>>>>>>> v1.3
for (RegRequestBaseDto regRequestBaseDto : regRequestBaseInfo) {
// 请求状态
regRequestBaseDto.setStatusEnum_enumText(
@@ -735,13 +676,13 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
// 药品
List<AdviceBatchOpParam> medicineList = paramList.stream()
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
List<Long> medicineRequestIds =
medicineList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
List<Long> medicineRequestIds
= medicineList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
// 诊疗
List<AdviceBatchOpParam> activityList = paramList.stream()
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
List<Long> activityRequestIds =
activityList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
List<Long> activityRequestIds
= activityList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
// 查询已完成的药品请求
List<MedicationRequest> medicineCompleteList = new ArrayList<>();
if (!medicineRequestIds.isEmpty()) {
@@ -793,13 +734,13 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
// 药品
List<AdviceBatchOpParam> medicineList = paramList.stream()
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
List<Long> medicineRequestIds =
medicineList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
List<Long> medicineRequestIds
= medicineList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
// 诊疗
List<AdviceBatchOpParam> activityList = paramList.stream()
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList());
List<Long> activityRequestIds =
activityList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
List<Long> activityRequestIds
= activityList.stream().map(AdviceBatchOpParam::getRequestId).collect(Collectors.toList());
if (!medicineRequestIds.isEmpty()) {
iMedicationRequestService.update(new LambdaUpdateWrapper<MedicationRequest>()
.in(MedicationRequest::getId, medicineRequestIds).set(MedicationRequest::getEffectiveDoseEnd, date)

View File

@@ -67,13 +67,13 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
public NursingOrdersDto getNursingOrdersInfos() {
NursingOrdersDto nursingOrdersDto = new NursingOrdersDto();
// 类型为护理医嘱的编码集合
List<String> categoryCodeList =
Arrays.stream(NursingOrdersClass.values()).map(NursingOrdersClass::getCode).collect(Collectors.toList());
List<NursingOrdersDetailDto> nursingOrdersInfos =
specialAdviceAppMapper.getNursingOrdersInfos(categoryCodeList);
List<String> categoryCodeList
= Arrays.stream(NursingOrdersClass.values()).map(NursingOrdersClass::getCode).collect(Collectors.toList());
List<NursingOrdersDetailDto> nursingOrdersInfos
= specialAdviceAppMapper.getNursingOrdersInfos(categoryCodeList);
// 按categoryCode进行分组
Map<String, List<NursingOrdersDetailDto>> groupedByCategory =
nursingOrdersInfos.stream().collect(Collectors.groupingBy(NursingOrdersDetailDto::getCategoryCode));
Map<String, List<NursingOrdersDetailDto>> groupedByCategory
= nursingOrdersInfos.stream().collect(Collectors.groupingBy(NursingOrdersDetailDto::getCategoryCode));
// 根据不同的categoryCode赋值给对应的List
for (Map.Entry<String, List<NursingOrdersDetailDto>> entry : groupedByCategory.entrySet()) {
String categoryCode = entry.getKey();
@@ -133,8 +133,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 就诊诊断id
Long encounterDiagnosisId = nursingOrdersSaveDto.getEncounterDiagnosisId();
// 护理医嘱详情保存集合
List<NursingOrdersSaveDetailDto> nursingOrdersSaveDetailDtoList =
nursingOrdersSaveDto.getNursingOrdersSaveDetailDtoList();
List<NursingOrdersSaveDetailDto> nursingOrdersSaveDetailDtoList
= nursingOrdersSaveDto.getNursingOrdersSaveDetailDtoList();
// 声明长期医嘱诊疗请求
ServiceRequest longServiceRequest;
// 已经存在的有效医嘱
@@ -149,11 +149,11 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 查询已经存在的有效医嘱
LambdaQueryWrapper<ServiceRequest> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(ServiceRequest::getEncounterId, encounterId)
.eq(ServiceRequest::getCategoryEnum, categoryEnum)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getCategoryEnum, categoryEnum)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue()).or()
.eq(ServiceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue()))
.orderByDesc(ServiceRequest::getCreateTime).last("LIMIT 1");
.orderByDesc(ServiceRequest::getCreateTime).last("LIMIT 1");
alreadyExistsLongServiceRequest = iServiceRequestService.getOne(lambdaQuery);
longServiceRequest = new ServiceRequest();
@@ -164,7 +164,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
// 对应的诊疗医嘱信息
activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null,
null, null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0);
null, null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0);
// 逻辑1---------------------直接新增
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间
@@ -191,9 +191,9 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
if (definitionId == null) {
// 逻辑2---------------------停掉原有的
iServiceRequestService.update(new LambdaUpdateWrapper<ServiceRequest>()
.eq(ServiceRequest::getId, alreadyExistsLongServiceRequest.getId())
.set(ServiceRequest::getOccurrenceEndTime, curDate)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue()));
.eq(ServiceRequest::getId, alreadyExistsLongServiceRequest.getId())
.set(ServiceRequest::getOccurrenceEndTime, curDate)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue()));
continue;
}
@@ -203,16 +203,16 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
}
// 逻辑4---------------------先停掉原有的,再新增
iServiceRequestService.update(new LambdaUpdateWrapper<ServiceRequest>()
.eq(ServiceRequest::getId, alreadyExistsLongServiceRequest.getId())
.set(ServiceRequest::getOccurrenceEndTime, curDate)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue()));
.eq(ServiceRequest::getId, alreadyExistsLongServiceRequest.getId())
.set(ServiceRequest::getOccurrenceEndTime, curDate)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue()));
adviceBaseDto = new AdviceBaseDto();
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
// 对应的诊疗医嘱信息
activityAdviceBaseDto = iDoctorStationAdviceAppService
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null)
.getRecords().get(0);
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null)
.getRecords().get(0);
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间
@@ -234,7 +234,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"护理医嘱"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"护理医嘱"}));
}
/**
@@ -247,16 +247,16 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
public NursingOrdersEncounterDto getEncounterNursingOrdersInfos(Long encounterId) {
NursingOrdersEncounterDto nursingOrdersEncounterDto = new NursingOrdersEncounterDto();
// 类型为护理医嘱的枚举集合
List<Integer> categoryEnumList =
Arrays.stream(NursingOrdersClass.values()).map(NursingOrdersClass::getValue).collect(Collectors.toList());
List<Integer> categoryEnumList
= Arrays.stream(NursingOrdersClass.values()).map(NursingOrdersClass::getValue).collect(Collectors.toList());
// 查询查询就诊护理医嘱 ; 为了排除可能存在的数据问题,每个categoryEnum按创建时间取最新的一条
List<NursingOrdersEncounterDetailDto> encounterNursingOrdersInfos =
specialAdviceAppMapper.getEncounterNursingOrdersInfos(encounterId, RequestStatus.DRAFT.getValue(),
RequestStatus.ACTIVE.getValue(), RequestStatus.COMPLETED.getValue(), categoryEnumList);
List<NursingOrdersEncounterDetailDto> encounterNursingOrdersInfos
= specialAdviceAppMapper.getEncounterNursingOrdersInfos(encounterId, RequestStatus.DRAFT.getValue(),
RequestStatus.ACTIVE.getValue(), RequestStatus.COMPLETED.getValue(), categoryEnumList);
if (!encounterNursingOrdersInfos.isEmpty()) {
// 按categoryEnum进行分组
Map<Integer, List<NursingOrdersEncounterDetailDto>> groupedByCategory = encounterNursingOrdersInfos.stream()
.collect(Collectors.groupingBy(NursingOrdersEncounterDetailDto::getCategoryEnum));
.collect(Collectors.groupingBy(NursingOrdersEncounterDetailDto::getCategoryEnum));
// 根据不同的categoryCode赋值给对应的List
for (Map.Entry<Integer, List<NursingOrdersEncounterDetailDto>> entry : groupedByCategory.entrySet()) {
Integer categoryEnum = entry.getKey();
@@ -320,18 +320,18 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 转科的医嘱定义id
Long transferOrganizationDefinitionId = iActivityDefinitionService
.getAppointActivityDefinitionId(CommonConstants.BusinessName.TRANSFER_ORGANIZATION);
.getAppointActivityDefinitionId(CommonConstants.BusinessName.TRANSFER_ORGANIZATION);
if (transferOrganizationDefinitionId == null) {
return R.fail("请先在诊疗目录维护转科医嘱");
}
// 出院的医嘱定义id
Long leaveHospitalDefinitionId =
iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.LEAVE_HOSPITAL);
Long leaveHospitalDefinitionId
= iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.LEAVE_HOSPITAL);
if (leaveHospitalDefinitionId != null) {
LambdaQueryWrapper<ServiceRequest> leaveLambdaQuery = new LambdaQueryWrapper<>();
leaveLambdaQuery.eq(ServiceRequest::getEncounterId, encounterId)
.eq(ServiceRequest::getActivityId, leaveHospitalDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getActivityId, leaveHospitalDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue()).or());
if (!iServiceRequestService.list(leaveLambdaQuery).isEmpty()) {
return R.fail("已经开立出院医嘱,请勿开立转科医嘱");
@@ -341,8 +341,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 校验重复开立
LambdaQueryWrapper<ServiceRequest> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(ServiceRequest::getEncounterId, encounterId)
.eq(ServiceRequest::getActivityId, transferOrganizationDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getActivityId, transferOrganizationDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue()).or());
if (!iServiceRequestService.list(lambdaQuery).isEmpty()) {
return R.fail("请勿重复开立转科医嘱");
@@ -351,8 +351,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
adviceBaseDto.setAdviceDefinitionId(transferOrganizationDefinitionId); // 医嘱定义id
// 转科的医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null)
.getRecords().get(0);
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null)
.getRecords().get(0);
// 保存转科医嘱请求
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
@@ -385,7 +385,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
orderProcess.setTargetLocationId(transferOrganizationParam.getTargetLocationId()); // 目标病区
iOrderProcessService.save(orderProcess);
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"转科医嘱"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"转科医嘱"}));
}
/**
@@ -415,8 +415,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
Long encounterDiagnosisId = leaveHospitalParam.getEncounterDiagnosisId();
// 出院的医嘱定义id
Long transferOrganizationDefinitionId =
iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.LEAVE_HOSPITAL);
Long transferOrganizationDefinitionId
= iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.LEAVE_HOSPITAL);
if (transferOrganizationDefinitionId == null) {
return R.fail("请先在诊疗目录维护出院医嘱");
}
@@ -424,8 +424,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 校验重复开立
LambdaQueryWrapper<ServiceRequest> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(ServiceRequest::getEncounterId, encounterId)
.eq(ServiceRequest::getActivityId, transferOrganizationDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getActivityId, transferOrganizationDefinitionId)
.and(wrapper -> wrapper.eq(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue()).or()
.eq(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue()).or());
if (!iServiceRequestService.list(lambdaQuery).isEmpty()) {
return R.fail("请勿重复开立出院医嘱");
@@ -433,12 +433,8 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 出院的医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
<<<<<<< HEAD
List.of(transferOrganizationDefinitionId), null, 1, 1, Whether.NO.getValue(), List.of(3)).getRecords()
=======
List.of(transferOrganizationDefinitionId), null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords()
>>>>>>> v1.3
.get(0);
List.of(transferOrganizationDefinitionId), null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords()
.get(0);
// 保存出院医嘱请求
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
@@ -466,14 +462,11 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
orderProcess.setRequestId(serviceRequest.getId()); // 请求id
orderProcess.setRequestTableName(CommonConstants.TableName.WOR_SERVICE_REQUEST); // 请求表名
orderProcess.setOutWayCode(leaveHospitalParam.getOutWayCode()); // 出院方式
<<<<<<< HEAD
=======
orderProcess.setTargetLocationId(leaveHospitalParam.getOriginalOrganizationId()); // 原科室
orderProcess.setOriginalLocationId(leaveHospitalParam.getOriginalLocationId()); // 原病区
>>>>>>> v1.3
iOrderProcessService.save(orderProcess);
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"出院医嘱"}));
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"出院医嘱"}));
}
}

View File

@@ -18,11 +18,15 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class LeaveHospitalParam {
/** 就诊id */
/**
* 就诊id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者 */
/**
* 患者
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
@@ -51,8 +55,6 @@ public class LeaveHospitalParam {
private String outWayCode;
/**
<<<<<<< HEAD
=======
* 原科室
*/
@JsonSerialize(using = ToStringSerializer.class)
@@ -65,7 +67,6 @@ public class LeaveHospitalParam {
private Long originalLocationId;
/**
>>>>>>> v1.3
* 理由
*/
private String reasonText;

View File

@@ -3,11 +3,6 @@
*/
package com.openhis.web.reportmanage.appservice;
<<<<<<< HEAD
import javax.servlet.http.HttpServletRequest;
import com.core.common.core.domain.R;
=======
import java.time.LocalDateTime;
import javax.servlet.http.HttpServletRequest;
@@ -16,7 +11,6 @@ import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.web.reportmanage.dto.*;
>>>>>>> v1.3
/**
* 报表 appService
@@ -26,13 +20,8 @@ import com.openhis.web.reportmanage.dto.*;
*/
public interface IReportAppService {
<<<<<<< HEAD
/**例子
* 药剂科报表_常规报表:出库明细表
=======
/**
* 例子 药剂科报表_常规报表:出库明细表
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -45,23 +34,16 @@ public interface IReportAppService {
/**
* 药剂科报表:患者明细主表
*
<<<<<<< HEAD
=======
* @param patientMasterDetailsSearchParam 患者明细主表查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 患者明细主表
*/
<<<<<<< HEAD
R<?> getPatientMasterDetailPage(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
=======
Page<ReportPatientMasterDetailDto> getPatientMasterDetailPage(
ReportPatientMasterDetailsSearchParam patientMasterDetailsSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
>>>>>>> v1.3
ReportPatientMasterDetailsSearchParam patientMasterDetailsSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request);
/**
* 药剂科报表:线下采购占比
@@ -83,32 +65,21 @@ public interface IReportAppService {
* @param request 请求数据
* @return 药品使用情况报表
*/
<<<<<<< HEAD
R<?> getMedicationUsagePage(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
=======
R<?> getMedicationUsagePage(Integer pageNo, Integer pageSize, String searchKey, LocalDateTime startTime,
LocalDateTime endTime, HttpServletRequest request);
>>>>>>> v1.3
LocalDateTime endTime, HttpServletRequest request);
/**
* 药剂科报表:患者明细
*
<<<<<<< HEAD
=======
* @param patientDetailsSearchParam 患者明细查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 患者明细报表
*/
<<<<<<< HEAD
R<?> getPatientDetailsPage(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
=======
Page<ReportPatientDetailsDto> getPatientDetailsPage(ReportPatientDetailsSearchParam patientDetailsSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
>>>>>>> v1.3
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
/**
* 药剂科报表_常规报表:药品费用增长率
@@ -135,37 +106,19 @@ public interface IReportAppService {
/**
* 药剂科报表:基本情况
*
<<<<<<< HEAD
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 基本情况报表
*/
R<?> getBasicInformationDetails(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
=======
* @param param 查询参数
* @return 基本情况报表
*/
R<?> getBasicInformationDetails(ReportDetailsSearchParam param);
>>>>>>> v1.3
/**
* 药剂科报表:药品出库情况
*
* @param pageNo 当前页码
* @param pageSize 查询条数
<<<<<<< HEAD
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 药品出库情况报表
*/
R<?> getMedicationStockOutDetails(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
=======
* @return 药品出库情况报表
*/
R<?> getMedicationStockOutDetails(ReportDetailsSearchParam param, Integer pageNo, Integer pageSize);
>>>>>>> v1.3
/**
* 药剂科报表:产品使用情况
@@ -189,9 +142,6 @@ public interface IReportAppService {
*/
R<?> getNonWinQtyRatio(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
<<<<<<< HEAD
=======
/**
* 药剂科报表:药品入库情况
*
@@ -254,7 +204,7 @@ public interface IReportAppService {
* @return 费用明细
*/
R<?> getPhysicianWorkloadPage(ReportPhysicianWorkloadSearchParam physicianWorkloadReportSearchParam, Integer pageNo,
Integer pageSize, String searchKey, HttpServletRequest request);
Integer pageSize, String searchKey, HttpServletRequest request);
/**
* 年度药品总收入导出
@@ -263,5 +213,4 @@ public interface IReportAppService {
* @param response 响应数据
*/
void makeExcelFile(ReportDetailsSearchParam param, HttpServletResponse response, String code);
>>>>>>> v1.3
}

View File

@@ -33,32 +33,6 @@ import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
<<<<<<< HEAD
import javax.annotation.Resource;
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.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IPractitionerService;
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.reportmanage.appservice.IChargeReportAppService;
import com.openhis.web.reportmanage.dto.ChargeReportInitDto;
import com.openhis.web.reportmanage.dto.ChargeReportPageDto;
import com.openhis.web.reportmanage.dto.ChargeReportSearchParam;
import com.openhis.web.reportmanage.mapper.ChargeReportMapper;
=======
>>>>>>> v1.3
/**
* 费用明细报表 impl
*
@@ -85,7 +59,7 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
// 统计类型
List<ChargeReportInitDto.commonStatusOption> statisticsTypeOptions = Stream.of(StatisticsType.values())
.map(statisticsType -> new ChargeReportInitDto.commonStatusOption(statisticsType.getValue(),
statisticsType.getInfo()))
statisticsType.getInfo()))
.collect(Collectors.toList());
// 查询制单人列表
List<Practitioner> applicantList = practitionerService.getList();
@@ -93,15 +67,11 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
// 项目类型
List<ChargeReportInitDto.commonStatusOption> clinicalTypeOptions = Stream.of(ChargeItemContext.values())
.map(ChargeItemContext -> new ChargeReportInitDto.commonStatusOption(ChargeItemContext.getValue(),
ChargeItemContext.getInfo()))
ChargeItemContext.getInfo()))
.collect(Collectors.toList());
initDto.setStatisticsTypeOptions(statisticsTypeOptions).setIssuerOptions(applicantList)
<<<<<<< HEAD
.setPayeeOptions(applicantList).setClinicalTypeOptions(clinicalTypeOptions);
=======
.setPayeeOptions(applicantList).setClinicalTypeOptions(clinicalTypeOptions);
>>>>>>> v1.3
return R.ok(initDto);
}
@@ -109,15 +79,15 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
* 费用明细列表
*
* @param chargeReportSearchParam 费用明细查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 费用明细
*/
@Override
public R<?> getPage(ChargeReportSearchParam chargeReportSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request) {
String searchKey, HttpServletRequest request) {
// 保存统计类型
String statisticsType = chargeReportSearchParam.getStatisticsType();
chargeReportSearchParam.setStatisticsType(null);
@@ -129,13 +99,13 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
List<String> deviceCategoryCode = null;
if (chargeReportSearchParam.getClinicalType() != null
&& !chargeReportSearchParam.getClinicalType().trim().isEmpty()) {
clinicalType =
Arrays.stream((chargeReportSearchParam.getClinicalType()).split(",")).map(Integer::valueOf).toList();
clinicalType
= Arrays.stream((chargeReportSearchParam.getClinicalType()).split(",")).map(Integer::valueOf).toList();
}
if (chargeReportSearchParam.getMedicationCategoryCode() != null
&& !chargeReportSearchParam.getMedicationCategoryCode().trim().isEmpty()) {
medicationCategoryCode =
Arrays.stream((chargeReportSearchParam.getMedicationCategoryCode()).split(",")).toList();
medicationCategoryCode
= Arrays.stream((chargeReportSearchParam.getMedicationCategoryCode()).split(",")).toList();
}
if (chargeReportSearchParam.getDeviceCategoryCode() != null
&& !chargeReportSearchParam.getDeviceCategoryCode().trim().isEmpty()) {
@@ -143,8 +113,8 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
}
if (chargeReportSearchParam.getActivityCategoryCode() != null
&& !chargeReportSearchParam.getActivityCategoryCode().trim().isEmpty()) {
activityCategoryCode =
Arrays.stream((chargeReportSearchParam.getActivityCategoryCode()).split(",")).toList();
activityCategoryCode
= Arrays.stream((chargeReportSearchParam.getActivityCategoryCode()).split(",")).toList();
}
// 避开QueryWrapper
chargeReportSearchParam.setClinicalType(null);
@@ -152,22 +122,12 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
chargeReportSearchParam.setDeviceCategoryCode(null);
chargeReportSearchParam.setActivityCategoryCode(null);
// 构建查询条件
QueryWrapper<ChargeReportSearchParam> queryWrapper =
<<<<<<< HEAD
HisQueryUtils.buildQueryWrapper(chargeReportSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.YbCode, CommonConstants.FieldName.BusNo,
CommonConstants.FieldName.Name, CommonConstants.FieldName.ClinicalName,
CommonConstants.FieldName.ClinicalNo)),
request);
queryWrapper.orderByDesc(CommonConstants.FieldName.BusNo).orderByAsc(CommonConstants.FieldName.ChargeId)
.orderByAsc(CommonConstants.FieldName.ChargeTime);
=======
HisQueryUtils.buildQueryWrapper(chargeReportSearchParam, searchKey,
QueryWrapper<ChargeReportSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(chargeReportSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.YbCode, CommonConstants.FieldName.BusNo,
CommonConstants.FieldName.Name, CommonConstants.FieldName.ClinicalName,
CommonConstants.FieldName.ClinicalNo)),
request);
>>>>>>> v1.3
// 最终返回结果
Page<ChargeReportPageDto> chargeReportList;
@@ -175,17 +135,6 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
if (Objects.equals(statisticsType, StatisticsType.OUTPATIENT_REVENUE.getCode())) {
// 门诊整体收入明细
chargeReportList = chargeReportMapper.selectRevenueReportPage(new Page<>(pageNo, pageSize), queryWrapper,
<<<<<<< HEAD
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 2);
} else if (Objects.equals(statisticsType, StatisticsType.OUTPATIENT_YB_REVENUE.getCode())) {
// 门诊医保收入明细
chargeReportList = chargeReportMapper.selectRevenueReportPage(new Page<>(pageNo, pageSize), queryWrapper,
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 1);
=======
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 2, clinicalType,
@@ -197,22 +146,10 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 1, clinicalType,
activityCategoryCode, deviceCategoryCode, medicationCategoryCode);
>>>>>>> v1.3
} else if (Objects.equals(statisticsType, StatisticsType.OUTPATIENT_SELF_REVENUE.getCode())) {
// 门诊自费收入明细
chargeReportList = chargeReportMapper.selectRevenueReportPage(new Page<>(pageNo, pageSize), queryWrapper,
<<<<<<< HEAD
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 0);
} else if (Objects.equals(statisticsType, StatisticsType.OUTPATIENT_REFUND.getCode())) {
// 门诊退费明细
chargeReportList = chargeReportMapper.selectRevenueReportPage(new Page<>(pageNo, pageSize), queryWrapper,
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 3);
=======
PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(),
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 0, clinicalType,
@@ -224,7 +161,6 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.DEVICE.getValue(),
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.REGISTER.getValue(), 3, clinicalType,
activityCategoryCode, deviceCategoryCode, medicationCategoryCode);
>>>>>>> v1.3
} else {
return R.fail(PromptMsgConstant.Report.M00002);
@@ -244,17 +180,10 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
List<ChargeReportPageDto> content = chargeReportList.getRecords();
// 按 busNo 分组,并合计 totalPrice
Map<String, BigDecimal> subtotalAmount = content.stream()
<<<<<<< HEAD
// 过滤掉 busNo 为 null 的元素,否则会报错但实际上不会出现这个情况 element cannot be mapped to a null key
.filter(dto -> dto.getBusNo() != null)
.collect(Collectors.groupingBy(ChargeReportPageDto::getBusNo, Collectors.reducing(BigDecimal.ZERO,
dto -> dto.getTotalPrice() != null ? dto.getTotalPrice() : BigDecimal.ZERO, BigDecimal::add)));
=======
// 过滤掉 busNo 为 null 的元素,否则会报错但实际上不会出现这个情况 element cannot be mapped to a null key
.filter(dto -> dto.getBusNo() != null)
.collect(Collectors.groupingBy(ChargeReportPageDto::getBusNo, Collectors.reducing(BigDecimal.ZERO,
dto -> dto.getTotalPrice() != null ? dto.getTotalPrice() : BigDecimal.ZERO, BigDecimal::add)));
>>>>>>> v1.3
// 更新每条数据的 Price 字段
for (ChargeReportPageDto dto : content) {
@@ -270,13 +199,13 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
* 门诊收费报表导出
*
* @param chargeReportSearchParam 查询条件
* @param searchKey 模糊查询关键字
* @param response 请求数据
* @param request 请求数据
* @param searchKey 模糊查询关键字
* @param response 请求数据
* @param request 请求数据
*/
@Override
public void makeExcelFile(ChargeReportSearchParam chargeReportSearchParam, String searchKey,
HttpServletResponse response, HttpServletRequest request) {
HttpServletResponse response, HttpServletRequest request) {
// 获取导出表名
String statisticsType = chargeReportSearchParam.getStatisticsType();
String sheetName = StatisticsType.getByValue(Integer.valueOf(statisticsType)).getInfo();
@@ -298,12 +227,12 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
* 费用明细列表 为了导出格式将同一门诊号数据封装在同一list
*
* @param chargeReportSearchParam 费用明细查询条件
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 费用明细
*/
public R<List<ChargeReportDto>> getPage(ChargeReportSearchParam chargeReportSearchParam, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
// 保存统计类型
String statisticsType = chargeReportSearchParam.getStatisticsType();
chargeReportSearchParam.setStatisticsType(null);
@@ -315,13 +244,13 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
List<String> deviceCategoryCode = null;
if (chargeReportSearchParam.getClinicalType() != null
&& !chargeReportSearchParam.getClinicalType().trim().isEmpty()) {
clinicalType =
Arrays.stream((chargeReportSearchParam.getClinicalType()).split(",")).map(Integer::valueOf).toList();
clinicalType
= Arrays.stream((chargeReportSearchParam.getClinicalType()).split(",")).map(Integer::valueOf).toList();
}
if (chargeReportSearchParam.getMedicationCategoryCode() != null
&& !chargeReportSearchParam.getMedicationCategoryCode().trim().isEmpty()) {
medicationCategoryCode =
Arrays.stream((chargeReportSearchParam.getMedicationCategoryCode()).split(",")).toList();
medicationCategoryCode
= Arrays.stream((chargeReportSearchParam.getMedicationCategoryCode()).split(",")).toList();
}
if (chargeReportSearchParam.getDeviceCategoryCode() != null
&& !chargeReportSearchParam.getDeviceCategoryCode().trim().isEmpty()) {
@@ -329,8 +258,8 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
}
if (chargeReportSearchParam.getActivityCategoryCode() != null
&& !chargeReportSearchParam.getActivityCategoryCode().trim().isEmpty()) {
activityCategoryCode =
Arrays.stream((chargeReportSearchParam.getActivityCategoryCode()).split(",")).toList();
activityCategoryCode
= Arrays.stream((chargeReportSearchParam.getActivityCategoryCode()).split(",")).toList();
}
// 避开QueryWrapper
chargeReportSearchParam.setClinicalType(null);
@@ -338,8 +267,8 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
chargeReportSearchParam.setDeviceCategoryCode(null);
chargeReportSearchParam.setActivityCategoryCode(null);
// 构建查询条件
QueryWrapper<ChargeReportSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(chargeReportSearchParam, searchKey,
QueryWrapper<ChargeReportSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(chargeReportSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.YbCode, CommonConstants.FieldName.BusNo,
CommonConstants.FieldName.Name, CommonConstants.FieldName.ClinicalName,
CommonConstants.FieldName.ClinicalNo)),
@@ -435,6 +364,7 @@ public class ChargeReportAppServiceImpl implements IChargeReportAppService {
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
return R.ok(chargeReportMapper.selectOrgWorkload(startTime, endTime, CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION, PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue(), ConditionCode.LOT_NUMBER_COST.getValue().toString(), tenantId));
}
/**
* 医生工作量统计
*

View File

@@ -3,14 +3,6 @@
*/
package com.openhis.web.reportmanage.appservice.impl;
<<<<<<< HEAD
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import com.core.common.core.domain.R;
import com.openhis.web.reportmanage.appservice.IReportAppService;
=======
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
@@ -46,7 +38,6 @@ import com.openhis.financial.service.IPaymentRecStaticService;
import com.openhis.web.reportmanage.appservice.IReportAppService;
import com.openhis.web.reportmanage.dto.*;
import com.openhis.web.reportmanage.mapper.ReportMapper;
>>>>>>> v1.3
/**
* 报表 impl
@@ -57,10 +48,6 @@ import com.openhis.web.reportmanage.mapper.ReportMapper;
@Service
public class ReportAppServiceImpl implements IReportAppService {
<<<<<<< HEAD
/**例子
* 药剂科报表_常规报表:出库明细表
=======
@Autowired
ReportMapper reportMapper;
@Resource
@@ -68,7 +55,6 @@ public class ReportAppServiceImpl implements IReportAppService {
/**
* 例子 药剂科报表_常规报表:出库明细表
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -84,10 +70,7 @@ public class ReportAppServiceImpl implements IReportAppService {
/**
* 药剂科报表:患者明细主表
*
<<<<<<< HEAD
=======
* @param patientMasterDetailsSearchParam 患者明细主表查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -95,23 +78,18 @@ public class ReportAppServiceImpl implements IReportAppService {
* @return 患者明细主表
*/
@Override
<<<<<<< HEAD
public R<?> getPatientMasterDetailPage(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
return null;
=======
public Page<ReportPatientMasterDetailDto> getPatientMasterDetailPage(
ReportPatientMasterDetailsSearchParam patientMasterDetailsSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request) {
ReportPatientMasterDetailsSearchParam patientMasterDetailsSearchParam, Integer pageNo, Integer pageSize,
String searchKey, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<ReportPatientMasterDetailsSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(patientMasterDetailsSearchParam, searchKey,
new HashSet<>(Arrays.asList("encounter_bus_no", "patient_name")), request);
QueryWrapper<ReportPatientMasterDetailsSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(patientMasterDetailsSearchParam, searchKey,
new HashSet<>(Arrays.asList("encounter_bus_no", "patient_name")), request);
// 查询挂号明细分页列表
Page<ReportPatientMasterDetailDto> patientMasterDetailsPage = reportMapper
.selectPatientMasterDetailPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.IMP.getValue());
.selectPatientMasterDetailPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.IMP.getValue());
return patientMasterDetailsPage;
>>>>>>> v1.3
}
/**
@@ -125,13 +103,10 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
@Override
public R<?> getOfflinePurchaseRatioPage(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
return null;
}
<<<<<<< HEAD
=======
>>>>>>> v1.3
/**
* 药剂科报表:药品使用情况
*
@@ -142,33 +117,24 @@ public class ReportAppServiceImpl implements IReportAppService {
* @return 药品使用情况报表
*/
@Override
<<<<<<< HEAD
public R<?> getMedicationUsagePage(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
return null;
=======
public R<?> getMedicationUsagePage(Integer pageNo, Integer pageSize, String searchKey, LocalDateTime startTime,
LocalDateTime endTime, HttpServletRequest request) {
LocalDateTime endTime, HttpServletRequest request) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long hospitalId = loginUser.getHospitalId();
String orgName = loginUser.getUser().getOrgName();
Page<ReportMedicationUsageDto> medicationUsagePage = reportMapper.selectMedicationUsagePage(
new Page<>(pageNo, pageSize), searchKey, DispenseStatus.COMPLETED.getValue(), startTime, endTime);
new Page<>(pageNo, pageSize), searchKey, DispenseStatus.COMPLETED.getValue(), startTime, endTime);
medicationUsagePage.getRecords().forEach(item -> {
item.setOrgId(String.valueOf(hospitalId));
item.setOrgName(orgName);
});
return R.ok(medicationUsagePage);
>>>>>>> v1.3
}
/**
* 药剂科报表:患者明细
*
<<<<<<< HEAD
=======
* @param patientDetailsSearchParam 患者明细查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -176,25 +142,19 @@ public class ReportAppServiceImpl implements IReportAppService {
* @return 患者明细报表
*/
@Override
<<<<<<< HEAD
public R<?> getPatientDetailsPage(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
return null;
=======
public Page<ReportPatientDetailsDto> getPatientDetailsPage(
ReportPatientDetailsSearchParam patientDetailsSearchParam, Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
ReportPatientDetailsSearchParam patientDetailsSearchParam, Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
// 构建查询条件
QueryWrapper<ReportPatientDetailsSearchParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(patientDetailsSearchParam, searchKey,
new HashSet<>(Arrays.asList("encounter_bus_no", "med_name", "manufacturer_text")), request);
QueryWrapper<ReportPatientDetailsSearchParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(patientDetailsSearchParam, searchKey,
new HashSet<>(Arrays.asList("encounter_bus_no", "med_name", "manufacturer_text")), request);
// 查询挂号明细分页列表
Page<ReportPatientDetailsDto> patientDetailsPage = reportMapper.selectPatientDetailsPage(
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_REQUEST);
new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_REQUEST);
return patientDetailsPage;
>>>>>>> v1.3
}
/**
@@ -207,12 +167,8 @@ public class ReportAppServiceImpl implements IReportAppService {
* @return 药品费用增长率
*/
@Override
<<<<<<< HEAD
public R<?> getDrugExpensesGrowthRate(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
=======
public R<?> getDrugExpensesGrowthRate(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
>>>>>>> v1.3
HttpServletRequest request) {
return null;
}
@@ -226,31 +182,14 @@ public class ReportAppServiceImpl implements IReportAppService {
* @return 30天回款率
*/
@Override
<<<<<<< HEAD
public R<?> getThirtyDayCollectionRate(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
=======
public R<?> getThirtyDayCollectionRate(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
>>>>>>> v1.3
HttpServletRequest request) {
return null;
}
/**
<<<<<<< HEAD
* 药剂科报表:基本情况
*
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 基本情况报表
*/
@Override
public R<?> getBasicInformationDetails(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
return null;
=======
* 获取医疗机构代码、组织机构名称
*
*
* @return 医疗机构代码[0]、组织机构名称[1]
*/
private String[] getOrgInfo() {
@@ -260,7 +199,7 @@ public class ReportAppServiceImpl implements IReportAppService {
String fixmedinsCode = optionJson.getString(CommonConstants.Option.FIXMEDINS_CODE);
// 组织机构名称
String fixmedinsName = optionJson.getString(CommonConstants.Option.FIXMEDINS_NAME);
return new String[] {fixmedinsCode, fixmedinsName};
return new String[]{fixmedinsCode, fixmedinsName};
}
/**
@@ -284,7 +223,7 @@ public class ReportAppServiceImpl implements IReportAppService {
}
// 年度总收入
BigDecimal totalAmount = paymentRecStatics.stream().map(PaymentRecStatic::getAmount)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
ReportBasicInformationDetailsDto dto = new ReportBasicInformationDetailsDto();
// 设置医疗机构代码、组织机构名称
String[] orgInfo = getOrgInfo();
@@ -295,7 +234,6 @@ public class ReportAppServiceImpl implements IReportAppService {
return R.ok(List.of(dto));
}
return R.ok();
>>>>>>> v1.3
}
/**
@@ -303,20 +241,11 @@ public class ReportAppServiceImpl implements IReportAppService {
*
* @param pageNo 当前页码
* @param pageSize 查询条数
<<<<<<< HEAD
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 药品出库情况报表
*/
@Override
public R<?> getMedicationStockOutDetails(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
return null;
=======
* @return 药品出库情况报表
*/
@Override
public R<Page<ReportMedicationInboundDetailsDto>> getMedicationStockOutDetails(ReportDetailsSearchParam param,
Integer pageNo, Integer pageSize) {
Integer pageNo, Integer pageSize) {
// 源仓库ID
Long sourceLocationId = param.getSourceLocationId();
// 目的仓库ID
@@ -326,13 +255,13 @@ public class ReportAppServiceImpl implements IReportAppService {
// 结束时间
String occurrenceTimeETime = param.getOccurrenceTimeETime();
if (sourceLocationId == null || purposeLocationId == null || occurrenceTimeSTime == null
|| occurrenceTimeETime == null) {
|| occurrenceTimeETime == null) {
return R.fail("请构建完整的查询条件");
}
Page<ReportMedicationInboundDetailsDto> detailsPage = reportMapper.selectMedicationInboundDetailsPage(
new Page<>(pageNo, pageSize), SupplyType.PRODUCT_TRANSFER.getValue(),
SupplyType.PRODUCT_BATCH_TRANSFER.getValue(), sourceLocationId, purposeLocationId,
LocalDate.parse(occurrenceTimeSTime), LocalDate.parse(occurrenceTimeETime).plusDays(1));
new Page<>(pageNo, pageSize), SupplyType.PRODUCT_TRANSFER.getValue(),
SupplyType.PRODUCT_BATCH_TRANSFER.getValue(), sourceLocationId, purposeLocationId,
LocalDate.parse(occurrenceTimeSTime), LocalDate.parse(occurrenceTimeETime).plusDays(1));
String[] orgInfo = getOrgInfo();
List<ReportMedicationInboundDetailsDto> records = detailsPage.getRecords();
// 设置医疗机构代码、组织机构名称
@@ -343,7 +272,6 @@ public class ReportAppServiceImpl implements IReportAppService {
});
}
return R.ok(detailsPage);
>>>>>>> v1.3
}
/**
@@ -374,9 +302,6 @@ public class ReportAppServiceImpl implements IReportAppService {
return null;
}
<<<<<<< HEAD
=======
/**
* 药剂科报表:药品入库情况
*
@@ -388,7 +313,7 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
@Override
public R<?> getMedicationInboundDetails(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
return null;
}
@@ -403,7 +328,7 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
@Override
public R<?> getMedicationSaleDetails(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
return null;
}
@@ -432,7 +357,7 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
@Override
public R<?> getOutpatientDepartmentMetrics(Integer pageNo, Integer pageSize, String searchKey,
HttpServletRequest request) {
HttpServletRequest request) {
return null;
}
@@ -459,7 +384,7 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
@Override
public R<?> getPhysicianWorkloadPage(ReportPhysicianWorkloadSearchParam physicianWorkloadReportSearchParam,
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
// 最终返回结果
Page<ReportPhysicianWorkloadPageDto> physicianWorkloadReportList;
@@ -493,8 +418,8 @@ public class ReportAppServiceImpl implements IReportAppService {
List<ReportMedicationInboundDetailsDto> dtoList = details.getData().getRecords();
if (!dtoList.isEmpty()) {
try {
NewExcelUtil<ReportMedicationInboundDetailsDto> util =
new NewExcelUtil<>(ReportMedicationInboundDetailsDto.class);
NewExcelUtil<ReportMedicationInboundDetailsDto> util
= new NewExcelUtil<>(ReportMedicationInboundDetailsDto.class);
util.exportExcel(response, dtoList, CommonConstants.SheetName.DRUG_TRANSFER_DETAILS);
} catch (Exception e) {
throw new RuntimeException(e);
@@ -510,16 +435,15 @@ public class ReportAppServiceImpl implements IReportAppService {
*/
private void reportBasicInformationDetailsExcelOut(ReportDetailsSearchParam param, HttpServletResponse response) {
R<?> details = this.getBasicInformationDetails(param);
List<ReportBasicInformationDetailsDto> dtoList = (List<ReportBasicInformationDetailsDto>)details.getData();
List<ReportBasicInformationDetailsDto> dtoList = (List<ReportBasicInformationDetailsDto>) details.getData();
if (dtoList != null && !dtoList.isEmpty()) {
try {
NewExcelUtil<ReportBasicInformationDetailsDto> util =
new NewExcelUtil<>(ReportBasicInformationDetailsDto.class);
NewExcelUtil<ReportBasicInformationDetailsDto> util
= new NewExcelUtil<>(ReportBasicInformationDetailsDto.class);
util.exportExcel(response, dtoList, CommonConstants.SheetName.ANNUAL_TOTAL_DRUG_REVENUE);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
>>>>>>> v1.3
}

View File

@@ -3,18 +3,6 @@
*/
package com.openhis.web.reportmanage.controller;
<<<<<<< HEAD
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 com.core.common.core.domain.R;
import com.openhis.web.reportmanage.appservice.IReportAppService;
=======
import java.time.LocalDateTime;
import javax.servlet.http.HttpServletRequest;
@@ -30,7 +18,6 @@ import com.openhis.web.reportmanage.dto.ReportDetailsSearchParam;
import com.openhis.web.reportmanage.dto.ReportPatientDetailsSearchParam;
import com.openhis.web.reportmanage.dto.ReportPatientMasterDetailsSearchParam;
import com.openhis.web.reportmanage.dto.ReportPhysicianWorkloadSearchParam;
>>>>>>> v1.3
import lombok.extern.slf4j.Slf4j;
@@ -48,14 +35,8 @@ public class ReportController {
@Autowired
private IReportAppService reportAppService;
<<<<<<< HEAD
/**例子Dto例子参考ReportStockOutDetailDto
* 药剂科报表_常规报表:出库明细表
=======
/**
* 例子Dto例子参考ReportStockOutDetailDto 药剂科报表_常规报表:出库明细表
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -65,16 +46,8 @@ public class ReportController {
*/
@GetMapping(value = "/stock-out-detail-page")
public R<?> getStockOutDetailPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getStockOutDetailPage(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportPatientMasterDetailDto
* 药剂科报表:患者明细主表
*
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getStockOutDetailPage(pageNo, pageSize, searchKey, request);
}
@@ -82,7 +55,6 @@ public class ReportController {
* Dto参考ReportPatientMasterDetailDto 药剂科报表:患者明细主表
*
* @param patientMasterDetailsSearchParam 患者明细主表查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -90,27 +62,16 @@ public class ReportController {
* @return 患者明细主报表
*/
@GetMapping(value = "/patient-master-detail")
<<<<<<< HEAD
public R<?> getPatientMasterDetailPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getPatientMasterDetailPage(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportOfflinePurchaseRatioDto
* 药剂科报表:线下采购占比
=======
public R<?> getPatientMasterDetailPage(ReportPatientMasterDetailsSearchParam patientMasterDetailsSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return R.ok(reportAppService.getPatientMasterDetailPage(patientMasterDetailsSearchParam, pageNo, pageSize,
searchKey, request));
searchKey, request));
}
/**
* Dto参考ReportOfflinePurchaseRatioDto 药剂科报表:线下采购占比
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -120,21 +81,13 @@ public class ReportController {
*/
@GetMapping(value = "/offline-purchase-ratio")
public R<?> getOfflinePurchaseRatioPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getOfflinePurchaseRatioPage(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportMedicationUsageDto
* 药剂科报表:药品使用情况
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getOfflinePurchaseRatioPage(pageNo, pageSize, searchKey, request);
}
/**
* Dto参考ReportMedicationUsageDto 药剂科报表:药品使用情况
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -144,22 +97,13 @@ public class ReportController {
*/
@GetMapping(value = "/medication-usage")
public R<?> getMedicationUsagePage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
<<<<<<< HEAD
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getMedicationUsagePage(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportPatientDetailsDto
* 药剂科报表:患者明细
*
=======
@RequestParam(name = "searchKey", required = false) String searchKey,
@RequestParam(name = "startTime",
required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam(name = "endTime",
required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime,
HttpServletRequest request) {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey,
@RequestParam(name = "startTime",
required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam(name = "endTime",
required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime,
HttpServletRequest request) {
return reportAppService.getMedicationUsagePage(pageNo, pageSize, searchKey, startTime, endTime, request);
}
@@ -167,7 +111,6 @@ public class ReportController {
* Dto参考ReportPatientDetailsDto 药剂科报表:患者明细
*
* @param patientDetailsSearchParam 患者明细查询条件
>>>>>>> v1.3
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
@@ -175,27 +118,16 @@ public class ReportController {
* @return 患者明细报表
*/
@GetMapping(value = "/patient-details")
<<<<<<< HEAD
public R<?> getPatientDetailsPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getPatientDetailsPage(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportDrugCostGrowthDto
* 药剂科报表:药品费用增长率
=======
public R<?> getPatientDetailsPage(ReportPatientDetailsSearchParam patientDetailsSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return R.ok(
reportAppService.getPatientDetailsPage(patientDetailsSearchParam, pageNo, pageSize, searchKey, request));
reportAppService.getPatientDetailsPage(patientDetailsSearchParam, pageNo, pageSize, searchKey, request));
}
/**
* Dto参考ReportDrugCostGrowthDto 药剂科报表:药品费用增长率
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -205,21 +137,13 @@ public class ReportController {
*/
@GetMapping(value = "/drug-expenses-growth-rate")
public R<?> getDrugExpensesGrowthRate(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getDrugExpensesGrowthRate(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportThirtyDayCollectionRateDto
* 药剂科报表:30天回款率
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getDrugExpensesGrowthRate(pageNo, pageSize, searchKey, request);
}
/**
* Dto参考ReportThirtyDayCollectionRateDto 药剂科报表:30天回款率
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -229,47 +153,8 @@ public class ReportController {
*/
@GetMapping(value = "/thirty-day-collection-rate")
public R<?> getThirtyDayCollectionRate(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getThirtyDayCollectionRate(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportBasicInformationDetailsDto
* 药剂科报表:基本情况报表
*
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 基本情况报表
*/
@GetMapping(value = "/basic-information-details")
public R<?> getBasicInformationDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getBasicInformationDetails(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportMedicationStockOutDetailsDto
* 药剂科报表:药品出库情况
*
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param searchKey 模糊查询关键字
* @param request 请求数据
* @return 药品出库情况报表
*/
@GetMapping(value = "/medication-stock-out-details")
public R<?> getMedicationStockOutDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getMedicationStockOutDetails(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportProductUsageDto
* 药剂科报表:产品使用情况
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getThirtyDayCollectionRate(pageNo, pageSize, searchKey, request);
}
@@ -304,14 +189,13 @@ public class ReportController {
*/
@GetMapping(value = "/medication-stock-out-details")
public R<?> getMedicationStockOutDetails(ReportDetailsSearchParam param,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return reportAppService.getMedicationStockOutDetails(param, pageNo, pageSize);
}
/**
* Dto参考ReportProductUsageDto 药剂科报表:产品使用情况
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -321,21 +205,13 @@ public class ReportController {
*/
@GetMapping(value = "/product-usage-details")
public R<?> getProductUsageDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getProductUsageDetails(pageNo,pageSize,searchKey,request);
}
/**Dto参考ReportNonWinQtyRatioDto
* 药剂科报表:非中选产品采购量占比
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getProductUsageDetails(pageNo, pageSize, searchKey, request);
}
/**
* Dto参考ReportNonWinQtyRatioDto 药剂科报表:非中选产品采购量占比
>>>>>>> v1.3
*
* @param pageNo 当前页码
* @param pageSize 查询条数
@@ -345,11 +221,8 @@ public class ReportController {
*/
@GetMapping(value = "/non-win-qty-ratio")
public R<?> getNonWinQtyRatio(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
<<<<<<< HEAD
return reportAppService.getNonWinQtyRatio(pageNo,pageSize,searchKey,request);
=======
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getNonWinQtyRatio(pageNo, pageSize, searchKey, request);
}
@@ -364,8 +237,8 @@ public class ReportController {
*/
@GetMapping(value = "/medication-inbound-details")
public R<?> getMedicationInboundDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getMedicationInboundDetails(pageNo, pageSize, searchKey, request);
}
@@ -380,8 +253,8 @@ public class ReportController {
*/
@GetMapping(value = "/medication-sale-details")
public R<?> getMedicationSaleDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getMedicationSaleDetails(pageNo, pageSize, searchKey, request);
}
@@ -396,8 +269,8 @@ public class ReportController {
*/
@GetMapping(value = "/disease-details")
public R<?> getDiseaseDetails(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getDiseaseDetails(pageNo, pageSize, searchKey, request);
}
@@ -413,8 +286,8 @@ public class ReportController {
*/
@GetMapping(value = "/outpatient-department-metrics")
public R<?> getOutpatientDepartmentMetrics(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
return reportAppService.getOutpatientDepartmentMetrics(pageNo, pageSize, searchKey, request);
}
@@ -441,12 +314,11 @@ public class ReportController {
*/
@GetMapping(value = "/report-physician-workload-page")
public R<?> getPhysicianWorkloadPage(ReportPhysicianWorkloadSearchParam physicianWorkloadReportSearchParam,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "searchKey", required = false) String searchKey,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "searchKey", required = false) String searchKey,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return reportAppService.getPhysicianWorkloadPage(physicianWorkloadReportSearchParam, pageNo, pageSize,
searchKey, request);
>>>>>>> v1.3
searchKey, request);
}
}

Some files were not shown because too many files have changed in this diff Show More