|
@@ -1,5 +1,6 @@
|
|
|
package org.diagbot.graphWeb.work;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.diagbot.common.javabean.MangementEvaluation;
|
|
|
import org.diagbot.common.work.FeatureRate;
|
|
@@ -280,11 +281,11 @@ public class GraphCalculate {
|
|
|
detailList.add(indicationJsonObject);
|
|
|
detailList.add(sexJson);
|
|
|
gongshiJson.put("details",detailList);
|
|
|
- JSONObject resultJson = new JSONObject();
|
|
|
- resultJson.put("value","");
|
|
|
- resultJson.put("unit","");
|
|
|
- resultJson.put("text","");
|
|
|
- gongshiJson.put("result",resultJson);
|
|
|
+// JSONObject resultJson = new JSONObject();
|
|
|
+// resultJson.put("value","");
|
|
|
+// resultJson.put("unit","");
|
|
|
+// resultJson.put("text","");
|
|
|
+// gongshiJson.put("result",resultJson);
|
|
|
medicalIndicationDetail2.setContent(gongshiJson);
|
|
|
//其他
|
|
|
MedicalIndicationDetail medicalIndicationDetail3 = new MedicalIndicationDetail();
|
|
@@ -304,6 +305,13 @@ public class GraphCalculate {
|
|
|
shiFouJson.put("details",shiFouList);
|
|
|
medicalIndicationDetail3.setContent(shiFouJson);
|
|
|
medicalIndicationDetailList.add(medicalIndicationDetail1);
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ Map<String, Object> scaleCalcMethod = scaleCalcMethod(medicalIndicationDetail2);
|
|
|
+ resultJson.put("value",scaleCalcMethod.get("value"));
|
|
|
+ resultJson.put("unit",scaleCalcMethod.get("unit"));
|
|
|
+ resultJson.put("text",scaleCalcMethod.get("text"));
|
|
|
+ gongshiJson.put("result",resultJson);
|
|
|
+ medicalIndicationDetail2.setContent(gongshiJson);
|
|
|
medicalIndicationDetailList.add(medicalIndicationDetail2);
|
|
|
medicalIndicationDetailList.add(medicalIndicationDetail3);
|
|
|
medicalIndication.setDetails(medicalIndicationDetailList);
|
|
@@ -384,4 +392,88 @@ public class GraphCalculate {
|
|
|
mangementEvaluation.setMangementEvaluation(mangementMap);
|
|
|
return mangementEvaluation;
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String, Object> scaleCalcMethod(MedicalIndicationDetail medicalIndicationDetail) {
|
|
|
+ Map<String, Object> scaleCalcResult = new HashMap<>();
|
|
|
+ Integer type = medicalIndicationDetail.getType();
|
|
|
+ switch (type) {
|
|
|
+ case 3:
|
|
|
+ // result = scaleScoreCalc(scaleItems, scaleName).get("text").toString();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ JSONObject content = medicalIndicationDetail.getContent();
|
|
|
+ JSONArray contentDetails = content.getJSONArray("details");
|
|
|
+ int age = 0;
|
|
|
+ double scr = 0.00;
|
|
|
+ float k = 0.0f;
|
|
|
+ double a = 0.00;
|
|
|
+ double denger = 0.00;
|
|
|
+ for (int i = 0; i < contentDetails.size(); i++) {
|
|
|
+ JSONObject detailSub = contentDetails.getJSONObject(i);
|
|
|
+ if ("年龄".equals(detailSub.getString("name"))) {
|
|
|
+ if ("".equals(detailSub.getString("value"))) {
|
|
|
+ //如果拿到的年龄为空,给的20是假数据
|
|
|
+ age = 20;
|
|
|
+ } else {
|
|
|
+ age = Integer.parseInt(detailSub.getString("value"));
|
|
|
+ }
|
|
|
+ } else if ("血肌酐".equals(detailSub.getString("name"))) {
|
|
|
+ if ("".equals(detailSub.getString("value"))) {
|
|
|
+ //如果给的value是空,给的2.2621是假数据
|
|
|
+ scr = 2.2621;
|
|
|
+ } else {
|
|
|
+ if ("umol/L".equals(detailSub.getString("value"))) {
|
|
|
+ scr = Double.valueOf(detailSub.getString("value")) / 88.41;
|
|
|
+ } else {
|
|
|
+ scr = Double.valueOf(detailSub.getString("value"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ("性别".equals(detailSub.getString("name"))) {
|
|
|
+ JSONArray genderDetails = detailSub.getJSONArray("details");
|
|
|
+ for (int j = 0; j < genderDetails.size(); j++) {
|
|
|
+ JSONObject genderDetail = genderDetails.getJSONObject(j);
|
|
|
+ //返回的数据结构性别暂时是写死(默认女性)
|
|
|
+ if (genderDetail.getInteger("state") == 1) {
|
|
|
+ if ("男".equals(genderDetail.getString("detailName"))) {
|
|
|
+ k = 0.9f;
|
|
|
+ denger = Double.parseDouble(genderDetail.getString("value"));
|
|
|
+ if (scr <= 0.90) {
|
|
|
+ a = -0.411;
|
|
|
+ } else {
|
|
|
+ a = -1.209;
|
|
|
+ }
|
|
|
+ } else if ("女".equals(genderDetail.getString("detailName"))) {
|
|
|
+ k = 0.7f;
|
|
|
+ denger = Double.parseDouble(genderDetail.getString("value"));
|
|
|
+ if (scr <= 0.70) {
|
|
|
+ a = -0.329;
|
|
|
+ } else {
|
|
|
+ a = -1.209;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double eGFR3 = 141 * Math.pow((scr / k), a) * Math.pow(0.993, age) * denger;
|
|
|
+ String unit = "ml/min•1.73m2";
|
|
|
+ String text = null;
|
|
|
+ if (eGFR3 <= 15) {
|
|
|
+ text = "肾功能衰竭";
|
|
|
+ } else if (eGFR3 > 15 && eGFR3 <= 29) {
|
|
|
+ text = "重度下降";
|
|
|
+ } else if (eGFR3 > 30 && eGFR3 <= 59) {
|
|
|
+ text = "中度下降";
|
|
|
+ } else if (eGFR3 > 60 && eGFR3 <= 89) {
|
|
|
+ text = "轻度下降";
|
|
|
+ } else if (eGFR3 >= 90) {
|
|
|
+ text = "正常或肾损伤代偿期";
|
|
|
+ }
|
|
|
+ scaleCalcResult.put("text", text);
|
|
|
+ scaleCalcResult.put("unit", unit);
|
|
|
+ scaleCalcResult.put("value", eGFR3);
|
|
|
+ System.out.println("text:" + text + "\tunit:" + unit + "\tvalue:" + eGFR3);
|
|
|
+ }
|
|
|
+ return scaleCalcResult;
|
|
|
+ }
|
|
|
}
|