|  | @ -10,7 +10,7 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
 | 
	
		
			
				|  |  | 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 +73,21 @@ 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;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.doctor_name","r.patient_name","r.health_doctor_name","r.sign_doctor_name");
 | 
	
		
			
				|  |  |         List<SpecialistPatientRelationVO> specialistPatientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sqlcount = "SELECT count(1) AS total " +
 | 
	
	
		
			
				|  | @ -134,8 +132,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 +152,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "   i.label_type = '7' AND " +
 | 
	
		
			
				|  |  |                 "   i.status = 1 " +
 | 
	
		
			
				|  |  |                 " )";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -174,8 +173,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 +196,7 @@ 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;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -206,8 +205,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 +219,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 +239,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 ";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"s.patient_name","s.health_assistant_name");
 | 
	
		
			
				|  |  |         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 +249,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 +257,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 +272,17 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | //                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
 | 
	
		
			
				|  |  |                     " AND a.team_code ='" +teamCode+"' "+
 | 
	
		
			
				|  |  |                     " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |             sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"a.patient_name","a.health_assistant_name");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         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 +290,8 @@ 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;
 | 
	
		
			
				|  |  |             sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"a.patient_name","a.health_assistant_name");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -345,8 +340,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, " +
 | 
	
	
		
			
				|  | @ -362,8 +356,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  t.label_name, " +
 | 
	
		
			
				|  |  |                 "  t.patient " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 "  "+basedb+".wlyy_sign_patient_label_info t " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 "  "+basedb+".wlyy_sign_patient_label_info t ";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         String tmpSql = " WHERE " +
 | 
	
		
			
				|  |  |                 "  t.label_type = '8' " +
 | 
	
		
			
				|  |  |                 " AND t.`status` = '1' " +
 | 
	
		
			
				|  |  |                 " ) h ON h.patient = r.patient " +
 | 
	
	
		
			
				|  | @ -371,9 +366,10 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " 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 " + AesEncryptUtils.decryptMysqlNo("r.patient_name") + " LIKE '%"+nameKey+"%' "+
 | 
	
		
			
				|  |  |                 " AND " + "r.patient_name" + " LIKE '%"+nameKey+"%' "+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         tmpSql = TransforSqlUtl.wlyySpecialistPatientRelationLike(tmpSql,"r.patient_name");
 | 
	
		
			
				|  |  |         sql = sql+tmpSql;
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -382,8 +378,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByNameOrIdCard(String doctor, String filter,String teamCode, Integer page, Integer size){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " p.code AS code " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " p.code AS code,r.patient_name as patientName " +
 | 
	
		
			
				|  |  | //                " p.`name` AS name, " +
 | 
	
		
			
				|  |  |                 " ,p.photo, " +
 | 
	
		
			
				|  |  |                 " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 | 
	
	
		
			
				|  | @ -400,8 +395,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  t.label_name, " +
 | 
	
		
			
				|  |  |                 "  t.patient " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 "  "+basedb+".wlyy_sign_patient_label_info t " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 "  "+basedb+".wlyy_sign_patient_label_info t " ;
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         String sqlTmp=  " WHERE " +
 | 
	
		
			
				|  |  |                 "  t.label_type = '8' " +
 | 
	
		
			
				|  |  |                 " AND t.`status` = '1' " +
 | 
	
		
			
				|  |  |                 " ) h ON h.patient = r.patient " +
 | 
	
	
		
			
				|  | @ -409,9 +405,10 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " 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 (" +  AesEncryptUtils.decryptMysqlNo("r.patient_name")  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
 | 
	
		
			
				|  |  |                 " AND (" +  "r.patient_name"  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sqlTmp = TransforSqlUtl.wlyySpecialistPatientRelationLike(sqlTmp,"r.patient_name");
 | 
	
		
			
				|  |  |         sql = sql+sqlTmp;
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
 | 
	
	
		
			
				|  | @ -448,8 +445,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " p.code AS patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " p.code AS patient ,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                 //AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " p.`name` AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,p.photo, " +
 | 
	
		
			
				|  |  |                 " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 | 
	
	
		
			
				|  | @ -475,6 +472,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " AND r.status >=0  AND r.sign_status >0 " +
 | 
	
		
			
				|  |  |                 " AND r.health_assistant IS NULL "+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         sql  = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessList(SpecialistMapping.api_success,patientRelationVOs,total.intValue());
 | 
	
	
		
			
				|  | @ -486,14 +484,14 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         //1.查询该居民是否已经与该专科医生签约
 | 
	
		
			
				|  |  |         String checkDoctorSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode," +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name as patientName " +
 | 
	
		
			
				|  |  |                 //AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,r.team_code AS teamCode, " +
 | 
	
		
			
				|  |  |                 " t.`name`, " +
 | 
	
		
			
				|  |  |                 " d.photo ," +
 | 
	
		
			
				|  |  |                 " d.code AS doctor" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
 | 
	
		
			
				|  |  |                 " d.code AS doctor, r.doctor_name as doctorName" +
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
 | 
	
		
			
				|  |  | //                " d.name AS doctorName" +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_specialist_patient_relation r " +
 | 
	
	
		
			
				|  | @ -505,6 +503,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " AND r.`status` >= 0 " +
 | 
	
		
			
				|  |  |                 " AND r.sign_status >=0 " +
 | 
	
		
			
				|  |  |                 " AND t.available = '1' ";
 | 
	
		
			
				|  |  |         checkDoctorSql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(checkDoctorSql,"r.patient_name","r.doctor_name");
 | 
	
		
			
				|  |  |         List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(checkDoctorSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
 | 
	
	
		
			
				|  | @ -519,8 +518,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         //验证团队是否已经签约
 | 
	
		
			
				|  |  |         String checkTeamSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode," +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name as patientName" +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,r.team_code AS teamCode, " +
 | 
	
		
			
				|  |  |                 " t.`name`, " +
 | 
	
	
		
			
				|  | @ -535,6 +533,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " AND r.`status` >=0 " +
 | 
	
		
			
				|  |  |                 " AND r.sign_status >=0 " +
 | 
	
		
			
				|  |  |                 " AND t.available = '1' ";
 | 
	
		
			
				|  |  |         checkTeamSql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(checkTeamSql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<SpecialistTeamVO> teamVOs = jdbcTemplate.query(checkTeamSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
 | 
	
		
			
				|  |  |         if(teamVOs!=null&&teamVOs.size()>0){
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -565,8 +564,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public List<AdminTeamMemberVO> findTeamMember(Long teamId){
 | 
	
		
			
				|  |  |         String menberSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " m.doctor_code AS doctorCode " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("d.name","doctorName") +
 | 
	
		
			
				|  |  | //                        " d.`name` AS doctorName " +
 | 
	
		
			
				|  |  |                         " d.`name` AS doctorName " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " "+basedb+".wlyy_admin_team_member m " +
 | 
	
		
			
				|  |  |                 " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
 | 
	
	
		
			
				|  | @ -600,11 +598,11 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientSignInfoVO, PatientSignInfoVO> findPatientSigninfo(String code){
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient ,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,r.doctor " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
 | 
	
		
			
				|  |  |                 " ,r.doctor ,r.doctor_name as doctorName" +
 | 
	
		
			
				|  |  |                 //AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
 | 
	
		
			
				|  |  | //                " r.doctor_name AS doctorName, " +
 | 
	
		
			
				|  |  |                 " ,d.hospital, " +
 | 
	
		
			
				|  |  |                 " d.hospital_name AS hospitalName, " +
 | 
	
	
		
			
				|  | @ -623,6 +621,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " r.id = '"+code+"'";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name","r.doctor_name");
 | 
	
		
			
				|  |  |         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);
 | 
	
	
		
			
				|  | @ -631,14 +630,14 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode, " +
 | 
	
		
			
				|  |  |                 " r.patient " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.patient r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,r.team_code,r.sign_date , " +
 | 
	
		
			
				|  |  |                 " t.`name` AS name," +
 | 
	
		
			
				|  |  |                 " d.photo," +
 | 
	
		
			
				|  |  |                 " md.code AS doctor" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("md.name","doctorName") +
 | 
	
		
			
				|  |  |                 " md.code AS doctor,md.name as doctorName" +
 | 
	
		
			
				|  |  |               //  AesEncryptUtils.decryptMysql("md.name","doctorName") +
 | 
	
		
			
				|  |  | //                " md.name AS doctorName," +
 | 
	
		
			
				|  |  |                 ",d.hospital,d.hospital_name " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
	
		
			
				|  | @ -650,6 +649,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " r.patient = '"+patient+"' " +
 | 
	
		
			
				|  |  |                 " AND r.`status` >=0  " +
 | 
	
		
			
				|  |  |                 " AND r.sign_status >0";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
 | 
	
		
			
				|  |  |         if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -665,11 +665,12 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode, " +
 | 
	
		
			
				|  |  |                 " r.patient, " +
 | 
	
		
			
				|  |  |                 " r.team_code AS teamCode" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " r.team_code AS teamCode,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  | //                " d.name AS doctorName, " +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("d.name","doctorName") +
 | 
	
		
			
				|  |  |                 ",d.name as doctorName"+
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("d.name","doctorName") +
 | 
	
		
			
				|  |  |                 " ,d.code AS doctor, " +
 | 
	
		
			
				|  |  |                 " d.photo, " +
 | 
	
		
			
				|  |  |                 " d.dept, " +
 | 
	
	
		
			
				|  | @ -686,6 +687,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " r.patient ='"+patient+"' " +
 | 
	
		
			
				|  |  |                 " AND r.`status`>=0 " +
 | 
	
		
			
				|  |  |                 " AND r.sign_status >0";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
 | 
	
		
			
				|  |  |         List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs);
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -697,15 +699,13 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "(SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode," +
 | 
	
		
			
				|  |  |                 " r.patient, " +
 | 
	
		
			
				|  |  |                 " r.team_code AS teamCode" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  | //                " r.patient_name AS patientName, " +
 | 
	
		
			
				|  |  |                 " ,r.health_assistant AS healthAssistant" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  | //                " r.health_assistant_name AS healthAssistantName," +
 | 
	
		
			
				|  |  |                 " ,r.create_time AS createTime" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("d.name","doctorName") +
 | 
	
		
			
				|  |  | //                " d.name AS doctorName, " +
 | 
	
		
			
				|  |  |                 " r.team_code AS teamCode,r.patient_name as patientName" +
 | 
	
		
			
				|  |  |                // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 " ,r.health_assistant AS healthAssistant,r.health_assistant_name as healthAssistantName" +
 | 
	
		
			
				|  |  |                 //AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  |                 " ,r.create_time AS createTime," +
 | 
	
		
			
				|  |  | //                AesEncryptUtils.decryptMysql("d.name","doctorName") +
 | 
	
		
			
				|  |  |                 " d.name AS doctorName, " +
 | 
	
		
			
				|  |  |                 " ,d.code AS doctor, " +
 | 
	
		
			
				|  |  |                 " d.photo, " +
 | 
	
		
			
				|  |  |                 " d.dept, " +
 | 
	
	
		
			
				|  | @ -725,6 +725,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1')" +
 | 
	
		
			
				|  |  | //                " AND r.`status`>=0 " +
 | 
	
		
			
				|  |  |                 " AND r.sign_status >0 ) r join "+basedb+".wlyy_patient p on r.patient = p.code order by p.czrq DESC ";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name","r.health_assistant_name");
 | 
	
		
			
				|  |  |         List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
 | 
	
		
			
				|  |  |         PatientSignInfoVO patientSignInfoVO = (null != patientSignInfoVOs && patientSignInfoVOs.size() > 0 )? patientSignInfoVOs.get(0):null;
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientSignInfoVO);
 | 
	
	
		
			
				|  | @ -737,8 +738,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(name)){
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     "doctor.CODE AS CODE" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("doctor.name","name") +
 | 
	
		
			
				|  |  | //                    "doctor.NAME AS NAME," +
 | 
	
		
			
				|  |  | //                    AesEncryptUtils.decryptMysql("doctor.name","name") +
 | 
	
		
			
				|  |  |                     ",doctor.NAME AS NAME" +
 | 
	
		
			
				|  |  |                     ",doctor.sex AS sex," +
 | 
	
		
			
				|  |  |                     "doctor.birthday AS birthday," +
 | 
	
		
			
				|  |  |                     "doctor.photo AS photo," +
 | 
	
	
		
			
				|  | @ -762,12 +763,12 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                     "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
 | 
	
		
			
				|  |  |                     ") " +
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     "t ON doctor.CODE=t.doctorcode and " + AesEncryptUtils.decryptMysqlNo("doctor.name")  + "  like '%"+name+"%'";
 | 
	
		
			
				|  |  |                     "t ON doctor.CODE=t.doctorcode and doctor.NAME like '%"+name+"%'";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     "doctor.CODE AS CODE" +
 | 
	
		
			
				|  |  |                     AesEncryptUtils.decryptMysql("doctor.name","name") +
 | 
	
		
			
				|  |  | //                    "doctor.NAME AS NAME," +
 | 
	
		
			
				|  |  | //                    AesEncryptUtils.decryptMysql("doctor.name","name") +
 | 
	
		
			
				|  |  |                     ",doctor.NAME AS NAME" +
 | 
	
		
			
				|  |  |                     ",doctor.sex AS sex," +
 | 
	
		
			
				|  |  |                     "doctor.birthday AS birthday," +
 | 
	
		
			
				|  |  |                     "doctor.photo AS photo," +
 | 
	
	
		
			
				|  | @ -817,8 +818,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public MixEnvelop<PatientRelationVO,PatientRelationVO> getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) {
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "p.CODE AS patient" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("p.name","patientName") +
 | 
	
		
			
				|  |  | //                "p.`name` AS patientName," +
 | 
	
		
			
				|  |  | //                AesEncryptUtils.decryptMysql("p.name","patientName") +
 | 
	
		
			
				|  |  |                 ",p.`name` AS patientName" +
 | 
	
		
			
				|  |  |                 ",p.photo," +
 | 
	
		
			
				|  |  |                 "IFNULL(YEAR (from_days(datediff(now(),p.birthday))),'未知') age," +
 | 
	
		
			
				|  |  |                 "p.sex " +
 | 
	
	
		
			
				|  | @ -829,8 +830,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  AND doctor='"+specialdoctor+"') " +
 | 
	
		
			
				|  |  |                 "  AND (a.doctor='"+familydoctor+"' OR a.doctor_health='"+familydoctor+"') ";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(nameKey)){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
 | 
	
		
			
				|  |  |             sql= sql + " AND  a.name LIKE '%"+nameKey+"%' ";
 | 
	
		
			
				|  |  | //            sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql= sql +" AND a.`status`=1 AND a.expenses_status=1) s ON p.CODE=s.patient" +
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
	
		
			
				|  | @ -847,7 +848,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
 | 
	
		
			
				|  |  |                 "p.birthday, " +
 | 
	
		
			
				|  |  |                 "p.photo " +
 | 
	
		
			
				|  |  |                 "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
 | 
	
		
			
				|  |  | //                "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
 | 
	
		
			
				|  |  |                 "FROM (SELECT s.disease,s.disease_name,s.patient s.patient_name,r.team_code from " +
 | 
	
		
			
				|  |  |                 "(SELECT id, team_code FROM wlyy_specialist_patient_relation WHERE doctor='" + doctor + "' and sign_status > 0 and `status` >= 0) r " +
 | 
	
		
			
				|  |  |                 "JOIN "+basedb+".wlyy_patient_disease_server s on r.id = s.specialist_relation_code WHERE s.del = 1) s " +
 | 
	
		
			
				|  |  |                 "JOIN "+basedb+".wlyy_patient p on s.patient = p.`code` where p.`status` >0 ";
 | 
	
	
		
			
				|  | @ -967,7 +969,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //3、获取该医生所属团队及团队成员信息
 | 
	
		
			
				|  |  |         String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
 | 
	
		
			
				|  |  |         String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code, wd.NAME as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
 | 
	
		
			
				|  |  |                 "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
 | 
	
		
			
				|  |  |         Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
 | 
	
	
		
			
				|  | @ -1018,7 +1020,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
 | 
	
		
			
				|  |  |         jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate());
 | 
	
		
			
				|  |  |         //1、获取居民基础信息
 | 
	
		
			
				|  |  |         String preSql = "SELECT p.photo as photo" +  AesEncryptUtils.decryptMysql("p.name","name") + ", p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
 | 
	
		
			
				|  |  |         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 ";
 | 
	
		
			
				|  |  |         String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
 | 
	
		
			
				|  |  |                 " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
 | 
	
	
		
			
				|  | @ -1039,9 +1041,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         jsonObject.put("patientInfo", map);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //2、获取医生信息(所属医院、科室、姓名)
 | 
	
		
			
				|  |  |         String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
 | 
	
		
			
				|  |  |         String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
 | 
	
		
			
				|  |  |         if("0".equals(signStatus)){
 | 
	
		
			
				|  |  |             doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
 | 
	
		
			
				|  |  |             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 ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) {
 | 
	
	
		
			
				|  | @ -1052,8 +1054,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         jsonObject.put("doctorInfo", result);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //3、获取该医生所属团队及团队成员信息
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
 | 
	
		
			
				|  |  |         String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code, wd.NAME as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
 | 
	
		
			
				|  |  |                 "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
 | 
	
		
			
				|  |  |         Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
 | 
	
	
		
			
				|  | @ -1174,13 +1175,8 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public List<SpecialistPatientRelationDO> selectByAssistant(String patient,String doctor){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "select *" +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
 | 
	
		
			
				|  |  |                 AesEncryptUtils.decryptMysql("r.create_user_name","createUserName") +
 | 
	
		
			
				|  |  |                 " from wlyy_specialist_patient_relation r where r.health_assistant = '"+doctor+"' and r.patient = '"+patient+"' ";
 | 
	
		
			
				|  |  |         sql = TransforSqlUtl.specialistPatientRelationAll(sql);
 | 
	
		
			
				|  |  |         List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
 | 
	
		
			
				|  |  |         return relationDOS;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -1192,8 +1188,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
 | 
	
		
			
				|  |  |         String sql1 = " select count(1) as num ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql2 = " select p.idcard" + AesEncryptUtils.decryptMysql("p.name","name")  + ",p.code,p.photo";
 | 
	
		
			
				|  |  |         String sql2 = " select p.name as name,p.idcard,p.code,p.photo";
 | 
	
		
			
				|  |  |         String whereSql ="";
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(keywords)){
 | 
	
		
			
				|  |  |             whereSql+=" and  p.mobile ='"+keywords+"'";
 | 
	
	
		
			
				|  | @ -1267,6 +1262,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 " 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'  ) and r.patient = '"+patient+"' and r.sign_status=0";
 | 
	
		
			
				|  |  |         sql  = TransforSqlUtl.specialistPatientRelationAll(sql);
 | 
	
		
			
				|  |  |         List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
 | 
	
		
			
				|  |  |         SpecialistPatientRelationDO specialistPatientRelationDO=null!=relationDOS&&relationDOS.size()>0?relationDOS.get(0):new SpecialistPatientRelationDO();
 | 
	
		
			
				|  |  |         return specialistPatientRelationDO;
 | 
	
	
		
			
				|  | @ -1310,10 +1306,10 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
 | 
	
		
			
				|  |  |         String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
 | 
	
		
			
				|  |  |         toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
 | 
	
		
			
				|  |  | //        toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
 | 
	
		
			
				|  |  |         sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
 | 
	
		
			
				|  |  |         String doctorName = jdbcTemplate.queryForObject(sql,String.class);
 | 
	
		
			
				|  |  |         doctorName = AesEncryptUtils.decrypt(doctorName);
 | 
	
		
			
				|  |  | //        doctorName = AesEncryptUtils.decrypt(doctorName);
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         JSONArray planObject = new JSONArray();
 | 
	
		
			
				|  |  |         JSONArray planDetailObject = new JSONArray();
 | 
	
	
		
			
				|  | @ -1322,7 +1318,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         for (String patientCode:patient){
 | 
	
		
			
				|  |  |             sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
 | 
	
		
			
				|  |  |             String patientName = jdbcTemplate.queryForObject(sql,String.class);
 | 
	
		
			
				|  |  |             patientName = AesEncryptUtils.decrypt(patientName);
 | 
	
		
			
				|  |  | //            patientName = AesEncryptUtils.decrypt(patientName);
 | 
	
		
			
				|  |  |             List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
 | 
	
		
			
				|  |  |                 for (PatientRehabilitationPlanDO plan:planList){
 | 
	
		
			
				|  |  |                     plan.setCreateUser(toDoctorCode);
 |