后端最新版本同步

This commit is contained in:
Zhang.WH
2025-09-25 10:43:25 +08:00
parent 1276dc4adb
commit c8014404f1
355 changed files with 10070 additions and 5578 deletions

View File

@@ -71,4 +71,13 @@ public interface IOutpatientTreatmentAppService {
* @return 取消结果
*/
R<?> cancelPerform(List<PerformInfoDto> performInfoList);
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
R<?> getBloodTransfusionPatch(Long requestId);
}

View File

@@ -28,12 +28,13 @@ import com.openhis.medication.service.IMedicationRequestService;
import com.openhis.web.common.dto.PerformInfoDto;
import com.openhis.web.common.dto.PerformRecordDto;
import com.openhis.web.outpatientmanage.appservice.IOutpatientTreatmentAppService;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import com.openhis.web.outpatientmanage.dto.OutpatientStationInitDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.outpatientmanage.mapper.OutpatientTreatmentAppMapper;
import com.openhis.web.pharmacymanage.appservice.impl.IReturnMedicineAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.IWesternMedicineDispenseAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.ReturnMedicineAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.WesternMedicineDispenseAppServiceImpl;
import com.openhis.web.pharmacymanage.dto.InventoryDto;
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
import com.openhis.workflow.domain.DeviceDispense;
@@ -81,10 +82,10 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
private ReturnMedicineMapper returnMedicineMapper;
@Resource
private IWesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
private WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
@Resource
private IReturnMedicineAppServiceImpl returnedMedicineAppServiceImpl;
private ReturnMedicineAppServiceImpl returnedMedicineAppServiceImpl;
@Resource
private AssignSeqUtil assignSeqUtil;
@@ -126,7 +127,6 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// 设置模糊查询的字段名
HashSet<String> searchFields = new HashSet<>();
searchFields.add(CommonConstants.FieldName.PatientName);
searchFields.add(CommonConstants.FieldName.idCard);
searchFields.add(CommonConstants.FieldName.PatientPyStr);
searchFields.add(CommonConstants.FieldName.PatientWbStr);
// 构建查询条件
@@ -253,11 +253,13 @@ 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())
|| CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
serviceMedPerformList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
devicePerformList.add(item);
}
// else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
// devicePerformList.add(item);
// }
}
// 分别处理诊疗/药品执行和耗材发放
if (!serviceMedPerformList.isEmpty()) {
@@ -274,7 +276,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
encounterId = serviceRequest.getEncounterId();
requestId = serviceRequest.getId();
patientId = serviceRequest.getPatientId();
exeCount = serviceRequest.getQuantity();
exeCount = serviceRequest.getQuantity().intValue();
}
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(performInfoDto.getRequestTable())) {
MedicationRequest medicationRequest =
@@ -324,105 +326,105 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// todo因长大农大在执行的时候都不发耗材暂时注释掉
// // 返回信息
// String returnMsg = null;
// if (!devicePerformList.isEmpty()) {
// // 耗材请求id列表
// List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// // 获取耗材发放id列表
// List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
// // 获取库存信息
// List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
// CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// // 按每个耗材分组
// Map<Long, List<InventoryDto>> groupedByItemId =
// inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
// // 遍历每个分组校验库存状态
// for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
// List<InventoryDto> groupItems = entry.getValue();
// if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
// .allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// // 库存停供校验
// return R.fail(groupItems.get(0).getItemName() + "库存已停供");
// }
// }
// List<InventoryItem> inventoryItemList = new ArrayList<>();
// if (!inventoryList.isEmpty()) {
// for (InventoryDto inventoryDto : inventoryList) {
// if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
// InventoryItem inventoryItem = new InventoryItem();
// // 库存数量判定
// if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
// // 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
// BigDecimal quantity =
// inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
// // 库存数量判定
// if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// // 库存数量不足
// return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
// } else {
// inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
// }
// } else {
// // 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
// BigDecimal quantity = inventoryDto.getInventoryQuantity()
// .subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
// // 库存数量判定
// if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// // 库存数量不足
// return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
// } else {
// inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
// }
// }
// inventoryItemList.add(inventoryItem);
// }
// }
// }
// // 发耗材信息查询
// List<DeviceDispense> dispenseList = deviceDispenseService
// .list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// if (dispenseList != null) {
// for (DeviceDispense deviceDispense : dispenseList) {
// if (deviceDispense.getStatusEnum().equals(DispenseStatus.PREPARATION.getValue())) {
// // 耗材发放状态
// deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
// // 发药数量
// deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
// // 发药时间
// deviceDispense.setDispenseTime(DateUtils.getNowDate());
// // 发药人
// deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// // 根据数量设置追溯码
// deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
// Collections.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
// }
// }
// // 药品发放更新
// deviceDispenseService.updateBatchById(dispenseList);
// } else {
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
// }
// // 库存更新
// inventoryItemService.updateBatchById(inventoryItemList);
// // 更新请求状态为已完成
// deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
// 返回信息
String returnMsg = null;
if (!devicePerformList.isEmpty()) {
// 耗材请求id列表
List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// 获取耗材发放id列表
List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
// 获取库存信息
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个耗材分组
Map<Long, List<InventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
List<InventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
if (!inventoryList.isEmpty()) {
for (InventoryDto inventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity =
inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = inventoryDto.getInventoryQuantity()
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
}
}
}
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
if (dispenseList != null) {
for (DeviceDispense deviceDispense : dispenseList) {
if (deviceDispense.getStatusEnum().equals(DispenseStatus.PREPARATION.getValue())) {
// 耗材发放状态
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
// 发药数量
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
// 发药时间
deviceDispense.setDispenseTime(DateUtils.getNowDate());
// 发药人
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
Collections.nCopies(deviceDispense.getQuantity(), CommonConstants.Common.DEV_TRACE_NO)));
}
}
// 药品发放更新
deviceDispenseService.updateBatchById(dispenseList);
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 更新请求状态为已完成
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商品销售上传成功";
}
}
}
return R.ok(returnMsg, "执行成功");
// // 调用医保商品销售接口
// 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商品销售上传成功";
// }
// }
// }
return R.ok("执行成功");
}
/**
@@ -508,7 +510,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
// 生成退耗材请求
deviceRequest.setId(null); // 耗材请求id
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
deviceRequest.setQuantity(deviceRequest.getQuantity() * (-1)); // 请求数量
deviceRequest.setQuantity(deviceRequest.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
deviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
deviceRequest.setRefundDeviceId(deviceRequest.getId()); // 退药id
deviceRequestService.save(deviceRequest);
@@ -588,4 +590,24 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
}
return R.ok(returnMsg, "取消执行成功");
}
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
@Override
public R<?> getBloodTransfusionPatch(Long requestId) {
BloodTransfusionPatchDto bloodTransfusionPatch =
outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
// 性别枚举
bloodTransfusionPatch.setGenderEnum_enumText(
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
// 计算年龄
if (bloodTransfusionPatch.getBirthDate() != null) {
bloodTransfusionPatch.setAge(AgeCalculatorUtil.getAge(bloodTransfusionPatch.getBirthDate()));
}
return R.ok(bloodTransfusionPatch);
}
}

View File

@@ -107,4 +107,16 @@ public class OutpatientTreatmentController {
public R<?> cancelPerform(@RequestBody List<PerformInfoDto> performInfoList) {
return outpatientTreatmentAppService.cancelPerform(performInfoList);
}
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
@GetMapping(value = "/blood-transfusion-patch")
public R<?> getBloodTransfusionPatch(@RequestParam(value = "requestId") Long requestId) {
return outpatientTreatmentAppService.getBloodTransfusionPatch(requestId);
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.outpatientmanage.dto;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 输血贴
*
* @author yuxj
* @date 2025-04-11
*/
@Data
@Accessors(chain = true)
public class BloodTransfusionPatchDto {
/** 患者姓名 */
private String patientName;
/** 性别编码 */
private Integer genderEnum;
private String genderEnum_enumText;
/** 生日 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthDate;
/** 病人年龄 */
private String age;
/**
* 项目名称
*/
private String activityName;
/**
* 项目编码
*/
private String busNo;
/**
* 科室
*/
private String orgName;
/**
* 医生
*/
private String practitionerName;
}

View File

@@ -110,4 +110,12 @@ public class OutpatientTreatmentInfoDto {
/** 取消执行次数 */
private Integer cancelCount;
/** 用法 */
@Dict(dictCode = "method_code")
private String methodCode;
private String methodCode_dictText;
/** 用药天数 */
private Integer dispensePerDuration;
}

View File

@@ -5,6 +5,7 @@ package com.openhis.web.outpatientmanage.mapper;
import java.util.List;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -56,4 +57,12 @@ public interface OutpatientTreatmentAppMapper {
* @return 执行记录列表
*/
List<PerformRecordDto> selectPerformRecordList(@Param("reqIds") List<Long> reqIds);
/**
* 输血贴查询
*
* @param requestId 请求id
* @return 输血贴
*/
BloodTransfusionPatchDto getBloodTransfusionPatch(@Param("requestId") Long requestId);
}