|
@@ -1,7 +1,6 @@
|
|
|
package cn.tr.module.phototherapy.common.service.impl;
|
|
package cn.tr.module.phototherapy.common.service.impl;
|
|
|
|
|
|
|
|
-import cn.tr.module.phototherapy.common.dto.BusClinicAddDTO;
|
|
|
|
|
-import cn.tr.module.phototherapy.common.dto.BusTherapyPlanAddDTO;
|
|
|
|
|
|
|
+import cn.tr.module.phototherapy.common.dto.*;
|
|
|
import cn.tr.module.phototherapy.common.enums.PhaseDayEnum;
|
|
import cn.tr.module.phototherapy.common.enums.PhaseDayEnum;
|
|
|
import cn.tr.module.phototherapy.common.enums.TherapyPlanNameEnum;
|
|
import cn.tr.module.phototherapy.common.enums.TherapyPlanNameEnum;
|
|
|
import cn.tr.module.phototherapy.common.enums.TherapyPlanStatusEnum;
|
|
import cn.tr.module.phototherapy.common.enums.TherapyPlanStatusEnum;
|
|
@@ -16,9 +15,9 @@ import cn.tr.core.exception.ServiceException;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import cn.tr.module.phototherapy.common.repository.BusTherapyPlanRepository;
|
|
import cn.tr.module.phototherapy.common.repository.BusTherapyPlanRepository;
|
|
|
import cn.tr.module.phototherapy.common.po.BusTherapyPlanPO;
|
|
import cn.tr.module.phototherapy.common.po.BusTherapyPlanPO;
|
|
|
-import cn.tr.module.phototherapy.common.dto.BusTherapyPlanDTO;
|
|
|
|
|
-import cn.tr.module.phototherapy.common.dto.BusTherapyPlanQueryDTO;
|
|
|
|
|
|
|
+
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+
|
|
|
import cn.tr.module.phototherapy.common.service.IBusTherapyPlanService;
|
|
import cn.tr.module.phototherapy.common.service.IBusTherapyPlanService;
|
|
|
import cn.tr.module.phototherapy.common.mapper.BusTherapyPlanMapper;
|
|
import cn.tr.module.phototherapy.common.mapper.BusTherapyPlanMapper;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
@@ -34,80 +33,93 @@ import cn.tr.core.exception.TRExcCode;
|
|
|
public class BusTherapyPlanServiceImpl extends ServiceImpl<BusTherapyPlanRepository, BusTherapyPlanPO> implements IBusTherapyPlanService {
|
|
public class BusTherapyPlanServiceImpl extends ServiceImpl<BusTherapyPlanRepository, BusTherapyPlanPO> implements IBusTherapyPlanService {
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 根据条件查询设计方案
|
|
|
|
|
- * @param query 查询参数
|
|
|
|
|
- * @author CodeGenerator
|
|
|
|
|
- * @date 2026-01-13
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 根据条件查询设计方案
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param query 查询参数
|
|
|
|
|
+ * @author CodeGenerator
|
|
|
|
|
+ * @date 2026-01-13
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
- public List<BusTherapyPlanDTO> selectBusTherapyPlanList(BusTherapyPlanQueryDTO query){
|
|
|
|
|
|
|
+ public List<BusTherapyPlanDTO> selectBusTherapyPlanList(BusTherapyPlanQueryDTO query) {
|
|
|
return BusTherapyPlanMapper.INSTANCE.convertDtoList(
|
|
return BusTherapyPlanMapper.INSTANCE.convertDtoList(
|
|
|
this.list(new LambdaQueryWrapper<BusTherapyPlanPO>()
|
|
this.list(new LambdaQueryWrapper<BusTherapyPlanPO>()
|
|
|
- .eq(ObjectUtil.isNotNull(query.getId()), BusTherapyPlanPO::getId, query.getId())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPlanDoctor()), BusTherapyPlanPO::getPlanDoctor, query.getPlanDoctor())
|
|
|
|
|
- .like(ObjectUtil.isNotNull(query.getPlanName()), BusTherapyPlanPO::getPlanName, query.getPlanName())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPhaseType()), BusTherapyPlanPO::getPhaseType, query.getPhaseType())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPhaseTargetTimes()), BusTherapyPlanPO::getPhaseTargetTimes, query.getPhaseTargetTimes())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPhaseFreq()), BusTherapyPlanPO::getPhaseFreq, query.getPhaseFreq())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPhaseDurationMin()), BusTherapyPlanPO::getPhaseDurationMin, query.getPhaseDurationMin())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getPlanStatus()), BusTherapyPlanPO::getPlanStatus, query.getPlanStatus())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getIsDelete()), BusTherapyPlanPO::getIsDelete, query.getIsDelete())
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(query.getTenantId()), BusTherapyPlanPO::getTenantId, query.getTenantId())
|
|
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getId()), BusTherapyPlanPO::getId, query.getId())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPlanDoctor()), BusTherapyPlanPO::getPlanDoctor, query.getPlanDoctor())
|
|
|
|
|
+ .like(ObjectUtil.isNotNull(query.getPlanName()), BusTherapyPlanPO::getPlanName, query.getPlanName())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPhaseType()), BusTherapyPlanPO::getPhaseType, query.getPhaseType())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPhaseTargetTimes()), BusTherapyPlanPO::getPhaseTargetTimes, query.getPhaseTargetTimes())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPhaseFreq()), BusTherapyPlanPO::getPhaseFreq, query.getPhaseFreq())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPhaseDurationMin()), BusTherapyPlanPO::getPhaseDurationMin, query.getPhaseDurationMin())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPlanStatus()), BusTherapyPlanPO::getPlanStatus, query.getPlanStatus())
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getIsDelete()), BusTherapyPlanPO::getIsDelete, query.getIsDelete())
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 根据id查询设计方案
|
|
|
|
|
- * @param id 主键id
|
|
|
|
|
- * @author CodeGenerator
|
|
|
|
|
- * @date 2026-01-13
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 根据id查询设计方案
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 主键id
|
|
|
|
|
+ * @author CodeGenerator
|
|
|
|
|
+ * @date 2026-01-13
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
- public BusTherapyPlanDTO selectBusTherapyPlanById(String id){
|
|
|
|
|
|
|
+ public BusTherapyPlanDTO selectBusTherapyPlanById(String id) {
|
|
|
return BusTherapyPlanMapper.INSTANCE.convertDto(this.getById(id));
|
|
return BusTherapyPlanMapper.INSTANCE.convertDto(this.getById(id));
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 编辑设计方案
|
|
|
|
|
- * @param source 编辑实体类
|
|
|
|
|
- * @author CodeGenerator
|
|
|
|
|
- * @date 2026-01-13
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 编辑设计方案
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param source 编辑实体类
|
|
|
|
|
+ * @author CodeGenerator
|
|
|
|
|
+ * @date 2026-01-13
|
|
|
|
|
+ */
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean updateBusTherapyPlanById(BusTherapyPlanDTO source){
|
|
|
|
|
- return this.updateById(BusTherapyPlanMapper.INSTANCE.convertPO(source));
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ public boolean updateBusTherapyPlanById(BusTherapyPlanDTO source) {
|
|
|
|
|
+ return this.updateById(BusTherapyPlanMapper.INSTANCE.convertPO(source));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 新增设计方案
|
|
|
|
|
- * @param source 新增实体类
|
|
|
|
|
- * @author CodeGenerator
|
|
|
|
|
- * @date 2026-01-13
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 新增设计方案
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param source 新增实体类
|
|
|
|
|
+ * @author CodeGenerator
|
|
|
|
|
+ * @date 2026-01-13
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean insertBusTherapyPlan(BusTherapyPlanDTO source){
|
|
|
|
|
|
|
+ public boolean insertBusTherapyPlan(BusTherapyPlanDTO source) {
|
|
|
return this.save(BusTherapyPlanMapper.INSTANCE.convertPO(source));
|
|
return this.save(BusTherapyPlanMapper.INSTANCE.convertPO(source));
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 删除设计方案详情
|
|
|
|
|
- * @param ids 删除主键集合
|
|
|
|
|
- * @author CodeGenerator
|
|
|
|
|
- * @date 2026-01-13
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 删除设计方案详情
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param ids 删除主键集合
|
|
|
|
|
+ * @author CodeGenerator
|
|
|
|
|
+ * @date 2026-01-13
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean removeBusTherapyPlanByIds(Collection<String> ids){
|
|
|
|
|
- if(CollectionUtil.isEmpty(ids)){
|
|
|
|
|
- throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"请选择要删除的数据");
|
|
|
|
|
|
|
+ public boolean removeBusTherapyPlanByIds(Collection<String> ids) {
|
|
|
|
|
+ if (CollectionUtil.isEmpty(ids)) {
|
|
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "请选择要删除的数据");
|
|
|
}
|
|
}
|
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<BusTherapyPlanDTO> addBatchBusTherapyPlanBatch(BusClinicAddDTO source) {
|
|
public List<BusTherapyPlanDTO> addBatchBusTherapyPlanBatch(BusClinicAddDTO source) {
|
|
@@ -127,7 +139,8 @@ public class BusTherapyPlanServiceImpl extends ServiceImpl<BusTherapyPlanReposit
|
|
|
intensivePlan.setPlanStatus(TherapyPlanStatusEnum.ENABLED.getValue());
|
|
intensivePlan.setPlanStatus(TherapyPlanStatusEnum.ENABLED.getValue());
|
|
|
planList.add(intensivePlan);
|
|
planList.add(intensivePlan);
|
|
|
|
|
|
|
|
- Integer continuousPhaseDayValue = phaseDayEnum.getValue();
|
|
|
|
|
|
|
+ PhaseDayEnum continuousphaseDayEnum = PhaseDayEnum.getByText(source.getContinuousPhaseDayText());
|
|
|
|
|
+ Integer continuousPhaseDayValue = continuousphaseDayEnum.getValue();
|
|
|
|
|
|
|
|
//生成持续期
|
|
//生成持续期
|
|
|
BusTherapyPlanDTO continuousPlan = new BusTherapyPlanDTO();
|
|
BusTherapyPlanDTO continuousPlan = new BusTherapyPlanDTO();
|
|
@@ -146,4 +159,75 @@ public class BusTherapyPlanServiceImpl extends ServiceImpl<BusTherapyPlanReposit
|
|
|
this.saveBatch(planPOList);
|
|
this.saveBatch(planPOList);
|
|
|
return BusTherapyPlanMapper.INSTANCE.convertDtoList(planPOList);
|
|
return BusTherapyPlanMapper.INSTANCE.convertDtoList(planPOList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public boolean editBatchBusTherapyPlanBatch(BusClinicEditDTO source) {
|
|
|
|
|
+ String patientUniqueId = source.getPatientUniqueId();
|
|
|
|
|
+ if (ObjectUtil.isEmpty(patientUniqueId)) {
|
|
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "患者唯一标识不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询该患者的所有方法
|
|
|
|
|
+ List<BusTherapyPlanPO> planPOList = this.list(new LambdaQueryWrapper<BusTherapyPlanPO>()
|
|
|
|
|
+ .eq(BusTherapyPlanPO::getPatientUniqueId, patientUniqueId)
|
|
|
|
|
+ .eq(BusTherapyPlanPO::getIsDelete, 0));
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtil.isEmpty(planPOList)) {
|
|
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "该患者没有治疗方案");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 转换阶段日文本为枚举值(每日→0,隔日→1)
|
|
|
|
|
+ PhaseDayEnum intensivePhaseDayEnum = PhaseDayEnum.getByText(source.getIntensivePhaseDayText());
|
|
|
|
|
+ Integer intensivePhaseDayValue = intensivePhaseDayEnum.getValue();
|
|
|
|
|
+ PhaseDayEnum continuousPhaseDayEnum = PhaseDayEnum.getByText(source.getContinuousPhaseDayText());
|
|
|
|
|
+ Integer continuousPhaseDayValue = continuousPhaseDayEnum.getValue();
|
|
|
|
|
+
|
|
|
|
|
+ //便利方案,按阶段类型分别更新
|
|
|
|
|
+ List<BusTherapyPlanPO> updateList = new ArrayList<>();
|
|
|
|
|
+ for (BusTherapyPlanPO plan : planPOList) {
|
|
|
|
|
+ if (TherapyPlanNameEnum.INTENSIVE.getText().equals(plan.getPhaseType())) {
|
|
|
|
|
+ if (source.getIntensivePhaseDayText() != null) {
|
|
|
|
|
+ plan.setPhaseDay(intensivePhaseDayValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getIntensivePhaseFreq() != null) {
|
|
|
|
|
+ plan.setPhaseFreq(source.getIntensivePhaseFreq());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getIntensivePhaseDurationMin() != null) {
|
|
|
|
|
+ plan.setPhaseDurationMin(source.getIntensivePhaseDurationMin());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getPlanDoctor() != null) {
|
|
|
|
|
+ plan.setPlanDoctor(source.getPlanDoctor());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else if (TherapyPlanNameEnum.MAINTENANCE.getText().equals(plan.getPhaseType())) {
|
|
|
|
|
+ if (source.getContinuousPhaseDayText() != null) {
|
|
|
|
|
+ plan.setPhaseDay(continuousPhaseDayValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getContinuousPhaseFreq() != null) {
|
|
|
|
|
+ plan.setPhaseFreq(source.getContinuousPhaseFreq());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getContinuousPhaseDurationMin() != null) {
|
|
|
|
|
+ plan.setPhaseDurationMin(source.getContinuousPhaseDurationMin());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (source.getPlanDoctor() != null) {
|
|
|
|
|
+ plan.setPlanDoctor(source.getPlanDoctor());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ updateList.add(plan);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(updateList)) {
|
|
|
|
|
+ this.updateBatchById(updateList);
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<BusTherapyPlanDTO> queryByStatusAndName() {
|
|
|
|
|
+ return BusTherapyPlanMapper.INSTANCE.convertDtoList(this.list(new LambdaQueryWrapper<BusTherapyPlanPO>()
|
|
|
|
|
+ .eq(BusTherapyPlanPO::getPlanStatus, TherapyPlanStatusEnum.ENABLED.getValue())
|
|
|
|
|
+ .eq(BusTherapyPlanPO::getPhaseType, TherapyPlanNameEnum.INTENSIVE.getText())
|
|
|
|
|
+ .eq(BusTherapyPlanPO::getIsDelete, 0)
|
|
|
|
|
+ .isNull(BusTherapyPlanPO::getPhaseEndTime))
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|