| 
															
																@ -10,7 +10,6 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO; 
															 | 
															
															 | 
															
																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.entity.util.TransforSqlUtl; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.specialist.*; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.specialist.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.web.Envelop; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.web.Envelop; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -520,7 +519,6 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String checkTeamSql = "SELECT " + 
															 | 
															
															 | 
															
																        String checkTeamSql = "SELECT " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " r.id AS relationCode," + 
															 | 
															
															 | 
															
																                " r.id AS relationCode," + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " r.patient ,r.patient_name as patientName" + 
															 | 
															
															 | 
															
																                " r.patient ,r.patient_name as patientName" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                //AesEncryptUtils.decryptMysql("r.patient_name","patientName") + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                " r.patient_name AS patientName, " + 
															 | 
															
															 | 
															
																//                " r.patient_name AS patientName, " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " ,r.team_code AS teamCode, " + 
															 | 
															
															 | 
															
																                " ,r.team_code AS teamCode, " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " t.`name`, " + 
															 | 
															
															 | 
															
																                " t.`name`, " + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -566,8 +564,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<AdminTeamMemberVO> findTeamMember(Long teamId){ 
															 | 
															
															 | 
															
																    public List<AdminTeamMemberVO> findTeamMember(Long teamId){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String menberSql = "SELECT " + 
															 | 
															
															 | 
															
																        String menberSql = "SELECT " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " m.doctor_code AS doctorCode " + 
															 | 
															
															 | 
															
																                " m.doctor_code AS doctorCode " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                AesEncryptUtils.decryptMysql("d.name","doctorName") + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        " d.`name` AS doctorName " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        " d.`name` AS doctorName " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " FROM " + 
															 | 
															
															 | 
															
																                " FROM " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " "+basedb+".wlyy_admin_team_member m " + 
															 | 
															
															 | 
															
																                " "+basedb+".wlyy_admin_team_member m " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " + 
															 | 
															
															 | 
															
																                " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -972,7 +969,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql)); 
															 | 
															
															 | 
															
																        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //3、获取该医生所属团队及团队成员信息 
															 | 
															
															 | 
															
																        //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"; 
															 | 
															
															 | 
															
																                "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); 
															 | 
															
															 | 
															
																        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())); 
															 | 
															
															 | 
															
																        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList())); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1023,7 +1020,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId()); 
															 | 
															
															 | 
															
																        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate()); 
															 | 
															
															 | 
															
																        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //1、获取居民基础信息 
															 | 
															
															 | 
															
																        //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 "; 
															 | 
															
															 | 
															
																                " 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 " + 
															 | 
															
															 | 
															
																        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' " + 
															 | 
															
															 | 
															
																                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1044,9 +1041,9 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("patientInfo", map); 
															 | 
															
															 | 
															
																        jsonObject.put("patientInfo", map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //2、获取医生信息(所属医院、科室、姓名) 
															 | 
															
															 | 
															
																        //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)){ 
															 | 
															
															 | 
															
																        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); 
															 | 
															
															 | 
															
																        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) { 
															 | 
															
															 | 
															
																        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1057,8 +1054,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("doctorInfo", result); 
															 | 
															
															 | 
															
																        jsonObject.put("doctorInfo", result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //3、获取该医生所属团队及团队成员信息 
															 | 
															
															 | 
															
																        //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"; 
															 | 
															
															 | 
															
																                "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); 
															 | 
															
															 | 
															
																        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())); 
															 | 
															
															 | 
															
																        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList())); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1192,8 +1188,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{ 
															 | 
															
															 | 
															
																    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sql1 = " select count(1) as num "; 
															 | 
															
															 | 
															
																        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 =""; 
															 | 
															
															 | 
															
																        String whereSql =""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(!StringUtils.isEmpty(keywords)){ 
															 | 
															
															 | 
															
																        if(!StringUtils.isEmpty(keywords)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            whereSql+=" and  p.mobile ='"+keywords+"'"; 
															 | 
															
															 | 
															
																            whereSql+=" and  p.mobile ='"+keywords+"'"; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1311,10 +1306,10 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'"; 
															 | 
															
															 | 
															
																        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class); 
															 | 
															
															 | 
															
																        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+"'"; 
															 | 
															
															 | 
															
																        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String doctorName = jdbcTemplate.queryForObject(sql,String.class); 
															 | 
															
															 | 
															
																        String doctorName = jdbcTemplate.queryForObject(sql,String.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        doctorName = AesEncryptUtils.decrypt(doctorName); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        doctorName = AesEncryptUtils.decrypt(doctorName); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject result = new JSONObject(); 
															 | 
															
															 | 
															
																        JSONObject result = new JSONObject(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONArray planObject = new JSONArray(); 
															 | 
															
															 | 
															
																        JSONArray planObject = new JSONArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONArray planDetailObject = new JSONArray(); 
															 | 
															
															 | 
															
																        JSONArray planDetailObject = new JSONArray(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1323,7 +1318,7 @@ public class SpecialistService{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for (String patientCode:patient){ 
															 | 
															
															 | 
															
																        for (String patientCode:patient){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' "; 
															 | 
															
															 | 
															
																            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String patientName = jdbcTemplate.queryForObject(sql,String.class); 
															 | 
															
															 | 
															
																            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));{ 
															 | 
															
															 | 
															
																            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                for (PatientRehabilitationPlanDO plan:planList){ 
															 | 
															
															 | 
															
																                for (PatientRehabilitationPlanDO plan:planList){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    plan.setCreateUser(toDoctorCode); 
															 | 
															
															 | 
															
																                    plan.setCreateUser(toDoctorCode); 
															 |