CommonFacade.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.diagbot.facade;
  2. import com.diagbot.client.CRFServiceClient;
  3. import com.diagbot.dto.WordBillCrfDTO;
  4. import com.diagbot.model.ai.AIAnalyze;
  5. import com.diagbot.model.entity.Clinical;
  6. import com.diagbot.model.label.ChiefLabel;
  7. import com.diagbot.util.CoreUtil;
  8. import com.diagbot.vo.IndicationPushVO;
  9. import com.diagbot.vo.StandConvert;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Component;
  12. import java.lang.reflect.Field;
  13. import java.util.ArrayList;
  14. import java.util.List;
  15. import java.util.Map;
  16. /**
  17. * @Description: 通过业务facade
  18. * @author: zhoutg
  19. * @time: 2018/8/6 9:11
  20. */
  21. @Component
  22. public class CommonFacade {
  23. @Autowired
  24. CRFServiceClient crfServiceClient;
  25. public WordBillCrfDTO crf_process(IndicationPushVO indicationPushVO){
  26. AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
  27. WordBillCrfDTO wordBillCrfDTO = new WordBillCrfDTO();
  28. aiAnalyze.aiProcess(indicationPushVO,wordBillCrfDTO);
  29. return wordBillCrfDTO;
  30. }
  31. public StandConvert dataTypeGet(WordBillCrfDTO wordBillCrfDTO){
  32. StandConvert standConvert = new StandConvert();
  33. List<String> clinicalList = new ArrayList<>();
  34. ChiefLabel chiefLabel = wordBillCrfDTO.getChiefLabel();
  35. clinicalList.addAll(CoreUtil.getPropertyList(chiefLabel.getClinicals()));
  36. standConvert.setClinicalList(clinicalList);
  37. return standConvert;
  38. }
  39. public StandConvert dataTypeSet(WordBillCrfDTO wordBillCrfDTO, Map<String, Map<String, String>> map){
  40. StandConvert standConvert = new StandConvert();
  41. List<String> clinicalList = new ArrayList<>();
  42. Map<String, String> clinicMap = map.get("clinicalList");
  43. ChiefLabel chiefLabel = wordBillCrfDTO.getChiefLabel();
  44. List<Clinical> clinicals = chiefLabel.getClinicals();
  45. for (Clinical c : clinicals) {
  46. if (clinicMap != null && clinicMap.get(c.getName()) != null) {
  47. c.setStandName(clinicMap.get(c.getName()));
  48. }
  49. }
  50. standConvert.setClinicalList(clinicalList);
  51. return standConvert;
  52. }
  53. }