|  | @ -88,45 +88,46 @@ public class StatisticsService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject serviceResources(){
 |  |     public JSONObject serviceResources(){
 | 
												
													
														
															|  |         String orgFilter = "";
 |  |         String orgFilter = "";
 | 
												
													
														
															|  |         String helperFilter = "";
 |  | 
 | 
												
													
														
															|  |         String teacherFilter = "";
 |  | 
 | 
												
													
														
															|  |         String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
 |  |         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);
 |  |         List<Map<String,Object>> listOrg =  jdbcTemplate.queryForList(sqlOrg);
 | 
												
													
														
															|  |         if(listOrg.size()>0){
 |  |         if(listOrg.size()>0){
 | 
												
													
														
															|  |             String orgCodes = String.valueOf(listOrg.get(0).get("orgCodes"));
 |  |             String orgCodes = String.valueOf(listOrg.get(0).get("orgCodes"));
 | 
												
													
														
															|  |             orgCodes = orgCodes.replaceAll(",","','");
 |  |             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+"')";
 |  | 
 | 
												
													
														
															|  | 
 |  |             orgFilter = " and code not in ('"+orgCodes+"')";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         JSONObject res = new JSONObject();
 |  |         JSONObject res = new JSONObject();
 | 
												
													
														
															|  |         String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) 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 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 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" +helperFilter;
 |  | 
 | 
												
													
														
															|  |         String teacherSql = "SELECT COUNT(1) FROM base_doctor WHERE del = 1 AND doctor_level = 3"+teacherFilter;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //助老员和教师注册人数
 | 
												
													
														
															|  | 
 |  |         Integer doctorNum = 0;
 | 
												
													
														
															|  | 
 |  |         Integer helperNum = 0;
 | 
												
													
														
															|  | 
 |  |         Integer teacherNum = 0;
 | 
												
													
														
															|  | 
 |  |         String sql2 = "SELECT COUNT(a.id) c,a.doctor_level from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
 | 
												
													
														
															|  | 
 |  |                 "and a.doctor_level is not null and h.org_code not in ( " +
 | 
												
													
														
															|  | 
 |  |                 "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
 | 
												
													
														
															|  | 
 |  |                 ") GROUP BY a.doctor_level";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
 | 
												
													
														
															|  | 
 |  |         for(Map<String,Object> map:list2){
 | 
												
													
														
															|  | 
 |  |             String archive_type = map.get("doctor_level").toString();
 | 
												
													
														
															|  | 
 |  |             Integer num = Integer.valueOf(map.get("c").toString());
 | 
												
													
														
															|  | 
 |  |             if("1".equals(archive_type)){
 | 
												
													
														
															|  | 
 |  |                 doctorNum = num;
 | 
												
													
														
															|  | 
 |  |                 continue;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if("2".equals(archive_type)){
 | 
												
													
														
															|  | 
 |  |                 helperNum = num;
 | 
												
													
														
															|  | 
 |  |                 continue;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if("3".equals(archive_type)){
 | 
												
													
														
															|  | 
 |  |                 teacherNum = num;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql,Integer.class);
 |  |         Integer medicalInstitutionNum = jdbcTemplate.queryForObject(medicalInstitutionSql,Integer.class);
 | 
												
													
														
															|  |         Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql,Integer.class);
 |  |         Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql,Integer.class);
 | 
												
													
														
															|  |         Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql,Integer.class);
 |  |         Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql,Integer.class);
 | 
												
													
														
															|  |         Integer doctorNum = jdbcTemplate.queryForObject(doctorSql,Integer.class);
 |  | 
 | 
												
													
														
															|  |         Integer helperNum = jdbcTemplate.queryForObject(helperSql,Integer.class);
 |  | 
 | 
												
													
														
															|  |         Integer teacherNum = jdbcTemplate.queryForObject(teacherSql,Integer.class);
 |  | 
 | 
												
													
														
															|  |         res.put("medicalInstitutionNum",medicalInstitutionNum);             //医疗结构
 |  |         res.put("medicalInstitutionNum",medicalInstitutionNum);             //医疗结构
 | 
												
													
														
															|  |         res.put("elderlyCarServiceNum",elderlyCarServiceNum);               //养老机构
 |  |         res.put("elderlyCarServiceNum",elderlyCarServiceNum);               //养老机构
 | 
												
													
														
															|  |         res.put("childcareInstitutionsssNum",childcareInstitutionsssNum);   //托育机构
 |  |         res.put("childcareInstitutionsssNum",childcareInstitutionsssNum);   //托育机构
 | 
												
											
												
													
														
															|  | @ -376,22 +377,54 @@ public class StatisticsService {
 | 
												
													
														
															|  |         Integer childTotal = 0;
 |  |         Integer childTotal = 0;
 | 
												
													
														
															|  |         Integer helperTotal = 0;
 |  |         Integer helperTotal = 0;
 | 
												
													
														
															|  |         Integer teacherTotal = 0;
 |  |         Integer teacherTotal = 0;
 | 
												
													
														
															|  | 
 |  |         Integer olderOff = 0;
 | 
												
													
														
															|  | 
 |  |         Integer childOff = 0;
 | 
												
													
														
															|  | 
 |  |         Integer helperOff = 0;
 | 
												
													
														
															|  | 
 |  |         Integer teacherOff = 0;
 | 
												
													
														
															|  | 
 |  |         Integer helperOn = 0;
 | 
												
													
														
															|  | 
 |  |         Integer teacherOn = 0;
 | 
												
													
														
															|  | 
 |  |         Integer childOn = 0;
 | 
												
													
														
															|  | 
 |  |         Integer olderOn = 0;
 | 
												
													
														
															|  | 
 |  |         Integer olderWxOn = 0;
 | 
												
													
														
															|  | 
 |  |         Integer olderPadOn = 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 pateintFilter = "";
 | 
												
													
														
															|  | 
 |  |         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(",","','");
 | 
												
													
														
															|  | 
 |  |             pateintFilter = " and id not in ('"+orgCodes+"')";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type,IFNULL(on_line,0) online from base_patient WHERE archive_type is  not null" +
 | 
												
													
														
															|  | 
 |  |                 " and del='1' "+pateintFilter+" GROUP BY archive_type";
 | 
												
													
														
															|  |         List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
 |  |         List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
 | 
												
													
														
															|  |         for(Map<String,Object> map:list1){
 |  |         for(Map<String,Object> map:list1){
 | 
												
													
														
															|  |             String archive_type = map.get("archive_type").toString();
 |  |             String archive_type = map.get("archive_type").toString();
 | 
												
													
														
															|  |             Integer num = Integer.valueOf(map.get("c").toString());
 |  |             Integer num = Integer.valueOf(map.get("c").toString());
 | 
												
													
														
															|  | 
 |  |             Integer online = Integer.valueOf(map.get("online").toString());
 | 
												
													
														
															|  |             if("1".equals(archive_type)){
 |  |             if("1".equals(archive_type)){
 | 
												
													
														
															|  |                 olderTotal = num;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(online == 1){
 | 
												
													
														
															|  | 
 |  |                     olderOn = num;
 | 
												
													
														
															|  | 
 |  |                 }else{
 | 
												
													
														
															|  | 
 |  |                     olderOff = num;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |                 continue;
 |  |                 continue;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if("2".equals(archive_type)){
 |  |             if("2".equals(archive_type)){
 | 
												
													
														
															|  |                 childTotal = num;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(online == 1){
 | 
												
													
														
															|  | 
 |  |                     childOn = num;
 | 
												
													
														
															|  | 
 |  |                 }else{
 | 
												
													
														
															|  | 
 |  |                     childOff = num;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         olderTotal = olderOff+olderOn;
 | 
												
													
														
															|  | 
 |  |         childTotal = childOff+childOn;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //助老员和教师注册人数
 |  |         //助老员和教师注册人数
 | 
												
													
														
															|  |         String sql2 = "SELECT COUNT(a.id) c,a.doctor_level from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
 | 
												
													
														
															|  |                 "and a.doctor_level is not null and h.org_code not in ( " +
 |  |                 "and a.doctor_level is not null and h.org_code not in ( " +
 | 
												
													
														
															|  |                 "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
 |  |                 "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
 | 
												
													
														
															|  |                 ") GROUP BY a.doctor_level";
 |  |                 ") GROUP BY a.doctor_level";
 | 
												
											
												
													
														
															|  | @ -399,50 +432,32 @@ public class StatisticsService {
 | 
												
													
														
															|  |         for(Map<String,Object> map:list2){
 |  |         for(Map<String,Object> map:list2){
 | 
												
													
														
															|  |             String archive_type = map.get("doctor_level").toString();
 |  |             String archive_type = map.get("doctor_level").toString();
 | 
												
													
														
															|  |             Integer num = Integer.valueOf(map.get("c").toString());
 |  |             Integer num = Integer.valueOf(map.get("c").toString());
 | 
												
													
														
															|  | 
 |  |             Integer online = Integer.valueOf(map.get("online").toString());
 | 
												
													
														
															|  |             if("2".equals(archive_type)){
 |  |             if("2".equals(archive_type)){
 | 
												
													
														
															|  |                 helperTotal = num;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(online == 1){
 | 
												
													
														
															|  | 
 |  |                     helperOn = num;
 | 
												
													
														
															|  | 
 |  |                 }else{
 | 
												
													
														
															|  | 
 |  |                     helperOff = num;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |                 continue;
 |  |                 continue;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if("3".equals(archive_type)){
 |  |             if("3".equals(archive_type)){
 | 
												
													
														
															|  |                 teacherTotal = num;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(online == 1){
 | 
												
													
														
															|  | 
 |  |                     teacherOn = num;
 | 
												
													
														
															|  | 
 |  |                 }else{
 | 
												
													
														
															|  | 
 |  |                     teacherOff = num;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         helperTotal = helperOff+helperOn;
 | 
												
													
														
															|  | 
 |  |         teacherTotal = teacherOff+teacherOn;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
 |  |         //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
 | 
												
													
														
															|  |         String onlineCount = imUtil.getOnlineCountByType("");
 |  |         String onlineCount = imUtil.getOnlineCountByType("");
 | 
												
													
														
															|  |         JSONObject jsonObject = JSON.parseObject(onlineCount).getJSONObject("data");
 |  |         JSONObject jsonObject = JSON.parseObject(onlineCount).getJSONObject("data");
 | 
												
													
														
															|  |         //olderPad":0,"olderWx":0,"child":0,"teacher":0,"helper":0
 |  |         //olderPad":0,"olderWx":0,"child":0,"teacher":0,"helper":0
 | 
												
													
														
															|  |         Integer helperOn = jsonObject.getInteger("helper");
 |  | 
 | 
												
													
														
															|  |         Integer teacherOn = jsonObject.getInteger("teacher");
 |  | 
 | 
												
													
														
															|  |         Integer childOn = jsonObject.getInteger("child");
 |  | 
 | 
												
													
														
															|  |         Integer olderWxOn = jsonObject.getInteger("olderWx");
 |  | 
 | 
												
													
														
															|  |         Integer olderPadOn = jsonObject.getInteger("olderPad");
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         int repeatNum = 0;
 |  | 
 | 
												
													
														
															|  |         if(olderWxOn>0&&olderPadOn>0){
 |  | 
 | 
												
													
														
															|  |             //2个都大于0 要计算重复的人数
 |  | 
 | 
												
													
														
															|  |             String onlineOlderWx = imUtil.getOnlineListByType("olderWx");
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             JSONObject olderWx = JSON.parseObject(onlineOlderWx);
 |  | 
 | 
												
													
														
															|  |             List<String> list = new ArrayList(olderWx.size());
 |  | 
 | 
												
													
														
															|  |             olderWx.entrySet().stream().forEach(one->{
 |  | 
 | 
												
													
														
															|  |                 list.add(one.getKey());
 |  | 
 | 
												
													
														
															|  |             });
 |  | 
 | 
												
													
														
															|  |             String onlineOlderPad = imUtil.getOnlineListByType("olderPad");
 |  | 
 | 
												
													
														
															|  |             JSONObject olderPad = JSON.parseObject(onlineOlderPad);
 |  | 
 | 
												
													
														
															|  |             for (Map.Entry<String,Object> s:olderPad.entrySet()){
 |  | 
 | 
												
													
														
															|  |                 if(list.contains(s.getKey())){
 |  | 
 | 
												
													
														
															|  |                     repeatNum++;
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  |         Integer olderOff = olderTotal - olderWxOn - olderPadOn + repeatNum;
 |  | 
 | 
												
													
														
															|  |         olderOff = olderOff>0?olderOff:0;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         Integer childOff = childTotal - childOn;
 |  | 
 | 
												
													
														
															|  |         Integer helperOff = helperTotal - helperOn;
 |  | 
 | 
												
													
														
															|  |         Integer teacherOff = teacherTotal - teacherOn;
 |  | 
 | 
												
													
														
															|  | 
 |  |         olderWxOn = jsonObject.getInteger("olderWx");
 | 
												
													
														
															|  | 
 |  |         olderPadOn = jsonObject.getInteger("olderPad");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         result.put("olderTotal",olderTotal);
 |  |         result.put("olderTotal",olderTotal);
 | 
												
													
														
															|  |         result.put("childTotal",childTotal);
 |  |         result.put("childTotal",childTotal);
 | 
												
											
												
													
														
															|  | @ -720,7 +735,7 @@ public class StatisticsService {
 | 
												
													
														
															|  |                 " GROUP BY dict.dict_code; ";
 |  |                 " GROUP BY dict.dict_code; ";
 | 
												
													
														
															|  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String older = "  select count(id) from base_patient where archive_type=1 ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         String older = "  select count(patient) from wlyy_patient_label where label_type='1' ";
 | 
												
													
														
															|  |         Integer count = jdbcTemplate.queryForObject(older,Integer.class);
 |  |         Integer count = jdbcTemplate.queryForObject(older,Integer.class);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         for(Map<String,Object> map:list){
 |  |         for(Map<String,Object> map:list){
 |