|  | @ -0,0 +1,115 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.es.service.yqfk;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  *
 | 
	
		
			
				|  |  |  * 卫建局疫情防控
 | 
	
		
			
				|  |  |  *
 | 
	
		
			
				|  |  |  * Created by wangzhinan on 2020/08/21
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @Service
 | 
	
		
			
				|  |  | public class YqfkService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private Logger logger = LoggerFactory.getLogger(YqfkService.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 疫情防控头部总数统计
 | 
	
		
			
				|  |  |      * @param startTime
 | 
	
		
			
				|  |  |      * @param endTime
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject yqfkStatisticsHead(String startTime,String endTime){
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         String sql = "select COUNT(1) as confirmedTotal from MID_CDC_CASE_INFO where ";
 | 
	
		
			
				|  |  |         object.put("confirmed","");//现有确诊
 | 
	
		
			
				|  |  |         object.put("newHome","");//新增本土
 | 
	
		
			
				|  |  |         object.put("newAsymptomatic","");//新增无症状;
 | 
	
		
			
				|  |  |         object.put("confirmedTotal","");//累计确诊
 | 
	
		
			
				|  |  |         object.put("cureTotal","");//累计治愈
 | 
	
		
			
				|  |  |         object.put("deathTotal","");//累计死亡
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject yqfkStatisticsTail(String startTime,String endTime){
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         JSONObject MjObject = new JSONObject();//在厦密接
 | 
	
		
			
				|  |  |         MjObject.put("zyTotal","");//正转运
 | 
	
		
			
				|  |  |         MjObject.put("jdTotal","");//在酒店/已采核酸
 | 
	
		
			
				|  |  |         MjObject.put("dlsTotal","");//待落实
 | 
	
		
			
				|  |  |         MjObject.put("total","");//总计
 | 
	
		
			
				|  |  |         JSONObject CmObject = new JSONObject();//在厦次密
 | 
	
		
			
				|  |  |         CmObject.put("zyTotal","");//正转运
 | 
	
		
			
				|  |  |         CmObject.put("jdTotal","");//在酒店/已采核酸
 | 
	
		
			
				|  |  |         CmObject.put("dlsTotal","");//待落实
 | 
	
		
			
				|  |  |         CmObject.put("total","");//总计
 | 
	
		
			
				|  |  |         JSONObject ybObject = new JSONObject();//在厦一般接触者
 | 
	
		
			
				|  |  |         ybObject.put("zyTotal","");//正转运
 | 
	
		
			
				|  |  |         ybObject.put("jdTotal","");//在酒店/已采核酸
 | 
	
		
			
				|  |  |         ybObject.put("dlsTotal","");//待落实
 | 
	
		
			
				|  |  |         ybObject.put("total","");//总计
 | 
	
		
			
				|  |  |         object.put("MjObject",MjObject);
 | 
	
		
			
				|  |  |         object.put("CmObject", CmObject);
 | 
	
		
			
				|  |  |         object.put("ybObject",ybObject);
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  List<Map<String, Object>> confirmedList(){
 | 
	
		
			
				|  |  |         String confirmedListSql = "select PATIENT_ID as \"patientId\",PATIENT_NAME as \"patientName\",PATIENT_SEX as \"patientSex\",PATIENT_AGE as \"patientAge\",DIAG_TIME as \"diagTime\" from MID_CDC_CASE_INFO ";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> confirmedList = jdbcTemplate.queryForList(confirmedListSql);
 | 
	
		
			
				|  |  |         if (confirmedList!=null&&confirmedList.size()!=0){
 | 
	
		
			
				|  |  |             for (Map<String,Object> map:confirmedList){
 | 
	
		
			
				|  |  |                 String patientId = map.get("patientId").toString();
 | 
	
		
			
				|  |  |                 //密接人数计算
 | 
	
		
			
				|  |  |                 String mjTotalSql = "select count(1) as total from MID_CDC_CCC_INFO where PATIENT_ID='"+patientId+"'";
 | 
	
		
			
				|  |  |                 List<Map<String, Object>> mjList = jdbcTemplate.queryForList(mjTotalSql);
 | 
	
		
			
				|  |  |                 Integer mjTotal = 0;//密接人数
 | 
	
		
			
				|  |  |                 if (mjList!=null&&mjList.size()!=0){
 | 
	
		
			
				|  |  |                     mjTotal = Integer.parseInt(mjList.get(0).get("total").toString());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 map.put("mjTotal",mjTotal);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //次密接人数计算
 | 
	
		
			
				|  |  |                 String cmjTotalSql = "select count(1) as total from MID_CDC_CCC_SED_INFO where PATIENT_ID='"+patientId+"'";
 | 
	
		
			
				|  |  |                 List<Map<String, Object>> cmjList = jdbcTemplate.queryForList(cmjTotalSql);
 | 
	
		
			
				|  |  |                 Integer cmjTotal = 0;//密接人数
 | 
	
		
			
				|  |  |                 if (cmjList!=null&&cmjList.size()!=0){
 | 
	
		
			
				|  |  |                     cmjTotal = Integer.parseInt(cmjList.get(0).get("total").toString());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 map.put("cmjTotal",cmjTotal);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //一般接触人数计算
 | 
	
		
			
				|  |  |                 String ybmjTotalSql = "select count(1) as total from MID_KEYNOTE_CROWD_INFO where PATIENT_ID='"+patientId+"'";
 | 
	
		
			
				|  |  |                 List<Map<String, Object>> ybmjList = jdbcTemplate.queryForList(ybmjTotalSql);
 | 
	
		
			
				|  |  |                 Integer ybmjTotal = 0;//密接人数
 | 
	
		
			
				|  |  |                 if (ybmjList!=null&&ybmjList.size()!=0){
 | 
	
		
			
				|  |  |                     ybmjTotal = Integer.parseInt(ybmjList.get(0).get("total").toString());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 map.put("ybmjTotal",ybmjTotal);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return confirmedList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |