|
@@ -5,6 +5,8 @@ import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
@@ -18,27 +20,32 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
|
- * @Description:入院后没有连续记录3天
|
|
|
- * 记录分为:首次病程记录+查房记录
|
|
|
+ * @Description:入院后没有连续记录3天 记录分为:首次病程记录+查房记录
|
|
|
* @date 2020-06-29 17:16
|
|
|
*/
|
|
|
@Component
|
|
|
public class THR03010 extends QCCatalogue {
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
status.set("0");
|
|
|
+ //住院病例信息为空,终止
|
|
|
if (inputInfo.getMedicalRecordInfoDoc() == null || inputInfo.getMedicalRecordInfoDoc().getStructureMap().size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
if (inputInfo.getFirstPageRecordDoc() == null || inputInfo.getFirstPageRecordDoc().getStructureMap().size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
+ //获取入院记录文档集合
|
|
|
Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
|
|
|
+ //入院日期为空前面就是入院日期,入院日期不为空 前面就为空
|
|
|
String behospitalDate = structureMap.get("入院日期") == null ? null : structureMap.get("入院日期");
|
|
|
//String leaveHospitalDate = structureMap.get("leaveHospitalDate") == null ? null : structureMap.get("leaveHospitalDate");
|
|
|
+ //获取病案首页文档集合
|
|
|
Map<String, String> structureMaps = inputInfo.getFirstPageRecordDoc().getStructureMap();
|
|
|
- String leaveHospitalDate = structureMaps.get("出院时间")!= null ?
|
|
|
- structureMaps.get("出院时间") :inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("leaveHospitalDate");
|
|
|
+ //离开医院时间为如果出院时间不为空,则离开医院时间为出院时间,如果出院时间为空,则离开医院时间为住院病例信息集合中的离开医院日期
|
|
|
+ String leaveHospitalDate = structureMaps.get("出院时间") != null ?
|
|
|
+ structureMaps.get("出院时间") : inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("leaveHospitalDate");
|
|
|
if (behospitalDate != null && leaveHospitalDate != null) {
|
|
|
+ //解析时间
|
|
|
Date beDate = StringUtil.parseDateTime(behospitalDate);
|
|
|
Date leaveDate = StringUtil.parseDateTime(leaveHospitalDate);
|
|
|
long l = (leaveDate.getTime() - beDate.getTime()) / (24 * 60 * 60 * 1000);
|
|
@@ -49,6 +56,7 @@ public class THR03010 extends QCCatalogue {
|
|
|
//从住院开始连续的时间列表
|
|
|
List<Date> stringDate = new ArrayList<>();
|
|
|
//当天算进去所以从零开始
|
|
|
+ //获取从当天开始的后三天日期时 分 秒
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
stringDate.add(DateUtil.getFirstTimeOfDay(DateUtil.addDay(beDate, i)));
|
|
|
}
|
|
@@ -57,11 +65,10 @@ public class THR03010 extends QCCatalogue {
|
|
|
List<Date> wordDateList = new ArrayList<>();
|
|
|
//获取首次病程记录时间
|
|
|
FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
|
|
|
- if(firstCourseRecordDoc!=null
|
|
|
- &&StringUtil.isNotBlank(firstCourseRecordDoc.getStructureMap().get("病历日期"))) {
|
|
|
+ if (firstCourseRecordDoc != null
|
|
|
+ && StringUtil.isNotBlank(firstCourseRecordDoc.getStructureMap().get("病历日期"))) {
|
|
|
String firstCourseRecorTime = firstCourseRecordDoc.getStructureMap().get("病历日期");
|
|
|
- if(StringUtil.isNotBlank(firstCourseRecorTime))
|
|
|
- {
|
|
|
+ if (StringUtil.isNotBlank(firstCourseRecorTime)) {
|
|
|
wordDateList.add(StringUtil.parseDateTime(firstCourseRecorTime));
|
|
|
}
|
|
|
}
|
|
@@ -70,26 +77,36 @@ public class THR03010 extends QCCatalogue {
|
|
|
for (ThreeLevelWardDoc t : threeLevelWardDocs) {
|
|
|
Date threeLevelDate = StringUtil.parseDateTime(t.getStructureMap().get("查房日期"));
|
|
|
//去重,同一天就存一次
|
|
|
- if(threeLevelDate!=null&&wordDateList.get(wordDateList.size()-1)!=null
|
|
|
- &&!DateUtils.isSameDay(wordDateList.get(wordDateList.size()-1),threeLevelDate))
|
|
|
- {
|
|
|
+ if (threeLevelDate != null && wordDateList.get(wordDateList.size() - 1) != null
|
|
|
+ && !DateUtils.isSameDay(wordDateList.get(wordDateList.size() - 1), threeLevelDate)) {
|
|
|
wordDateList.add(threeLevelDate);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //获取手术首次病程录时间
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
+ if (operationDocs != null) {
|
|
|
+ for (OperationDoc t : operationDocs) {
|
|
|
+ OperationDiscussionDoc operationDiscussionDoc = t.getOperationDiscussionDoc();
|
|
|
+ if (operationDiscussionDoc != null) {
|
|
|
+ Date firstOperationtime = StringUtil.parseDateTime(operationDiscussionDoc.getStructureMap().get("病历日期"));
|
|
|
+ if (firstOperationtime != null) {
|
|
|
+ wordDateList.add(firstOperationtime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//如果记录时间没有3天
|
|
|
- if(wordDateList.size()<3)
|
|
|
- {
|
|
|
+ if (wordDateList.size() < 3) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|
|
|
//如果住院当天开始做记录
|
|
|
- if(DateUtils.isSameDay(stringDate.get(0),wordDateList.get(0)))
|
|
|
- {
|
|
|
- for(int i = 1;i<=2;i++)
|
|
|
- {
|
|
|
+ if (DateUtils.isSameDay(stringDate.get(0), wordDateList.get(0))) {
|
|
|
+ for (int i = 1; i <= 2; i++) {
|
|
|
//如果时间不相等则时间不连续
|
|
|
- if(!DateUtils.isSameDay(stringDate.get(i),wordDateList.get(i)))
|
|
|
- {
|
|
|
+ if (!DateUtils.isSameDay(stringDate.get(i), wordDateList.get(i))) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|
|
@@ -97,13 +114,10 @@ public class THR03010 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
//如果是住院后第二天开始
|
|
|
- else
|
|
|
- {
|
|
|
- for(int i = 0;i<=3;i++)
|
|
|
- {
|
|
|
+ else {
|
|
|
+ for (int i = 0; i <= 3; i++) {
|
|
|
//如果时间不相等则时间不连续
|
|
|
- if(!DateUtils.isSameDay(stringDate.get(i+1),wordDateList.get(i)))
|
|
|
- {
|
|
|
+ if (!DateUtils.isSameDay(stringDate.get(i + 1), wordDateList.get(i))) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|