|  | @ -17,7 +17,6 @@ import com.yihu.jw.entity.scheme.vo.DoctorSchemeBloodPressureVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.scheme.vo.DoctorSchemeBloodSuggerVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.module.health.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.patient.PatientVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
	
		
			
				|  | @ -36,9 +35,14 @@ import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import org.springframework.transaction.support.DefaultTransactionDefinition;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | import java.util.concurrent.CompletableFuture;
 | 
	
		
			
				|  |  | import java.util.concurrent.ExecutionException;
 | 
	
		
			
				|  |  | import java.util.concurrent.ExecutorService;
 | 
	
		
			
				|  |  | import java.util.concurrent.Executors;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 医生监测方案相关业务层方法
 | 
	
		
			
				|  |  |  *
 | 
	
		
			
				|  |  |  * @author huangwenjie
 | 
	
		
			
				|  |  |  * @date 2017/9/13 15:46
 | 
	
		
			
				|  |  |  */
 | 
	
	
		
			
				|  | @ -89,60 +93,57 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据团队CODE/居民标签/病情/设备绑定状态查询团队具名CODE列表
 | 
	
		
			
				|  |  |      * @param teamCode 团队CODE
 | 
	
		
			
				|  |  |      * @param disease  病情
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param teamCode         团队CODE
 | 
	
		
			
				|  |  |      * @param disease          病情
 | 
	
		
			
				|  |  |      * @param diseaseCondition 居民标签
 | 
	
		
			
				|  |  |      * @param deviceType 设备绑定状态
 | 
	
		
			
				|  |  |      * @param deviceType       设备绑定状态
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @author huangwenjie
 | 
	
		
			
				|  |  |      * @date 2017/9/13 16:23
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType,String doctorcode,String trackFlag) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "select DISTINCT p.code from wlyy_patient p ";
 | 
	
		
			
				|  |  |     public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType, String doctorcode, String trackFlag) throws Exception {
 | 
	
		
			
				|  |  |         String sql = "SELECT  a.id\n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //1.4.2加入跟踪居民过滤
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
 | 
	
		
			
				|  |  |             sql = sql + " JOIN wlyy_track_patient tp ON tp.patient_code = p.code ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)) {
 | 
	
		
			
				|  |  |             sql = sql + " INNER JOIN wlyy_track_patient tp ON tp.patient_code = a.id ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(-1 != deviceType){
 | 
	
		
			
				|  |  |             sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
 | 
	
		
			
				|  |  |         if (-1 != deviceType) {
 | 
	
		
			
				|  |  |             sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = a.id ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql += "WHERE 1=1\n";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = sql+ " RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.status =1 ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = sql+ " LEFT JOIN wlyy_sign_family sf on sf.patient = p.code where sf.admin_team_code = "+teamCode;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(-1 != disease && 3 != disease){
 | 
	
		
			
				|  |  |             sql = sql + " and sp.label ="+disease;
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql = sql + " and (sp.label = 1 or sp.label = 2) ";
 | 
	
		
			
				|  |  |         //疾病类型,-1全部,0健康,1高血压,2糖尿病,3高血压+糖尿病
 | 
	
		
			
				|  |  |         if (-1 == disease) {
 | 
	
		
			
				|  |  |             sql += " AND a.disease IN ('1','2','1,2','2,1') ";
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             if (disease == 3) {
 | 
	
		
			
				|  |  |                 sql += " AND a.disease IN ('1,2','2,1') ";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " and a.disease ='" + disease + "' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)){
 | 
	
		
			
				|  |  |             sql = sql + " and p.disease_condition IN ("+diseaseCondition +")";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)) {
 | 
	
		
			
				|  |  |             sql += " AND a.disease_condition IN (" + diseaseCondition + ") ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(-1 != deviceType){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if( 0 == deviceType){
 | 
	
		
			
				|  |  |         if (-1 != deviceType) {
 | 
	
		
			
				|  |  |             if (0 == deviceType) {
 | 
	
		
			
				|  |  |                 sql = sql + " and dev.user is null ";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql = sql + " and dev.user is not null ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = sql + " and (sf.doctor = '"+doctorcode+"' or sf.doctor_health ='"+doctorcode+"')";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql += " AND b.doctor_id ='" + doctorcode + "' ";
 | 
	
		
			
				|  |  |         //1.4.2加入跟踪居民过滤
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
 | 
	
		
			
				|  |  |             sql = sql + " AND tp.del='1' AND tp.doctor_code = '"+doctorcode+"' AND tp.team_code = "+teamCode;
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)) {
 | 
	
		
			
				|  |  |             sql += " AND tp.del='1' AND tp.doctor_code = '" + doctorcode + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
 | 
	
		
			
				|  |  |         List<String> result = jdbcTemplate.queryForList(sql, new Object[]{}, String.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -151,34 +152,35 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取医生的血糖监测方案,根据创建时间降序排序,系统方案放最后
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctorcode
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<DoctorSchemeBloodSuggerVO> getDoctorScheBloodSuggerList(String doctorcode)  throws Exception {
 | 
	
		
			
				|  |  |     public List<DoctorSchemeBloodSuggerVO> getDoctorScheBloodSuggerList(String doctorcode) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodSuggerVO> result = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         HashMap<String,List<DoctorSchemeBloodSugger>> mapresult = new HashMap<>();
 | 
	
		
			
				|  |  |         HashMap<String, List<DoctorSchemeBloodSugger>> mapresult = new HashMap<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         LinkedList<String> keys = new LinkedList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodSugger> schemelist = doctroSchemeBloodSuggerDao.getListByDoctorcode(doctorcode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!schemelist.isEmpty()){
 | 
	
		
			
				|  |  |         if (!schemelist.isEmpty()) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             for (DoctorSchemeBloodSugger doctorSchemeBloodSugger : schemelist) {
 | 
	
		
			
				|  |  |                 if(keys.contains(doctorSchemeBloodSugger.getCode())){
 | 
	
		
			
				|  |  |                 if (keys.contains(doctorSchemeBloodSugger.getCode())) {
 | 
	
		
			
				|  |  |                     mapresult.get(doctorSchemeBloodSugger.getCode()).add(doctorSchemeBloodSugger);
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     List<DoctorSchemeBloodSugger> list = new ArrayList<>();
 | 
	
		
			
				|  |  |                     list.add(doctorSchemeBloodSugger);
 | 
	
		
			
				|  |  |                     mapresult.put(doctorSchemeBloodSugger.getCode(),list);
 | 
	
		
			
				|  |  |                     mapresult.put(doctorSchemeBloodSugger.getCode(), list);
 | 
	
		
			
				|  |  |                     keys.add(doctorSchemeBloodSugger.getCode());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             for (String key :keys) {
 | 
	
		
			
				|  |  |             for (String key : keys) {
 | 
	
		
			
				|  |  |                 DoctorSchemeBloodSuggerVO doctorSchemeBloodSuggerVO = new DoctorSchemeBloodSuggerVO();
 | 
	
		
			
				|  |  |                 doctorSchemeBloodSuggerVO.setCode(key);
 | 
	
		
			
				|  |  |                 doctorSchemeBloodSuggerVO.setName(mapresult.get(key).get(0).getName());
 | 
	
	
		
			
				|  | @ -192,33 +194,31 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取医生的血压监测方案,根据创建时间降序排序,系统方案放最后
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctorcode
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public  List<DoctorSchemeBloodPressureVO>  getDoctorSchemeBloodPressureList(String doctorcode) throws Exception{
 | 
	
		
			
				|  |  |     public List<DoctorSchemeBloodPressureVO> getDoctorSchemeBloodPressureList(String doctorcode) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodPressureVO> result = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         HashMap<String,List<DoctorSchemeBloodPressure>> mapresult = new HashMap<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         HashMap<String, List<DoctorSchemeBloodPressure>> mapresult = new HashMap<>();
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodPressure> schemelist = doctoreSchemeBloodPressureDao.getListByDoctorcode(doctorcode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         LinkedList<String> keys = new LinkedList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!schemelist.isEmpty()){
 | 
	
		
			
				|  |  |         if (!schemelist.isEmpty()) {
 | 
	
		
			
				|  |  |             for (DoctorSchemeBloodPressure doctorSchemeBloodPressure : schemelist) {
 | 
	
		
			
				|  |  |                 if(keys.contains(doctorSchemeBloodPressure.getCode())){
 | 
	
		
			
				|  |  |                 if (keys.contains(doctorSchemeBloodPressure.getCode())) {
 | 
	
		
			
				|  |  |                     mapresult.get(doctorSchemeBloodPressure.getCode()).add(doctorSchemeBloodPressure);
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     List<DoctorSchemeBloodPressure> list = new ArrayList<>();
 | 
	
		
			
				|  |  |                     list.add(doctorSchemeBloodPressure);
 | 
	
		
			
				|  |  |                     mapresult.put(doctorSchemeBloodPressure.getCode(),list);
 | 
	
		
			
				|  |  |                     mapresult.put(doctorSchemeBloodPressure.getCode(), list);
 | 
	
		
			
				|  |  |                     keys.add(doctorSchemeBloodPressure.getCode());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             for (String key :keys) {
 | 
	
		
			
				|  |  |             for (String key : keys) {
 | 
	
		
			
				|  |  |                 DoctorSchemeBloodPressureVO doctorSchemeBloodPressureVO = new DoctorSchemeBloodPressureVO();
 | 
	
		
			
				|  |  |                 doctorSchemeBloodPressureVO.setCode(key);
 | 
	
		
			
				|  |  |                 doctorSchemeBloodPressureVO.setName(mapresult.get(key).get(0).getName());
 | 
	
	
		
			
				|  | @ -227,46 +227,37 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 result.add(doctorSchemeBloodPressureVO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生保存血糖监测方案
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param data
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void saveDoctorSchemeBloodSugger(String data) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject dataObj =  JSON.parseObject(data);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void saveDoctorSchemeBloodSugger(String data) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject dataObj = JSON.parseObject(data);
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodSugger> results = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String code = dataObj.getString("code");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(code)){
 | 
	
		
			
				|  |  |         if (StringUtils.isBlank(code)) {
 | 
	
		
			
				|  |  |             code = UUID.randomUUID().toString();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String name = dataObj.getString("name");
 | 
	
		
			
				|  |  |         String content = dataObj.getString("content");
 | 
	
		
			
				|  |  |         String doctorcode = dataObj.getString("doctorcode");
 | 
	
		
			
				|  |  |         JSONArray datalist = dataObj.getJSONArray("list");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         for (int i = 0; i < datalist.size(); i++) {
 | 
	
		
			
				|  |  |             DoctorSchemeBloodSugger doctorSchemeBloodSugger = new DoctorSchemeBloodSugger();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             long id = 0;
 | 
	
		
			
				|  |  |             if(datalist.getJSONObject(i).containsKey("id")){
 | 
	
		
			
				|  |  |                 id=datalist.getJSONObject(i).getLong("id");
 | 
	
		
			
				|  |  |             if (datalist.getJSONObject(i).containsKey("id")) {
 | 
	
		
			
				|  |  |                 id = datalist.getJSONObject(i).getLong("id");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(id != 0){
 | 
	
		
			
				|  |  |             if (id != 0) {
 | 
	
		
			
				|  |  |                 doctorSchemeBloodSugger.setId(datalist.getJSONObject(i).getLong("id"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setName(name);
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setCode(code);
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setDoctorcode(doctorcode);
 | 
	
	
		
			
				|  | @ -286,52 +277,44 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setBeforeSleep(datalist.getJSONObject(i).getShort("beforeSleep"));
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setBeforeSleepTime(DateUtil.hhmmStrToTime(datalist.getJSONObject(i).getString("beforeSleepTime")));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setContent(content);
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setCreateTime(DateUtil.getNowTimestamp());
 | 
	
		
			
				|  |  |             doctorSchemeBloodSugger.setDel(0);
 | 
	
		
			
				|  |  |             results.add(doctorSchemeBloodSugger);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!results.isEmpty()) {
 | 
	
		
			
				|  |  |         if (!results.isEmpty()) {
 | 
	
		
			
				|  |  |             doctroSchemeBloodSuggerDao.saveAll(results);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生保存血压监测方案
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param data
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void saveDoctorSchemeBloodPressure(String data) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject dataObj =  JSON.parseObject(data);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void saveDoctorSchemeBloodPressure(String data) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject dataObj = JSON.parseObject(data);
 | 
	
		
			
				|  |  |         List<DoctorSchemeBloodPressure> results = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String code = dataObj.getString("code");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(code)){
 | 
	
		
			
				|  |  |         if (StringUtils.isBlank(code)) {
 | 
	
		
			
				|  |  |             code = UUID.randomUUID().toString();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String name = dataObj.getString("name");
 | 
	
		
			
				|  |  |         String content = dataObj.getString("content");
 | 
	
		
			
				|  |  |         String doctorcode = dataObj.getString("doctorcode");
 | 
	
		
			
				|  |  |         JSONArray datalist = dataObj.getJSONArray("list");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         for (int i = 0; i < datalist.size(); i++) {
 | 
	
		
			
				|  |  |             DoctorSchemeBloodPressure doctorSchemeBloodPressure = new DoctorSchemeBloodPressure();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             long id = 0;
 | 
	
		
			
				|  |  |             if(datalist.getJSONObject(i).containsKey("id")){
 | 
	
		
			
				|  |  |                 id=datalist.getJSONObject(i).getLong("id");
 | 
	
		
			
				|  |  |             if (datalist.getJSONObject(i).containsKey("id")) {
 | 
	
		
			
				|  |  |                 id = datalist.getJSONObject(i).getLong("id");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(id != 0){
 | 
	
		
			
				|  |  |             if (id != 0) {
 | 
	
		
			
				|  |  |                 doctorSchemeBloodPressure.setId(datalist.getJSONObject(i).getLong("id"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             doctorSchemeBloodPressure.setName(name);
 | 
	
		
			
				|  |  |             doctorSchemeBloodPressure.setCode(code);
 | 
	
		
			
				|  |  |             doctorSchemeBloodPressure.setDoctorcode(doctorcode);
 | 
	
	
		
			
				|  | @ -352,8 +335,7 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |             doctorSchemeBloodPressure.setDel(0);
 | 
	
		
			
				|  |  |             results.add(doctorSchemeBloodPressure);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!results.isEmpty()) {
 | 
	
		
			
				|  |  |         if (!results.isEmpty()) {
 | 
	
		
			
				|  |  |             doctoreSchemeBloodPressureDao.saveAll(results);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -368,30 +350,23 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
 | 
	
		
			
				|  |  |     public void savePatientScheme(String doctorcode, String schemecode, String type, String patientcodes) throws Exception {
 | 
	
		
			
				|  |  |         List<String> patientcodeList = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String[] codes = patientcodes.split(",");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(patientcodes.contains(",")){
 | 
	
		
			
				|  |  |         if (patientcodes.contains(",")) {
 | 
	
		
			
				|  |  |             for (String code : codes) {
 | 
	
		
			
				|  |  |                 patientcodeList.add(code);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             patientcodeList.add(patientcodes);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (!patientcodeList.isEmpty()) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //使用事务控制批量更新
 | 
	
		
			
				|  |  |             DefaultTransactionDefinition def = new DefaultTransactionDefinition();
 | 
	
		
			
				|  |  |             def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
 | 
	
		
			
				|  |  |             TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 for (String patientcode : patientcodeList) {
 | 
	
		
			
				|  |  |                     patientSchemeListDao.delByPatientCode(patientcode, Integer.parseInt(type));
 | 
	
		
			
				|  |  |                     PatientSchemeList patientSchemeListObj = new PatientSchemeList();
 | 
	
	
		
			
				|  | @ -413,8 +388,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生端-获取慢病管理居民管理端数据
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param teamCode
 | 
	
		
			
				|  |  |      * @param getcolor
 | 
	
		
			
				|  |  |      * @param getstands
 | 
	
	
		
			
				|  | @ -423,33 +400,34 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |      * @param enddate
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate,String doctorcode) throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate, String doctorcode) throws Exception {
 | 
	
		
			
				|  |  |         List<PatientVO> patients = new ArrayList<>();
 | 
	
		
			
				|  |  |         String patientsql = "select p.code,p.standard_status,p.disease_condition,group_concat(sp.label) as disease " +
 | 
	
		
			
				|  |  |                 " from wlyy_patient p " +
 | 
	
		
			
				|  |  |                 " LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
 | 
	
		
			
				|  |  |                 " RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and (sp.label = 1 or sp.label = 2) and sp.status =1" +
 | 
	
		
			
				|  |  |                 " WHERE s.status > 0 " +
 | 
	
		
			
				|  |  |                 " and s.admin_team_code ='"+teamCode+"' and (s.doctor = '"+doctorcode+"' or s.doctor_health ='"+doctorcode+"') " +
 | 
	
		
			
				|  |  |                 " GROUP BY p.code ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         patients= jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String patientsql = "SELECT DISTINCT\n" +
 | 
	
		
			
				|  |  |                 "	a.id 'code',\n" +
 | 
	
		
			
				|  |  |                 "	a.standard_status ,\n" +
 | 
	
		
			
				|  |  |                 "	a.disease,\n" +
 | 
	
		
			
				|  |  |                 "	a.disease_condition \n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "	base_patient a \n" +
 | 
	
		
			
				|  |  |                 "	INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease IN ('1','2','1,2','2,1')\n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorcode + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         JSONObject green = new JSONObject();//绿标
 | 
	
		
			
				|  |  |         JSONObject yellow = new JSONObject();//黄标
 | 
	
		
			
				|  |  |         JSONObject red = new JSONObject();//红标
 | 
	
		
			
				|  |  |         JSONObject pressure_standard =  new JSONObject();//血压预警
 | 
	
		
			
				|  |  |         JSONObject sugar_standard =  new JSONObject();//血糖预警
 | 
	
		
			
				|  |  |         JSONObject pressure_standard = new JSONObject();//血压预警
 | 
	
		
			
				|  |  |         JSONObject sugar_standard = new JSONObject();//血糖预警
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject pressure_count =  new JSONObject();//血压体征总数
 | 
	
		
			
				|  |  |         JSONObject pressure_unusual_ount =  new JSONObject();//血压体征总数
 | 
	
		
			
				|  |  |         JSONObject sugar_count =  new JSONObject();//血糖体征总数
 | 
	
		
			
				|  |  |         JSONObject sugar_unusual_count =  new JSONObject();//血糖体征总数
 | 
	
		
			
				|  |  |         JSONObject pressure_count = new JSONObject();//血压体征总数
 | 
	
		
			
				|  |  |         JSONObject pressure_unusual_ount = new JSONObject();//血压体征总数
 | 
	
		
			
				|  |  |         JSONObject sugar_count = new JSONObject();//血糖体征总数
 | 
	
		
			
				|  |  |         JSONObject sugar_unusual_count = new JSONObject();//血糖体征总数
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         int count = patients.size();
 | 
	
		
			
				|  |  |         //绿标居民
 | 
	
	
		
			
				|  | @ -463,11 +441,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         //高血糖居民预警居民CODE
 | 
	
		
			
				|  |  |         List<String> bloodsugar_patientcodes = new ArrayList<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!patients.isEmpty()){
 | 
	
		
			
				|  |  |         if (!patients.isEmpty()) {
 | 
	
		
			
				|  |  |             for (PatientVO patient : patients) {
 | 
	
		
			
				|  |  |                 //获取居民颜色标签
 | 
	
		
			
				|  |  |                 if(1 == getcolor && patient.getDiseaseCondition() != null){
 | 
	
		
			
				|  |  |                     switch (patient.getDiseaseCondition()){
 | 
	
		
			
				|  |  |                 if (1 == getcolor && patient.getDiseaseCondition() != null) {
 | 
	
		
			
				|  |  |                     switch (patient.getDiseaseCondition()) {
 | 
	
		
			
				|  |  |                         case 0:
 | 
	
		
			
				|  |  |                             green_patients.add(patient);
 | 
	
		
			
				|  |  |                             break;
 | 
	
	
		
			
				|  | @ -481,40 +459,36 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //获取预警居民CODES
 | 
	
		
			
				|  |  |                 if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
 | 
	
		
			
				|  |  |                 if (1 == getstands && (patient.getStandardStatus() != null && patient.getStandardStatus() == 1)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if(patient.getDisease() != null){
 | 
	
		
			
				|  |  |                         if( "1".equals(patient.getDisease()) || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())){
 | 
	
		
			
				|  |  |                     if (patient.getDisease() != null) {
 | 
	
		
			
				|  |  |                         if ("1".equals(patient.getDisease()) || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
 | 
	
		
			
				|  |  |                             bloodpressure_patientcodes.add(patient.getCode());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         if( "2".equals(patient.getDisease()) || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())){
 | 
	
		
			
				|  |  |                         if ("2".equals(patient.getDisease()) || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
 | 
	
		
			
				|  |  |                             bloodsugar_patientcodes.add(patient.getCode());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(1 == getcolor){
 | 
	
		
			
				|  |  |             result.put("greencount",green_patients.size());
 | 
	
		
			
				|  |  |             result.put("yellowcount",yellow_patients.size());
 | 
	
		
			
				|  |  |             result.put("redcount",red_patients.size());
 | 
	
		
			
				|  |  | //            result.add(green);
 | 
	
		
			
				|  |  | //            result.add(yellow);
 | 
	
		
			
				|  |  | //            result.add(red);
 | 
	
		
			
				|  |  |         if (1 == getcolor) {
 | 
	
		
			
				|  |  |             result.put("greencount", green_patients.size());
 | 
	
		
			
				|  |  |             result.put("yellowcount", yellow_patients.size());
 | 
	
		
			
				|  |  |             result.put("redcount", red_patients.size());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(1 == getstands){
 | 
	
		
			
				|  |  |             result.put("pressure_standard",bloodpressure_patientcodes);
 | 
	
		
			
				|  |  |             result.put("sugar_standard",bloodsugar_patientcodes);
 | 
	
		
			
				|  |  | //            result.add(pressure_standard);
 | 
	
		
			
				|  |  | //            result.add(sugar_standard);
 | 
	
		
			
				|  |  |         if (1 == getstands) {
 | 
	
		
			
				|  |  |             result.put("pressure_standard", bloodpressure_patientcodes);
 | 
	
		
			
				|  |  |             result.put("sugar_standard", bloodsugar_patientcodes);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(1 == gethealthindex){
 | 
	
		
			
				|  |  |         if (1 == gethealthindex) {
 | 
	
		
			
				|  |  |             Date start = DateUtil.strToDate(startdate);
 | 
	
		
			
				|  |  |             Date end = DateUtil.strToDate(enddate);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByTeamcodeAndRecordDate(start,end,teamCode,doctorcode);
 | 
	
		
			
				|  |  | //            List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByTeamcodeAndRecordDate(start,end,teamCode,doctorcode);
 | 
	
		
			
				|  |  |             List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByDoctor(start, end, doctorcode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             int sugar = 0;
 | 
	
		
			
				|  |  |             int sugar_unusual = 0;
 | 
	
	
		
			
				|  | @ -522,73 +496,69 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |             int pressure = 0;
 | 
	
		
			
				|  |  |             int pressure_unusual = 0;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(!devicePatientHealthIndices.isEmpty()){
 | 
	
		
			
				|  |  |             if (!devicePatientHealthIndices.isEmpty()) {
 | 
	
		
			
				|  |  |                 for (DevicePatientHealthIndex devicePatientHealthIndex : devicePatientHealthIndices) {
 | 
	
		
			
				|  |  |                     if( 1 == devicePatientHealthIndex.getType()){
 | 
	
		
			
				|  |  |                     if (1 == devicePatientHealthIndex.getType()) {
 | 
	
		
			
				|  |  |                         sugar++;
 | 
	
		
			
				|  |  |                         if( devicePatientHealthIndex.getStatus() !=null && 0 == devicePatientHealthIndex.getStatus()){
 | 
	
		
			
				|  |  |                         if (devicePatientHealthIndex.getStatus() != null && 0 == devicePatientHealthIndex.getStatus()) {
 | 
	
		
			
				|  |  |                             sugar_unusual++;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if( 2 == devicePatientHealthIndex.getType()){
 | 
	
		
			
				|  |  |                     if (2 == devicePatientHealthIndex.getType()) {
 | 
	
		
			
				|  |  |                         pressure++;
 | 
	
		
			
				|  |  |                         if(devicePatientHealthIndex.getStatus() !=null && 0 == devicePatientHealthIndex.getStatus()){
 | 
	
		
			
				|  |  |                         if (devicePatientHealthIndex.getStatus() != null && 0 == devicePatientHealthIndex.getStatus()) {
 | 
	
		
			
				|  |  |                             pressure_unusual++;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             result.put("pressure_count",pressure);
 | 
	
		
			
				|  |  |             result.put("pressure_unusual_count",pressure_unusual);
 | 
	
		
			
				|  |  |             result.put("sugar_count",sugar);
 | 
	
		
			
				|  |  |             result.put("sugar_unusual_count",sugar_unusual);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //            result.add(pressure_count);
 | 
	
		
			
				|  |  | //            result.add(pressure_unusual_ount);
 | 
	
		
			
				|  |  | //            result.add(sugar_count);
 | 
	
		
			
				|  |  | //            result.add(sugar_unusual_count);
 | 
	
		
			
				|  |  |             result.put("pressure_count", pressure);
 | 
	
		
			
				|  |  |             result.put("pressure_unusual_count", pressure_unusual);
 | 
	
		
			
				|  |  |             result.put("sugar_count", sugar);
 | 
	
		
			
				|  |  |             result.put("sugar_unusual_count", sugar_unusual);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //1.4.2 重点关注居民
 | 
	
		
			
				|  |  |         List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctorcode,Integer.parseInt(teamCode),"1");
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             result.put("trackPatientCount",list.size());
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             result.put("trackPatientCount",0);
 | 
	
		
			
				|  |  |         List<TrackPatient> list = trackPatientDao.findByDoctor(doctorcode, "1");
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             result.put("trackPatientCount", list.size());
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             result.put("trackPatientCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 删除医生监测方案
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctorcode
 | 
	
		
			
				|  |  |      * @param schemecode
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
 | 
	
		
			
				|  |  |     public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if("1".equals(type)){
 | 
	
		
			
				|  |  |             doctroSchemeBloodSuggerDao.updateDelStatus(1,doctorcode,schemecode);
 | 
	
		
			
				|  |  |         if ("1".equals(type)) {
 | 
	
		
			
				|  |  |             doctroSchemeBloodSuggerDao.updateDelStatus(1, doctorcode, schemecode);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if("2".equals(type)){
 | 
	
		
			
				|  |  |             doctoreSchemeBloodPressureDao.updateDelStatus(1,doctorcode,schemecode);
 | 
	
		
			
				|  |  |         if ("2".equals(type)) {
 | 
	
		
			
				|  |  |             doctoreSchemeBloodPressureDao.updateDelStatus(1, doctorcode, schemecode);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<PatientSchemeList> list = patientSchemeListDao.findBySchemecode(schemecode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             patientSchemeListDao.deleteAll(list);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getPatientHealthIndex(String patient,String startDate,String endDate,String type){
 | 
	
		
			
				|  |  |     public Map<String, Object> getPatientHealthIndex(String patient, String startDate, String endDate, String type) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         startDate = startDate+" 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate+" 23:59:59";
 | 
	
		
			
				|  |  |         String highSql ="SELECT  " +
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  |         String highSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS highCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -601,9 +571,9 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 7 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -615,11 +585,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 11.1 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  |         String stdSql ="SELECT  " +
 | 
	
		
			
				|  |  |         String stdSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS stdCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -633,9 +603,9 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 7 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -648,11 +618,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 11.1 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  |         String lowSql ="SELECT  " +
 | 
	
		
			
				|  |  |         String lowSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS lowCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -665,9 +635,9 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -679,12 +649,12 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String pHighSql ="SELECT " +
 | 
	
		
			
				|  |  |         String pHighSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS highCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -692,10 +662,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 139 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'";
 | 
	
		
			
				|  |  |         String  pStdSql ="SELECT " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'";
 | 
	
		
			
				|  |  |         String pStdSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS stdCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -704,10 +674,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 139 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 90 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'";
 | 
	
		
			
				|  |  |         String pLowSql ="SELECT " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'";
 | 
	
		
			
				|  |  |         String pLowSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS lowCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -715,61 +685,61 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 90 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'";
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //0血檀
 | 
	
		
			
				|  |  |         if ("0".equals(type)){
 | 
	
		
			
				|  |  |         if ("0".equals(type)) {
 | 
	
		
			
				|  |  |             //1.高
 | 
	
		
			
				|  |  |             List<Map<String,Object>> high = jdbcTemplate.queryForList(highSql);
 | 
	
		
			
				|  |  |             if(high!=null&&high.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount",h.get("highCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> high = jdbcTemplate.queryForList(highSql);
 | 
	
		
			
				|  |  |             if (high != null && high.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount", h.get("highCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //2.正常
 | 
	
		
			
				|  |  |             List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
 | 
	
		
			
				|  |  |             if(std!=null&&std.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount",st.get("stdCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> std = jdbcTemplate.queryForList(stdSql);
 | 
	
		
			
				|  |  |             if (std != null && std.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount", st.get("stdCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //3.偏低
 | 
	
		
			
				|  |  |             List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
 | 
	
		
			
				|  |  |             if(low!=null&&low.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount",lw.get("lowCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> low = jdbcTemplate.queryForList(lowSql);
 | 
	
		
			
				|  |  |             if (low != null && low.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount", lw.get("lowCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //其他血压
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             //1.高
 | 
	
		
			
				|  |  |             List<Map<String,Object>> high = jdbcTemplate.queryForList(pHighSql);
 | 
	
		
			
				|  |  |             if(high!=null&&high.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount",h.get("highCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> high = jdbcTemplate.queryForList(pHighSql);
 | 
	
		
			
				|  |  |             if (high != null && high.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount", h.get("highCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //2.正常
 | 
	
		
			
				|  |  |             List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
 | 
	
		
			
				|  |  |             if(std!=null&&std.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount",st.get("stdCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> std = jdbcTemplate.queryForList(pStdSql);
 | 
	
		
			
				|  |  |             if (std != null && std.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount", st.get("stdCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //3.偏低
 | 
	
		
			
				|  |  |             List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
 | 
	
		
			
				|  |  |             if(low!=null&&low.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount",lw.get("lowCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> low = jdbcTemplate.queryForList(pLowSql);
 | 
	
		
			
				|  |  |             if (low != null && low.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount", lw.get("lowCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getPatientHealthIndex(String startDate,String endDate,String type,Long teamCode,String doctor){
 | 
	
		
			
				|  |  |     public Map<String, Object> getPatientHealthIndexNew(String startDate, String endDate, String type, String doctor) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         startDate = startDate+" 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate+" 23:59:59";
 | 
	
		
			
				|  |  |         String highSql ="SELECT  " +
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  |         String highSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS highCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -782,9 +752,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 7 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (" +
 | 
	
		
			
				|  |  |                 "SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -796,11 +767,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 11.1 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  |         String stdSql ="SELECT  " +
 | 
	
		
			
				|  |  |         String stdSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS stdCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -814,9 +785,9 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 7 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -829,11 +800,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 11.1 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  |         String lowSql ="SELECT  " +
 | 
	
		
			
				|  |  |         String lowSql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " (bf.befHighCount + aft.aftHighCount) AS lowCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -846,9 +817,9 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(1,3,5,7) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) bf, " +
 | 
	
		
			
				|  |  |                 " (  " +
 | 
	
		
			
				|  |  |                 " SELECT " +
 | 
	
	
		
			
				|  | @ -860,12 +831,12 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.value2 in(2,4,6) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
 | 
	
		
			
				|  |  |                 " ) aft";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String pHighSql ="SELECT " +
 | 
	
		
			
				|  |  |         String pHighSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS highCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -873,10 +844,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 > 139 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
 | 
	
		
			
				|  |  |         String  pStdSql ="SELECT " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
 | 
	
		
			
				|  |  |         String pStdSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS stdCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -885,10 +856,10 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= 139 " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= 90 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
 | 
	
		
			
				|  |  |         String pLowSql ="SELECT " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
 | 
	
		
			
				|  |  |         String pLowSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS lowCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " device.wlyy_patient_health_index i " +
 | 
	
	
		
			
				|  | @ -896,60 +867,60 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = '2' " +
 | 
	
		
			
				|  |  |                 " AND i.value1 < 90 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "')";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //0血檀
 | 
	
		
			
				|  |  |         if ("0".equals(type)){
 | 
	
		
			
				|  |  |         if ("0".equals(type)) {
 | 
	
		
			
				|  |  |             //1.高
 | 
	
		
			
				|  |  |             List<Map<String,Object>> high = jdbcTemplate.queryForList(highSql);
 | 
	
		
			
				|  |  |             if(high!=null&&high.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount",h.get("highCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> high = jdbcTemplate.queryForList(highSql);
 | 
	
		
			
				|  |  |             if (high != null && high.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount", h.get("highCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //2.正常
 | 
	
		
			
				|  |  |             List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
 | 
	
		
			
				|  |  |             if(std!=null&&std.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount",st.get("stdCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> std = jdbcTemplate.queryForList(stdSql);
 | 
	
		
			
				|  |  |             if (std != null && std.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount", st.get("stdCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //3.偏低
 | 
	
		
			
				|  |  |             List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
 | 
	
		
			
				|  |  |             if(low!=null&&low.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount",lw.get("lowCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> low = jdbcTemplate.queryForList(lowSql);
 | 
	
		
			
				|  |  |             if (low != null && low.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount", lw.get("lowCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         //其他血压
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             //其他血压
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             //1.高
 | 
	
		
			
				|  |  |             List<Map<String,Object>> high = jdbcTemplate.queryForList(pHighSql);
 | 
	
		
			
				|  |  |             if(high!=null&&high.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount",h.get("highCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> high = jdbcTemplate.queryForList(pHighSql);
 | 
	
		
			
				|  |  |             if (high != null && high.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> h = high.get(0);
 | 
	
		
			
				|  |  |                 rs.put("highCount", h.get("highCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //2.正常
 | 
	
		
			
				|  |  |             List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
 | 
	
		
			
				|  |  |             if(std!=null&&std.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount",st.get("stdCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> std = jdbcTemplate.queryForList(pStdSql);
 | 
	
		
			
				|  |  |             if (std != null && std.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> st = std.get(0);
 | 
	
		
			
				|  |  |                 rs.put("stdCount", st.get("stdCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //3.偏低
 | 
	
		
			
				|  |  |             List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
 | 
	
		
			
				|  |  |             if(low!=null&&low.size()>0){
 | 
	
		
			
				|  |  |                 Map<String,Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount",lw.get("lowCount"));
 | 
	
		
			
				|  |  |             List<Map<String, Object>> low = jdbcTemplate.queryForList(pLowSql);
 | 
	
		
			
				|  |  |             if (low != null && low.size() > 0) {
 | 
	
		
			
				|  |  |                 Map<String, Object> lw = low.get(0);
 | 
	
		
			
				|  |  |                 rs.put("lowCount", lw.get("lowCount"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getTrackPatientInfo(String patient){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |     public Map<String, Object> getTrackPatientInfo(String patient) {
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         rs.put("wxSport",0);
 | 
	
		
			
				|  |  |         rs.put("wxSport", 0);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String hsql = "SELECT " +
 | 
	
		
			
				|  |  |                 " i.value1 AS weight, " +
 | 
	
	
		
			
				|  | @ -960,66 +931,65 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = '3'  " +
 | 
	
		
			
				|  |  |                 " AND i.user ='"+patient+"'" +
 | 
	
		
			
				|  |  |                 " AND i.user ='" + patient + "'" +
 | 
	
		
			
				|  |  |                 " ORDER BY " +
 | 
	
		
			
				|  |  |                 " i.record_date DESC LIMIT 0,1";
 | 
	
		
			
				|  |  |         String xtSchSql="SELECT " +
 | 
	
		
			
				|  |  |         String xtSchSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " l.*," +
 | 
	
		
			
				|  |  |                 " s.name " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_patient_scheme_list l JOIN wlyy_doctor_scheme_blood_sugger s ON s.code = l.schemecode  " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " l.type = 1 " +
 | 
	
		
			
				|  |  |                 " AND l.patientcode = '"+patient+"'";
 | 
	
		
			
				|  |  |         String xySchSql="SELECT " +
 | 
	
		
			
				|  |  |                 " AND l.patientcode = '" + patient + "'";
 | 
	
		
			
				|  |  |         String xySchSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " l.*," +
 | 
	
		
			
				|  |  |                 " s.name " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_patient_scheme_list l JOIN wlyy_doctor_scheme_blood_pressure s ON s.code = l.schemecode" +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " l.type = 2 " +
 | 
	
		
			
				|  |  |                 " AND l.patientcode = '"+patient+"'";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> hList = jdbcTemplate.queryForList(hsql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(hList!=null&&hList.size()>0){
 | 
	
		
			
				|  |  |             Map<String,Object> body = hList.get(0);
 | 
	
		
			
				|  |  |             rs.put("body",body);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("body",null);
 | 
	
		
			
				|  |  |                 " AND l.patientcode = '" + patient + "'";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> hList = jdbcTemplate.queryForList(hsql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (hList != null && hList.size() > 0) {
 | 
	
		
			
				|  |  |             Map<String, Object> body = hList.get(0);
 | 
	
		
			
				|  |  |             rs.put("body", body);
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("body", null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> xtList = jdbcTemplate.queryForList(xtSchSql);
 | 
	
		
			
				|  |  |         if(xtList!=null&&xtList.size()>0){
 | 
	
		
			
				|  |  |             rs.put("sugger",xtList.get(0));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("sugger",null);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> xtList = jdbcTemplate.queryForList(xtSchSql);
 | 
	
		
			
				|  |  |         if (xtList != null && xtList.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("sugger", xtList.get(0));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("sugger", null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> xyList = jdbcTemplate.queryForList(xySchSql);
 | 
	
		
			
				|  |  |         if(xyList!=null&&xyList.size()>0){
 | 
	
		
			
				|  |  |             rs.put("pressure",xyList.get(0));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("pressure",null);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> xyList = jdbcTemplate.queryForList(xySchSql);
 | 
	
		
			
				|  |  |         if (xyList != null && xyList.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("pressure", xyList.get(0));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("pressure", null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return  rs;
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getControlObjectives(String patient){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         PatientAimBloodSugger patientAimBloodSugger =  patientAimBloodSuggerDao.findByPatientcode(patient);
 | 
	
		
			
				|  |  |     public Map<String, Object> getControlObjectives(String patient) {
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         PatientAimBloodSugger patientAimBloodSugger = patientAimBloodSuggerDao.findByPatientcode(patient);
 | 
	
		
			
				|  |  |         PatientAimBloodPressure patientAimBloodPressure = patientAimBloodPressureDao.findByPatientcode(patient);
 | 
	
		
			
				|  |  |         PatientAimSports patientAimSports = patientAimSportsDao.getPatientAimSportsByPatientCode(patient);
 | 
	
		
			
				|  |  |         rs.put("patientAimBloodSugger",patientAimBloodSugger);
 | 
	
		
			
				|  |  |         rs.put("patientAimBloodPressure",patientAimBloodPressure);
 | 
	
		
			
				|  |  |         rs.put("patientAimSports",patientAimSports);
 | 
	
		
			
				|  |  |         rs.put("patientAimBloodSugger", patientAimBloodSugger);
 | 
	
		
			
				|  |  |         rs.put("patientAimBloodPressure", patientAimBloodPressure);
 | 
	
		
			
				|  |  |         rs.put("patientAimSports", patientAimSports);
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getBodyInfo(String patient,String startDate,String endDate,Integer page,Integer size){
 | 
	
		
			
				|  |  |         startDate = startDate+" 00:00:00";
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getBodyInfo(String patient, String startDate, String endDate, Integer page, Integer size) {
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " i.record_date, " +
 | 
	
	
		
			
				|  | @ -1031,20 +1001,20 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = 3 " +
 | 
	
		
			
				|  |  |                 " AND i.`user` = '"+patient+"' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='"+endDate+"'"+
 | 
	
		
			
				|  |  |                 " AND i.`user` = '" + patient + "' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " ORDER BY " +
 | 
	
		
			
				|  |  |                 " i.record_date DESC LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                 " i.record_date DESC LIMIT " + (page - 1) * size + "," + size;
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String setDoctorSwitchTrackPatient(String doctor,String state){
 | 
	
		
			
				|  |  |         DoctorSwitch doctorSwitch =doctorSwitchDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         if(doctorSwitch!=null){
 | 
	
		
			
				|  |  |     public String setDoctorSwitchTrackPatient(String doctor, String state) {
 | 
	
		
			
				|  |  |         DoctorSwitch doctorSwitch = doctorSwitchDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         if (doctorSwitch != null) {
 | 
	
		
			
				|  |  |             doctorSwitch.setAlertPatientSwitch(state);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             DoctorSwitch dw = new DoctorSwitch();
 | 
	
		
			
				|  |  |             dw.setDoctor(doctor);
 | 
	
		
			
				|  |  |             dw.setAlertPatientSwitch(state);
 | 
	
	
		
			
				|  | @ -1054,12 +1024,12 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         return "0";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getDoctorSwitchTrackPatient(String doctor){
 | 
	
		
			
				|  |  |     public Map<String, Object> getDoctorSwitchTrackPatient(String doctor) {
 | 
	
		
			
				|  |  |         DoctorSwitch doctorSwitch = doctorSwitchDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         if(doctorSwitch!=null){
 | 
	
		
			
				|  |  |             rs.put("alertPatientSwitch",doctorSwitch.getAlertPatientSwitch());
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         if (doctorSwitch != null) {
 | 
	
		
			
				|  |  |             rs.put("alertPatientSwitch", doctorSwitch.getAlertPatientSwitch());
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             DoctorSwitch dw = new DoctorSwitch();
 | 
	
		
			
				|  |  |             dw.setDoctor(doctor);
 | 
	
	
		
			
				|  | @ -1067,52 +1037,53 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |             dw.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             doctorSwitchDao.save(dw);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             rs.put("alertPatientSwitch","0");
 | 
	
		
			
				|  |  |             rs.put("alertPatientSwitch", "0");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getTrackPatientCountTitle(Integer teamCode,String doctor,String startDate,String endDate){
 | 
	
		
			
				|  |  |         List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctor,teamCode,"1");
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         rs.put("trackPatientCount",trackPatients.size());
 | 
	
		
			
				|  |  |     public Map<String, Object> getTrackPatientCountTitle(String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  | //        List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctor, teamCode, "1");
 | 
	
		
			
				|  |  |         List<TrackPatient> trackPatients = trackPatientDao.findByDoctor(doctor, "1");
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         rs.put("trackPatientCount", trackPatients.size());
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) AS total " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_track_patient t " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " t.del='1' " +
 | 
	
		
			
				|  |  |                 " AND t.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 " AND t.team_code = "+teamCode +
 | 
	
		
			
				|  |  |                 " AND t.create_time >= '"+startDate+" 00:00:00' " +
 | 
	
		
			
				|  |  |                 " AND t.create_time <= '"+endDate+" 23:59:59'";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             Long total = (Long)list.get(0).get("total");
 | 
	
		
			
				|  |  |             rs.put("trackPatientAddCount",total);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("trackPatientAddCount",0);
 | 
	
		
			
				|  |  |                 " AND t.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  | //                " AND t.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 " AND t.create_time >= '" + startDate + " 00:00:00' " +
 | 
	
		
			
				|  |  |                 " AND t.create_time <= '" + endDate + " 23:59:59'";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             Long total = (Long) list.get(0).get("total");
 | 
	
		
			
				|  |  |             rs.put("trackPatientAddCount", total);
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("trackPatientAddCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  Map<String,Object> getTrackPatientServerCount(Long teamCode,String doctor,String startDate,String endDate){
 | 
	
		
			
				|  |  |     public Map<String, Object> getTrackPatientServerCount(Long teamCode, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new  HashedMap();
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //咨询
 | 
	
		
			
				|  |  |         rs.put("consultCount",getConsultByteam(teamCode,doctor,startDate,endDate));
 | 
	
		
			
				|  |  |         rs.put("consultCount", getConsultByteam(teamCode, doctor, startDate, endDate));
 | 
	
		
			
				|  |  |         //随访
 | 
	
		
			
				|  |  |         rs.put("followupCount",getFollowByTeam(teamCode,doctor,startDate,endDate));
 | 
	
		
			
				|  |  |         rs.put("followupCount", getFollowByTeam(teamCode, doctor, startDate, endDate));
 | 
	
		
			
				|  |  |         //获取健康指导
 | 
	
		
			
				|  |  |         rs.put("guidanceCount",getGuidanceByTeam(teamCode,doctor,startDate,endDate));
 | 
	
		
			
				|  |  |         rs.put("guidanceCount", getGuidanceByTeam(teamCode, doctor, startDate, endDate));
 | 
	
		
			
				|  |  |         //获取待预约
 | 
	
		
			
				|  |  |         rs.put("reservationCount",getReservationByteam(teamCode,doctor,startDate,endDate));
 | 
	
		
			
				|  |  |         rs.put("reservationCount", getReservationByteam(teamCode, doctor, startDate, endDate));
 | 
	
		
			
				|  |  |         //续方审核
 | 
	
		
			
				|  |  |         rs.put("reviewedCount",getPresCount(teamCode,doctor,startDate,endDate));
 | 
	
		
			
				|  |  |         rs.put("reviewedCount", getPresCount(teamCode, doctor, startDate, endDate));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -1126,7 +1097,7 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |      * @param endDate
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Long getConsultByteam(Long id, String doctor,String startDate, String endDate) {
 | 
	
		
			
				|  |  |     public Long getConsultByteam(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         String imDataBaseName = im_dataBase_name;
 | 
	
		
			
				|  |  |         //咨询量
 | 
	
		
			
				|  |  |         String consult_sql = "SELECT " +
 | 
	
	
		
			
				|  | @ -1149,98 +1120,98 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " AND t.create_time >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND t.create_time <= '" + endDate + "'" +
 | 
	
		
			
				|  |  |                 " AND c.patient IN(" +
 | 
	
		
			
				|  |  |                 "  SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+
 | 
	
		
			
				|  |  |                 "  SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' AND t.team_code = " + id +
 | 
	
		
			
				|  |  |                 " )" +
 | 
	
		
			
				|  |  |                 " )c ON c.id = m.doctor_code " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " m.team_id = "  + id+
 | 
	
		
			
				|  |  |                 " AND m.doctor_code ='"+doctor+"'" ;
 | 
	
		
			
				|  |  |                 " m.team_id = " + id +
 | 
	
		
			
				|  |  |                 " AND m.doctor_code ='" + doctor + "'";
 | 
	
		
			
				|  |  |         //获取咨詢數
 | 
	
		
			
				|  |  |         Map<String, Object> consultCout = jdbcTemplate.queryForMap(consult_sql);
 | 
	
		
			
				|  |  |         if (consultCout.get("consultCount") == null) {
 | 
	
		
			
				|  |  |             consultCout.put("consultCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)consultCout.get("consultCount");
 | 
	
		
			
				|  |  |         return (Long) consultCout.get("consultCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Long getReservationByteam(Long id,String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |     public Long getReservationByteam(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         //获取待预约
 | 
	
		
			
				|  |  |         String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation  w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
 | 
	
		
			
				|  |  |                 " AND w.doctor ='" + doctor + "' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' AND t.team_code = " + id + ") ";
 | 
	
		
			
				|  |  |         //获取待预约
 | 
	
		
			
				|  |  |         Map<String, Object> reservationCout = jdbcTemplate.queryForMap(reservation_sql);
 | 
	
		
			
				|  |  |         if (reservationCout.get("reservationCount") == null) {
 | 
	
		
			
				|  |  |             reservationCout.put("reservationCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)reservationCout.get("reservationCount");
 | 
	
		
			
				|  |  |         return (Long) reservationCout.get("reservationCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Long getEduArticleByTeam(Long id,String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |     public Long getEduArticleByTeam(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         //获取健康教育
 | 
	
		
			
				|  |  |         String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient w WHERE  w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
 | 
	
		
			
				|  |  |                 " AND w.doctor ='" + doctor + "' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' AND t.team_code = " + id + ") ";
 | 
	
		
			
				|  |  |         //获取健康教育
 | 
	
		
			
				|  |  |         Map<String, Object> articleCout = jdbcTemplate.queryForMap(article_sql);
 | 
	
		
			
				|  |  |         if (articleCout.get("articleCount") == null) {
 | 
	
		
			
				|  |  |             articleCout.put("articleCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)articleCout.get("articleCount");
 | 
	
		
			
				|  |  |         return (Long) articleCout.get("articleCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Long getGuidanceByTeam(Long id,String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |     public Long getGuidanceByTeam(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         //获取健康指导
 | 
	
		
			
				|  |  |         String guidance_sql = "SELECT COUNT(1) AS guidanceCount  FROM wlyy_patient_health_guidance w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
 | 
	
		
			
				|  |  |                 " AND w.doctor ='" + doctor + "' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' AND t.team_code = " + id + ") ";
 | 
	
		
			
				|  |  |         //获取健康指导
 | 
	
		
			
				|  |  |         Map<String, Object> guidanceCout = jdbcTemplate.queryForMap(guidance_sql);
 | 
	
		
			
				|  |  |         if (guidanceCout.get("guidanceCount") == null) {
 | 
	
		
			
				|  |  |             guidanceCout.put("guidanceCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)guidanceCout.get("guidanceCount");
 | 
	
		
			
				|  |  |         return (Long) guidanceCout.get("guidanceCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Long getFollowByTeam(Long id,String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |     public Long getFollowByTeam(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         //随访数目
 | 
	
		
			
				|  |  |         String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " AND w.doctor_code ='"+doctor+"' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
 | 
	
		
			
				|  |  |                 " AND w.doctor_code ='" + doctor + "' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' AND t.team_code = " + id + ") ";
 | 
	
		
			
				|  |  |         //随访数目
 | 
	
		
			
				|  |  |         Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
 | 
	
		
			
				|  |  |         if (followupCout.get("followupCount") == null) {
 | 
	
		
			
				|  |  |             followupCout.put("followupCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)followupCout.get("followupCount");
 | 
	
		
			
				|  |  |         return (Long) followupCout.get("followupCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Long getPresCount(Long id,String doctor, String startDate, String endDate){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |     public Long getPresCount(Long id, String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " count(1) AS reviewedCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_prescription p " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_prescription_reviewed r ON r.prescription_code = p.`code` " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " r.doctor = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 " r.doctor = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 " AND p.admin_team_id = " + id +
 | 
	
		
			
				|  |  |                 " AND r.reviewed_time >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 " AND r.reviewed_time <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 " AND r.reviewed_time >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND r.reviewed_time <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " AND p.patient IN ( " +
 | 
	
		
			
				|  |  |                 " SELECT t.patient_code " +
 | 
	
		
			
				|  |  |                 " FROM wlyy_track_patient t " +
 | 
	
		
			
				|  |  |                 " WHERE t.del='1' AND t.doctor_code ='"+doctor+"' " +
 | 
	
		
			
				|  |  |                 " AND t.team_code = " +id+")";
 | 
	
		
			
				|  |  |                 " WHERE t.del='1' AND t.doctor_code ='" + doctor + "' " +
 | 
	
		
			
				|  |  |                 " AND t.team_code = " + id + ")";
 | 
	
		
			
				|  |  |         //审核数目
 | 
	
		
			
				|  |  |         Map<String, Object> reviewedCount = jdbcTemplate.queryForMap(sql);
 | 
	
		
			
				|  |  |         if (reviewedCount.get("reviewedCount") == null) {
 | 
	
		
			
				|  |  |             reviewedCount.put("reviewedCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return (Long)reviewedCount.get("reviewedCount");
 | 
	
		
			
				|  |  |         return (Long) reviewedCount.get("reviewedCount");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getTrackPatientAimByteam(String doctor ,Long teamCode,String startDate,String endDate){
 | 
	
		
			
				|  |  |         startDate = startDate +" 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate +" 23:59:59";
 | 
	
		
			
				|  |  |     public Map<String, Object> getTrackPatientAimByteam(String doctor, String startDate, String endDate) {
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String presSql="SELECT " +
 | 
	
		
			
				|  |  |         String presSql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) AS dbCount " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " ( " +
 | 
	
	
		
			
				|  | @ -1252,12 +1223,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    WHERE  " +
 | 
	
		
			
				|  |  |                 "   i.`user` in  " +
 | 
	
		
			
				|  |  |                 "    ( " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
 | 
	
		
			
				|  |  |                 "    ) " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='" + doctor + "'   ) " +
 | 
	
		
			
				|  |  |                 "  AND i.del ='1' " +
 | 
	
		
			
				|  |  |                 "  AND i.type = 2  " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i.`user` " +
 | 
	
		
			
				|  |  |                 " ) tt " +
 | 
	
	
		
			
				|  | @ -1272,58 +1242,56 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 "  i.`user` in  " +
 | 
	
		
			
				|  |  |                 "    ( " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
 | 
	
		
			
				|  |  |                 "    ) " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='" + doctor + "'   ) " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 <= cast(p.sbp as SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 >= cast(p.sbp_min as SIGNED INTEGER) "+
 | 
	
		
			
				|  |  |                 "  AND i.value1 >= cast(p.sbp_min as SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 "  AND i.del ='1'  " +
 | 
	
		
			
				|  |  |                 "  AND i.type = 2   " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " GROUP BY " +
 | 
	
		
			
				|  |  |                 "  i.`user` " +
 | 
	
		
			
				|  |  |                 " ) dbt ON tt.`user`=dbt.`user` " +
 | 
	
		
			
				|  |  |                 " WHERE dbt.dbtotal/tt.total > 0.7";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         List<Map<String,Object>> presTotal = jdbcTemplate.queryForList(presSql);
 | 
	
		
			
				|  |  |         if(presTotal!=null&&presTotal.size()>0){
 | 
	
		
			
				|  |  |             rs.put("dbPresCount",presTotal.get(0).get("dbCount"));
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             rs.put("dbPresCount",0);
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         List<Map<String, Object>> presTotal = jdbcTemplate.queryForList(presSql);
 | 
	
		
			
				|  |  |         if (presTotal != null && presTotal.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("dbPresCount", presTotal.get(0).get("dbCount"));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("dbPresCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //血糖达标数量
 | 
	
		
			
				|  |  |         List<Map<String,Object>> cqXT = jdbcTemplate.queryForList(getXTAimSQL( doctor , teamCode, startDate, endDate));
 | 
	
		
			
				|  |  |         List<Map<String, Object>> cqXT = jdbcTemplate.queryForList(getXTAimSQL(doctor, startDate, endDate));
 | 
	
		
			
				|  |  |         Long dbSuggerCount;
 | 
	
		
			
				|  |  |         if(cqXT!=null&&cqXT.size()>0){
 | 
	
		
			
				|  |  |             dbSuggerCount = (Long)cqXT.get(0).get("total");
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         if (cqXT != null && cqXT.size() > 0) {
 | 
	
		
			
				|  |  |             dbSuggerCount = (Long) cqXT.get(0).get("total");
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             dbSuggerCount = 0L;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         rs.put("dbSuggerCount",dbSuggerCount);
 | 
	
		
			
				|  |  |         rs.put("dbSuggerCount", dbSuggerCount);
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @param teamCode
 | 
	
		
			
				|  |  |      * @param startDate
 | 
	
		
			
				|  |  |      * @param endDate
 | 
	
		
			
				|  |  |      * @param state 0 餐前,1餐_后
 | 
	
		
			
				|  |  |      * @param state     0 餐前,1餐_后
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String getXTSql(String doctor ,Long teamCode,String startDate,String endDate,String state){
 | 
	
		
			
				|  |  |         String value1 ="cast(p.fbg as SIGNED INTEGER)";
 | 
	
		
			
				|  |  |         String value1min ="cast(p.fbg_min as SIGNED INTEGER)";
 | 
	
		
			
				|  |  |         String value2 ="1,3,5,7";
 | 
	
		
			
				|  |  |         if("1".equals(state)){
 | 
	
		
			
				|  |  |     public String getXTSql(String doctor, Long teamCode, String startDate, String endDate, String state) {
 | 
	
		
			
				|  |  |         String value1 = "cast(p.fbg as SIGNED INTEGER)";
 | 
	
		
			
				|  |  |         String value1min = "cast(p.fbg_min as SIGNED INTEGER)";
 | 
	
		
			
				|  |  |         String value2 = "1,3,5,7";
 | 
	
		
			
				|  |  |         if ("1".equals(state)) {
 | 
	
		
			
				|  |  |             value2 = "2,4,6";
 | 
	
		
			
				|  |  |             value1 = "cast(p.hpg AS SIGNED INTEGER)";
 | 
	
		
			
				|  |  |             value1min ="cast(p.hpg_min AS SIGNED INTEGER)";
 | 
	
		
			
				|  |  |             value1min = "cast(p.hpg_min AS SIGNED INTEGER)";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //餐前血糖达标数
 | 
	
		
			
				|  |  |         String xtSql = "SELECT " +
 | 
	
	
		
			
				|  | @ -1338,13 +1306,13 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    WHERE  " +
 | 
	
		
			
				|  |  |                 "   i.`user` in  " +
 | 
	
		
			
				|  |  |                 "    ( " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='" + doctor + "' AND p.team_code =" + teamCode +
 | 
	
		
			
				|  |  |                 "    ) " +
 | 
	
		
			
				|  |  |                 "  AND i.del ='1' " +
 | 
	
		
			
				|  |  |                 "  AND i.value2 in("+value2+") " +
 | 
	
		
			
				|  |  |                 "  AND i.value2 in(" + value2 + ") " +
 | 
	
		
			
				|  |  |                 "  AND i.type = 1  " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i.`user` " +
 | 
	
		
			
				|  |  |                 " ) tt " +
 | 
	
	
		
			
				|  | @ -1359,17 +1327,17 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 "  i.`user` in  " +
 | 
	
		
			
				|  |  |                 "    ( " +
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
 | 
	
		
			
				|  |  |                 "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='" + doctor + "' AND p.team_code =" + teamCode +
 | 
	
		
			
				|  |  |                 "    ) " +
 | 
	
		
			
				|  |  |                 "  AND " +
 | 
	
		
			
				|  |  |                 "  i.value1 <= " +value1+
 | 
	
		
			
				|  |  |                 "  i.value1 <= " + value1 +
 | 
	
		
			
				|  |  |                 "  AND  " +
 | 
	
		
			
				|  |  |                 "  i.value1 >= " +value1min +
 | 
	
		
			
				|  |  |                 "  AND i.value2 in("+value2+") " +
 | 
	
		
			
				|  |  |                 "  i.value1 >= " + value1min +
 | 
	
		
			
				|  |  |                 "  AND i.value2 in(" + value2 + ") " +
 | 
	
		
			
				|  |  |                 "  AND i.del ='1'  " +
 | 
	
		
			
				|  |  |                 "  AND i.type = 1   " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " GROUP BY " +
 | 
	
		
			
				|  |  |                 "  i.`user` " +
 | 
	
		
			
				|  |  |                 " ) dbt ON tt.`user`=dbt.`user` " +
 | 
	
	
		
			
				|  | @ -1377,7 +1345,7 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         return xtSql;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String getXTAimSQL(String doctor ,Long teamCode,String startDate,String endDate){
 | 
	
		
			
				|  |  |     public String getXTAimSQL(String doctor,  String startDate, String endDate) {
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) total " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
	
		
			
				|  | @ -1395,13 +1363,13 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient p " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     p.del = '1' " +
 | 
	
		
			
				|  |  |                 "    AND p.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "    AND p.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "    AND p.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  | //                "    AND p.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) " +
 | 
	
		
			
				|  |  |                 "  AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 "  AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i.`user` " +
 | 
	
		
			
				|  |  |                 " ) tt " +
 | 
	
	
		
			
				|  | @ -1420,16 +1388,16 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    wlyy_track_patient p " +
 | 
	
		
			
				|  |  |                 "   WHERE " +
 | 
	
		
			
				|  |  |                 "    p.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND p.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND p.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND p.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  | //                "   AND p.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "  ) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= cast(p.fbg AS SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= cast(p.fbg_min AS SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 " AND i.value2 IN (1,3,5,7)  " +
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " GROUP BY " +
 | 
	
		
			
				|  |  |                 "  i.`user` " +
 | 
	
		
			
				|  |  |                 " ) dbt ON tt.`user` = dbt.`user`  " +
 | 
	
	
		
			
				|  | @ -1448,16 +1416,16 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    wlyy_track_patient p " +
 | 
	
		
			
				|  |  |                 "   WHERE " +
 | 
	
		
			
				|  |  |                 "    p.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND p.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND p.team_code =  " +teamCode +
 | 
	
		
			
				|  |  |                 "   AND p.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  | //                "   AND p.team_code =  " + teamCode +
 | 
	
		
			
				|  |  |                 "  ) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 <= cast(p.hpg AS SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 " AND i.value1 >= cast(p.hpg_min AS SIGNED INTEGER) " +
 | 
	
		
			
				|  |  |                 " AND i.value2 IN (2,4,6)  " +
 | 
	
		
			
				|  |  |                 " AND i.del = '1' " +
 | 
	
		
			
				|  |  |                 " AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >= '"+startDate+"' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date <= '"+endDate+"' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date >= '" + startDate + "' " +
 | 
	
		
			
				|  |  |                 " AND i.record_date <= '" + endDate + "' " +
 | 
	
		
			
				|  |  |                 " GROUP BY " +
 | 
	
		
			
				|  |  |                 "  i.`user` " +
 | 
	
		
			
				|  |  |                 " ) cht ON tt.`user` = cht.`user` " +
 | 
	
	
		
			
				|  | @ -1466,8 +1434,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         return sql;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getDeviceStateByTeam(String doctor ,Long teamCode){
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |     public Map<String, Object> getDeviceStateByTeam(String doctor) {
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) AS total " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_patient_device d JOIN  " +
 | 
	
	
		
			
				|  | @ -1475,51 +1443,51 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " WHERE  " +
 | 
	
		
			
				|  |  |                 " t.del='1' " +
 | 
	
		
			
				|  |  |                 " AND d.category_code = ? " +
 | 
	
		
			
				|  |  |                 " AND t.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 " AND t.team_code = "+teamCode;
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |                 " AND t.doctor_code = '" + doctor + "' ";
 | 
	
		
			
				|  |  | //                " AND t.team_code = " + teamCode;
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //血糖仪
 | 
	
		
			
				|  |  |         List<Map<String,Object>> xt = jdbcTemplate.queryForList(sql,new Object[]{"1"});
 | 
	
		
			
				|  |  |         if(xt!=null&&xt.size()>0){
 | 
	
		
			
				|  |  |             rs.put("suggerDevCount",xt.get(0).get("total"));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("suggerDevCount",0);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> xt = jdbcTemplate.queryForList(sql, new Object[]{"1"});
 | 
	
		
			
				|  |  |         if (xt != null && xt.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("suggerDevCount", xt.get(0).get("total"));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("suggerDevCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //血压计
 | 
	
		
			
				|  |  |         List<Map<String,Object>> xh = jdbcTemplate.queryForList(sql,new Object[]{"2"});
 | 
	
		
			
				|  |  |         if(xh!=null&&xh.size()>0){
 | 
	
		
			
				|  |  |             rs.put("presDevCount",xh.get(0).get("total"));
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             rs.put("presDevCount",0);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> xh = jdbcTemplate.queryForList(sql, new Object[]{"2"});
 | 
	
		
			
				|  |  |         if (xh != null && xh.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("presDevCount", xh.get(0).get("total"));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("presDevCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String setSinglePatientAim(String patient ,String suggerJson,String presJson,String sportJson ){
 | 
	
		
			
				|  |  |     public String setSinglePatientAim(String patient, String suggerJson, String presJson, String sportJson) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         PatientAimBloodSugger sugger = patientAimBloodSuggerDao.findByPatientcode(patient);
 | 
	
		
			
				|  |  |         if(sugger!=null){
 | 
	
		
			
				|  |  |         if (sugger != null) {
 | 
	
		
			
				|  |  |             patientAimBloodSuggerDao.delete(sugger);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         PatientAimBloodPressure pres = patientAimBloodPressureDao.findByPatientcode(patient);
 | 
	
		
			
				|  |  |         if(pres!=null){
 | 
	
		
			
				|  |  |         if (pres != null) {
 | 
	
		
			
				|  |  |             patientAimBloodPressureDao.delete(pres);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         PatientAimSports sport = patientAimSportsDao.getPatientAimSportsByPatientCode(patient);
 | 
	
		
			
				|  |  |         if(sport!=null){
 | 
	
		
			
				|  |  |         if (sport != null) {
 | 
	
		
			
				|  |  |             patientAimSportsDao.delete(sport);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject spj  = net.sf.json.JSONObject.fromObject(sportJson);
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject sj = net.sf.json.JSONObject.fromObject(suggerJson);
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject pj = net.sf.json.JSONObject.fromObject(presJson);
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject spj = net.sf.json.JSONObject.fromObject(sportJson);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
 | 
	
		
			
				|  |  |         PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
 | 
	
		
			
				|  |  |         PatientAimSports patientAimSports = (PatientAimSports)net.sf.json.JSONObject.toBean(spj,PatientAimSports.class);
 | 
	
		
			
				|  |  |         PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger) net.sf.json.JSONObject.toBean(sj, PatientAimBloodSugger.class);
 | 
	
		
			
				|  |  |         PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure) net.sf.json.JSONObject.toBean(pj, PatientAimBloodPressure.class);
 | 
	
		
			
				|  |  |         PatientAimSports patientAimSports = (PatientAimSports) net.sf.json.JSONObject.toBean(spj, PatientAimSports.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         patientAimBloodSugger.setPatientcode(patient);
 | 
	
		
			
				|  |  |         patientAimBloodSugger.setCode(getCode());
 | 
	
	
		
			
				|  | @ -1540,30 +1508,29 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String setPatientAim(String patients ,String suggerJson,String presJson,String sportJson){
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(patients)){
 | 
	
		
			
				|  |  |     public String setPatientAim(String patients, String suggerJson, String presJson, String sportJson) {
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patients)) {
 | 
	
		
			
				|  |  |             String[] patient = patients.split(",");
 | 
	
		
			
				|  |  |             for(String p : patient){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             for (String p : patient) {
 | 
	
		
			
				|  |  |                 PatientAimBloodSugger sugger = patientAimBloodSuggerDao.findByPatientcode(p);
 | 
	
		
			
				|  |  |                 if(sugger!=null){
 | 
	
		
			
				|  |  |                 if (sugger != null) {
 | 
	
		
			
				|  |  |                     patientAimBloodSuggerDao.delete(sugger);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 PatientAimBloodPressure pres = patientAimBloodPressureDao.findByPatientcode(p);
 | 
	
		
			
				|  |  |                 if(pres!=null){
 | 
	
		
			
				|  |  |                 if (pres != null) {
 | 
	
		
			
				|  |  |                     patientAimBloodPressureDao.delete(pres);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 PatientAimSports sport = patientAimSportsDao.getPatientAimSportsByPatientCode(p);
 | 
	
		
			
				|  |  |                 if(sport!=null){
 | 
	
		
			
				|  |  |                 if (sport != null) {
 | 
	
		
			
				|  |  |                     patientAimSportsDao.delete(sport);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject spj  = net.sf.json.JSONObject.fromObject(sportJson);
 | 
	
		
			
				|  |  |                 PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
 | 
	
		
			
				|  |  |                 PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
 | 
	
		
			
				|  |  |                 PatientAimSports patientAimSports = (PatientAimSports)net.sf.json.JSONObject.toBean(spj,PatientAimSports.class);
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject sj = net.sf.json.JSONObject.fromObject(suggerJson);
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject pj = net.sf.json.JSONObject.fromObject(presJson);
 | 
	
		
			
				|  |  |                 net.sf.json.JSONObject spj = net.sf.json.JSONObject.fromObject(sportJson);
 | 
	
		
			
				|  |  |                 PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger) net.sf.json.JSONObject.toBean(sj, PatientAimBloodSugger.class);
 | 
	
		
			
				|  |  |                 PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure) net.sf.json.JSONObject.toBean(pj, PatientAimBloodPressure.class);
 | 
	
		
			
				|  |  |                 PatientAimSports patientAimSports = (PatientAimSports) net.sf.json.JSONObject.toBean(spj, PatientAimSports.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 patientAimBloodSugger.setPatientcode(p);
 | 
	
		
			
				|  |  |                 patientAimBloodSugger.setCode(getCode());
 | 
	
	
		
			
				|  | @ -1585,56 +1552,56 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getPatientScheme(String patient,String type){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         String sql =null;
 | 
	
		
			
				|  |  |         if("1".equals(type)){
 | 
	
		
			
				|  |  |             sql =  "SELECT " +
 | 
	
		
			
				|  |  |     public Map<String, Object> getPatientScheme(String patient, String type) {
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         String sql = null;
 | 
	
		
			
				|  |  |         if ("1".equals(type)) {
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     " s.* " +
 | 
	
		
			
				|  |  |                     " FROM " +
 | 
	
		
			
				|  |  |                     " wlyy_patient_scheme_list l " +
 | 
	
		
			
				|  |  |                     " JOIN wlyy_doctor_scheme_blood_sugger s ON s. CODE = l.schemecode " +
 | 
	
		
			
				|  |  |                     " WHERE " +
 | 
	
		
			
				|  |  |                     " l.type = 1  " +
 | 
	
		
			
				|  |  |                     " AND l.patientcode='"+patient+"'" +
 | 
	
		
			
				|  |  |                     " AND l.patientcode='" + patient + "'" +
 | 
	
		
			
				|  |  |                     " ORDER BY s.dayofweek ASC";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql =  "SELECT " +
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = "SELECT " +
 | 
	
		
			
				|  |  |                     " s.* " +
 | 
	
		
			
				|  |  |                     " FROM " +
 | 
	
		
			
				|  |  |                     " wlyy_patient_scheme_list l " +
 | 
	
		
			
				|  |  |                     " JOIN wlyy_doctor_scheme_blood_pressure s ON s. CODE = l.schemecode " +
 | 
	
		
			
				|  |  |                     " WHERE " +
 | 
	
		
			
				|  |  |                     " l.type = 2 " +
 | 
	
		
			
				|  |  |                     " AND l.patientcode='"+patient+"'" +
 | 
	
		
			
				|  |  |                     " AND l.patientcode='" + patient + "'" +
 | 
	
		
			
				|  |  |                     " ORDER BY s.dayofweek ASC";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             rs.put("code",list.get(0).get("code"));
 | 
	
		
			
				|  |  |             rs.put("name",list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content",list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list",list);
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("code", list.get(0).get("code"));
 | 
	
		
			
				|  |  |             rs.put("name", list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content", list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list", list);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getTrackPatientIndexCountList(String doctor,Integer teamCode,String type,String startDate,String endDate,String keyword,Integer page,Integer size){
 | 
	
		
			
				|  |  |         startDate = startDate+" 00:00:00";
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getTrackPatientIndexCountList(String doctor, Integer teamCode, String type, String startDate, String endDate, String keyword, Integer page, Integer size) {
 | 
	
		
			
				|  |  |         startDate = startDate + " 00:00:00";
 | 
	
		
			
				|  |  |         endDate = endDate + " 23:59:59";
 | 
	
		
			
				|  |  |         // /血糖查询
 | 
	
		
			
				|  |  |         if("1".equals(type)){
 | 
	
		
			
				|  |  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(getXTTrackPatientIndexCountListSql(doctor,teamCode,startDate,endDate,keyword, page, size));
 | 
	
		
			
				|  |  |         if ("1".equals(type)) {
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(getXTTrackPatientIndexCountListSql(doctor, teamCode, startDate, endDate, keyword, page, size));
 | 
	
		
			
				|  |  |             return list;
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(getXYTrackPatientIndexCountListSql(doctor,teamCode,startDate,endDate,keyword, page, size));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(getXYTrackPatientIndexCountListSql(doctor, teamCode, startDate, endDate, keyword, page, size));
 | 
	
		
			
				|  |  |             return list;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String getXTTrackPatientIndexCountListSql(String doctor,Integer teamCode,String startDate,String endDate,String keyword,Integer page,Integer size){
 | 
	
		
			
				|  |  |     public String getXTTrackPatientIndexCountListSql(String doctor, Integer teamCode, String startDate, String endDate, String keyword, Integer page, Integer size) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " tt1.patient_code, " +
 | 
	
	
		
			
				|  | @ -1666,8 +1633,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1680,8 +1647,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "   AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 "   AND i.value2 IN (2, 4, 6) " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 > 11.1 " +
 | 
	
		
			
				|  |  |                 "   AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "   AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "   AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "   AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1701,8 +1668,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "   WHERE " +
 | 
	
		
			
				|  |  |                 "    tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code =" +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code =" + teamCode +
 | 
	
		
			
				|  |  |                 "  ) t " +
 | 
	
		
			
				|  |  |                 " LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -1715,8 +1682,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "  AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 "  AND i.value2 IN (1, 3, 5, 7) " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 > 7 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i. USER " +
 | 
	
		
			
				|  |  |                 " ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1743,8 +1710,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code =  " +teamCode+
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code =  " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1757,8 +1724,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "   AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 "   AND i.value2 IN (2, 4, 6) " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1778,8 +1745,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "   WHERE " +
 | 
	
		
			
				|  |  |                 "    tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code =  " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code =  " + teamCode +
 | 
	
		
			
				|  |  |                 "  ) t " +
 | 
	
		
			
				|  |  |                 " LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -1792,8 +1759,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "  AND i.type = 1 " +
 | 
	
		
			
				|  |  |                 "  AND i.value2 IN (1, 3, 5, 7) " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 < 4 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i. USER " +
 | 
	
		
			
				|  |  |                 " ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1821,8 +1788,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code = " +teamCode +
 | 
	
		
			
				|  |  |                 "    AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "    AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1836,8 +1803,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "   AND i.value2 IN (2, 4, 6) " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 <= 11.1 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1857,8 +1824,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "   WHERE " +
 | 
	
		
			
				|  |  |                 "    tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "  ) t " +
 | 
	
		
			
				|  |  |                 " LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "  SELECT " +
 | 
	
	
		
			
				|  | @ -1872,8 +1839,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "  AND i.value2 IN (1, 3, 5, 7) " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 >= 4 " +
 | 
	
		
			
				|  |  |                 "  AND i.value1 <= 7 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "  GROUP BY " +
 | 
	
		
			
				|  |  |                 "   i. USER " +
 | 
	
		
			
				|  |  |                 " ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1882,20 +1849,20 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 " )tt3 ON tt1.patient_code = tt3.patient_code " +
 | 
	
		
			
				|  |  |                 " " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_patient p On tt1.patient_code =p.code";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(keyword)){
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(keyword)) {
 | 
	
		
			
				|  |  |             BasePatientDO p = patientDao.findByIdcard(keyword);
 | 
	
		
			
				|  |  |             if(p!=null){
 | 
	
		
			
				|  |  |                 sql =sql + " WHERE p.idcard ='"+keyword+"'";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 sql =sql + " WHERE p.name like '%"+keyword+"%' ";
 | 
	
		
			
				|  |  |             if (p != null) {
 | 
	
		
			
				|  |  |                 sql = sql + " WHERE p.idcard ='" + keyword + "'";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql = sql + " WHERE p.name like '%" + keyword + "%' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql += " ORDER BY highCount DESC LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         return sql ;
 | 
	
		
			
				|  |  |         sql += " ORDER BY highCount DESC LIMIT " + (page - 1) * size + "," + size;
 | 
	
		
			
				|  |  |         return sql;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String getXYTrackPatientIndexCountListSql(String doctor,Integer teamCode,String startDate,String endDate,String keyword,Integer page,Integer size){
 | 
	
		
			
				|  |  |         String sql ="SELECT  " +
 | 
	
		
			
				|  |  |     public String getXYTrackPatientIndexCountListSql(String doctor, Integer teamCode, String startDate, String endDate, String keyword, Integer page, Integer size) {
 | 
	
		
			
				|  |  |         String sql = "SELECT  " +
 | 
	
		
			
				|  |  |                 " t1.patient_code, " +
 | 
	
		
			
				|  |  |                 " t1.total AS lowCount, " +
 | 
	
		
			
				|  |  |                 " t2.total AS stdCount, " +
 | 
	
	
		
			
				|  | @ -1918,8 +1885,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1931,8 +1898,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    i.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND i.type = 2 " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 < 90 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1950,8 +1917,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1964,8 +1931,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "   AND i.type = 2 " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 >= 90 " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 <=139 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
	
		
			
				|  | @ -1984,8 +1951,8 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "     wlyy_track_patient tp " +
 | 
	
		
			
				|  |  |                 "    WHERE " +
 | 
	
		
			
				|  |  |                 "     tp.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " +teamCode+
 | 
	
		
			
				|  |  |                 "   AND tp.doctor_code = '" + doctor + "' " +
 | 
	
		
			
				|  |  |                 "   AND tp.team_code = " + teamCode +
 | 
	
		
			
				|  |  |                 "   ) t " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN ( " +
 | 
	
		
			
				|  |  |                 "   SELECT " +
 | 
	
	
		
			
				|  | @ -1997,58 +1964,58 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 "    i.del = '1' " +
 | 
	
		
			
				|  |  |                 "   AND i.type = 2 " +
 | 
	
		
			
				|  |  |                 "   AND i.value1 >139 " +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='"+startDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='"+endDate+"'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date >='" + startDate + "'" +
 | 
	
		
			
				|  |  |                 "  AND i.record_date <='" + endDate + "'" +
 | 
	
		
			
				|  |  |                 "   GROUP BY " +
 | 
	
		
			
				|  |  |                 "    i. USER " +
 | 
	
		
			
				|  |  |                 "  ) pid ON pid. USER = t.patient_code " +
 | 
	
		
			
				|  |  |                 " ) t3 ON t1.patient_code = t3.patient_code " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_patient p ON t1.patient_code = p.`code`";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(keyword)){
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(keyword)) {
 | 
	
		
			
				|  |  |             BasePatientDO p = patientDao.findByIdcard(keyword);
 | 
	
		
			
				|  |  |             if(p!=null){
 | 
	
		
			
				|  |  |                 sql =sql + " WHERE p.idcard ='"+keyword+"'";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 sql =sql + " WHERE p.name like '%"+keyword+"%' ";
 | 
	
		
			
				|  |  |             if (p != null) {
 | 
	
		
			
				|  |  |                 sql = sql + " WHERE p.idcard ='" + keyword + "'";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql = sql + " WHERE p.name like '%" + keyword + "%' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql += " ORDER BY highCount DESC LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         sql += " ORDER BY highCount DESC LIMIT " + (page - 1) * size + "," + size;
 | 
	
		
			
				|  |  |         return sql;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getDefaultScheme(String type){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |     public Map<String, Object> getDefaultScheme(String type) {
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //1. 血糖2.血压
 | 
	
		
			
				|  |  |         if("1".equals(type)){
 | 
	
		
			
				|  |  |         if ("1".equals(type)) {
 | 
	
		
			
				|  |  |             String sql = " SELECT p.* FROM wlyy_doctor_scheme_blood_sugger p where p.code='default' and p.del=0 order by p.doctorcode,p.code desc,p.dayofweek asc";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             rs.put("code","default");
 | 
	
		
			
				|  |  |             rs.put("name",list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content",list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list",list);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             rs.put("code", "default");
 | 
	
		
			
				|  |  |             rs.put("name", list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content", list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list", list);
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             String sql = " SELECT p.* FROM wlyy_doctor_scheme_blood_pressure p where p.code='default' and p.del=0 order by p.doctorcode,p.code desc,p.dayofweek asc";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             rs.put("code","default");
 | 
	
		
			
				|  |  |             rs.put("name",list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content",list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list",list);
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             rs.put("code", "default");
 | 
	
		
			
				|  |  |             rs.put("name", list.get(0).get("name"));
 | 
	
		
			
				|  |  |             rs.put("content", list.get(0).get("content"));
 | 
	
		
			
				|  |  |             rs.put("list", list);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public String setPatientDefaultScheme(String patient,String type){
 | 
	
		
			
				|  |  |     public String setPatientDefaultScheme(String patient, String type) {
 | 
	
		
			
				|  |  |         PatientSchemeList pl = new PatientSchemeList();
 | 
	
		
			
				|  |  |         if("1".equals(type)){
 | 
	
		
			
				|  |  |             List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient,"default",1);
 | 
	
		
			
				|  |  |             if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |         if ("1".equals(type)) {
 | 
	
		
			
				|  |  |             List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient, "default", 1);
 | 
	
		
			
				|  |  |             if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |                 return "-1";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             pl.setType(1);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient,"default",2);
 | 
	
		
			
				|  |  |             if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient, "default", 2);
 | 
	
		
			
				|  |  |             if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |                 return "-1";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             pl.setType(2);
 | 
	
	
		
			
				|  | @ -2065,6 +2032,7 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查看指定医生是否开启分派订单功能
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -2078,11 +2046,12 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 修改指定医生的分派订单开关,不存在该医生的开关,则创建
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @param dispatchOrderStatus
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void updateDispatchStatusByDoctor(String doctor, String dispatchOrderStatus) {
 | 
	
		
			
				|  |  |         DoctorSwitch doctorSwitch =doctorSwitchDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         DoctorSwitch doctorSwitch = doctorSwitchDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         if (null != doctorSwitch) {
 | 
	
		
			
				|  |  |             doctorSwitch.setDispatchOrderSwitch(dispatchOrderStatus);
 | 
	
		
			
				|  |  |             doctorSwitch.setUpdateTime(new Date());
 | 
	
	
		
			
				|  | @ -2095,17 +2064,17 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         doctorSwitchDao.save(doctorSwitch);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject patientsByDoctorAndLabelCode(String labelCode, String doctorCode){//1,2改变。
 | 
	
		
			
				|  |  |     public JSONObject patientsByDoctorAndLabelCode(String labelCode, String doctorCode) {//1,2改变。
 | 
	
		
			
				|  |  |         StringBuilder sqlLabelStr = new StringBuilder();
 | 
	
		
			
				|  |  |         sqlLabelStr.append(" sp.label in ('").append(labelCode.replace(",","','")).append("') ");
 | 
	
		
			
				|  |  |         sqlLabelStr.append(" sp.label in ('").append(labelCode.replace(",", "','")).append("') ");
 | 
	
		
			
				|  |  |         List<PatientVO> patients = new ArrayList<>();
 | 
	
		
			
				|  |  |         String patientsql = "select * from (select p.code,p.standard_status,p.disease_condition,group_concat(DISTINCT sp.label order by sp.label asc ) as disease from wlyy_patient p " +
 | 
	
		
			
				|  |  |                 "  LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
 | 
	
		
			
				|  |  |                 "  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and "+sqlLabelStr.toString()+" and sp.status =1" +
 | 
	
		
			
				|  |  |                 " WHERE s.status > 0 and (s.doctor = '"+doctorCode+"' or s.doctor_health ='"+doctorCode+"') GROUP BY p.code " +
 | 
	
		
			
				|  |  |                 "order by sp.label asc)tmp where tmp.disease='"+labelCode+"'";
 | 
	
		
			
				|  |  |                 "  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and " + sqlLabelStr.toString() + " and sp.status =1" +
 | 
	
		
			
				|  |  |                 " WHERE s.status > 0 and (s.doctor = '" + doctorCode + "' or s.doctor_health ='" + doctorCode + "') GROUP BY p.code " +
 | 
	
		
			
				|  |  |                 "order by sp.label asc)tmp where tmp.disease='" + labelCode + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         patients= jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
 | 
	
		
			
				|  |  |         patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         //绿标居民
 | 
	
		
			
				|  |  |         List<PatientVO> green_patients = new ArrayList<>();
 | 
	
	
		
			
				|  | @ -2113,11 +2082,11 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |         List<PatientVO> yellow_patients = new ArrayList<>();
 | 
	
		
			
				|  |  |         //红标居民
 | 
	
		
			
				|  |  |         List<PatientVO> red_patients = new ArrayList<>();
 | 
	
		
			
				|  |  |         if(!patients.isEmpty()){
 | 
	
		
			
				|  |  |         if (!patients.isEmpty()) {
 | 
	
		
			
				|  |  |             for (PatientVO patient : patients) {
 | 
	
		
			
				|  |  |                 //获取居民颜色标签
 | 
	
		
			
				|  |  |                 if(patient.getDiseaseCondition() != null){
 | 
	
		
			
				|  |  |                     switch (patient.getDiseaseCondition()){
 | 
	
		
			
				|  |  |                 if (patient.getDiseaseCondition() != null) {
 | 
	
		
			
				|  |  |                     switch (patient.getDiseaseCondition()) {
 | 
	
		
			
				|  |  |                         case 0:
 | 
	
		
			
				|  |  |                             green_patients.add(patient);
 | 
	
		
			
				|  |  |                             break;
 | 
	
	
		
			
				|  | @ -2133,15 +2102,15 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         result.put("greencount",green_patients.size());
 | 
	
		
			
				|  |  |         result.put("yellowcount",yellow_patients.size());
 | 
	
		
			
				|  |  |         result.put("redcount",red_patients.size());
 | 
	
		
			
				|  |  |         result.put("greencount", green_patients.size());
 | 
	
		
			
				|  |  |         result.put("yellowcount", yellow_patients.size());
 | 
	
		
			
				|  |  |         result.put("redcount", red_patients.size());
 | 
	
		
			
				|  |  |         // 重点关注居民
 | 
	
		
			
				|  |  |         List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndDel(doctorCode,"1");
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             result.put("trackPatientCount",list.size());
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             result.put("trackPatientCount",0);
 | 
	
		
			
				|  |  |         List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndDel(doctorCode, "1");
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             result.put("trackPatientCount", list.size());
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             result.put("trackPatientCount", 0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -2149,4 +2118,108 @@ public class DoctorSchemeService {
 | 
	
		
			
				|  |  |     public String getCode() {
 | 
	
		
			
				|  |  |         return UUID.randomUUID().toString().replaceAll("-", "");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public static ExecutorService execute = Executors.newFixedThreadPool(20);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取红黄绿标高血压糖尿病的指标人数
 | 
	
		
			
				|  |  |      * disease 1高血压,2糖尿病,3高血压+糖尿病
 | 
	
		
			
				|  |  |      * 预警数量   a.standard_status='1'
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public HashMap<String, Object> getLabelCount(String doctorId) throws ExecutionException, InterruptedException {
 | 
	
		
			
				|  |  |         // 高血压预警
 | 
	
		
			
				|  |  |         String sql01 = "SELECT count(DISTINCT  a.id)\n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.standard_status='1'\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease IN ('1','3') \n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorId + "'";
 | 
	
		
			
				|  |  |         // 高血压
 | 
	
		
			
				|  |  |         String sql02 = "SELECT count(DISTINCT  a.id)\n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease IN ('1','3') \n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorId + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         // 糖尿病预警
 | 
	
		
			
				|  |  |         String sql03 = "SELECT count(DISTINCT  a.id)\n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.standard_status='1'\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease IN ('2','3') \n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorId + "'";
 | 
	
		
			
				|  |  |         // 糖尿病
 | 
	
		
			
				|  |  |         String sql04 = "SELECT count(DISTINCT  a.id)\n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease IN ('2','3') \n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorId + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         CompletableFuture<Integer> future01 = CompletableFuture.supplyAsync(() -> {
 | 
	
		
			
				|  |  |             Integer count = jdbcTemplate.queryForObject(sql01, Integer.class);
 | 
	
		
			
				|  |  |             return count;
 | 
	
		
			
				|  |  |         }, execute);
 | 
	
		
			
				|  |  |         CompletableFuture<Integer> future02 = CompletableFuture.supplyAsync(() -> {
 | 
	
		
			
				|  |  |             Integer count = jdbcTemplate.queryForObject(sql02, Integer.class);
 | 
	
		
			
				|  |  |             return count;
 | 
	
		
			
				|  |  |         }, execute);
 | 
	
		
			
				|  |  |         CompletableFuture<Integer> future03 = CompletableFuture.supplyAsync(() -> {
 | 
	
		
			
				|  |  |             Integer count = jdbcTemplate.queryForObject(sql03, Integer.class);
 | 
	
		
			
				|  |  |             return count;
 | 
	
		
			
				|  |  |         }, execute);
 | 
	
		
			
				|  |  |         CompletableFuture<Integer> future04 = CompletableFuture.supplyAsync(() -> {
 | 
	
		
			
				|  |  |             Integer count = jdbcTemplate.queryForObject(sql04, Integer.class);
 | 
	
		
			
				|  |  |             return count;
 | 
	
		
			
				|  |  |         }, execute);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         CompletableFuture.allOf(future01, future02, future03, future04).get();
 | 
	
		
			
				|  |  |         Integer count1 = future01.get();// 高血压预警
 | 
	
		
			
				|  |  |         Integer count2 = future02.get();// 高血压
 | 
	
		
			
				|  |  |         Integer count3 = future03.get();// 糖尿病预警
 | 
	
		
			
				|  |  |         Integer count4 = future04.get();// 糖尿病
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         HashMap<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  |         map.put("gxy_yj", count1);// 高血压预警
 | 
	
		
			
				|  |  |         map.put("gxy", count2);// 高血压预警
 | 
	
		
			
				|  |  |         map.put("tnb_yj", count3);// 高血压预警
 | 
	
		
			
				|  |  |         map.put("tnb", count4);// 高血压预警
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * labelType 1高血压 2糖尿病
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType, String searchContent, int page, int pageSize) {
 | 
	
		
			
				|  |  |         String sql = "SELECTDISTINCT a.id,a.`name`,a.idcard,a.mobile,a.ssc, TIMESTAMPDIFF(YEAR, a.birthday, CURDATE()) AS age ,a.sex \n" +
 | 
	
		
			
				|  |  |                 "FROM base_patient a \n" +
 | 
	
		
			
				|  |  |                 "INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
 | 
	
		
			
				|  |  |                 "WHERE 1=1\n" +
 | 
	
		
			
				|  |  |                 "AND a.disease_condition IN('1','2','3')\n" +
 | 
	
		
			
				|  |  |                 "AND b.doctor_id ='" + doctorId + "'";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(labelType)) {
 | 
	
		
			
				|  |  |             if ("1".equals(labelType)) {
 | 
	
		
			
				|  |  |                 sql += "AND a.disease IN ('1','3') \n";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("2".equals(labelType)) {
 | 
	
		
			
				|  |  |                 sql += "AND a.disease IN ('2','3') \n";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(searchContent)) {
 | 
	
		
			
				|  |  |             sql += " AND a.`name` LIKE '%" + searchContent + "%' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql += " LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |