|
|
|
|
@ -4,8 +4,10 @@ import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
|
import com.docus.infrastructure.web.api.CommonResult;
|
|
|
|
|
import com.docus.infrastructure.web.api.ResultCode;
|
|
|
|
|
import com.docus.server.archive.dto.PatientState;
|
|
|
|
|
import com.docus.server.archive.entity.TBasic;
|
|
|
|
|
import com.docus.server.archive.mapper.TBasicMapper;
|
|
|
|
|
import com.docus.server.mzzyy.entity.MzZyyXinDianView;
|
|
|
|
|
@ -33,12 +35,14 @@ import com.xxl.job.core.context.XxlJobHelper;
|
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
@ -67,6 +71,8 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
private TBasicMapper tBasicMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MzZyyXinDianViewMapper xinDianViewMapper;
|
|
|
|
|
@Value("${docus.prevent-invalid-file:}")
|
|
|
|
|
private String preventInvalidFile;
|
|
|
|
|
|
|
|
|
|
@XxlJob("MzZyyLisCollectJob")
|
|
|
|
|
public void lisCollectJob() {
|
|
|
|
|
@ -135,9 +141,9 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.info("住院号:{},住院流水号:{},采集了 {} 份文件。", inpatientNo, jzh, count);
|
|
|
|
|
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
|
|
|
|
|
if (!isPreventInvalidFile(patientId)) {
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
}
|
|
|
|
|
ReportDownPatientDto patient = new ReportDownPatientDto();
|
|
|
|
|
patient.setPatientid(patientId);
|
|
|
|
|
|
|
|
|
|
@ -168,6 +174,7 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@XxlJob("MzZyyShouMaCollectJob")
|
|
|
|
|
public void shouMaCollectJob() {
|
|
|
|
|
String configPath = "data-config";
|
|
|
|
|
@ -254,7 +261,9 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
reportDownDto.setCollectorid(collectorId);
|
|
|
|
|
reportDownDto.setIp("java-shouma-job");
|
|
|
|
|
reportDownDto.setPatient(patient);
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
if (!isPreventInvalidFile(patientId)) {
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
}
|
|
|
|
|
for (ReportDownScanFileDto scanFile : scanFiles) {
|
|
|
|
|
List<ReportDownScanFileDto> scanFileDtos = Collections.singletonList(scanFile);
|
|
|
|
|
String assortId = getShouMaAssortId(scanFile.getFiletitle());
|
|
|
|
|
@ -300,7 +309,9 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
determineAndCancelTask(patientId, collectorId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
if (!isPreventInvalidFile(patientId)) {
|
|
|
|
|
tBasicMapper.invalidFileBySource(patientId, collectorId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReportDownPatientDto patient = new ReportDownPatientDto();
|
|
|
|
|
patient.setPatientid(patientId);
|
|
|
|
|
@ -402,6 +413,38 @@ public class MzZyyReportCollectJob {
|
|
|
|
|
return defaultAssort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isPreventInvalidFile(String patientId) {
|
|
|
|
|
PatientState state = tBasicMapper.getPatientState(patientId);
|
|
|
|
|
if (Func.isNull(state)) {
|
|
|
|
|
throw new BaseException("患者不存在");
|
|
|
|
|
}
|
|
|
|
|
if (Func.isBlank(preventInvalidFile)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 封存、锁定、归档 符合阻止作废条件则返回true
|
|
|
|
|
String[] prevents = preventInvalidFile.toLowerCase().split(",");
|
|
|
|
|
List<String> preventList = Arrays.asList(prevents);
|
|
|
|
|
if (preventList.contains("seal")) {
|
|
|
|
|
Integer isSeal = 1;
|
|
|
|
|
if (isSeal.equals(state.getIsSeal())) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (preventList.contains("lock")) {
|
|
|
|
|
Integer isLock = 3;
|
|
|
|
|
if (isLock.equals(state.getIsLock())) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (preventList.contains("archive")) {
|
|
|
|
|
Integer isArchive = 1;
|
|
|
|
|
if (isArchive.equals(state.getIsArchive())) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
System.out.println(new MzZyyReportCollectJob().getShouMaAssortId("手术登记"));
|
|
|
|
|
}
|
|
|
|
|
|