Merge remote-tracking branch 'origin/master-rx-咨询项目bug修改' into master-base
1个文件已修改
77 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/service/consultation/impl/ConsultationRecordServiceImpl.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/consultation/impl/ConsultationRecordServiceImpl.java
@@ -105,22 +105,24 @@
        }
        //推荐项目
        List<String> recommendIdList = new ArrayList<>();
        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());
//            handleRecommendPro(recommendIdList,consultationRecord.getId(), consultRecordDto.getUserId());
            handleRecommendProNew(recommendIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        }
        //治疗项目
        List<String> treatIdList = new ArrayList<>();
        if (!StringUtils.isEmpty(consultRecordDto.getTreatProjectIds())) {
            List<String> treatIdList = new ArrayList<>();
            for (String s:consultRecordDto.getTreatProjectIds().split(",")) {
                treatIdList.add(s);
            }
            handleTreatPro(treatIdList,consultationRecord.getId(), consultRecordDto.getUserId());
//            handleTreatPro(treatIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        }
        handleTreatProNew(treatIdList,consultationRecord.getId(), consultRecordDto.getUserId());
        //预约项目
        preProjectHandle(consultationRecord.getId(),consultationRecord.getUserId(),consultRecordDto.getPreProjectList());
@@ -349,4 +351,71 @@
    }
    //处理推荐项目
    public void handleRecommendProNew(List<String> recommendProjectIds,String recordId,String userId){
        SqlSentence sqlSentence = new SqlSentence();
        StringBuffer sql = new StringBuffer();
        Map<String, Object> values = new HashMap<>();
        sqlSentence.setM(values);
        values.put("recordId", recordId);
        values.put("userId", userId);
        //删除所有旧的推荐项目数据
        sqlSentence.setSqlSentence(" consultationRecordId = #{m.recordId} and isDel = 0 and userId = #{m.userId} ");
        consultationRecommendedProjectMapper.deleteWhere(sqlSentence);
        if(recommendProjectIds!=null && recommendProjectIds.size()>0){
            //全部重新新增
            for (String proId: recommendProjectIds) {
                Project project = getProjectById(proId);
                if (project == null) {
                    throw new TipsException("找不到推荐项目信息!");
                }
                //不存在则更新
                ConsultationRecommendedProject recommendedProject = new ConsultationRecommendedProject(userId, project.getId(), project.getName(), recordId);
                if (consultationRecommendedProjectMapper.insert(recommendedProject) != 1) {
                    throw new TipsException("新增推荐项目息信息失败!");
                }
            }
        }
    }
    /**处理治疗项目*/
    public void handleTreatProNew(List<String> treatProjectIds,String recordId,String userId){
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> values = new HashMap<>();
        sqlSentence.setM(values);
        values.put("recordId", recordId);
        values.put("type", ConsultationTreatProject.PROJECT_TYPE_TREAT);
        values.put("userId", userId);
        //删除所有旧的治疗项目数据
        sqlSentence.setSqlSentence(" consultationRecordId = #{m.recordId} and isDel = 0 and userId = #{m.userId}  and type = #{m.type}");
        consultationTreatProjectMapper.deleteWhere(sqlSentence);
        //不存在则新增
        if(treatProjectIds!= null && treatProjectIds.size()!=0){
            for (String proId : treatProjectIds) {
                Project project = getProjectById(proId);
                if (project == null) {
                    throw new TipsException("找不到项目信息!");
                }
                ConsultationTreatProject treatPro= new ConsultationTreatProject(userId, project.getId(), project.getName(), recordId, ConsultationTreatProject.PROJECT_TYPE_TREAT);
                if (consultationTreatProjectMapper.insert(treatPro) != 1) {
                    throw new TipsException("新增治疗项目信息信息失败!");
                }
            }
        }
    }
}