| 
					
				 | 
			
			
				@ -186,7 +186,7 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType, String labelCode, Integer page, Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p. NAME, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p. CODE, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -222,9 +222,7 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE s.doctor in " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id in " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (SELECT dt.id FROM  wlyy.wlyy_admin_team dt LEFT JOIN  wlyy.wlyy_admin_team_member watm ON dt.id=watm.team_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1') "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id ='" +teamCode+"') "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND s.status >=0  AND s.sign_status >0"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LIMIT "+(page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.print("日志:"+sql); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -247,16 +245,14 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE a.sign_status> 0 AND a.`status`>=0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND a.doctor in " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id in " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " (SELECT dt.id FROM  wlyy.wlyy_admin_team dt LEFT JOIN  wlyy.wlyy_admin_team_member watm ON dt.id=watm.team_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1') "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id ='" +teamCode+"') "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " LIMIT "+(page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label,Long teamCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) as total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -273,8 +269,10 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  AND i.label_type = '"+labelType+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  AND i.`status` = '1' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND i.patient in ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select patient from  wlyy_specialist_patient_relation  WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "( doctor = '"+doctor+"' OR health_doctor = '"+doctor+"' OR health_assistant='"+doctor+ "' ) AND STATUS >= 0 AND sign_status > 0 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select patient from  wlyy_specialist_patient_relation  WHERE doctor in" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id ='" +teamCode+"') "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               /* "*//*( doctor = '"+doctor+"' OR health_doctor = '"+doctor+"' OR health_assistant='"+doctor+ "' ) *//*" +*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND STATUS >= 0 AND sign_status > 0 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                +" ) lb "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.print("日志:"+sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -531,8 +529,9 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " r.id = '"+code+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper(PatientSignInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientSignInfoVO patientSignInfoVO = (null != patientSignInfoVOs && patientSignInfoVOs.size() > 0 ? patientSignInfoVOs.get(0) : new PatientSignInfoVO()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientSignInfoVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -931,6 +930,7 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            specialistPatientRelationDO = selectByDoctorAndPatient(doctorCode, patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1、获取居民基础信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -958,10 +958,10 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(doctorCode.equals(specialistPatientRelationDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("buttonShowFlag", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("buttonShowFlag",true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("buttonShowFlag",false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("doctorInfo", result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1016,9 +1016,12 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //康复情况标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String labelSql = "SELECT wspl.label_code,wspl.label_name from  wlyy.wlyy_sign_patient_label wspl WHERE wspl.label_type='8' AND status='1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> signPatientLabelList = jdbcTemplate.queryForList(labelSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民的康复情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patientLabelSql = "SELECT wspl.label from  wlyy.wlyy_sign_patient_label_info wspl WHERE wspl.patient='"+patientCode+"' and  wspl.label_type='8' AND status='1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> patientLabelList = jdbcTemplate.queryForList(patientLabelSql,String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> patientLabelList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("0".equals(signStatus) ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //居民的康复情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String patientLabelSql = "SELECT wspl.label from  wlyy.wlyy_sign_patient_label_info wspl WHERE wspl.patient='"+patientCode+"' and  wspl.label_type='8' AND status='1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientLabelList = jdbcTemplate.queryForList(patientLabelSql,String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Set<String> patientLabelSet =new HashSet<>(patientLabelList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        signPatientLabelList.stream().forEach(item->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            item.put("status",patientLabelSet.contains(item.get("label_code").toString())?1:0) ; 
			 |