|
@@ -8,6 +8,8 @@ import com.lantone.qc.pub.util.DateUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
@@ -23,9 +25,9 @@ public class FIRC03331 extends QCCatalogue {
|
|
|
@Override
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
/**
|
|
|
- * 1.查证【首次病程录】>>是否有“预产期”和“末次月经”两个字段,任一不存在则直接返回。
|
|
|
- * 2.查证【首次病程录】>>【末次月经月份】字段内容,字段内容:月+9(月+9大于12则月-3)记为:A【末次月经日】字段内容:日+7(日+7大于30则返回月份,月改记为:A+1,日:日+7-30)记为:B
|
|
|
- * 3.查证【首次病程录】>>【预产期】中的内容与A(月)B(日)对比,内容一致则通过,否则提示
|
|
|
+ *1.查证【首次病程录】>>是否有“预产期”和“末次月经”两个字段,任一不存在则直接返回。
|
|
|
+ * 2.查证【首次病程录】>>【末次月经】字段内容,加280天计算出数值为“预产期”。
|
|
|
+ * 3.查证【首次病程录】>>【预产期】中的内容与计算出的“预产期”转换相同格式后时间一致或大于3天或小于1天则通过,否则提示。
|
|
|
* */
|
|
|
status.set("0");
|
|
|
//获取首次病程录
|
|
@@ -37,6 +39,16 @@ public class FIRC03331 extends QCCatalogue {
|
|
|
String eDOC = firstCourseRecordDoc.getStructureMap().get("预产期");
|
|
|
//末次月经
|
|
|
String lastMP = firstCourseRecordDoc.getStructureMap().get("末次月经");
|
|
|
+ //病例特点
|
|
|
+ String firstCourseChief = firstCourseRecordDoc.getStructureMap().get("病例特点");
|
|
|
+ if (StringUtil.isNotBlank(firstCourseChief)) {
|
|
|
+ if (StringUtil.isBlank(eDOC) && firstCourseChief.contains("预产期")) {
|
|
|
+ eDOC = firstCourseChief.substring(firstCourseChief.indexOf("预产期"), firstCourseChief.indexOf("预产期") + 13).replace("预产期", "");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(lastMP) && firstCourseChief.contains("末次月经")) {
|
|
|
+ lastMP = firstCourseChief.substring(firstCourseChief.indexOf("末次月经"), firstCourseChief.indexOf("末次月经") + 14).replace("末次月经", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
if (StringUtil.isBlank(eDOC) || StringUtil.isBlank(lastMP)) {
|
|
|
return;
|
|
|
}
|
|
@@ -46,22 +58,24 @@ public class FIRC03331 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
- //预产期月份
|
|
|
- int eDOCMonth = DateUtil.getMonth(eDOCDate);
|
|
|
- //预产期日
|
|
|
- int eDOCDay = DateUtil.getDay(eDOCDate);
|
|
|
- //末次月经月份
|
|
|
- int lastMPMonth = DateUtil.getMonth(lastMPDate);
|
|
|
- //末次月经日
|
|
|
- int lastMPDay = DateUtil.getDay(lastMPDate);
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//定义格式
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
|
|
|
- int lastMPMonthNum = lastMPMonth + 9 > 12 ? lastMPMonth - 3 : lastMPMonth + 9;
|
|
|
- int lastMPDayNum = lastMPDay + 7;
|
|
|
- if (lastMPDayNum > 30) {
|
|
|
- lastMPMonthNum = lastMPMonthNum + 1;
|
|
|
- lastMPDayNum = lastMPDayNum - 30;
|
|
|
- }
|
|
|
- if (eDOCMonth != lastMPMonthNum || eDOCDay != lastMPDayNum) {
|
|
|
+ //添加末次月经时间
|
|
|
+ c.setTime(lastMPDate);
|
|
|
+ c.add(Calendar.DATE, 277); //给末次月经时间加277天
|
|
|
+ String after = sdf.format(c.getTime());
|
|
|
+ Date afterDate = StringUtil.parseDateTime(after);//日期转成Date格式
|
|
|
+
|
|
|
+ c.setTime(lastMPDate);
|
|
|
+ c.add(Calendar.DATE, 281);//给末次月经时间加281天
|
|
|
+ String before = sdf.format(c.getTime());
|
|
|
+ Date beforeDate = StringUtil.parseDateTime(before);
|
|
|
+
|
|
|
+ //判断预产期是否在正确的区间里
|
|
|
+ if ((eDOCDate.after(afterDate) && eDOCDate.before(beforeDate)) || eDOCDate.equals(afterDate) || eDOCDate.equals(beforeDate)) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|