|  | @ -10,7 +10,6 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.login.BaseLoginLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.jw.es.util.ElasticsearchUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.es.util.SaveModel;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
	
		
			
				|  | @ -72,7 +71,7 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject statisticsTotalAmount( String endDate) throws Exception {
 | 
	
		
			
				|  |  |     public JSONObject statisticsTotalAmount(String endDate) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |         String index = "28,31,35,37,39,41,43,44";
 | 
	
		
			
				|  |  |         String[] indexes = index.split(",");
 | 
	
	
		
			
				|  | @ -88,15 +87,40 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject serviceResources(){
 | 
	
		
			
				|  |  | //        String sql = "SELECT type , COUNT(1) count FROM base_org WHERE del = 1 GROUP BY type";
 | 
	
		
			
				|  |  | //        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         String orgFilter = "";
 | 
	
		
			
				|  |  |         String helperFilter = "";
 | 
	
		
			
				|  |  |         String teacherFilter = "";
 | 
	
		
			
				|  |  |         String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listOrg =  jdbcTemplate.queryForList(sqlOrg);
 | 
	
		
			
				|  |  |         if(listOrg.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listOrg.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             orgFilter = " and id not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sqlHelper = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_helper' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listHelper =  jdbcTemplate.queryForList(sqlHelper);
 | 
	
		
			
				|  |  |         if(listHelper.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listHelper.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             helperFilter = " and id not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_teacher' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             teacherFilter = " and id not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |         String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) AND del = 1;";
 | 
	
		
			
				|  |  |         String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1";
 | 
	
		
			
				|  |  |         String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1";
 | 
	
		
			
				|  |  |         String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) AND del = 1 ";
 | 
	
		
			
				|  |  |         String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1"+orgFilter;
 | 
	
		
			
				|  |  |         String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1"+orgFilter;
 | 
	
		
			
				|  |  |         String doctorSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 1";
 | 
	
		
			
				|  |  |         String helperSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 2";
 | 
	
		
			
				|  |  |         String teacherSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 3";
 | 
	
		
			
				|  |  |         String helperSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 2" +helperFilter;
 | 
	
		
			
				|  |  |         String teacherSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 3"+teacherFilter;
 | 
	
		
			
				|  |  |         Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql,Integer.class);
 | 
	
		
			
				|  |  |         Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql,Integer.class);
 | 
	
	
		
			
				|  | @ -115,9 +139,22 @@ public class StatisticsService {
 | 
	
		
			
				|  |  |     // v0.7.0实时数据 照护对象、检测设备、紧急救助
 | 
	
		
			
				|  |  |     public JSONObject realTimeDataNew() throws Exception {
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String filter = "";
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " and id not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Integer olderTotal = 0;
 | 
	
		
			
				|  |  |         Integer childTotal = 0;
 | 
	
		
			
				|  |  |         String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type from base_patient WHERE archive_type is not null and del='1' GROUP BY archive_type";
 | 
	
		
			
				|  |  |         String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type from base_patient WHERE archive_type is not null and del='1' ";
 | 
	
		
			
				|  |  |         sql1 += filter;
 | 
	
		
			
				|  |  |         sql1 += " GROUP BY archive_type";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
 | 
	
		
			
				|  |  |         for(Map<String,Object> map:list1){
 | 
	
		
			
				|  |  |             String archive_type = map.get("archive_type").toString();
 |