BillProcess.java 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package com.diagbot.process;
  2. import com.diagbot.biz.push.entity.Lis;
  3. import com.diagbot.biz.push.entity.Pacs;
  4. import com.diagbot.dto.BillMsg;
  5. import com.diagbot.dto.BillNeoDTO;
  6. import com.diagbot.dto.BillNeoMaxDTO;
  7. import com.diagbot.dto.IndicationDTO;
  8. import com.diagbot.dto.WordCrfDTO;
  9. import com.diagbot.model.entity.Clinical;
  10. import com.diagbot.model.entity.Diag;
  11. import com.diagbot.model.label.ChiefLabel;
  12. import com.diagbot.model.label.DiagLabel;
  13. import com.diagbot.model.label.PresentLabel;
  14. import com.diagbot.rule.*;
  15. import com.diagbot.util.BeanUtil;
  16. import com.diagbot.util.CoreUtil;
  17. import com.diagbot.util.ListUtil;
  18. import org.springframework.stereotype.Component;
  19. import java.util.ArrayList;
  20. import java.util.List;
  21. /**
  22. * @Description: 开单总入口
  23. * @author: zhoutg
  24. * @time: 2018/8/6 9:11
  25. */
  26. @Component
  27. public class BillProcess {
  28. public void process(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO res) {
  29. // 合并图谱数据到同一个对象中
  30. List<BillNeoMaxDTO> billNeoMaxDTOList = new ArrayList<>();
  31. for (BillNeoDTO billNeoDTO : billNeoDTOList) {
  32. BillNeoMaxDTO billNeoMaxDTO = new BillNeoMaxDTO();
  33. if (billNeoDTO.getDrugBillNeoDTO() != null) {
  34. BeanUtil.copyProperties(billNeoDTO.getDrugBillNeoDTO(), billNeoMaxDTO);
  35. } else if (billNeoDTO.getLisBillNeoDTO() != null) {
  36. BeanUtil.copyProperties(billNeoDTO.getLisBillNeoDTO(), billNeoMaxDTO);
  37. } else if (billNeoDTO.getPacsBillNeoDTO() != null) {
  38. BeanUtil.copyProperties(billNeoDTO.getPacsBillNeoDTO(), billNeoMaxDTO);
  39. }
  40. billNeoMaxDTO.setOrderName(billNeoDTO.getName()); // 开单名称
  41. billNeoMaxDTO.setOrderStandName(billNeoDTO.getStandname()); // 开单标准名称
  42. // 测试数据开始
  43. // billNeoMaxDTO.setGender("男");
  44. // billNeoMaxDTO.getAgeNeoDTO().setMax(new BigDecimal(30));
  45. // billNeoMaxDTO.getAgeNeoDTO().setMin(new BigDecimal(25));
  46. // 测试数据结束
  47. System.out.println(billNeoMaxDTO);
  48. billNeoMaxDTOList.add(billNeoMaxDTO);
  49. }
  50. processRule(billNeoMaxDTOList, wordCrfDTO, res);
  51. }
  52. // 规则处理
  53. public void processRule(List<BillNeoMaxDTO> billNeoMaxDTOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
  54. DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
  55. ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
  56. PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  57. List<Diag> diags = new ArrayList<>();
  58. List<Clinical> clinicals = new ArrayList<>();
  59. if(diagLabel != null){
  60. diags = diagLabel.getDiags();
  61. }
  62. if(chiefLabel != null && ListUtil.isNotEmpty(chiefLabel.getClinicals())){
  63. clinicals.addAll(chiefLabel.getClinicals());
  64. }
  65. // 现病史临床表现数据先不用
  66. if(presentLabel != null && ListUtil.isNotEmpty(presentLabel.getClinicals())){
  67. clinicals.addAll(presentLabel.getClinicals());
  68. }
  69. List<Lis> lis = wordCrfDTO.getLis();
  70. List<Pacs> pacs = wordCrfDTO.getPacs();
  71. List<BillMsg> billMsgList = new ArrayList<>();
  72. for (BillNeoMaxDTO bill : billNeoMaxDTOList) {
  73. // 性别
  74. BillMsg sexMsg = SexRule.compareSexWithBill(bill.getGender(), wordCrfDTO, bill);
  75. CoreUtil.addBeanToList(billMsgList, sexMsg);
  76. // 诊断
  77. BillMsg billMsg_disease = DiagRule.compareDiseaseWithBill(bill.getDisease(), diags, bill);
  78. CoreUtil.addBeanToList(billMsgList, billMsg_disease);
  79. //化验
  80. BillMsg lisMsg = LisRule.compareLisWithBill(bill.getLis(), lis, bill);
  81. CoreUtil.addBeanToList(billMsgList, lisMsg);
  82. //辅检
  83. BillMsg pacsMsg = PacsRule.comparePacsWithBill(bill.getPacs(), pacs, bill);
  84. CoreUtil.addBeanToList(billMsgList, pacsMsg);
  85. //临床表现
  86. BillMsg clinicalMsg = DiagRule.compareDiseaseWithBill(bill.getClinicfindings(), clinicals, bill);
  87. CoreUtil.addBeanToList(billMsgList, clinicalMsg);
  88. // 年龄
  89. BillMsg ageMsg = AgeRule.compareAgeWithBill(bill.getAgeNeoDTO(), wordCrfDTO, bill);
  90. CoreUtil.addBeanToList(billMsgList, ageMsg);
  91. }
  92. indicationDTO.setBillMsgList(billMsgList);
  93. }
  94. //
  95. // /**
  96. // * 化验规则处理
  97. // *
  98. // * @param billNeoDTOList
  99. // * @param wordCrfDTO
  100. // * @param indicationDTO
  101. // */
  102. // public void processBillWithLis(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
  103. //
  104. // }
  105. //
  106. // /**
  107. // * 辅检规则处理
  108. // *
  109. // * @param billNeoDTOList
  110. // * @param wordCrfDTO
  111. // * @param indicationDTO
  112. // */
  113. // public void processBillWithPacs(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
  114. //
  115. // }
  116. //
  117. // /**
  118. // * 药品规则处理
  119. // *
  120. // * @param billNeoDTOList
  121. // * @param wordCrfDTO
  122. // * @param indicationDTO
  123. // */
  124. // public void processBillWithDrug(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
  125. // DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
  126. // ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
  127. // PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
  128. // List<Diag> diags = new ArrayList<>();
  129. // List<Clinical> clinicals = new ArrayList<>();
  130. // if(diagLabel != null){
  131. // diags = diagLabel.getDiags();
  132. // }
  133. // if(chiefLabel != null && ListUtil.isNotEmpty(chiefLabel.getClinicals())){
  134. // clinicals.addAll(chiefLabel.getClinicals());
  135. // }
  136. // // 现病史临床表现数据先不用
  137. // if(presentLabel != null && ListUtil.isNotEmpty(presentLabel.getClinicals())){
  138. // clinicals.addAll(presentLabel.getClinicals());
  139. // }
  140. // List<Lis> lis = wordCrfDTO.getLis();
  141. // List<Pacs> pacs = wordCrfDTO.getPacs();
  142. //
  143. // List<BillMsg> drugBill = new ArrayList<>();
  144. // for (BillNeoDTO bill : billNeoDTOList) {
  145. // DrugBillNeoDTO drug = bill.getDrugBillNeoDTO();
  146. // // 性别
  147. // BillMsg sexMsg = SexRule.compareSexWithBill(drug.getGender(), wordCrfDTO, bill.getName());
  148. // CoreUtil.addBeanToList(drugBill, sexMsg);
  149. //
  150. // // 诊断
  151. // BillMsg billMsg_disease = DiagRule.compareDiseaseWithBill(drug.getDisease(), diags, bill.getName());
  152. // CoreUtil.addBeanToList(drugBill, billMsg_disease);
  153. //
  154. // // //化验
  155. // // BillMsg lisMsg = LisPacsRule.compareLisPacsWithBill(drug.getLis(), lis, bill.getName());
  156. // // CoreUtil.addBeanToList(drugBill, lisMsg);
  157. // //
  158. // // //辅检
  159. // // BillMsg pacsMsg = LisPacsRule.compareLisPacsWithBill(drug.getPacs(), pacs, bill.getName());
  160. // // CoreUtil.addBeanToList(drugBill, pacsMsg);
  161. // //
  162. // // //临床表现
  163. // // BillMsg clinicalMsg = DiagRule.compareDiseaseWithBill(drug.getClinicfindings(), clinicals, bill.getName());
  164. // // CoreUtil.addBeanToList(drugBill, clinicalMsg);
  165. //
  166. // // 年龄
  167. // BillMsg ageMsg = AgeRule.compareAgeWithBill(drug.getAgeNeoDTO(), wordCrfDTO, bill.getName());
  168. // CoreUtil.addBeanToList(drugBill, ageMsg);
  169. //
  170. // }
  171. // indicationDTO.setDrugBill(drugBill);
  172. // }
  173. }