|
@@ -28,6 +28,8 @@ import java.util.LinkedHashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -109,6 +111,95 @@ public class CommonRule {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 无需重复开单项
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param billNeoMaxDTO
|
|
|
+ * @param billMsgList
|
|
|
+ */
|
|
|
+ public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, BillNeoMaxDTO billNeoMaxDTO, List<BillMsg> billMsgList) {
|
|
|
+ List<NodeNeoDTO> needlessPacsOrder = billNeoMaxDTO.getNeedlessPacsOrder();
|
|
|
+ String orderStandName = billNeoMaxDTO.getOrderStandName();
|
|
|
+ for (NodeNeoDTO nodeNeoDTO : needlessPacsOrder) {
|
|
|
+ Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
|
|
|
+ List<Pacs> pacsList = map.get(orderStandName);
|
|
|
+ if (ListUtil.isNotEmpty(pacsList)) {
|
|
|
+ sortByProperty(pacsList, "dateValue");
|
|
|
+ Pacs pacs = pacsList.get(pacsList.size() - 1);
|
|
|
+ String result = pacs.getResult();
|
|
|
+ if (StringUtil.isNotBlank(result) && StringUtil.isNotBlank(nodeNeoDTO.getRegex())
|
|
|
+ && getRegexRes(result, nodeNeoDTO.getRegex())) {
|
|
|
+ String dateValue = pacs.getDateValue(); // 结果日期
|
|
|
+ String orderDateValue = billNeoMaxDTO.getDateValue(); // 开单项日期
|
|
|
+ if (StringUtil.isNotBlank(dateValue) && StringUtil.isNotBlank(orderDateValue)) {
|
|
|
+ Date dateValueDate = CatalogueUtil.parseStringDate(dateValue);
|
|
|
+ Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
|
|
|
+ if (dateValueDate != null && orderDateValueDate != null) {
|
|
|
+ if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7)) {
|
|
|
+ BillMsg commonBillMsg = MsgUtil.getNeedlessRepeatOrderMsg(
|
|
|
+ billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
|
|
|
+ pacs.getName(), billNeoMaxDTO.getType());
|
|
|
+ billMsgList.add(commonBillMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否有符合的数据(公共方法)
|
|
|
+ *
|
|
|
+ * @param content 文本内容
|
|
|
+ * @param regex 表达式
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean getRegexRes(String content, String regex) {
|
|
|
+ // 是否有符合的数据
|
|
|
+ try {
|
|
|
+ if (StringUtil.isBlank(content) || StringUtil.isBlank(regex)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
|
|
|
+ Matcher matcher = pattern.matcher(content);
|
|
|
+ if (matcher.find()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据指定字段按照字符串排序
|
|
|
+ *
|
|
|
+ * @param tList
|
|
|
+ * @param property
|
|
|
+ * @param <T>
|
|
|
+ */
|
|
|
+ public <T> void sortByProperty(List<T> tList, String property) {
|
|
|
+ if (ListUtil.isNotEmpty(tList) && tList.size() > 1) {
|
|
|
+ // items 按照时间排序
|
|
|
+ Collections.sort(tList, new Comparator<T>() {
|
|
|
+ @Override
|
|
|
+ public int compare(T o1, T o2) {
|
|
|
+ String o1Str = (String) CoreUtil.getFieldValue(o1, property);
|
|
|
+ String o2Str = (String) CoreUtil.getFieldValue(o2, property);
|
|
|
+ if (StringUtil.isBlank(o1Str)) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(o2Str)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return o1Str.compareTo(o2Str);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 24小时重复开单总入口
|
|
|
*
|
|
@@ -206,7 +297,7 @@ public class CommonRule {
|
|
|
if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
|
|
|
String name = (String) CoreUtil.getFieldValue(it, "name");
|
|
|
String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
|
|
|
- BillMsg commonBillMsg = MsgUtil.getBillMsg24Repeat(
|
|
|
+ BillMsg commonBillMsg = MsgUtil.getBill24RepeatMsg(
|
|
|
name, uniqueName, name, type);
|
|
|
billMsgList.add(commonBillMsg);
|
|
|
break;
|
|
@@ -285,4 +376,29 @@ public class CommonRule {
|
|
|
return drugAllergyAll;
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ List<Pacs> pacsList = new ArrayList<>();
|
|
|
+ Pacs pacs = new Pacs();
|
|
|
+ pacs.setName("d1");
|
|
|
+ pacs.setDateValue("2020-01-01");
|
|
|
+ pacsList.add(pacs);
|
|
|
+
|
|
|
+ Pacs pacs1 = new Pacs();
|
|
|
+ pacs1.setName("d2");
|
|
|
+ pacs1.setDateValue("2020-01-07");
|
|
|
+ pacsList.add(pacs1);
|
|
|
+
|
|
|
+ Pacs pacs3 = new Pacs();
|
|
|
+ pacs3.setName("d3");
|
|
|
+ pacs3.setDateValue("2020-01-09");
|
|
|
+ pacsList.add(pacs3);
|
|
|
+ CommonRule commonRule = new CommonRule();
|
|
|
+ commonRule.sortByProperty(pacsList, "dateValue");
|
|
|
+ for (Pacs bean : pacsList) {
|
|
|
+ System.out.println(bean.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|