|
@ -28,7 +28,6 @@ import org.quartz.JobExecutionException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.core.metadata.SybaseCallMetaDataProvider;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
|
|
@ -163,46 +162,52 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
Map<String, Map<String, Map>> orgAgeMap = new HashMap<String, Map<String, Map>>();//key是机构代码
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
Hospital hospital = hospitalsMap.get(getOrg(signFamily.getHospital()));//得到患者签约的机构
|
|
|
if(hospital == null) continue;
|
|
|
String town = hospital.getTown();
|
|
|
int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());//根据card解析年龄
|
|
|
String ageCode = getAgeCode(age);//得到年龄的code
|
|
|
|
|
|
boolean hasGXY = false;//有高血压
|
|
|
boolean hasTNB = false;//有糖尿病
|
|
|
//如果是慢病的 统计高血压的 糖尿病 1高血压,2糖尿病 糖尿病和高血压是100
|
|
|
//如果是慢病的 统计高血压的 糖尿病 1高血压,2糖尿病 糖尿病和高血压是3
|
|
|
String diseaseType="";
|
|
|
String jsonString = redisTemplate.opsForValue().get("disease:" + signFamily.getPatient());
|
|
|
if (StringUtils.isEmpty(jsonString)) {
|
|
|
continue;
|
|
|
}
|
|
|
//排除数据 只留下高血压和糖尿病
|
|
|
List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
|
|
|
JSONArray redisValues = new JSONArray(jsonString);
|
|
|
for (Object obj : redisValues) {
|
|
|
JSONObject redisValue = new JSONObject(obj);
|
|
|
if(!redisValue.has("signType")){
|
|
|
continue;
|
|
|
}
|
|
|
//排除掉三师签约
|
|
|
if ("1".equals(redisValue.get("signType").toString())) {
|
|
|
continue;
|
|
|
}
|
|
|
String disease = redisValue.get("disease").toString();
|
|
|
if (Integer.valueOf(disease).equals("1")) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasGXY = true;//设置有高血压
|
|
|
diseaseType="1";
|
|
|
}
|
|
|
if (Integer.valueOf(disease).equals("2")) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasTNB = true;//设置有糖尿病
|
|
|
diseaseType="2";
|
|
|
diseaseType="4";//健康人群
|
|
|
}else{
|
|
|
//排除数据 只留下高血压和糖尿病
|
|
|
List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
|
|
|
JSONArray redisValues = new JSONArray(jsonString);
|
|
|
if(redisValues.length()>0){
|
|
|
for (Object obj : redisValues) {
|
|
|
JSONObject redisValue = (JSONObject)(obj);
|
|
|
if(!redisValue.has("signType")){
|
|
|
continue;
|
|
|
}
|
|
|
//排除掉三师签约
|
|
|
if ("1".equals(redisValue.getString("signType"))) {
|
|
|
continue;
|
|
|
}
|
|
|
String disease = redisValue.getString("disease");
|
|
|
if (("1").equals(disease)) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasGXY = true;//设置有高血压
|
|
|
diseaseType="1";
|
|
|
}
|
|
|
if (("2").equals(disease)) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasTNB = true;//设置有糖尿病
|
|
|
diseaseType="2";
|
|
|
}
|
|
|
}
|
|
|
if(hasGXY&&hasTNB){
|
|
|
diseaseType="3";
|
|
|
}
|
|
|
}else{
|
|
|
diseaseType="4";
|
|
|
}
|
|
|
}
|
|
|
if(hasGXY&&hasTNB){
|
|
|
diseaseType="100";
|
|
|
}
|
|
|
//统计市
|
|
|
compute(cityAgeMap, Constant.city, ageCode, diseaseType);
|
|
|
//统计区
|
|
@ -223,7 +228,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
for (Map.Entry<String, Map<String, Map>> entry : cityAgeMap.entrySet()) {
|
|
|
Map<String, Map> oneAgeMap = entry.getValue();
|
|
|
for(int i=1;i<7;i++){
|
|
|
for(int j=1;j<4;j++){
|
|
|
for(int j=1;j<5;j++){
|
|
|
String key_2=i+"";
|
|
|
String key_3=j+"";
|
|
|
String name=Constant.cityName;
|
|
@ -231,7 +236,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
if (oneAgeMap != null && oneAgeMap.containsKey(key_2)) {
|
|
|
Map<String,Long> key3Map=oneAgeMap.get(key_2);
|
|
|
if(key3Map!=null&&key3Map.containsKey(key_3)){
|
|
|
jsonObject.put("num",entry.getValue().get((key3Map.get(key_3) + "")));
|
|
|
jsonObject.put("num",key3Map.get(key_3) + "");
|
|
|
}else{
|
|
|
jsonObject.put("num",0);
|
|
|
}
|
|
@ -250,7 +255,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
Map<String, Map> oneAgeMap = townAgeMap.get(entry.getKey());//得到当个区的统计数据
|
|
|
Town townObj = entry.getValue();//得到区级信息
|
|
|
for(int i=1;i<7;i++){
|
|
|
for(int j=1;j<4;j++){
|
|
|
for(int j=1;j<5;j++){
|
|
|
String key_2=i+"";
|
|
|
String key_3=j+"";
|
|
|
String name=townObj.getName();
|
|
@ -277,7 +282,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
Map<String, Map> oneAgeMap = orgAgeMap.get(entry.getKey());//得到当个机构的统计数据
|
|
|
Hospital hospital = entry.getValue();//得到机构信息
|
|
|
for(int i=1;i<7;i++){
|
|
|
for(int j=1;j<4;j++){
|
|
|
for(int j=1;j<5;j++){
|
|
|
String key_2=i+"";
|
|
|
String key_3=j+"";
|
|
|
String name=hospital.getName();
|
|
@ -344,24 +349,28 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String hospitalCode=signFamily.getHospital();
|
|
|
String hospitalCode=getOrg(signFamily.getHospital());
|
|
|
Hospital hospital=hospitalsMap.get(hospitalCode);
|
|
|
|
|
|
if(hospital == null) continue;
|
|
|
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
if(hospital == null) continue;
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(hospital.getCode()));
|
|
|
if(orgjo==null){
|
|
|
System.out.println(new JSONObject(hospital).toString());
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(hospital.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
if(!"00".equals(hospital.getCode().substring(8))){
|
|
|
String orgCodeTemp=hospital.getCode().substring(0,8)+"00";
|
|
|
JSONObject orgjo=tjOrgMap.get(orgCodeTemp);
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}else{
|
|
|
JSONObject orgjo=tjOrgMap.get(hospital.getCode());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}
|
|
|
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjQkdoctorMap.get(signFamily.getDoctor());
|
|
|
if(qkjo!=null){
|
|
@ -444,30 +453,22 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
// modifid by lyr 2016-09-29
|
|
|
System.out.println(new JSONObject(signFamily).toString());
|
|
|
// modifid by lyr 2016-09-29
|
|
|
String hospitalCode=signFamily.getHospital();
|
|
|
String hospitalCode=getOrg(signFamily.getHospital());
|
|
|
Hospital hospital=hospitalsMap.get(hospitalCode);
|
|
|
// modifid by lyr 2016-09-29
|
|
|
System.out.println(hospital != null ? new JSONObject(hospital).toString():"hospital is null");
|
|
|
// modifid by lyr 2016-09-29
|
|
|
if(hospital == null) continue;
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(hospital.getCode()));
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(hospital.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
if(!"00".equals(hospital.getCode().substring(8))){
|
|
|
String orgCodeTemp=hospital.getCode().substring(0,8)+"00";
|
|
|
JSONObject orgjo=tjOrgMap.get(orgCodeTemp);
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}else{
|
|
|
JSONObject orgjo=tjOrgMap.get(hospital.getCode());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjQkdoctorMap.get(signFamily.getDoctor());
|
|
|
if(qkjo!=null){
|
|
@ -513,15 +514,19 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
if(doctor==null){
|
|
|
continue;
|
|
|
}
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(doctor.getHospital()));
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(doctor.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(doctor.getHospital());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjJkdoctorMap.get(doctor.getCode());
|
|
|
if(qkjo!=null){
|
|
@ -564,15 +569,19 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
if(doctor==null){
|
|
|
continue;
|
|
|
}
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(doctor.getHospital()));
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(doctor.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(doctor.getHospital());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjJkdoctorMap.get(doctor.getCode());
|
|
|
if(qkjo!=null){
|
|
@ -620,14 +629,18 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(doctor.getHospital()));
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(doctor.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(doctor.getHospital());
|
|
|
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjQkdoctorMap.get(doctor.getCode());
|
|
@ -665,7 +678,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
Map<String, Map<String, Long>> orgSexMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String idcard = signFamily.getIdcard();//得到签约中患者的身份证号
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
Hospital hospital = hospitalsMap.get(getOrg(signFamily.getHospital()));//得到患者签约的机构
|
|
|
if(hospital==null){
|
|
|
continue;
|
|
|
}
|
|
@ -839,7 +852,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String patient=signFamily.getPatient();
|
|
|
String group = groupMap.get(patient);//得到该签约病人的所在分组 1 普通 2 慢病 3是 65岁以上人群
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
Hospital hospital = hospitalsMap.get(getOrg(signFamily.getHospital()));//得到患者签约的机构
|
|
|
if(hospital==null){
|
|
|
continue;
|
|
|
}
|
|
@ -886,20 +899,20 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
List<JSONObject> jsonObjects = new ArrayList<JSONObject>();
|
|
|
JSONArray redisValues = new JSONArray(jsonString);
|
|
|
for (Object obj : redisValues) {
|
|
|
JSONObject redisValue = new JSONObject(obj);
|
|
|
JSONObject redisValue = (JSONObject)(obj);
|
|
|
if(!redisValue.has("signType")){
|
|
|
continue;
|
|
|
}
|
|
|
//排除掉三师签约
|
|
|
if ("1".equals(redisValue.get("signType").toString())) {
|
|
|
if ("1".equals(redisValue.getString("signType"))) {
|
|
|
continue;
|
|
|
}
|
|
|
String disease = redisValue.get("disease").toString();
|
|
|
if (Integer.valueOf(disease).equals("1")) {
|
|
|
String disease = redisValue.getString("disease");
|
|
|
if ("1".equals(disease)) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasGXY = true;//设置有高血压
|
|
|
}
|
|
|
if (Integer.valueOf(disease).equals("2")) {
|
|
|
if ("2".equals(disease)) {
|
|
|
jsonObjects.add(redisValue);
|
|
|
hasTNB = true;//设置有糖尿病
|
|
|
}
|
|
@ -933,8 +946,9 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
}
|
|
|
//统计机构
|
|
|
//统计站
|
|
|
if (!"00".equals(hospital.getCode().substring(8))) {
|
|
|
String orgCodeTemp = hospital.getCode().substring(0, 8) + "00";
|
|
|
String org=hospital.getCode();
|
|
|
if (!"00".equals(org.substring(org.length()-2,org.length()))) {
|
|
|
String orgCodeTemp =org.substring(0,org.length()-2)+"00";
|
|
|
//统计机构
|
|
|
if (orgGroupMap.containsKey(orgCodeTemp)) {
|
|
|
Map<String, Long> groupMapTemp = orgGroupMap.get(orgCodeTemp);
|
|
@ -1099,6 +1113,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
for (Map.Entry<String, Hospital> hospitalEntry : hospitalsMap.entrySet()) {
|
|
|
//保存健康人群
|
|
|
Hospital hospital=hospitalsMap.get(hospitalEntry.getKey());
|
|
|
if(hospital == null) continue;
|
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
|
|
|
Map<String, Long> oneOrg= orgGroupMap.get(hospitalEntry.getKey());
|
|
@ -1190,7 +1205,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
Map<String, Map<String, Long>> orgAgeMap = new HashMap<String, Map<String, Long>>();//key是机构代码
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
Hospital hospital = hospitalsMap.get(signFamily.getHospital());//得到患者签约的机构
|
|
|
Hospital hospital = hospitalsMap.get(getOrg(signFamily.getHospital()));//得到患者签约的机构
|
|
|
if(hospital==null){
|
|
|
continue;
|
|
|
}
|
|
@ -1402,7 +1417,7 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
}
|
|
|
jsonObject.put("name",hospital.getName());
|
|
|
jsonObject.put("date", DateUtil.dateToStrLong(new Date()));
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:8:2:4"+entry.getKey()).toString(),jsonObject.toString());
|
|
|
redisTemplate.opsForValue().set(new StringBuffer("quota:8:2:4:"+entry.getKey()).toString(),jsonObject.toString());
|
|
|
//保存50~65
|
|
|
jsonObject=new JSONObject();
|
|
|
if (oneAgeMap!=null&&oneAgeMap.containsKey(Constant.level_age_5)) {
|
|
@ -1440,24 +1455,23 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String hospitalCode=signFamily.getHospital();
|
|
|
String hospitalCode=getOrg(signFamily.getHospital());
|
|
|
Hospital hospital=hospitalsMap.get(hospitalCode);
|
|
|
if(hospital == null) continue;
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
JSONObject orgjo=tjOrgMap.get(getOrg(hospital.getCode()));
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(hospital.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
//判断是中心还是服务站 服务站的话添加到中心去
|
|
|
if(!"00".equals(hospital.getCode().substring(8))){
|
|
|
String orgCodeTemp=hospital.getCode().substring(0,8)+"00";
|
|
|
JSONObject orgjo=tjOrgMap.get(orgCodeTemp);
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}else{
|
|
|
JSONObject orgjo=tjOrgMap.get(hospital.getCode());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
}
|
|
|
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjQkdoctorMap.get(signFamily.getDoctor());
|
|
|
if(qkjo!=null){
|
|
@ -1496,17 +1510,22 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
|
|
|
//统计有签约的
|
|
|
for (SignFamily signFamily : signFamilys) {
|
|
|
String hospitalCode=signFamily.getHospital();
|
|
|
String hospitalCode=getOrg(signFamily.getHospital());
|
|
|
Hospital hospital=hospitalsMap.get(hospitalCode);
|
|
|
if(hospital == null) continue;
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(hospital.getCode());
|
|
|
if(orgjo==null){
|
|
|
continue;
|
|
|
}
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
//统计市
|
|
|
JSONObject cityjo=tjCityMap.get(Constant.city);
|
|
|
cityjo.put("num",((int)cityjo.get("num"))+1);
|
|
|
//统计区
|
|
|
JSONObject townjo=tjTownMap.get(hospital.getTown());
|
|
|
townjo.put("num",((int)townjo.get("num"))+1);
|
|
|
//统计机构
|
|
|
JSONObject orgjo=tjOrgMap.get(hospital.getCode());
|
|
|
orgjo.put("num",((int)orgjo.get("num"))+1);
|
|
|
|
|
|
//统计全科医生
|
|
|
JSONObject qkjo=tjQkdoctorMap.get(signFamily.getDoctor());
|
|
|
if(qkjo!=null){
|
|
@ -1593,5 +1612,12 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
return Constant.level_age_6;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String getOrg(String org){
|
|
|
//if(!"00".equals(org.substring(org.length()-2,org.length()))){
|
|
|
if(org.length() == 10 && !org.endsWith("00")){
|
|
|
return org.substring(0,org.length()-2)+"00";
|
|
|
}else{
|
|
|
return org;
|
|
|
}
|
|
|
}
|
|
|
}
|