|  | @ -221,8 +221,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " ) lb " +
 | 
	
		
			
				|  |  |                 " 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 ='" +teamCode+"') "+
 | 
	
		
			
				|  |  |                 " WHERE s.team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                 " AND s.status >=0  AND s.sign_status >0"+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         System.out.print("日志:"+sql);
 | 
	
	
		
			
				|  | @ -244,8 +243,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                     "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
 | 
	
		
			
				|  |  |                     " 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 ='" +teamCode+"') "+
 | 
	
		
			
				|  |  |                     " AND a.team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                     " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
 | 
	
	
		
			
				|  | @ -256,24 +254,14 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) as total " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  | //                " ( " +
 | 
	
		
			
				|  |  | //                "  SELECT " +
 | 
	
		
			
				|  |  | //                "   i.label_type AS labelType, " +
 | 
	
		
			
				|  |  | //                "   i.label, " +
 | 
	
		
			
				|  |  | //                "   i.label_name AS labelName, " +
 | 
	
		
			
				|  |  | //                "   i.patient " +
 | 
	
		
			
				|  |  | //                "  FROM " +
 | 
	
		
			
				|  |  |                 "   "+basedb+".wlyy_sign_patient_label_info i " +
 | 
	
		
			
				|  |  |                 "  WHERE " +
 | 
	
		
			
				|  |  |                 "   i.label = '"+label+"' "+
 | 
	
		
			
				|  |  |                 "  AND i.label_type = '"+labelType+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.`status` = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.patient in ( " +
 | 
	
		
			
				|  |  |                 " 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+ "' ) *//*" +*/
 | 
	
		
			
				|  |  |                 " select patient from  wlyy_specialist_patient_relation  WHERE team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                 " AND STATUS >= 0 AND sign_status > 0 )";
 | 
	
		
			
				|  |  | //                +" ) lb ";
 | 
	
		
			
				|  |  |         System.out.print("日志:"+sql);
 | 
	
		
			
				|  |  |         List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
	
		
			
				|  | @ -295,7 +283,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey, Integer page, Integer size){
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " p.code AS patient, " +
 | 
	
		
			
				|  |  |                 " p.`name` AS patientName, " +
 | 
	
	
		
			
				|  | @ -319,7 +307,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " AND t.`status` = '1' " +
 | 
	
		
			
				|  |  |                 " ) h ON h.patient = r.patient " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " r.doctor='"+doctor+"' " +
 | 
	
		
			
				|  |  |                 " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
 | 
	
		
			
				|  |  |                 "' ) " +
 | 
	
		
			
				|  |  |                 " AND r.status >=0  AND r.sign_status >0 " +
 | 
	
		
			
				|  |  |                 " AND r.patient_name LIKE '%"+nameKey+"%' "+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
	
		
			
				|  | @ -1041,7 +1030,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public ObjEnvelop<SpecialistPatientRelationDO> createPatientInSpeciaRelation(SpecialistPatientRelationDO specialistPatientRelationDO) throws Exception {
 | 
	
		
			
				|  |  |         if(StringUtils.isNotEmpty(specialistPatientRelationDO.getId())){
 | 
	
		
			
				|  |  |             //获取
 | 
	
		
			
				|  |  |             //获取专科相关的信息
 | 
	
		
			
				|  |  |             Map<String,Object> m=  getMessageByRelationId(specialistPatientRelationDO.getId());
 | 
	
		
			
				|  |  |             if(null!=m){
 | 
	
		
			
				|  |  |                 updateMessageByRelationId(specialistPatientRelationDO.getId());
 | 
	
	
		
			
				|  | @ -1184,7 +1173,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String,Object> getMessageByRelationId(String relationId){
 | 
	
		
			
				|  |  |         String sql = "select w.* from wlyy_message w where w.type='16' and  w.relation_code='" + relationId + "' ";
 | 
	
		
			
				|  |  |         String sql = "select w.* from wlyy.wlyy_message w where w.type='16' and  w.relation_code='" + relationId + "' ";
 | 
	
		
			
				|  |  |        List<Map<String,Object>> res= jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |        if(null!=res&&res.size()>0){
 | 
	
		
			
				|  |  |            return res.get(0);
 | 
	
	
		
			
				|  | @ -1198,7 +1187,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void updateMessageByRelationId(String relationId){
 | 
	
		
			
				|  |  |         String sql = "update wlyy_message set has_read=0 ,over=0  where relation_code='" + relationId + "' ";
 | 
	
		
			
				|  |  |         String sql = "update wlyy.wlyy_message set has_read=0 ,over=0  where relation_code='" + relationId + "' ";
 | 
	
		
			
				|  |  |         jdbcTemplate.execute(sql);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |