| 
					
				 | 
			
			
				@ -4431,7 +4431,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " base_doctor_role r " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " JOIN base_doctor_role_dict t ON t.code = r.role_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " r.doctor_code = '" + doctor + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " r.doctor_code = '" + doctorDO.getId() + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (list != null && list.size() > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4440,14 +4441,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("roles", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //医生预约量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (registerTimeDOs != null && registerTimeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("registerCount", registerTimeDOs.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("registerCount", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //医生问诊量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wlyyOutpatientDOs != null && wlyyOutpatientDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("outpatientCount", wlyyOutpatientDOs.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4459,7 +4460,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            rs.put("coordinationCout",coordinationCout); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //医生关注 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctorDO.getId(),patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.put("attention", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4480,7 +4481,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //专家咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctor + "' AND (type=1 OR type=15)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctorDO.getId() + "' AND (type=1 OR type=15)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> zjList = jdbcTemplate.queryForList(zjCountsql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (zjList != null && zjList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("zjCount", zjList.size()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4495,7 +4496,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM base_evaluate a,base_evaluate_score b " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "a.relation_code=b.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "AND b.doctor='" + doctor + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "AND b.doctor='" + doctorDO.getId() + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "GROUP BY a.score_type ORDER BY  a.score_type ASC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> listscore = jdbcTemplate.queryForList(sqlscore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4514,7 +4515,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("scoreDoctor", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int count = baseBannerDoctorDao.getTotalBannerCount(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int count = baseBannerDoctorDao.getTotalBannerCount(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("bannerCount",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询评价明细 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4532,8 +4533,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "base_evaluate a " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctor + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' order by b.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctorDO.getId() + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE a.relation_code=b.id AND b.doctor='" + doctorDO.getId() + "' order by b.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (scoreList != null && scoreList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                Set<String> datelist = new HashSet<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6837,17 +6838,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("consultStatus", consultStatus); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+=" NULLS LAST,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\tD.id DESC,dw.workTotal DESC NULLS LAST"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort");//isSort:1按照后台顺序,0按照系统排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and d.del='1' order by d.sort asc  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql+=" NULLS LAST,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "\tD.id DESC,dw.workTotal DESC NULLS LAST"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*list.stream().forEach(e->{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -13981,7 +13988,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("获取患者待结算信息开始!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(outpatientDO==null){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -14002,7 +14009,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("医保预结算信息开始!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("医保预结算信息结束!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("获取医保结算页面地址开始!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -14037,7 +14044,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("医保预结算信息开始!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("医保预结算信息结束!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("获取医保结算页面地址开始!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -14054,7 +14061,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("preSettlement",ylzMedicalRelationDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("cardNo",outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("deptName",outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("deptName",outpatientDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |