chenjiahe
2024-05-30 a5704a4dd10ad7de4b91f05951e3bb019ccfa256
phi_platform_user/src/main/java/com/hx/phip/service/consultation/impl/ConsultationRecordServiceImpl.java
@@ -13,7 +13,9 @@
import com.hx.phip.service.SystemParameterService;
import com.hx.phip.service.consultation.ConsultationRecordService;
import com.hx.util.StringUtils;
import com.hz.his.dto.consultation.ConsultAppearancePlanVo;
import com.hz.his.dto.consultation.ConsultRecordDto;
import com.hz.his.dto.consultation.ConsultTreatProjectVo;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import org.springframework.beans.BeanUtils;
@@ -37,6 +39,10 @@
    private ConsultationTreatProjectMapper consultationTreatProjectMapper;
    @Resource
    private ConsultationRecommendedProjectMapper consultationRecommendedProjectMapper;
    @Resource
    private ProjectMapper projectMapper;
    @Resource
    private ConsultationAppearancePlanMapper appearancePlanMapper;
    @Override
    public String insertOrEdit(ConsultRecordDto consultRecordDto, SystemParameterService systemParameterService, CommonService commonService) {
@@ -87,6 +93,15 @@
            }
        }
        //推荐项目
        if (!StringUtils.isEmpty(consultRecordDto.getRecommendProjectIds())) {
            List<String> recommendIdList = new ArrayList<>();
            for (String s:consultRecordDto.getRecommendProjectIds().split(",")) {
                recommendIdList.add(s);
            }
            handleRecommendPro(recommendIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        }
        //治疗项目
        if (!StringUtils.isEmpty(consultRecordDto.getTreatProjectIds())) {
            List<String> treatIdList = new ArrayList<>();
@@ -96,14 +111,10 @@
            handleTreatPro(treatIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        }
        //推荐项目
        if (!StringUtils.isEmpty(consultRecordDto.getRecommendProjectIds())) {
            List<String> recommendIdList = new ArrayList<>();
            for (String s:consultRecordDto.getRecommendProjectIds().split(",")) {
                recommendIdList.add(s);
            }
            handleRecommendPro(recommendIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        }
        //预约项目
        preProjectHandle(consultationRecord.getId(),consultationRecord.getUserId(),consultRecordDto.getPreProjectList());
        //颜值规划
        appearancePlanHandle(consultationRecord.getId(),consultRecordDto.getAppearancePlanList());
        return consultationRecord.getId();
    }
@@ -122,7 +133,7 @@
    //---------------------------------------------------------------------
    //处理治疗项目
    /**处理治疗项目*/
    public void handleTreatPro(List<String> treatProjectIds,String recordId,String userId){
        SqlSentence sqlSentence = new SqlSentence();
@@ -203,6 +214,49 @@
    }
    /**预约项目*/
    public void preProjectHandle(String recordId,String userId,List<ConsultTreatProjectVo> preProjectList){
        //先删除旧的
        consultationTreatProjectMapper.deleteByRecordId(recordId,ConsultationTreatProject.PROJECT_TYPE_PRE);
        if(preProjectList == null || preProjectList.size() == 0){
            return;
        }
        ConsultationTreatProject consultationTreatProject;
        Project project;
        for(ConsultTreatProjectVo consultTreatProjectVo:preProjectList){
            if(StringUtils.isEmpty(consultTreatProjectVo.getProjectId())){
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"预约项目标识不能空!");
            }
            project = projectMapper.selectOneByKey(consultTreatProjectVo.getProjectId());
            if(project == null){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS,"预约项目标识错误!");
            }
            consultationTreatProject = new ConsultationTreatProject(userId,project.getId(),project.getName(),recordId,ConsultationTreatProject.PROJECT_TYPE_PRE);
            consultationTreatProjectMapper.insert(consultationTreatProject);
        }
    }
    /**颜值规划*/
    public void appearancePlanHandle(String recordId,List<ConsultAppearancePlanVo> appearancePlanList){
        //先删除旧的
        appearancePlanMapper.deleteByRecordId(recordId);
        if(appearancePlanList == null || appearancePlanList.size() == 0){
            return;
        }
        ConsultationAppearancePlan consultationAppearancePlan;
        for(ConsultAppearancePlanVo consultAppearancePlanVo:appearancePlanList){
            consultationAppearancePlan = new ConsultationAppearancePlan(consultAppearancePlanVo.getDetails(),recordId);
            appearancePlanMapper.insert(consultationAppearancePlan);
        }
    }
    //处理推荐项目
    public void handleRecommendPro(List<String> recommendProjectIds,String recordId,String userId){