|  | @ -11,6 +11,7 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLog
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.util.AesEncryptUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.util.TransforSqlUtl;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.specialist.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
	
		
			
				|  | @ -73,23 +74,26 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public MixEnvelop<SpecialistPatientRelationVO, SpecialistPatientRelationVO> findSpecialistPatientRelation(String doctor, Integer page, Integer size)throws ParseException {
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id, " +
 | 
	
		
			
				|  |  |                 " r.doctor " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.doctor_name","doctor_name") +
 | 
	
		
			
				|  |  |                 " r.doctor ,r.doctor_name AS doctor_name " +
 | 
	
		
			
				|  |  |                 " ,r.saas_id AS sassId, " +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                  AesEncryptUtils.decryptMysql("r.patient_name","patient_name") +
 | 
	
		
			
				|  |  |                 " ,r.health_doctor AS healthDoctor " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name AS patient_name" +
 | 
	
		
			
				|  |  |                 " ,r.health_doctor AS healthDoctor ,r.health_doctor_name AS healthDoctorName" +
 | 
	
		
			
				|  |  |                 " ,r.sign_code AS signCode, " +
 | 
	
		
			
				|  |  |                 " r.sign_year AS signYear, " +
 | 
	
		
			
				|  |  |                 " r.sign_doctor AS sign_doctor " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
 | 
	
		
			
				|  |  |                 " r.sign_doctor AS sign_doctor ,r.sign_doctor_name AS signDoctorName" +
 | 
	
		
			
				|  |  |                 " ,r.create_time AS createTime," +
 | 
	
		
			
				|  |  |                 " r.status " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_specialist_patient_relation r " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 " r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 ORDER BY r.create_time DESC LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<String> tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |         tmpDeList.add("r.doctor_name");
 | 
	
		
			
				|  |  |         tmpDeList.add("r.patient_name");
 | 
	
		
			
				|  |  |         tmpDeList.add("r.health_doctor_name");
 | 
	
		
			
				|  |  |         tmpDeList.add("r.sign_doctor_name");
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         List<SpecialistPatientRelationVO> specialistPatientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sqlcount = "SELECT count(1) AS total " +
 | 
	
	
		
			
				|  | @ -134,8 +138,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> findNoLabelPatientRelation(String doctor){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                 " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 | 
	
		
			
				|  |  |                 " p.photo, " +
 | 
	
		
			
				|  |  |                 " rd.create_time AS createTime ," +
 | 
	
	
		
			
				|  | @ -155,6 +158,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "   i.label_type = '7' AND " +
 | 
	
		
			
				|  |  |                 "   i.status = 1 " +
 | 
	
		
			
				|  |  |                 " )";
 | 
	
		
			
				|  |  |         List<String> tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |         tmpDeList.add("r.patient_name");
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -174,8 +180,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> findPatientRelatioByAssistant(String doctor , String assistant, Integer page, Integer size){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                 " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 | 
	
		
			
				|  |  |                 " p.photo ," +
 | 
	
		
			
				|  |  |                 " p.sex," +
 | 
	
	
		
			
				|  | @ -198,6 +203,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 "+
 | 
	
		
			
				|  |  |                 " AND r.health_assistant = '"+assistant+"' LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<String> tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |         tmpDeList.add("r.patient_name");
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -206,8 +214,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
 | 
	
		
			
				|  |  |         String sql="SELECT " +
 | 
	
		
			
				|  |  |                 " p. CODE " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("s.patient_name","name") +
 | 
	
		
			
				|  |  |                 " p. CODE ,s.patient_name as name," +
 | 
	
		
			
				|  |  |                 " p.sex," +
 | 
	
		
			
				|  |  |                 " IFNULL( " +
 | 
	
		
			
				|  |  |                 "  YEAR ( " +
 | 
	
	
		
			
				|  | @ -221,8 +228,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " p.photo, " +
 | 
	
		
			
				|  |  |                 " lb.labelName as health, " +
 | 
	
		
			
				|  |  |                 " lb.label AS healthcode ," +
 | 
	
		
			
				|  |  |                 " s.health_assistant AS healthAssistant" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("s.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  |                 " s.health_assistant AS healthAssistant,s.health_assistant_name as healthAssistantName " +
 | 
	
		
			
				|  |  | //                " s.health_assistant_name AS healthAssistantName," +
 | 
	
		
			
				|  |  |                 " ,s.is_manage AS isManage," +
 | 
	
		
			
				|  |  |                 " s.id AS specialCode" +
 | 
	
	
		
			
				|  | @ -242,6 +248,10 @@ 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 ";
 | 
	
		
			
				|  |  |         List<String> tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |         tmpDeList.add("s.patient_name");
 | 
	
		
			
				|  |  |         tmpDeList.add("s.health_assistant_name");
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(shareDoctor)){
 | 
	
		
			
				|  |  |             sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON s.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -251,8 +261,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         System.out.print("日志:"+sql);
 | 
	
		
			
				|  |  |         if("7".equals(labelType)){
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     "c.CODE" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("a.patient_name","name") +
 | 
	
		
			
				|  |  |                     "c.CODE,a.patient_name as name" +
 | 
	
		
			
				|  |  | //                    "c.NAME," +
 | 
	
		
			
				|  |  |                     ",c.sex," +
 | 
	
		
			
				|  |  |                     "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
 | 
	
	
		
			
				|  | @ -260,8 +269,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                     "b.disease_name AS labelName," +
 | 
	
		
			
				|  |  |                     "d.label_name AS health," +
 | 
	
		
			
				|  |  |                     "d.label AS healthcode," +
 | 
	
		
			
				|  |  |                     "a.health_assistant AS healthAssistant" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  |                     "a.health_assistant AS healthAssistant,a.health_assistant_name AS healthAssistantName," +
 | 
	
		
			
				|  |  | //                    "a.health_assistant_name AS healthAssistantName, " +
 | 
	
		
			
				|  |  |                     ",a.is_manage AS isManage, " +
 | 
	
		
			
				|  |  |                     "a.id AS specialCode " +
 | 
	
	
		
			
				|  | @ -276,18 +284,20 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | //                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
 | 
	
		
			
				|  |  |                     " AND a.team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                     " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |             tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |             tmpDeList.add("a.patient_name");
 | 
	
		
			
				|  |  |             tmpDeList.add("a.health_assistant_name");
 | 
	
		
			
				|  |  |             sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         if("pending".equals(labelType)){
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     "c.CODE" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("a.patient_name","name") +
 | 
	
		
			
				|  |  |                     "c.CODE, a.patient_name as name" +
 | 
	
		
			
				|  |  | //                    "c.NAME," +
 | 
	
		
			
				|  |  |                     ",c.sex," +
 | 
	
		
			
				|  |  |                     "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
 | 
	
		
			
				|  |  |                     "c.photo," +
 | 
	
		
			
				|  |  |                     "a.health_assistant AS healthAssistant" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  |                     "a.health_assistant AS healthAssistant,a.health_assistant_name as healthAssistantName" +
 | 
	
		
			
				|  |  | //                    "a.health_assistant_name AS healthAssistantName, " +
 | 
	
		
			
				|  |  |                     ",a.is_manage AS isManage " +
 | 
	
		
			
				|  |  |                     "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
 | 
	
	
		
			
				|  | @ -295,8 +305,11 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                     " WHERE a.sign_status> 0 AND a.`status`>=0 AND (a.is_manage = 0 or a.is_manage is null)" +
 | 
	
		
			
				|  |  |                     " AND a.team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                     " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |             tmpDeList = new ArrayList<>();
 | 
	
		
			
				|  |  |             tmpDeList.add("a.patient_name");
 | 
	
		
			
				|  |  |             tmpDeList.add("a.health_assistant_name");
 | 
	
		
			
				|  |  |             sql = TransforSqlUtl.sqlColumnReplay(sql,new ArrayList<>(),tmpDeList);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -345,8 +358,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " p.code AS patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " p.code AS patient,r.patient_name as patientName,  " +
 | 
	
		
			
				|  |  | //                " p.`name` AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,p.photo, " +
 | 
	
		
			
				|  |  |                 " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 |