|
@@ -16,10 +16,11 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
- * 推送诊断和治疗方案
|
|
|
+ * 推送诊断(疑诊,急诊,鉴别诊断)和治疗方案,不良反应,指标推送,管理评估
|
|
|
*/
|
|
|
public class DiseaseCalculate {
|
|
|
Logger logger = LoggerFactory.getLogger(DiseaseCalculate.class);
|
|
|
+
|
|
|
public ResponseData getDisease(SearchData searchData) throws Exception {
|
|
|
ResponseData responseData = new ResponseData();
|
|
|
String[] featureSplits = searchData.getFeatureType().split(",");
|
|
@@ -31,35 +32,30 @@ public class DiseaseCalculate {
|
|
|
ResponseData diseaseResponse = api.doPost(propertiesUtil.getProperty("disease.http.url"), searchData,
|
|
|
ResponseData.class);
|
|
|
//走诊断推送(诊断推送包含诊断,指标和量表,管理评估)
|
|
|
- List<FeatureRate> dis = (List<FeatureRate>)diseaseResponse.getDis();
|
|
|
+ List<FeatureRate> dis = (List<FeatureRate>) diseaseResponse.getDis();
|
|
|
List<FeatureRate> diseaseName = this.getDisease(dis);
|
|
|
|
|
|
//走治疗推送(治疗里面包含治疗方案和不良反应)
|
|
|
Map<String, Filnlly> treat = this.getTreat(diseaseResponse.getTreat());
|
|
|
|
|
|
//走量表和指标推送
|
|
|
- if(featureList.contains("22")){
|
|
|
- List<MedicalIndication> medicalIndications = this.getMedicalIndications(diseaseResponse.getMedicalIndications());
|
|
|
- responseData.setMedicalIndications(medicalIndications);
|
|
|
- }
|
|
|
+ List<MedicalIndication> medicalIndications = this.getMedicalIndications(diseaseResponse.getMedicalIndications());
|
|
|
+ responseData.setMedicalIndications(medicalIndications);
|
|
|
|
|
|
//走管理评估
|
|
|
- if(featureList.contains("11") && diseaseType == 1 && diseaseType !=null){
|
|
|
-// Map<String, JSONObject> managementEvaluation = this.getMangeEv(diseaseResponse.getManagementEvaluation());
|
|
|
-// responseData.setManagementEvaluation(managementEvaluation);
|
|
|
- Map managementEvaluation = diseaseResponse.getManagementEvaluation();
|
|
|
- Map test = this.getTest(managementEvaluation);
|
|
|
- responseData.setManagementEvaluation(test);
|
|
|
- }
|
|
|
+ Map managementEvaluation = diseaseResponse.getManagementEvaluation();
|
|
|
+ Map test = this.getMan(managementEvaluation);
|
|
|
+
|
|
|
+ responseData.setManagementEvaluation(test);
|
|
|
responseData.setTreat(treat);
|
|
|
responseData.setDis(diseaseName);
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
- public List<FeatureRate> getDisease(List<FeatureRate> dis){
|
|
|
+ public List<FeatureRate> getDisease(List<FeatureRate> dis) {
|
|
|
List<FeatureRate> diseaseName = new ArrayList<>();
|
|
|
- if(dis != null && dis.size()>0){
|
|
|
- for (FeatureRate d:dis) {
|
|
|
+ if (dis != null && dis.size() > 0) {
|
|
|
+ for (FeatureRate d : dis) {
|
|
|
FeatureRate featureRate = new FeatureRate();
|
|
|
featureRate.setFeatureName(d.getFeatureName());
|
|
|
featureRate.setExtraProperty(d.getExtraProperty());
|
|
@@ -71,23 +67,23 @@ public class DiseaseCalculate {
|
|
|
return diseaseName;
|
|
|
}
|
|
|
|
|
|
- public Map<String, Filnlly> getTreat(Map<String, Filnlly> treat){
|
|
|
- Map<String,Filnlly> diseaseTreat = new HashMap<String,Filnlly>();
|
|
|
- if(treat != null){
|
|
|
- for (Map.Entry<String, Filnlly> tm:treat.entrySet()) {
|
|
|
+ public Map<String, Filnlly> getTreat(Map<String, Filnlly> treat) {
|
|
|
+ Map<String, Filnlly> diseaseTreat = new HashMap<String, Filnlly>();
|
|
|
+ if (treat != null) {
|
|
|
+ for (Map.Entry<String, Filnlly> tm : treat.entrySet()) {
|
|
|
String dise = tm.getKey();
|
|
|
Filnlly value = tm.getValue();
|
|
|
List<Indicators> adverseEvent = value.getAdverseEvent();
|
|
|
List<Indicators> newAdverseEvent = new ArrayList<>();
|
|
|
- if(adverseEvent !=null && adverseEvent.size()>0){
|
|
|
- for (Indicators i:adverseEvent) {
|
|
|
+ if (adverseEvent != null && adverseEvent.size() > 0) {
|
|
|
+ for (Indicators i : adverseEvent) {
|
|
|
Indicators indicators = new Indicators();
|
|
|
indicators.setName(i.getName());
|
|
|
indicators.setControlType(i.getControlType());
|
|
|
List<Detail> details = i.getDetails();
|
|
|
List<Detail> newDetails = new ArrayList<>();
|
|
|
- if(details !=null && details.size()>0){
|
|
|
- for (Detail d:details) {
|
|
|
+ if (details != null && details.size() > 0) {
|
|
|
+ for (Detail d : details) {
|
|
|
Detail detail = new Detail();
|
|
|
detail.setName(d.getName());
|
|
|
detail.setValue(d.getValue());
|
|
@@ -101,16 +97,16 @@ public class DiseaseCalculate {
|
|
|
|
|
|
ArrayList<Drugs> treatment = value.getTreatment();
|
|
|
ArrayList<Drugs> newTreatment = new ArrayList<>();
|
|
|
- if(treatment != null && treatment.size()>0){
|
|
|
- for (Drugs d:treatment) {
|
|
|
+ if (treatment != null && treatment.size() > 0) {
|
|
|
+ for (Drugs d : treatment) {
|
|
|
Drugs drugs = new Drugs();
|
|
|
String bigdrugsName = d.getBigdrugsName();
|
|
|
String subdrugsName = d.getSubdrugsName();
|
|
|
Integer drugsForbidden = d.getDrugsForbidden();
|
|
|
LinkedList<Medicition> medicitionsList = d.getMedicitionsList();
|
|
|
- LinkedList<Medicition> newMedicitionsList =new LinkedList<>();
|
|
|
- if(medicitionsList != null && medicitionsList.size()>0){
|
|
|
- for (Medicition m:medicitionsList) {
|
|
|
+ LinkedList<Medicition> newMedicitionsList = new LinkedList<>();
|
|
|
+ if (medicitionsList != null && medicitionsList.size() > 0) {
|
|
|
+ for (Medicition m : medicitionsList) {
|
|
|
Medicition newMedication = new Medicition();
|
|
|
newMedication.setMedicitionName(m.getMedicitionName());
|
|
|
newMedication.setForbidden(m.getForbidden());
|
|
@@ -129,22 +125,22 @@ public class DiseaseCalculate {
|
|
|
Filnlly filnlly = new Filnlly();
|
|
|
filnlly.setTreatment(newTreatment);
|
|
|
filnlly.setAdverseEvent(newAdverseEvent);
|
|
|
- diseaseTreat.put(dise,filnlly);
|
|
|
+ diseaseTreat.put(dise, filnlly);
|
|
|
}
|
|
|
}
|
|
|
return diseaseTreat;
|
|
|
}
|
|
|
|
|
|
- public List<MedicalIndication> getMedicalIndications(List<MedicalIndication> medicalIndications){
|
|
|
- List<MedicalIndication> newMedicalIndicationList =new ArrayList<>();
|
|
|
- if(medicalIndications !=null && medicalIndications.size()>0){
|
|
|
- for (MedicalIndication m:medicalIndications) {
|
|
|
+ public List<MedicalIndication> getMedicalIndications(List<MedicalIndication> medicalIndications) {
|
|
|
+ List<MedicalIndication> newMedicalIndicationList = new ArrayList<>();
|
|
|
+ if (medicalIndications != null && medicalIndications.size() > 0) {
|
|
|
+ for (MedicalIndication m : medicalIndications) {
|
|
|
MedicalIndication newMedicalIndication = new MedicalIndication();
|
|
|
String name = m.getName();
|
|
|
List<MedicalIndicationDetail> newDetails = new ArrayList<>();
|
|
|
List<MedicalIndicationDetail> details = m.getDetails();
|
|
|
- if(details !=null && details.size()>0){
|
|
|
- for (MedicalIndicationDetail detail:details) {
|
|
|
+ if (details != null && details.size() > 0) {
|
|
|
+ for (MedicalIndicationDetail detail : details) {
|
|
|
MedicalIndicationDetail newMe = new MedicalIndicationDetail();
|
|
|
newMe.setType(detail.getType());
|
|
|
newMe.setContent(detail.getContent());
|
|
@@ -159,96 +155,39 @@ public class DiseaseCalculate {
|
|
|
return newMedicalIndicationList;
|
|
|
}
|
|
|
|
|
|
- public Map<String, JSONObject> getMangeEv(Map<String, JSONObject> mv){
|
|
|
- Map<String, JSONObject> mangeEv = new HashMap<>();
|
|
|
- JSONObject liaoXiao = mv.get("疗效评估");
|
|
|
- JSONObject curativeJson = new JSONObject();
|
|
|
- List<JSONObject> liaoXiaoJsonList = (List<JSONObject>)liaoXiao.get("rows");
|
|
|
- List<JSONObject> newLiaoXiaoJsonList = new ArrayList<>();
|
|
|
- if(liaoXiaoJsonList !=null && liaoXiaoJsonList.size()>0){
|
|
|
- for (JSONObject item:liaoXiaoJsonList) {
|
|
|
- JSONObject newItem = new JSONObject();
|
|
|
- newItem.put("controltype",item.get("controltype"));
|
|
|
- newItem.put("name",item.get("name"));
|
|
|
- List<JSONObject> detailList = (List<JSONObject>)item.get("details");
|
|
|
- List<JSONObject> newDetailList = new ArrayList<>();
|
|
|
- if(detailList !=null && detailList.size()>0){
|
|
|
- for (JSONObject itemJson:detailList) {
|
|
|
- JSONObject newItemJson = new JSONObject();
|
|
|
- newItemJson.put("detailName",itemJson.get("detailName"));
|
|
|
- newItemJson.put("state",itemJson.get("state"));
|
|
|
- newDetailList.add(newItemJson);
|
|
|
- }
|
|
|
- }
|
|
|
- newItem.put("details",newDetailList);
|
|
|
- newLiaoXiaoJsonList.add(newItem);
|
|
|
- }
|
|
|
- }
|
|
|
- curativeJson.put("rows",newLiaoXiaoJsonList);
|
|
|
-
|
|
|
- JSONObject fenjiMange = mv.get("糖尿病分级管理");
|
|
|
- JSONObject newFenjiMange = new JSONObject();
|
|
|
- List<JSONObject> fenjiJsonList = (List<JSONObject>) fenjiMange.get("rows");
|
|
|
- List<JSONObject> newFenjiJsonList = new ArrayList<>();
|
|
|
- if(fenjiJsonList !=null && fenjiJsonList.size()>0){
|
|
|
- for (JSONObject fenjiItem:fenjiJsonList) {
|
|
|
- JSONObject newFenjiIem = new JSONObject();
|
|
|
- newFenjiIem.put("name",fenjiItem.get("name"));
|
|
|
- newFenjiIem.put("controltype",fenjiItem.get("controltype"));
|
|
|
- List<JSONObject> detaillist = (List<JSONObject>)fenjiItem.get("details");
|
|
|
- List<JSONObject> newDetaillist = new ArrayList<>();
|
|
|
- if(detaillist !=null && detaillist.size()>0){
|
|
|
- for (JSONObject h:detaillist) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("detailName",h.get("detailName"));
|
|
|
- jsonObject.put("state",h.get("state"));
|
|
|
- newDetaillist.add(jsonObject);
|
|
|
- }
|
|
|
- }
|
|
|
- newFenjiIem.put("details",newDetaillist);
|
|
|
- newFenjiJsonList.add(newFenjiIem);
|
|
|
- }
|
|
|
- }
|
|
|
- newFenjiMange.put("rows",newFenjiJsonList);
|
|
|
-
|
|
|
- mangeEv.put("疗效评估",curativeJson);
|
|
|
- mangeEv.put("糖尿病分级管理",newFenjiMange);
|
|
|
- return mangeEv;
|
|
|
- }
|
|
|
-
|
|
|
- public Map getTest(Map input){
|
|
|
- Map resultMap =new HashMap();
|
|
|
- Map lixiao = (HashMap)input.get("疗效评估");
|
|
|
+ public Map getMan(Map input) {
|
|
|
+ Map resultMap = new HashMap();
|
|
|
+ Map lixiao = (HashMap) input.get("疗效评估");
|
|
|
Map newlixiao = new HashMap();
|
|
|
- List<Map> lxRows = (ArrayList)lixiao.get("rows");
|
|
|
+ List<Map> lxRows = (ArrayList) lixiao.get("rows");
|
|
|
List<Map> newlxRows = new ArrayList();
|
|
|
- if(lxRows !=null && lxRows.size()>0){
|
|
|
- for (Map item:lxRows) {
|
|
|
+ if (lxRows != null && lxRows.size() > 0) {
|
|
|
+ for (Map item : lxRows) {
|
|
|
Map k = new HashMap();
|
|
|
- k.put("controltype",item.get("controltype"));
|
|
|
- k.put("name",item.get("name"));
|
|
|
- ArrayList<Map> h = (ArrayList<Map>)item.get("details");
|
|
|
+ k.put("controltype", item.get("controltype"));
|
|
|
+ k.put("name", item.get("name"));
|
|
|
+ ArrayList<Map> h = (ArrayList<Map>) item.get("details");
|
|
|
ArrayList<Map> newh = new ArrayList<>();
|
|
|
- if(h !=null && h.size()>0){
|
|
|
- for (Map d:h) {
|
|
|
- Map ll =new HashMap();
|
|
|
- ll.put("detailName",d.get("detailName"));
|
|
|
- ll.put("state",d.get("state"));
|
|
|
+ if (h != null && h.size() > 0) {
|
|
|
+ for (Map d : h) {
|
|
|
+ Map ll = new HashMap();
|
|
|
+ ll.put("detailName", d.get("detailName"));
|
|
|
+ ll.put("state", d.get("state"));
|
|
|
newh.add(ll);
|
|
|
}
|
|
|
}
|
|
|
- k.put("details",newh);
|
|
|
+ k.put("details", newh);
|
|
|
newlxRows.add(k);
|
|
|
}
|
|
|
}
|
|
|
- newlixiao.put("rows",newlxRows);
|
|
|
+ newlixiao.put("rows", newlxRows);
|
|
|
|
|
|
- Map fenji = (HashMap)input.get("糖尿病分级管理");
|
|
|
+ Map fenji = (HashMap) input.get("糖尿病分级管理");
|
|
|
Map newfenji = new HashMap();
|
|
|
- List<Map> fjRows = (ArrayList)fenji.get("rows");
|
|
|
+ List<Map> fjRows = (ArrayList) fenji.get("rows");
|
|
|
List<Map> newfjRows = new ArrayList();
|
|
|
- if(fjRows !=null && fjRows.size()>0){
|
|
|
- for (Map item:fjRows) {
|
|
|
+ if (fjRows != null && fjRows.size() > 0) {
|
|
|
+ for (Map item : fjRows) {
|
|
|
Map k = new HashMap();
|
|
|
k.put("controltype", item.get("controltype"));
|
|
|
k.put("name", item.get("name"));
|
|
@@ -265,10 +204,10 @@ public class DiseaseCalculate {
|
|
|
k.put("details", newh);
|
|
|
newfjRows.add(k);
|
|
|
}
|
|
|
- }
|
|
|
- newfenji.put("rows",newfjRows);
|
|
|
- resultMap.put("疗效评估",newlixiao);
|
|
|
- resultMap.put("糖尿病分级管理",newfenji);
|
|
|
+ }
|
|
|
+ newfenji.put("rows", newfjRows);
|
|
|
+ resultMap.put("疗效评估", newlixiao);
|
|
|
+ resultMap.put("糖尿病分级管理", newfenji);
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|