86门诊医生站-》西药方
This commit is contained in:
@@ -40,6 +40,7 @@ import com.openhis.workflow.service.IServiceRequestService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -118,7 +119,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
String safeSearchKey = searchKey != null ? searchKey : "";
|
||||
String safeAdviceTypesStr = "";
|
||||
if (adviceTypes != null && !adviceTypes.isEmpty()) {
|
||||
safeAdviceTypesStr = String.join(",", adviceTypes.stream().map(String::valueOf).collect(Collectors.toList()));
|
||||
safeAdviceTypesStr = String.join(",",
|
||||
adviceTypes.stream().map(String::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
String safeOrganizationId = organizationId != null ? organizationId.toString() : "";
|
||||
String safePricingFlag = pricingFlag != null ? pricingFlag.toString() : "";
|
||||
@@ -141,8 +143,8 @@ 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);
|
||||
|
||||
@@ -152,7 +154,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
IPage<AdviceBaseDto> adviceBaseInfo = doctorStationAdviceAppMapper.getAdviceBaseInfo(
|
||||
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,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList,
|
||||
adviceTypes,
|
||||
queryWrapper);
|
||||
List<AdviceBaseDto> adviceBaseDtoList = adviceBaseInfo.getRecords();
|
||||
|
||||
@@ -162,22 +165,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,
|
||||
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
|
||||
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集合}
|
||||
@@ -212,7 +215,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, chargeItemDefinitionIdList.size());
|
||||
List<Long> batch = chargeItemDefinitionIdList.subList(i, endIndex);
|
||||
mainCharge.addAll(doctorStationAdviceAppMapper.getMainCharge(batch, PublicationStatus.ACTIVE.getValue()));
|
||||
mainCharge
|
||||
.addAll(doctorStationAdviceAppMapper.getMainCharge(batch, PublicationStatus.ACTIVE.getValue()));
|
||||
}
|
||||
}
|
||||
String unitCode = ""; // 包装单位
|
||||
@@ -228,13 +232,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
|
||||
// fallthrough to 耗材处理逻辑(保持原有逻辑)
|
||||
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e ->
|
||||
baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory
|
||||
.stream().filter(e -> baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null
|
||||
&& baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
.collect(Collectors.toList());
|
||||
// 库存信息
|
||||
baseDto.setInventoryList(inventoryList);
|
||||
@@ -251,13 +256,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 第一步:在medLocationConfig中匹配categoryCode
|
||||
AdviceInventoryDto result1 = medLocationConfig.stream()
|
||||
.filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst()
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (result1 != null) {
|
||||
// 第二步:在inventoryList中匹配locationId
|
||||
AdviceInventoryDto result2 = inventoryList.stream()
|
||||
.filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null
|
||||
&& result1.getLocationId().equals(dto.getLocationId())).findFirst()
|
||||
&& result1.getLocationId().equals(dto.getLocationId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (result2 != null && result2.getLotNumber() != null) {
|
||||
baseDto.setDefaultLotNumber(result2.getLotNumber());
|
||||
@@ -296,13 +303,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
baseDto.setPriceList(priceDtoList);
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(tableName)) { // 耗材
|
||||
// 每一条医嘱的库存集合信息 , 包装单位库存前端计算
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory.stream().filter(e ->
|
||||
baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
List<AdviceInventoryDto> inventoryList = adviceInventory
|
||||
.stream().filter(e -> baseDto.getAdviceDefinitionId() != null && e.getItemId() != null
|
||||
&& baseDto.getAdviceDefinitionId().equals(e.getItemId())
|
||||
&& baseDto.getAdviceTableName() != null && e.getItemTable() != null
|
||||
&& baseDto.getAdviceTableName().equals(e.getItemTable())
|
||||
&& (pharmacyMultipleChoice
|
||||
|| (baseDto.getPositionId() == null || (e.getLocationId() != null
|
||||
&& baseDto.getPositionId().equals(e.getLocationId())))))
|
||||
.collect(Collectors.toList());
|
||||
// 库存信息
|
||||
baseDto.setInventoryList(inventoryList);
|
||||
@@ -319,13 +327,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 第一步:在medLocationConfig中匹配categoryCode
|
||||
AdviceInventoryDto result1 = medLocationConfig.stream()
|
||||
.filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst()
|
||||
&& baseDto.getCategoryCode().equals(dto.getCategoryCode()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (result1 != null) {
|
||||
// 第二步:在inventoryList中匹配locationId
|
||||
AdviceInventoryDto result2 = inventoryList.stream()
|
||||
.filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null
|
||||
&& result1.getLocationId().equals(dto.getLocationId())).findFirst()
|
||||
&& result1.getLocationId().equals(dto.getLocationId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (result2 != null && result2.getLotNumber() != null) {
|
||||
baseDto.setDefaultLotNumber(result2.getLotNumber());
|
||||
@@ -363,13 +373,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceDtoList);
|
||||
} else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(tableName)) { // 诊疗
|
||||
List<AdvicePriceDto> priceList
|
||||
= mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null
|
||||
List<AdvicePriceDto> priceList = mainCharge.stream()
|
||||
.filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null
|
||||
&& baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId()))
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toList());
|
||||
// 价格信息
|
||||
baseDto.setPriceList(priceList);
|
||||
// 活动类型:字典转换框架会自动填充 activityType_dictText,无需手动设置
|
||||
// 活动类型
|
||||
baseDto.setActivityType_enumText(
|
||||
EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +392,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
* 查询医嘱绑定信息
|
||||
*
|
||||
* @param typeCode 1:用法绑东西 2:诊疗绑东西
|
||||
* @param itemNo 用法的code 或者 诊疗定义id
|
||||
* @param itemNo 用法的code 或者 诊疗定义id
|
||||
* @return 医嘱绑定信息
|
||||
*/
|
||||
@Override
|
||||
@@ -392,10 +404,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
* 门诊保存/签发医嘱
|
||||
*
|
||||
* @param adviceSaveParam 医嘱表单信息
|
||||
* @param adviceOpType 医嘱操作类型
|
||||
* @param adviceOpType 医嘱操作类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> saveAdvice(AdviceSaveParam adviceSaveParam, String adviceOpType) {
|
||||
try {
|
||||
// 患者挂号对应的科室id
|
||||
@@ -416,10 +429,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());
|
||||
@@ -428,9 +441,10 @@ 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) {
|
||||
@@ -445,8 +459,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);
|
||||
|
||||
/**
|
||||
* 处理诊疗项目请求
|
||||
@@ -463,7 +477,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 签发的医嘱id集合
|
||||
List<Long> requestIds = adviceSaveList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
|
||||
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId)
|
||||
.collect(Collectors.toList());
|
||||
// 就诊id
|
||||
Long encounterId = adviceSaveList.get(0).getEncounterId();
|
||||
iChargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
|
||||
@@ -477,7 +492,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
clearRelatedCache();
|
||||
|
||||
return R.ok(medRequestIdList,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"}));
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] { "门诊医嘱" }));
|
||||
} catch (Exception e) {
|
||||
// 异常处理
|
||||
throw e;
|
||||
@@ -499,6 +514,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
Long organizationId, String signCode) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 获取当前登录用户的tenantId
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 获取当前登录用户名
|
||||
String currentUsername = SecurityUtils.getUsername();
|
||||
// 保存操作
|
||||
boolean is_save = AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType);
|
||||
// 签发操作
|
||||
@@ -508,9 +527,10 @@ 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());
|
||||
@@ -535,7 +555,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
adviceSaveDto.getRequestId());
|
||||
// 删除基于这个药品生成的需要执行的诊疗请求
|
||||
iServiceRequestService.remove(
|
||||
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getBasedOnId, adviceSaveDto.getRequestId())
|
||||
new LambdaQueryWrapper<ServiceRequest>()
|
||||
.eq(ServiceRequest::getBasedOnId, adviceSaveDto.getRequestId())
|
||||
.isNotNull(ServiceRequest::getBasedOnTable)
|
||||
.eq(ServiceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue()));
|
||||
}
|
||||
@@ -552,8 +573,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
medicationRequest.setId(adviceSaveDto.getRequestId()); // 主键id
|
||||
medicationRequest.setStatusEnum(is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue()); // 请求状态
|
||||
medicationRequest.setPrescriptionNo(adviceSaveDto.getPrescriptionNo()); // 处方号
|
||||
medicationRequest.setTenantId(SecurityUtils.getLoginUser().getTenantId()); // 显式设置租户ID
|
||||
medicationRequest.setGroupId(adviceSaveDto.getGroupId()); // 组号
|
||||
medicationRequest.setTenantId(tenantId); // 设置租户id
|
||||
medicationRequest.setCreateBy(currentUsername); // 设置创建人
|
||||
medicationRequest.setCreateTime(curDate); // 设置创建时间
|
||||
if (is_sign) {
|
||||
medicationRequest.setSignCode(signCode);
|
||||
}
|
||||
@@ -598,8 +621,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
}
|
||||
if (is_save) {
|
||||
// 处理药品发放
|
||||
Long dispenseId
|
||||
= iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
|
||||
Long dispenseId = iMedicationDispenseService.handleMedicationDispense(medicationRequest,
|
||||
adviceSaveDto.getDbOpType());
|
||||
|
||||
// 保存药品费用项
|
||||
chargeItem = new ChargeItem();
|
||||
@@ -624,6 +647,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
chargeItem.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
chargeItem.setDispenseId(dispenseId); // 发放ID
|
||||
chargeItem.setTenantId(tenantId); // 设置租户ID (修复本次报错)
|
||||
chargeItem.setCreateBy(currentUsername); // 设置创建人
|
||||
chargeItem.setCreateTime(curDate); // 设置创建时间
|
||||
|
||||
chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量
|
||||
chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位
|
||||
@@ -648,6 +674,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
private void handDevice(List<AdviceSaveDto> deviceList, Date curDate, String adviceOpType) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 获取当前登录用户的tenantId
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 获取当前登录用户名
|
||||
String currentUsername = SecurityUtils.getUsername();
|
||||
// 保存操作
|
||||
boolean is_save = AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType);
|
||||
// 签发操作
|
||||
@@ -656,9 +686,10 @@ 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());
|
||||
@@ -691,6 +722,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 显式设置审计字段,防止自动填充机制失效
|
||||
deviceRequest.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
deviceRequest.setCreateTime(new Date());
|
||||
deviceRequest.setTenantId(tenantId); // 设置租户id
|
||||
deviceRequest.setCreateBy(currentUsername); // 设置创建人
|
||||
deviceRequest.setCreateTime(curDate); // 设置创建时间
|
||||
|
||||
// 保存时,处理数据(请求,发放,账单)
|
||||
if (is_save) {
|
||||
@@ -720,12 +754,15 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
iDeviceRequestService.saveOrUpdate(deviceRequest);
|
||||
if (is_save) {
|
||||
// 处理耗材发放
|
||||
Long dispenseId
|
||||
= iDeviceDispenseService.handleDeviceDispense(deviceRequest, adviceSaveDto.getDbOpType());
|
||||
Long dispenseId = iDeviceDispenseService.handleDeviceDispense(deviceRequest,
|
||||
adviceSaveDto.getDbOpType());
|
||||
|
||||
// 保存耗材费用项
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setId(adviceSaveDto.getChargeItemId()); // 费用项id
|
||||
chargeItem.setTenantId(tenantId); // 补全租户ID
|
||||
chargeItem.setCreateBy(currentUsername); // 补全创建人
|
||||
chargeItem.setCreateTime(curDate); // 补全创建时间
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo()));
|
||||
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||
@@ -768,6 +805,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
String signCode) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 获取当前登录用户的tenantId
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 获取当前登录用户名
|
||||
String currentUsername = SecurityUtils.getUsername();
|
||||
// 保存操作
|
||||
boolean is_save = AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType);
|
||||
// 签发操作
|
||||
@@ -776,9 +817,10 @@ 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());
|
||||
@@ -797,7 +839,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||
iServiceRequestService.removeById(adviceSaveDto.getRequestId());// 删除诊疗
|
||||
iServiceRequestService.remove(
|
||||
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId, adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项
|
||||
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId,
|
||||
adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项
|
||||
// 删除费用项
|
||||
iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
adviceSaveDto.getRequestId());
|
||||
@@ -807,6 +850,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setId(adviceSaveDto.getRequestId()); // 主键id
|
||||
serviceRequest.setStatusEnum(is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue());// 请求状态
|
||||
serviceRequest.setTenantId(tenantId); // 设置租户id
|
||||
serviceRequest.setCreateBy(currentUsername); // 设置创建人
|
||||
serviceRequest.setCreateTime(curDate); // 设置创建时间
|
||||
serviceRequest.setTenantId(SecurityUtils.getLoginUser().getTenantId()); // 显式设置租户ID
|
||||
if (is_sign) {
|
||||
serviceRequest.setSignCode(signCode);
|
||||
@@ -845,6 +891,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
if (is_save) {
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setId(adviceSaveDto.getChargeItemId()); // 费用项id
|
||||
chargeItem.setTenantId(tenantId); // 补全租户ID
|
||||
chargeItem.setCreateBy(currentUsername); // 补全创建人
|
||||
chargeItem.setCreateTime(curDate); // 补全创建时间
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
|
||||
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||
@@ -868,11 +917,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
|
||||
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
|
||||
|
||||
// 显式设置审计字段,防止自动填充机制失效
|
||||
chargeItem.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
||||
chargeItem.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
chargeItem.setCreateTime(new Date());
|
||||
|
||||
iChargeItemService.saveOrUpdate(chargeItem);
|
||||
|
||||
// 第一次保存时,处理诊疗套餐的子项信息
|
||||
@@ -894,6 +938,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 只有在签发时
|
||||
if (is_sign) {
|
||||
// 发送跨系统申请
|
||||
|
||||
@@ -215,6 +215,12 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
condition.setYbNo(saveDiagnosisChildParam.getYbNo());
|
||||
condition.setRecordedDatetime(new Date());
|
||||
condition.setRecorderId(SecurityUtils.getLoginUser().getPractitionerId());// 记录人
|
||||
// 设置租户ID,避免数据库约束错误
|
||||
condition.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
||||
// 设置创建人,避免数据库约束错误
|
||||
condition.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
// 设置创建时间,避免数据库约束错误
|
||||
condition.setCreateTime(new Date());
|
||||
iConditionService.saveOrUpdate(condition);
|
||||
saveDiagnosisChildParam.setConditionId(condition.getId());
|
||||
}
|
||||
@@ -230,6 +236,12 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
// 设置租户ID,避免数据库约束错误
|
||||
encounterDiagnosis.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
||||
// 设置创建人,避免数据库约束错误
|
||||
encounterDiagnosis.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
// 设置创建时间,避免数据库约束错误
|
||||
encounterDiagnosis.setCreateTime(new Date());
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
|
||||
|
||||
@@ -111,6 +111,10 @@ public class AdviceBaseDto {
|
||||
@Dict(dictCode = "activity_category_code")
|
||||
private Integer activityType;
|
||||
private String activityType_dictText;
|
||||
/**
|
||||
* 活动类型枚举文本 (手动赋值用)
|
||||
*/
|
||||
private String activityType_enumText;
|
||||
|
||||
/**
|
||||
* 是否皮试
|
||||
|
||||
Reference in New Issue
Block a user