|  | @ -307,8 +307,10 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                     "   t1.doctor = ? " +
 |  |                     "   t1.doctor = ? " +
 | 
												
													
														
															|  |                     "   OR t1.doctor_health = ? " +
 |  |                     "   OR t1.doctor_health = ? " +
 | 
												
													
														
															|  |                     "  ) " +
 |  |                     "  ) " +
 | 
												
													
														
															|  |                     "  AND t1. STATUS > 0 " +
 |  | 
 | 
												
													
														
															|  |                     "  AND t1.admin_team_code = ?" ;
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "  AND t1. STATUS > 0  AND t1.admin_team_code = ?";
 | 
												
													
														
															|  | 
 |  |             if(isSlowDisease){
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "  AND p.diease >0 " ;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             if(StringUtils.isNotBlank(diseaseCondition)){
 |  |             if(StringUtils.isNotBlank(diseaseCondition)){
 | 
												
													
														
															|  |                 sql = sql + " AND p.disease_condition ="+diseaseCondition;
 |  |                 sql = sql + " AND p.disease_condition ="+diseaseCondition;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
											
												
													
														
															|  | @ -356,14 +358,13 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |         signList = jdbcTemplate.queryForList(sql, args);
 |  |         signList = jdbcTemplate.queryForList(sql, args);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //查询患者设备绑定情况
 |  |         //查询患者设备绑定情况
 | 
												
													
														
															|  |         String _pdsql = "select user,floor(sum(category_code)) deviceType FROM wlyy_patient_device GROUP BY user";
 |  | 
 | 
												
													
														
															|  | 
 |  |         String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
 | 
												
													
														
															|  |         List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
 |  |         List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(!patientCodeDeviceTypes.isEmpty()){
 |  |         if(!patientCodeDeviceTypes.isEmpty()){
 | 
												
													
														
															|  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 |  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 | 
												
													
														
															|  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 |  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 | 
												
													
														
															|  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 |  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 | 
												
													
														
															|  |                 System.out.println(user+sum);
 |  | 
 | 
												
													
														
															|  |                 patientDeviceTypeMap.put(user,sum);
 |  |                 patientDeviceTypeMap.put(user,sum);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -481,9 +482,9 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 //预警状态
 |  |                 //预警状态
 | 
												
													
														
															|  |                 json.put("standardStatus",p.getStandardStatus());
 |  |                 json.put("standardStatus",p.getStandardStatus());
 | 
												
													
														
															|  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 |  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 | 
												
													
														
															|  |                 Integer deviceType = 0;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String deviceType = "";
 | 
												
													
														
															|  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 |  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 | 
												
													
														
															|  |                     deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                     deviceType = (String) patientDeviceTypeMap.get(p.getCode());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 json.put("deviceType",deviceType);
 |  |                 json.put("deviceType",deviceType);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -537,11 +538,11 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                                 //判断微信绑定情况
 |  |                                 //判断微信绑定情况
 | 
												
													
														
															|  |                                 re = openid1.compareTo(openid2);
 |  |                                 re = openid1.compareTo(openid2);
 | 
												
													
														
															|  |                             }else{
 |  |                             }else{
 | 
												
													
														
															|  |                                 re = diseaseCondition1 - diseaseCondition2;
 |  | 
 | 
												
													
														
															|  | 
 |  |                                 re = diseaseCondition2 - diseaseCondition1;
 | 
												
													
														
															|  |                             }
 |  |                             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                         }else{
 |  |                         }else{
 | 
												
													
														
															|  |                             re = disease1 - disease2;
 |  | 
 | 
												
													
														
															|  | 
 |  |                             re = disease2 - disease1;
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     }else{
 |  |                     }else{
 | 
												
											
												
													
														
															|  | @ -3583,7 +3584,7 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      * @throws Exception
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean sortByStandardStatus, String diseaseCondition) throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean isSlowDisease, String diseaseCondition) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         Map<String, JSONObject> result = new TreeMap<>();
 |  |         Map<String, JSONObject> result = new TreeMap<>();
 | 
												
													
														
															|  |         List<Map<String, Object>> signList = new ArrayList<>();
 |  |         List<Map<String, Object>> signList = new ArrayList<>();
 | 
												
											
												
													
														
															|  | @ -3643,6 +3644,9 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |             }else{
 |  |             }else{
 | 
												
													
														
															|  |                 args = new Object[]{teamCode};
 |  |                 args = new Object[]{teamCode};
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if(isSlowDisease){
 | 
												
													
														
															|  | 
 |  |                 sql = sql + " AND p.disease >0 ";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             sql = sql +
 |  |             sql = sql +
 | 
												
													
														
															|  |                     " ) f " +
 |  |                     " ) f " +
 | 
												
													
														
															|  |                     "WHERE " +
 |  |                     "WHERE " +
 | 
												
											
												
													
														
															|  | @ -3706,7 +3710,6 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 |  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 | 
												
													
														
															|  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 |  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 | 
												
													
														
															|  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 |  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 | 
												
													
														
															|  |                 System.out.println(user+sum);
 |  | 
 | 
												
													
														
															|  |                 patientDeviceTypeMap.put(user,sum);
 |  |                 patientDeviceTypeMap.put(user,sum);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -3825,9 +3828,9 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 //预警状态
 |  |                 //预警状态
 | 
												
													
														
															|  |                 json.put("standardStatus",p.getStandardStatus());
 |  |                 json.put("standardStatus",p.getStandardStatus());
 | 
												
													
														
															|  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 |  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 | 
												
													
														
															|  |                 Integer deviceType = 0;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String deviceType = "";
 | 
												
													
														
															|  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 |  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 | 
												
													
														
															|  |                     deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                     deviceType = (String) patientDeviceTypeMap.get(p.getCode());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 json.put("deviceType",deviceType);
 |  |                 json.put("deviceType",deviceType);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -3882,11 +3885,11 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                                 //判断微信绑定情况
 |  |                                 //判断微信绑定情况
 | 
												
													
														
															|  |                                 re = openid1.compareTo(openid2);
 |  |                                 re = openid1.compareTo(openid2);
 | 
												
													
														
															|  |                             }else{
 |  |                             }else{
 | 
												
													
														
															|  |                                 re = diseaseCondition1 - diseaseCondition2;
 |  | 
 | 
												
													
														
															|  | 
 |  |                                 re = diseaseCondition2 - diseaseCondition1;
 | 
												
													
														
															|  |                             }
 |  |                             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                         }else{
 |  |                         }else{
 | 
												
													
														
															|  |                             re = disease1 - disease2;
 |  | 
 | 
												
													
														
															|  | 
 |  |                             re = disease2 - disease1;
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     }else{
 |  |                     }else{
 | 
												
											
												
													
														
															|  | @ -4094,10 +4097,11 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 "    (t1.doctor = ? or t1.doctor_health = ?) " +
 |  |                 "    (t1.doctor = ? or t1.doctor_health = ?) " +
 | 
												
													
														
															|  |                 "    AND t1.status > 0 " +
 |  |                 "    AND t1.status > 0 " +
 | 
												
													
														
															|  |                 "    AND t2.status = 1) " +
 |  |                 "    AND t2.status = 1) " +
 | 
												
													
														
															|  |                 (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : " AND (t2.label = 4 or t2.label = 5 )") +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
 | 
												
													
														
															|  |                 (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
 |  |                 (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
 | 
												
													
														
															|  |                 (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")+
 |  |                 (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")+
 | 
												
													
														
															|  |                 (StringUtils.isNotEmpty(diseaseCondition) ? " AND t3.diseaseCondition = ? " : "");
 |  |                 (StringUtils.isNotEmpty(diseaseCondition) ? " AND t3.diseaseCondition = ? " : "");
 | 
												
													
														
															|  | 
 |  |         sql = sql + " AND t3.disease > 0 AND t3.status > 0 ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (matcher.find()) {
 |  |         if (matcher.find()) {
 | 
												
													
														
															|  |             sql = sql + "  AND (t1.idcard like ?) ";
 |  |             sql = sql + "  AND (t1.idcard like ?) ";
 | 
												
											
												
													
														
															|  | @ -4146,7 +4150,6 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 |  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 | 
												
													
														
															|  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 |  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 | 
												
													
														
															|  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 |  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 | 
												
													
														
															|  |                 System.out.println(user+sum);
 |  | 
 | 
												
													
														
															|  |                 patientDeviceTypeMap.put(user,sum);
 |  |                 patientDeviceTypeMap.put(user,sum);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -4287,9 +4290,9 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 //预警状态
 |  |                 //预警状态
 | 
												
													
														
															|  |                 json.put("standardStatus",p.getStandardStatus());
 |  |                 json.put("standardStatus",p.getStandardStatus());
 | 
												
													
														
															|  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 |  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 | 
												
													
														
															|  |                 Integer deviceType = 0;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String deviceType = "";
 | 
												
													
														
															|  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 |  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 | 
												
													
														
															|  |                     deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                     deviceType = (String) patientDeviceTypeMap.get(p.getCode());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 json.put("deviceType",deviceType);
 |  |                 json.put("deviceType",deviceType);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -4347,7 +4350,7 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 "  AND" +
 |  |                 "  AND" +
 | 
												
													
														
															|  |                 (isIdcard ? " p.idcard like ? " : " t1.name like ? ");
 |  |                 (isIdcard ? " p.idcard like ? " : " t1.name like ? ");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition;
 |  | 
 | 
												
													
														
															|  | 
 |  |         sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition+" AND p.diease >0 AND p.status >0 ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = sqlTemp + " order by t2.diseaseCondition,t2.disease,t2,diseaseCondition,t2.openid desc  limit " + page + "," + pagesize;
 |  |         String sql = sqlTemp + " order by t2.diseaseCondition,t2.disease,t2,diseaseCondition,t2.openid desc  limit " + page + "," + pagesize;
 | 
												
													
														
															|  |         signList = jdbcTemplate.queryForList(sql, args);
 |  |         signList = jdbcTemplate.queryForList(sql, args);
 | 
												
											
												
													
														
															|  | @ -4360,7 +4363,6 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 |  |             for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
 | 
												
													
														
															|  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 |  |                 String user = String.valueOf(patientCodeDeviceType.get("user"));
 | 
												
													
														
															|  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 |  |                 String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
 | 
												
													
														
															|  |                 System.out.println(user+sum);
 |  | 
 | 
												
													
														
															|  |                 patientDeviceTypeMap.put(user,sum);
 |  |                 patientDeviceTypeMap.put(user,sum);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -4485,9 +4487,9 @@ public class SignPatientLabelInfoService extends BaseService {
 | 
												
													
														
															|  |                 //预警状态
 |  |                 //预警状态
 | 
												
													
														
															|  |                 json.put("standardStatus",p.getStandardStatus());
 |  |                 json.put("standardStatus",p.getStandardStatus());
 | 
												
													
														
															|  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 |  |                 //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
 | 
												
													
														
															|  |                 Integer deviceType = 0;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String deviceType = "";
 | 
												
													
														
															|  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 |  |                 if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
 | 
												
													
														
															|  |                     deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                     deviceType = (String) patientDeviceTypeMap.get(p.getCode());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 json.put("deviceType",deviceType);
 |  |                 json.put("deviceType",deviceType);
 | 
												
													
														
															|  | 
 |  | 
 |