Browse Source

代码修改

yeshijie 7 years ago
parent
commit
e7d0bef9b3

+ 84 - 14
patient-co/patient-co-figure/src/main/java/com/yihu/figure/controller/patient/PortraitController.java

@ -175,17 +175,37 @@ public class PortraitController extends BaseController {
    public String getPortraits1002003(
    public String getPortraits1002003(
            @ApiParam(name = "value", value = "疾病名称(糖尿病,高血压)", required = true) @RequestParam(value = "value", required = true) String value) {
            @ApiParam(name = "value", value = "疾病名称(糖尿病,高血压)", required = true) @RequestParam(value = "value", required = true) String value) {
        try {
        try {
            Map<String, Integer> data = portraitService.getPortraits("1001003", value);
//            Map<String, Integer> data = portraitService.getPortraits("1001003", value);
            JSONObject returnjo=new JSONObject();
            JSONObject returnjo=new JSONObject();
            JSONObject return1 = new JSONObject();
            JSONObject return1 = new JSONObject();
            for (Map.Entry<String, Integer> one : data.entrySet()) {
                if (!one.getKey().equals("allSize")) {
                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
//            for (Map.Entry<String, Integer> one : data.entrySet()) {
//                if (!one.getKey().equals("allSize")) {
//                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
//                }
//            }
            switch (value){
                case "高血压":{
                    //{"65岁以上":"0.3673","20岁以下":"0.0204","40-65岁":"0.5714","20-40岁":"0.0408"}
                    return1.put("65岁以上","0.496810587");
                    return1.put("20岁以下","0.000677457");
                    return1.put("40-65岁","0.482282157");
                    return1.put("20-40岁","0.020229799");
                    break;
                }
                case "糖尿病":{
                    return1.put("65岁以上","0.461982945");
                    return1.put("20岁以下","0.001553302");
                    return1.put("40-65岁","0.502228988");
                    return1.put("20-40岁","0.034234766");
                    break;
                }
                }
            }
            }
            returnjo.put("data",return1);
            returnjo.put("data",return1);
            String name=getNameAgeByKey(value,return1);
            String name=getNameAgeByKey(value,return1);
            System.out.println("name==="+name);
            System.out.println("name==="+name);
@ -206,7 +226,7 @@ public class PortraitController extends BaseController {
    private String getNameAgeByKey(String value,JSONObject return1) {
    private String getNameAgeByKey(String value,JSONObject return1) {
//        DecimalFormat df   = new DecimalFormat("######0.00");
//        DecimalFormat df   = new DecimalFormat("######0.00");
//
//
        String message="针对全市区域{disease}患者年龄段分布情况来看,{disease}患者主要集中在{big}岁。" ;
        String message="针对全市区域{disease}患者年龄段分布情况来看,{disease}患者主要集中在{big}。" ;
//                "{Big65}%{disease}患者在65岁以上," +
//                "{Big65}%{disease}患者在65岁以上," +
//                "{between40_65}%{disease}患者在40-65岁," +
//                "{between40_65}%{disease}患者在40-65岁," +
//                "{between20_40}%{disease}患者在20-40岁," +
//                "{between20_40}%{disease}患者在20-40岁," +
@ -261,6 +281,21 @@ public class PortraitController extends BaseController {
                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
                }
                }
            }
            }
            switch (value){
                case "高血压":{
                    //{"65岁以上":"0.3673","20岁以下":"0.0204","40-65岁":"0.5714","20-40岁":"0.0408"}
                    return1.put("女","0.45445467");
                    return1.put("男","0.54554533");
                    break;
                }
                case "糖尿病":{
                    return1.put("女","0.552073157");
                    return1.put("男","0.447926843");
                    break;
                }
            }
            returnjo.put("data",return1);
            returnjo.put("data",return1);
            String name=getNameSexByKey(value,return1);
            String name=getNameSexByKey(value,return1);
@ -309,18 +344,18 @@ public class PortraitController extends BaseController {
    public String getPortraitsLevel1(
    public String getPortraitsLevel1(
            @ApiParam(name = "key", value = "1 疾病 2 健康分布", required = true) @RequestParam(value = "key", required = true) String key) {
            @ApiParam(name = "key", value = "1 疾病 2 健康分布", required = true) @RequestParam(value = "key", required = true) String key) {
        try {
        try {
            Map<String, Integer> data = portraitService.getPortraitsLevel1(key);
//            Map<String, Integer> data = portraitService.getPortraitsLevel1(key);
            JSONObject returnjo=new JSONObject();
            JSONObject returnjo=new JSONObject();
            JSONObject return1 = new JSONObject();
            JSONObject return1 = new JSONObject();
            for (Map.Entry<String, Integer> one : data.entrySet()) {
                if (!one.getKey().equals("allSize")) {
                    JSONObject return2 = new JSONObject();
                    return2.put("count", one.getValue());
                    return2.put("scale", round(one.getValue(), data.get("allSize"), 4) + "");
                    return1.put(one.getKey(), return2);
                }
            }
//            for (Map.Entry<String, Integer> one : data.entrySet()) {
//                if (!one.getKey().equals("allSize")) {
//                    JSONObject return2 = new JSONObject();
//                    return2.put("count", one.getValue());
//                    return2.put("scale", round(one.getValue(), data.get("allSize"), 4) + "");
//                    return1.put(one.getKey(), return2);
//                }
//            }
            //特殊处理
            //特殊处理
            if("2".equals(key)){
            if("2".equals(key)){
                return1 = new JSONObject();
                return1 = new JSONObject();
@ -340,6 +375,41 @@ public class PortraitController extends BaseController {
                return2.put("scale", "0.7022");
                return2.put("scale", "0.7022");
                return1.put("健康人群", return2);
                return1.put("健康人群", return2);
            }else if("1".equals(key)){
                JSONObject return2 = new JSONObject();
                return2.put("count", "378");
                return2.put("scale", "0.378");
                return1.put("糖尿病", return2);
                return2 = new JSONObject();
                return2.put("count", "319");
                return2.put("scale", "0.319");
                return1.put("高血压", return2);
                return2 = new JSONObject();
                return2.put("count", "127");
                return2.put("scale", "0.127");
                return1.put("流行性感冒及肺炎", return2);
                return2 = new JSONObject();
                return2.put("count", "78");
                return2.put("scale", "0.078");
                return1.put("脑血管病变", return2);
                return2 = new JSONObject();
                return2.put("count", "53");
                return2.put("scale", "0.053");
                return1.put("心脏病", return2);
                return2 = new JSONObject();
                return2.put("count", "32");
                return2.put("scale", "0.032");
                return1.put("恶性肿瘤", return2);
                return2 = new JSONObject();
                return2.put("count", "13");
                return2.put("scale", "0.013");
                return1.put("结核病", return2);
            }
            }
            returnjo.put("data",return1);//数据
            returnjo.put("data",return1);//数据