|
@@ -0,0 +1,54 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.deathrecord;
|
|
|
+
|
|
|
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
+import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
+import com.lantone.qc.pub.Content;
|
|
|
+import com.lantone.qc.pub.model.InputInfo;
|
|
|
+import com.lantone.qc.pub.model.OutputInfo;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : DEAR0371
|
|
|
+ * @Description : 死亡记录里死亡时间未精确到分
|
|
|
+ * @Author : 胡敬
|
|
|
+ * @Date: 2020-03-18 18:38
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class DEAR0371 extends QCCatalogue {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ status = "0";
|
|
|
+ if (inputInfo.getDeathRecordDoc() != null && inputInfo.getDeathRecordDoc().getStructureMap() != null) {
|
|
|
+ Map<String, String> deathRecordStructureMap = inputInfo.getDeathRecordDoc().getStructureMap();
|
|
|
+ String deathTime = deathRecordStructureMap.get("死亡时间");
|
|
|
+ if (CatalogueUtil.isEmpty(deathTime)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Date deathDate = StringUtil.parseDateTime(CatalogueUtil.removeSpecialChar(deathTime)
|
|
|
+ , processDateFormat(Content.dateFormats));
|
|
|
+ if (null == deathDate) {
|
|
|
+ status = "-1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 只保留Date精确到分的格式
|
|
|
+ *
|
|
|
+ * @param dateFormats
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String[] processDateFormat(String[] dateFormats) {
|
|
|
+ List<String> dateFormatsList = Arrays.asList(dateFormats);
|
|
|
+ List<String> dateFormatsNew = new ArrayList<>(dateFormatsList);
|
|
|
+ dateFormatsNew.removeIf(dateFormat -> dateFormat.contains("s") || !dateFormat.contains("m"));
|
|
|
+ String[] dateFormatsArr = new String[dateFormatsNew.size()];
|
|
|
+ return dateFormatsNew.toArray(dateFormatsArr);
|
|
|
+ }
|
|
|
+}
|