|
@@ -23,6 +23,7 @@ import java.lang.reflect.Field;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Date;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -264,7 +265,7 @@ public class CoreUtil {
|
|
*/
|
|
*/
|
|
public static <T> void setUninameFromDetail(List<T> list, String targetProperty) {
|
|
public static <T> void setUninameFromDetail(List<T> list, String targetProperty) {
|
|
for (T r : list) {
|
|
for (T r : list) {
|
|
- String value = (String)getFieldValue(r, "uniqueName");
|
|
|
|
|
|
+ String value = (String) getFieldValue(r, "uniqueName");
|
|
if (StringUtil.isBlank(value)) {
|
|
if (StringUtil.isBlank(value)) {
|
|
String detailName = (String) getFieldValue(r, targetProperty);
|
|
String detailName = (String) getFieldValue(r, targetProperty);
|
|
ReflectUtil.setProperty(r, "uniqueName", detailName);
|
|
ReflectUtil.setProperty(r, "uniqueName", detailName);
|
|
@@ -338,16 +339,16 @@ public class CoreUtil {
|
|
if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
|
|
if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
|
|
// 有医院原值就提示医院值
|
|
// 有医院原值就提示医院值
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
- map.put("msg", lis.getDetailName() + lis.getResult());
|
|
|
|
|
|
+ map.put("msg", lis.getDetailName() + "结果" + lis.getResult());
|
|
} else {
|
|
} else {
|
|
- map.put("msg", lis.getDetailName() + lis.getOtherValue());
|
|
|
|
|
|
+ map.put("msg", lis.getDetailName() + "结果" + lis.getOtherValue());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 有医院原值就提示医院值
|
|
// 有医院原值就提示医院值
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
- map.put("msg", lis.getName() + lis.getDetailName() + lis.getResult());
|
|
|
|
|
|
+ map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getResult());
|
|
} else {
|
|
} else {
|
|
- map.put("msg", lis.getName() + lis.getDetailName() + lis.getOtherValue());
|
|
|
|
|
|
+ map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getOtherValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
flag = true;
|
|
flag = true;
|
|
@@ -358,15 +359,15 @@ public class CoreUtil {
|
|
if (flag) {
|
|
if (flag) {
|
|
if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
|
|
if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
- map.put("msg", lis.getDetailName() + lis.getResult());
|
|
|
|
|
|
+ map.put("msg", lis.getDetailName() + "结果" + lis.getResult());
|
|
} else {
|
|
} else {
|
|
- map.put("msg", lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
|
|
|
|
|
|
+ map.put("msg", lis.getDetailName() + "结果" + subZeroAndDot(String.valueOf(lis.getValue())));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
if (StringUtil.isNotBlank(lis.getResult())) {
|
|
- map.put("msg", lis.getName() + lis.getDetailName() + lis.getResult());
|
|
|
|
|
|
+ map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getResult());
|
|
} else {
|
|
} else {
|
|
- map.put("msg", lis.getName() + lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
|
|
|
|
|
|
+ map.put("msg", lis.getName() + lis.getDetailName() + "结果" + subZeroAndDot(String.valueOf(lis.getValue())));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -662,9 +663,9 @@ public class CoreUtil {
|
|
int indexSui = ageStr.indexOf("岁");
|
|
int indexSui = ageStr.indexOf("岁");
|
|
ageArr[0] = ageStr.substring(0, indexSui);
|
|
ageArr[0] = ageStr.substring(0, indexSui);
|
|
if (ageStr.indexOf("个月") > -1) { // 3岁7个月
|
|
if (ageStr.indexOf("个月") > -1) { // 3岁7个月
|
|
- ageArr[1] = ageStr.substring(indexSui + 1,ageStr.indexOf("个月"));
|
|
|
|
|
|
+ ageArr[1] = ageStr.substring(indexSui + 1, ageStr.indexOf("个月"));
|
|
} else { // 3岁7月
|
|
} else { // 3岁7月
|
|
- ageArr[1] = ageStr.substring(indexSui + 1,ageStr.indexOf("月"));
|
|
|
|
|
|
+ ageArr[1] = ageStr.substring(indexSui + 1, ageStr.indexOf("月"));
|
|
}
|
|
}
|
|
return Double.parseDouble(ageArr[0]) + getHalfUp(Double.parseDouble(ageArr[1]) / 12);
|
|
return Double.parseDouble(ageArr[0]) + getHalfUp(Double.parseDouble(ageArr[1]) / 12);
|
|
}
|
|
}
|
|
@@ -854,6 +855,22 @@ public class CoreUtil {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取mapMsg值
|
|
|
|
+ *
|
|
|
|
+ * @param map
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String getMapMsg(Map map) {
|
|
|
|
+ if (map != null && map.get("flag") != null && (Boolean) map.get("flag") == true) {
|
|
|
|
+ String msg = (String) map.get("msg");
|
|
|
|
+ if (StringUtil.isNotBlank(msg)) {
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取mapMsgList值
|
|
* 获取mapMsgList值
|
|
*
|
|
*
|
|
@@ -1041,12 +1058,13 @@ public class CoreUtil {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 将字符串以“,”分隔,添加到list列表中
|
|
* 将字符串以“,”分隔,添加到list列表中
|
|
|
|
+ *
|
|
* @param list
|
|
* @param list
|
|
* @param s
|
|
* @param s
|
|
*/
|
|
*/
|
|
public static void addSplitString(List<Long> list, String s) {
|
|
public static void addSplitString(List<Long> list, String s) {
|
|
if (StringUtil.isBlank(s)) {
|
|
if (StringUtil.isBlank(s)) {
|
|
- return ;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
list.addAll(Arrays.stream(s.split(",")).map(r -> Long.parseLong(r)).collect(Collectors.toList()));
|
|
list.addAll(Arrays.stream(s.split(",")).map(r -> Long.parseLong(r)).collect(Collectors.toList()));
|
|
}
|
|
}
|
|
@@ -1059,7 +1077,7 @@ public class CoreUtil {
|
|
*/
|
|
*/
|
|
public static void removeRepeat(List<String> orginList, List<String> splitList) {
|
|
public static void removeRepeat(List<String> orginList, List<String> splitList) {
|
|
if (ListUtil.isEmpty(orginList) || ListUtil.isEmpty(splitList)) {
|
|
if (ListUtil.isEmpty(orginList) || ListUtil.isEmpty(splitList)) {
|
|
- return ;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
Iterator<String> iterator = orginList.iterator();
|
|
Iterator<String> iterator = orginList.iterator();
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
@@ -1084,7 +1102,7 @@ public class CoreUtil {
|
|
}
|
|
}
|
|
for (T t : tList) {
|
|
for (T t : tList) {
|
|
for (String key : propertyName) {
|
|
for (String key : propertyName) {
|
|
- String name = (String)getFieldValue(t, key);
|
|
|
|
|
|
+ String name = (String) getFieldValue(t, key);
|
|
// 去重
|
|
// 去重
|
|
if (StringUtil.isNotBlank(name) && !list.contains(name)) {
|
|
if (StringUtil.isNotBlank(name) && !list.contains(name)) {
|
|
list.add(name);
|
|
list.add(name);
|
|
@@ -1115,13 +1133,13 @@ public class CoreUtil {
|
|
*/
|
|
*/
|
|
public static <T> void removeRepeat(List<T> source, String property) {
|
|
public static <T> void removeRepeat(List<T> source, String property) {
|
|
if (ListUtil.isEmpty(source) || source.size() < 2) {
|
|
if (ListUtil.isEmpty(source) || source.size() < 2) {
|
|
- return ;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
List<Object> list = Lists.newArrayList();
|
|
List<Object> list = Lists.newArrayList();
|
|
Iterator<T> iterator = source.iterator();
|
|
Iterator<T> iterator = source.iterator();
|
|
T t = null;
|
|
T t = null;
|
|
Object object = null;
|
|
Object object = null;
|
|
- while(iterator.hasNext()) {
|
|
|
|
|
|
+ while (iterator.hasNext()) {
|
|
t = iterator.next();
|
|
t = iterator.next();
|
|
object = getFieldValue(t, property);
|
|
object = getFieldValue(t, property);
|
|
if (object != null) {
|
|
if (object != null) {
|
|
@@ -1162,6 +1180,7 @@ public class CoreUtil {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据分隔符转成list
|
|
* 根据分隔符转成list
|
|
|
|
+ *
|
|
* @param name
|
|
* @param name
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -1183,6 +1202,45 @@ public class CoreUtil {
|
|
return Lists.newArrayList(name.split(splitSymbol));
|
|
return Lists.newArrayList(name.split(splitSymbol));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 时间差值(绝对值)和指定分钟数进行比较
|
|
|
|
+ *
|
|
|
|
+ * @param startDateStr 开始时间
|
|
|
|
+ * @param endDateStr 结束时间
|
|
|
|
+ * @param minute 分钟
|
|
|
|
+ * @param hasEqual 是否包含等于
|
|
|
|
+ * @return 返回值:-1:无法比较或出错,0:时间差超出范围,1:时间差在范围内
|
|
|
|
+ */
|
|
|
|
+ public static int compareTime(String startDateStr, String endDateStr, Long minute, boolean hasEqual) {
|
|
|
|
+ int flag = -1;
|
|
|
|
+ if (StringUtil.isBlank(startDateStr) || StringUtil.isBlank(endDateStr)) {
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ Date startDate = CatalogueUtil.parseStringDate(startDateStr);
|
|
|
|
+ Date endDate = CatalogueUtil.parseStringDate(endDateStr);
|
|
|
|
+ Long timeStart = startDate.getTime();
|
|
|
|
+ Long timeEnd = endDate.getTime();
|
|
|
|
+
|
|
|
|
+ if (hasEqual) {
|
|
|
|
+ if (Math.abs(timeEnd - timeStart) >= minute * 1000 * 60) {
|
|
|
|
+ flag = 0;
|
|
|
|
+ } else {
|
|
|
|
+ flag = 1;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (Math.abs(timeEnd - timeStart) > minute * 1000 * 60) {
|
|
|
|
+ flag = 0;
|
|
|
|
+ } else {
|
|
|
|
+ flag = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
List<PushBaseDTO> pushBaseDTOList = ListUtil.newArrayList();
|
|
List<PushBaseDTO> pushBaseDTOList = ListUtil.newArrayList();
|
|
PushBaseDTO pushBaseDTO = new PushBaseDTO();
|
|
PushBaseDTO pushBaseDTO = new PushBaseDTO();
|