CommonFacade.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. package com.diagbot.facade;
  2. import com.diagbot.biz.push.entity.Item;
  3. import com.diagbot.biz.push.entity.Lis;
  4. import com.diagbot.client.CRFServiceClient;
  5. import com.diagbot.dto.WordCrfDTO;
  6. import com.diagbot.enums.StandConvertEnum;
  7. import com.diagbot.model.ai.AIAnalyze;
  8. import com.diagbot.model.entity.BodyPart;
  9. import com.diagbot.model.entity.Modification;
  10. import com.diagbot.model.entity.Pacs;
  11. import com.diagbot.model.label.ChiefLabel;
  12. import com.diagbot.model.label.DiagLabel;
  13. import com.diagbot.model.label.PacsLabel;
  14. import com.diagbot.model.label.PastLabel;
  15. import com.diagbot.model.label.PresentLabel;
  16. import com.diagbot.model.label.VitalLabel;
  17. import com.diagbot.util.CoreUtil;
  18. import com.diagbot.util.ListUtil;
  19. import com.diagbot.vo.NeoPushVO;
  20. import com.diagbot.vo.SearchData;
  21. import com.diagbot.vo.StandConvert;
  22. import com.diagbot.vo.neoPushEntity.ChiefPushVo;
  23. import com.diagbot.vo.neoPushEntity.Diag;
  24. import com.diagbot.vo.neoPushEntity.DiagVo;
  25. import com.diagbot.vo.neoPushEntity.Drug;
  26. import com.diagbot.vo.neoPushEntity.LisPushVo;
  27. import com.diagbot.vo.neoPushEntity.PresentPushVo;
  28. import com.diagbot.vo.neoPushEntity.Symptom;
  29. import org.apache.commons.lang3.StringUtils;
  30. import org.springframework.beans.factory.annotation.Autowired;
  31. import org.springframework.stereotype.Component;
  32. import java.util.ArrayList;
  33. import java.util.List;
  34. import java.util.Map;
  35. import java.util.stream.Collectors;
  36. /**
  37. * @Description: 通过业务facade
  38. * @author: zhoutg
  39. * @time: 2018/8/6 9:11
  40. */
  41. @Component
  42. public class CommonFacade {
  43. @Autowired
  44. CRFServiceClient crfServiceClient;
  45. @Autowired
  46. LisConfigFacade lisConfigFacade;
  47. @Autowired
  48. PacsConfigFacade pacsConfigFacade;
  49. //组装好的label
  50. public WordCrfDTO crf_process(SearchData searchData) {
  51. AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
  52. WordCrfDTO wordCrfDTO = new WordCrfDTO();
  53. wordCrfDTO.setHospitalId(searchData.getHospitalId());
  54. wordCrfDTO.setAge(searchData.getAge());
  55. wordCrfDTO.setSex(searchData.getSex());
  56. if (searchData.getDiseaseName() != null && StringUtils.isNotBlank(searchData.getDiseaseName().getName())) {
  57. wordCrfDTO.setDiseaseName(searchData.getDiseaseName());
  58. }
  59. if (ListUtil.isNotEmpty(searchData.getLis())) {
  60. wordCrfDTO.setLis(searchData.getLis());
  61. }
  62. if (ListUtil.isNotEmpty(searchData.getPacs())) {
  63. wordCrfDTO.setPacs(searchData.getPacs());
  64. }
  65. if (ListUtil.isNotEmpty(searchData.getDrug())) {
  66. wordCrfDTO.setDrug(searchData.getDrug());
  67. }
  68. if (ListUtil.isNotEmpty(searchData.getOperation())) {
  69. wordCrfDTO.setOperation(searchData.getOperation());
  70. }
  71. if (ListUtil.isNotEmpty(searchData.getLisOrder())) {
  72. wordCrfDTO.setLisOrder(searchData.getLisOrder());
  73. }
  74. if (ListUtil.isNotEmpty(searchData.getPacsOrder())) {
  75. wordCrfDTO.setPacsOrder(searchData.getPacsOrder());
  76. }
  77. if (ListUtil.isNotEmpty(searchData.getDrugOrder())) {
  78. wordCrfDTO.setDrugOrder(searchData.getDrugOrder());
  79. }
  80. if (ListUtil.isNotEmpty(searchData.getOperationOrder())) {
  81. wordCrfDTO.setOperationOrder(searchData.getOperationOrder());
  82. }
  83. if (ListUtil.isNotEmpty(searchData.getDiagOrder())) {
  84. wordCrfDTO.setDiagOrder(searchData.getDiagOrder());
  85. }
  86. if (ListUtil.isNotEmpty(searchData.getDiag())) {
  87. wordCrfDTO.setDiag(searchData.getDiag());
  88. }
  89. if (ListUtil.isNotEmpty(searchData.getTransfusionOrder())) {
  90. wordCrfDTO.setTransfusionOrder(searchData.getTransfusionOrder());
  91. }
  92. //模型处理数据
  93. aiAnalyze.aiProcess(searchData, wordCrfDTO);
  94. // 处理现病史中的化验和辅检,放入结构化
  95. processPresentLisPacs(wordCrfDTO);
  96. return wordCrfDTO;
  97. }
  98. //返回给图谱的词,这些词需要转换成标准词
  99. public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO) {
  100. StandConvert standConvert = new StandConvert();
  101. //所有的症状(主诉、现病史)
  102. List<String> clinicalList = new ArrayList<>();
  103. ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
  104. clinicalList.addAll(CoreUtil.getPropertyList(chiefLabel.getClinicals()));
  105. PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  106. clinicalList.addAll(CoreUtil.getPropertyList(presentLabel.getClinicals()));
  107. standConvert.setClinicalList(clinicalList);
  108. //所有的疾病(主诉、现病史,诊断,既往史,下的诊断)
  109. DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
  110. PastLabel pastLabel = wordCrfDTO.getPastLabel();
  111. List<String> diagList = new ArrayList<>();
  112. diagList.addAll(CoreUtil.getPropertyList(chiefLabel.getDiags()));
  113. diagList.addAll(CoreUtil.getPropertyList(presentLabel.getDiags()));
  114. diagList.addAll(CoreUtil.getPropertyList(diagLabel.getDiags()));
  115. diagList.addAll(CoreUtil.getPropertyList(pastLabel.getDiags()));
  116. //下的诊断
  117. diagList.addAll(wordCrfDTO.getDiagOrder().stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  118. .map(x -> x.getName()).collect(Collectors.toList()));
  119. //传的诊断
  120. diagList.addAll(wordCrfDTO.getDiag().stream().filter(x ->
  121. StringUtils.isBlank(x.getUniqueName()))
  122. .map(x -> x.getName()).collect(Collectors.toList()));
  123. //选中的诊断
  124. if(wordCrfDTO.getDiseaseName() != null && StringUtils.isBlank(wordCrfDTO.getDiseaseName().getUniqueName())){
  125. diagList.add(wordCrfDTO.getDiseaseName().getName());
  126. }
  127. standConvert.setDiaglList(diagList);
  128. //所有化验(结构化数据)
  129. List<String> allLis = new ArrayList<>();
  130. //普通化验
  131. List<Lis> lis = wordCrfDTO.getLis();
  132. if (ListUtil.isNotEmpty(lis)) {
  133. List<String> lis_unique = lis.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  134. .map(x -> x.getName() + x.getDetailName()).collect(Collectors.toList());
  135. allLis.addAll(lis_unique);
  136. }
  137. //开单化验
  138. List<Lis> lisOrder = wordCrfDTO.getLisOrder();
  139. if (ListUtil.isNotEmpty(lisOrder)) {
  140. List<String> lis_unique = lisOrder.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  141. .map(x -> x.getName() + x.getDetailName()).collect(Collectors.toList());
  142. allLis.addAll(lis_unique);
  143. }
  144. standConvert.setLisList(allLis);
  145. //所有辅助项目(结构化数据)
  146. List<String> allPacs = new ArrayList<>();
  147. List<Item> pacsList = wordCrfDTO.getPacsLabel().getItem();
  148. if (ListUtil.isNotEmpty(pacsList)) {
  149. List<String> pacss_unique = pacsList.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  150. .map(x -> x.getName()).collect(Collectors.toList());
  151. allPacs.addAll(pacss_unique);
  152. }
  153. // List<PacsNew> pacsNews = wordCrfDTO.getPacsLabel().getPacsNewList();
  154. // if (ListUtil.isNotEmpty(pacsNews)) {
  155. // List<String> pacss_unique = pacsNews.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  156. // .map(x -> x.getName()).collect(Collectors.toList());
  157. // allPacs.addAll(pacss_unique);
  158. // }
  159. allPacs.addAll(wordCrfDTO.getPacs().stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
  160. .map(x -> x.getName()).collect(Collectors.toList()));
  161. //开单检查
  162. allPacs.addAll(wordCrfDTO.getPacsOrder().stream().filter(z -> StringUtils.isBlank(z.getUniqueName())).map(x -> x.getName()).collect(Collectors.toList()));
  163. standConvert.setPacsList(allPacs);
  164. //所有药品(现病史、既往史)
  165. List<String> drugList = new ArrayList<>();
  166. //1、现病史中的药品
  167. drugList.addAll(CoreUtil.getPropertyList(presentLabel.getMedicines()));
  168. drugList.addAll(CoreUtil.getPropertyList(presentLabel.getTakeMedicine()));
  169. //2、既往史(药物过敏)
  170. drugList.addAll(CoreUtil.getPropertyList(pastLabel.getAllergyMedicines()));
  171. //3、开单药品
  172. drugList.addAll(wordCrfDTO.getDrugOrder().stream().filter(z ->StringUtils.isBlank(z.getUniqueName())).map(x ->x.getName()).collect(Collectors.toList()));
  173. standConvert.setDrugList(drugList);
  174. //4、医嘱药品
  175. drugList.addAll(wordCrfDTO.getDrug().stream().filter(z ->StringUtils.isBlank(z.getUniqueName())).map(x ->x.getName()).collect(Collectors.toList()));
  176. standConvert.setDrugList(drugList);
  177. //所有手术(现病史、既往史)
  178. List<String> operationList = new ArrayList<>();
  179. //1、现病史中的手术
  180. operationList.addAll(CoreUtil.getPropertyList(presentLabel.getOperations()));
  181. //2、既往史中的手术
  182. operationList.addAll(CoreUtil.getPropertyList(pastLabel.getOperations()));
  183. //3.开单手术
  184. operationList.addAll(wordCrfDTO.getOperationOrder().stream().filter(z -> StringUtils.isBlank(z.getUniqueName())).map(x ->x.getName()).collect(Collectors.toList()));
  185. standConvert.setOperationList(operationList);
  186. //4.手术及操作
  187. operationList.addAll(wordCrfDTO.getOperation().stream().filter(z -> StringUtils.isBlank(z.getUniqueName())).map(x ->x.getName()).collect(Collectors.toList()));
  188. standConvert.setOperationList(operationList);
  189. //所有体征
  190. List<String> vitalList = new ArrayList<>();
  191. VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
  192. vitalList.addAll(CoreUtil.getPropertyList(vitalLabel.getVitals()));
  193. standConvert.setVitalList(vitalList);
  194. // 输血
  195. List<String> transfusionList = new ArrayList<>();
  196. if (ListUtil.isNotEmpty(wordCrfDTO.getTransfusionOrder())) {
  197. transfusionList.addAll(wordCrfDTO.getTransfusionOrder().stream().filter(z -> StringUtils.isBlank(z.getUniqueName())).map(x -> x.getName()).collect(Collectors.toList()));
  198. }
  199. standConvert.setTransfusionList(transfusionList);
  200. return standConvert;
  201. }
  202. //把图谱返回的标准词set到label中
  203. public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map) {
  204. ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
  205. PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  206. PastLabel pastLabel = wordCrfDTO.getPastLabel();
  207. DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
  208. List<Lis> lis = wordCrfDTO.getLis();
  209. List<Item> pacsList = wordCrfDTO.getPacsLabel().getItem();
  210. VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
  211. //症状回填
  212. CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.symptom.getName()));
  213. CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.symptom.getName()));
  214. //诊断回填
  215. CoreUtil.setPropertyList(diagLabel.getDiags(), map.get(StandConvertEnum.disease.getName()));
  216. CoreUtil.setPropertyList(wordCrfDTO.getDiagOrder(),"name", "uniqueName", map.get(StandConvertEnum.disease.getName()));
  217. CoreUtil.setPropertyList(wordCrfDTO.getDiag(),"name", "uniqueName", map.get(StandConvertEnum.disease.getName()));
  218. CoreUtil.setPropertyList(wordCrfDTO.getDiseaseName(),"name", "uniqueName", map.get(StandConvertEnum.disease.getName()));
  219. //药品回填
  220. CoreUtil.setPropertyList(presentLabel.getMedicines(), map.get(StandConvertEnum.drug.getName()));
  221. CoreUtil.setPropertyList(presentLabel.getTakeMedicine(), map.get(StandConvertEnum.drug.getName()));
  222. CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(), map.get(StandConvertEnum.drug.getName()));
  223. CoreUtil.setPropertyList(wordCrfDTO.getDrugOrder(),"name", "uniqueName", map.get(StandConvertEnum.drug.getName()));
  224. CoreUtil.setPropertyList(wordCrfDTO.getDrug(),"name", "uniqueName", map.get(StandConvertEnum.drug.getName()));
  225. //化验回填
  226. CoreUtil.setPropertyList(lis, "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
  227. CoreUtil.setPropertyList(wordCrfDTO.getLisOrder(), "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
  228. //辅助检查回填
  229. CoreUtil.setPropertyList(pacsList, "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
  230. CoreUtil.setPropertyList(wordCrfDTO.getPacs(), "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
  231. CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
  232. //体征回填
  233. CoreUtil.setPropertyList(vitalLabel.getVitals(), map.get(StandConvertEnum.vital.getName()));
  234. //手术回填
  235. CoreUtil.setPropertyList(presentLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
  236. CoreUtil.setPropertyList(pastLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
  237. CoreUtil.setPropertyList(wordCrfDTO.getOperationOrder(), "name", "uniqueName",map.get(StandConvertEnum.operation.getName()));
  238. CoreUtil.setPropertyList(wordCrfDTO.getOperation(), "name", "uniqueName",map.get(StandConvertEnum.operation.getName()));
  239. //输血回填
  240. CoreUtil.setPropertyList(wordCrfDTO.getTransfusionOrder(), "name", "uniqueName",map.get(StandConvertEnum.transfusion.getName()));
  241. }
  242. /**
  243. * 生成给图谱的入参(推送)
  244. */
  245. public NeoPushVO generatePushInput(WordCrfDTO wordCrfDTO) {
  246. NeoPushVO pushVO = new NeoPushVO();
  247. ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
  248. PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  249. List<Item> diags = wordCrfDTO.getDiag();
  250. Item diseaseName = wordCrfDTO.getDiseaseName();
  251. PastLabel pastLabel = wordCrfDTO.getPastLabel();
  252. List<Lis> lis = wordCrfDTO.getLis();
  253. // List<Pacs> pacs = wordCrfDTO.getPacs();
  254. // TODO 辅检
  255. // List<PacsNew> pacsNewList = wordCrfDTO.getPacsLabel().getPacsNewList();
  256. pushVO.setAge(wordCrfDTO.getAge());
  257. pushVO.setSex(wordCrfDTO.getSex());
  258. pushVO.setDiaeaseName(diseaseName);
  259. if (chiefLabel != null) {
  260. if(ListUtil.isNotEmpty(chiefLabel.getClinicals())){
  261. List<Symptom> cjiefClinicals = chiefLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
  262. {
  263. Symptom symptom = new Symptom();
  264. symptom.setName(z.getStandName());
  265. return symptom;
  266. }).collect(Collectors.toList());
  267. if (ListUtil.isNotEmpty(cjiefClinicals)) {
  268. ChiefPushVo chiefPushVo = new ChiefPushVo();
  269. chiefPushVo.setSymptoms(cjiefClinicals);
  270. pushVO.setChiefPushVo(chiefPushVo);
  271. }
  272. }
  273. }
  274. if(presentLabel != null){
  275. PresentPushVo presentPushVo = new PresentPushVo();
  276. if(ListUtil.isNotEmpty(presentLabel.getClinicals())){
  277. List<Symptom> presentClinicals = presentLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
  278. {
  279. Symptom symptom = new Symptom();
  280. symptom.setName(z.getStandName());
  281. return symptom;
  282. }).collect(Collectors.toList());
  283. presentPushVo.setSymptoms(presentClinicals);
  284. }
  285. if(ListUtil.isNotEmpty(presentLabel.getDiags())){
  286. List<Diag> presentdiags = presentLabel.getDiags().stream().filter(x -> x.getNegative() == null).map(z ->
  287. {
  288. Diag diag = new Diag();
  289. diag.setName(z.getStandName());
  290. return diag;
  291. }).collect(Collectors.toList());
  292. presentPushVo.setDiags(presentdiags);
  293. }
  294. if(ListUtil.isNotEmpty(presentLabel.getMedicines())){
  295. List<Drug> presentdrugs = presentLabel.getMedicines().stream().filter(x -> x.getNegative() == null).map(z ->
  296. {
  297. Drug drug = new Drug();
  298. drug.setName(z.getStandName());
  299. return drug;
  300. }).collect(Collectors.toList());
  301. presentPushVo.setDrugs(presentdrugs);
  302. }
  303. pushVO.setPresentPushVo(presentPushVo);
  304. }
  305. if(ListUtil.isNotEmpty(lis)){
  306. LisPushVo lisPushVo = new LisPushVo();
  307. lisPushVo.setLises(lis);
  308. pushVO.setLisPushVo(lisPushVo);
  309. }
  310. // TODO 辅检
  311. // if(ListUtil.isNotEmpty(pacsNewList)){
  312. // PacsPushVo pacsPushVo = new PacsPushVo();
  313. // pacsPushVo.setPacs(pacsNewList);
  314. // pushVO.setPacsPushVo(pacsPushVo);
  315. // }
  316. if(ListUtil.isNotEmpty(diags)){
  317. DiagVo diagVo = new DiagVo();
  318. List<Diag> diseases = diags.stream().map(x -> {
  319. Diag diag = new Diag();
  320. diag.setName(x.getUniqueName());
  321. return diag;
  322. }).collect(Collectors.toList());
  323. diagVo.setDiags(diseases);
  324. pushVO.setDiagVo(diagVo);
  325. }
  326. return pushVO;
  327. }
  328. public void processPresentLisPacs(WordCrfDTO wordCrfDTO){
  329. PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  330. List<com.diagbot.model.entity.Lis> lises = presentLabel.getLises();
  331. List<Lis> lisList = new ArrayList<>();
  332. if(ListUtil.isNotEmpty(lises)){
  333. List<String> lisNames = lises.stream().map(x -> x.getBigItem().getName()).distinct().collect(Collectors.toList());
  334. Map<String, Map<String, Map<String, Long>>> configMap = lisConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), lisNames, null);
  335. if(configMap.size() > 0){
  336. lises.stream().forEach(x ->{
  337. String bigName = x.getBigItem().getName();//大项名
  338. String detailName = x.getName();//小项名
  339. String value = x.getPd().getValue();
  340. String unit = x.getPd().getUnit();
  341. if(configMap.containsKey(bigName)){
  342. Map<String, Map<String, Long>> uniqueDetailMap = configMap.get(bigName);
  343. if(uniqueDetailMap.containsKey(detailName)){
  344. List<String> uniques = uniqueDetailMap.get(detailName).keySet().stream().collect(Collectors.toList());//所有的公表项
  345. if(ListUtil.isNotEmpty(uniques)){
  346. List<Lis> lisStream = uniques.stream().map(z -> {
  347. return getLis(bigName, detailName, value, unit, z);
  348. }).collect(Collectors.toList());
  349. lisList.addAll(lisStream);
  350. }
  351. }else {
  352. Lis lis = getLis(bigName, detailName, value, unit, null);
  353. lisList.add(lis);
  354. }
  355. }else {
  356. Lis lis = getLis(bigName, detailName, value, unit, null);
  357. lisList.add(lis);
  358. }
  359. });
  360. }else {
  361. lises.stream().forEach(x ->{
  362. Lis lis = getLis(x.getBigItem().getName(), x.getName(), x.getPd().getValue(), x.getPd().getUnit(), null);
  363. lisList.add(lis);
  364. });
  365. }
  366. }
  367. wordCrfDTO.getLis().addAll(lisList);
  368. // 处理辅检信息,将现病史和结构化辅检统一放到pacsLable中
  369. PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
  370. List<Item> pacsResList = pacsLabel.getRes();
  371. PacsLabel pacsPresentLabel = wordCrfDTO.getPresentLabel().getPacsLabel();
  372. if (pacsPresentLabel != null) {
  373. // 添加辅检项目名称
  374. if (ListUtil.isNotEmpty(pacsPresentLabel.getItem())) {
  375. pacsLabel.getItem().addAll(pacsPresentLabel.getItem());
  376. }
  377. // 添加辅检的诊断
  378. if (ListUtil.isNotEmpty(pacsPresentLabel.getDisease())) {
  379. pacsLabel.getDisease().addAll(pacsPresentLabel.getDisease());
  380. }
  381. // 添加辅检的描述
  382. if (ListUtil.isNotEmpty(pacsPresentLabel.getPacsResults())) {
  383. pacsLabel.getPacsResults().addAll(pacsPresentLabel.getPacsResults());
  384. }
  385. }
  386. if (ListUtil.isNotEmpty(pacsLabel.getDisease())) {
  387. for (Pacs pacs : pacsLabel.getDisease()) {
  388. Item item = new Item();
  389. item.setName(pacs.getName());
  390. item.setUniqueName(pacs.getStandName());
  391. pacsResList.add(item);
  392. }
  393. }
  394. // 添加辅检的描述
  395. if (ListUtil.isNotEmpty(pacsLabel.getPacsResults())) {
  396. for (Pacs pacs : pacsLabel.getPacsResults()) {
  397. Item item = new Item();
  398. item.setName(pacs.getName());
  399. item.setUniqueName(pacs.getStandName());
  400. pacsResList.add(item);
  401. // 部位 + 描述循环放入
  402. for (BodyPart bodyPart : pacs.getBodyPartList()) {
  403. Item itemPart = new Item();
  404. itemPart.setName(bodyPart.getName() + pacs.getName());
  405. itemPart.setUniqueName(bodyPart.getStandName() + pacs.getStandName());
  406. pacsResList.add(itemPart);
  407. }
  408. // 描述 + 修饰循环放入
  409. for (Modification modification : pacs.getModification()) {
  410. Item itemModification = new Item();
  411. itemModification.setName(pacs.getName() + modification.getName());
  412. itemModification.setUniqueName(pacs.getStandName() + modification.getStandName());
  413. pacsResList.add(itemModification);
  414. }
  415. }
  416. }
  417. //处理辅检
  418. // List<com.diagbot.biz.push.entity.Pacs> pacs = new ArrayList<>();
  419. // List<PacsNew> packagePacs = new ArrayList<>();
  420. // List<PacsNew> pacsNewList = wordCrfDTO.getPresentLabel().getPacsNewList();
  421. // if(ListUtil.isNotEmpty(pacsNewList)){
  422. // List<String> pacsNames = pacsNewList.stream().map(x -> x.getName()).collect(Collectors.toList());
  423. // Map<String, Map<String, Long>> configMap = pacsConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), pacsNames, null);
  424. // if(configMap.size() > 0){
  425. // pacsNewList.stream().forEach(pacsNew ->{
  426. // String name = pacsNew.getName();
  427. // List<Pacs> disease = pacsNew.getDisease();
  428. // List<Pacs> pacsResults = pacsNew.getPacsResults();
  429. // if(configMap.containsKey(name)){
  430. // Map<String, Long> uinqueNameMap = configMap.get(name);
  431. // List<PacsNew> collect = uinqueNameMap.keySet().stream().map(x -> {
  432. // PacsNew pan = new PacsNew();
  433. // pan.setName(name);
  434. // pan.setUniqueName(x);
  435. // pan.setPacsResults(pacsResults);
  436. // pan.setDisease(disease);
  437. // return pan;
  438. // }).collect(Collectors.toList());
  439. // packagePacs.addAll(collect);
  440. // collect.forEach(x ->{
  441. // com.diagbot.biz.push.entity.Pacs p = new com.diagbot.biz.push.entity.Pacs();
  442. // p.setName(x.getName());
  443. // p.setUniqueName(x.getUniqueName());
  444. // pacs.add(p);
  445. // });
  446. // }else {
  447. // PacsNew pan = new PacsNew();
  448. // pan.setName(name);
  449. // pan.setPacsResults(pacsResults);
  450. // pan.setDisease(disease);
  451. // packagePacs.add(pan);
  452. // com.diagbot.biz.push.entity.Pacs p = new com.diagbot.biz.push.entity.Pacs();
  453. // p.setName(name);
  454. // pacs.add(p);
  455. // }
  456. // });
  457. // }else {
  458. // packagePacs.addAll(pacsNewList);
  459. // pacsNewList.forEach(x ->{
  460. // com.diagbot.biz.push.entity.Pacs p = new com.diagbot.biz.push.entity.Pacs();
  461. // p.setName(x.getName());
  462. // pacs.add(p);
  463. // });
  464. // }
  465. // }
  466. // if(ListUtil.isNotEmpty(pacs)){
  467. // wordCrfDTO.getPacs().addAll(pacs);
  468. // }
  469. // pacsLabel.getPacsNewList().addAll(packagePacs);
  470. }
  471. private Lis getLis(String bigName, String detailName, String value, String unit, String uniqueName) {
  472. Lis lis = new Lis();
  473. lis.setUnits(unit);
  474. if(StringUtils.isBlank(unit)){
  475. lis.setOtherValue(value);
  476. }else {
  477. lis.setValue(Double.parseDouble(value));
  478. }
  479. lis.setDetailName(detailName);
  480. lis.setName(bigName);
  481. lis.setUniqueName(uniqueName);
  482. return lis;
  483. }
  484. }