|
|
@ -24,7 +24,7 @@ import java.io.IOException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
@ -46,6 +46,12 @@ public class UpdateService {
|
|
|
|
|
|
|
|
|
|
|
|
private Set<String> lianZhongPatPicDirs = new HashSet<>();
|
|
|
|
private Set<String> lianZhongPatPicDirs = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 最终保存文件的目录两位标识+10位病案号相关+8位日期,将标识作为第一级检索,病案号相关位第二层检索
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private Map<String, Map<String, Set<String>>> lianZhongPatPicDirMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<CardInfo> updateData() {
|
|
|
|
public List<CardInfo> updateData() {
|
|
|
|
List<CardInfo> cardInfos = dataQuery.dateQuery();
|
|
|
|
List<CardInfo> cardInfos = dataQuery.dateQuery();
|
|
|
|
dataQuery.updateBatchState(cardInfos, 1);
|
|
|
|
dataQuery.updateBatchState(cardInfos, 1);
|
|
|
@ -229,8 +235,14 @@ public class UpdateService {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
UpdateService updateService = new UpdateService();
|
|
|
|
UpdateService updateService = new UpdateService();
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirs));
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirs));
|
|
|
|
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirMap));
|
|
|
|
updateService.initLianZhongPatPicDir();
|
|
|
|
updateService.initLianZhongPatPicDir();
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirs));
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirs));
|
|
|
|
|
|
|
|
System.out.println(new Gson().toJson(updateService.lianZhongPatPicDirMap));
|
|
|
|
|
|
|
|
Map<String, Set<String>> stringSetMap = updateService.lianZhongPatPicDirMap.get("75");
|
|
|
|
|
|
|
|
System.out.println(new Gson().toJson(stringSetMap));
|
|
|
|
|
|
|
|
Set<String> strings = stringSetMap.get("12345");
|
|
|
|
|
|
|
|
System.out.println(new Gson().toJson(strings));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void initLianZhongPatPicDir() {
|
|
|
|
private void initLianZhongPatPicDir() {
|
|
|
@ -243,6 +255,7 @@ public class UpdateService {
|
|
|
|
while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
lianZhongPatPicDirs.add(line);
|
|
|
|
lianZhongPatPicDirs.add(line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
initLianZhongPatPicDirsMap(lianZhongPatPicDirs);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
log.error(">>>>>>>>>>>> 初始化联众患者文件目录读取存储文件错误!");
|
|
|
|
log.error(">>>>>>>>>>>> 初始化联众患者文件目录读取存储文件错误!");
|
|
|
@ -292,6 +305,7 @@ public class UpdateService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!lianZhongPatPicDirs.isEmpty()) {
|
|
|
|
if (!lianZhongPatPicDirs.isEmpty()) {
|
|
|
|
|
|
|
|
initLianZhongPatPicDirsMap(lianZhongPatPicDirs);
|
|
|
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(readFile));) {
|
|
|
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(readFile));) {
|
|
|
|
for (String picDir : lianZhongPatPicDirs) {
|
|
|
|
for (String picDir : lianZhongPatPicDirs) {
|
|
|
|
writer.write(picDir);
|
|
|
|
writer.write(picDir);
|
|
|
@ -307,6 +321,24 @@ public class UpdateService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 最终保存文件的目录两位标识+10位病案号相关+8位日期,将标识作为第一级检索,病案号相关位第二层检索
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void initLianZhongPatPicDirsMap(Set<String> lianZhongPatPicDirs) {
|
|
|
|
|
|
|
|
for (String lianZhongPatPicDir : lianZhongPatPicDirs) {
|
|
|
|
|
|
|
|
File patPicDirFile = new File(lianZhongPatPicDir);
|
|
|
|
|
|
|
|
String name = patPicDirFile.getName();
|
|
|
|
|
|
|
|
String flag = name.substring(0, 2);
|
|
|
|
|
|
|
|
String maybe = name.substring(2).substring(0, 10);
|
|
|
|
|
|
|
|
maybe = removeLeadingZeros(maybe);
|
|
|
|
|
|
|
|
Map<String, Set<String>> maybeMap = lianZhongPatPicDirMap.getOrDefault(flag, new HashMap<>());
|
|
|
|
|
|
|
|
Set<String> maybeVal = maybeMap.getOrDefault(maybe, new HashSet<>());
|
|
|
|
|
|
|
|
maybeVal.add(lianZhongPatPicDir);
|
|
|
|
|
|
|
|
maybeMap.put(maybe, maybeVal);
|
|
|
|
|
|
|
|
lianZhongPatPicDirMap.put(flag, maybeMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private LianZhongUploadInfo.PatientInfo convert(CardInfo cardInfo) {
|
|
|
|
private LianZhongUploadInfo.PatientInfo convert(CardInfo cardInfo) {
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
@ -349,24 +381,23 @@ public class UpdateService {
|
|
|
|
private String findLianZhongDir(CardInfo cardInfo) {
|
|
|
|
private String findLianZhongDir(CardInfo cardInfo) {
|
|
|
|
String gestno = cardInfo.getGestno();
|
|
|
|
String gestno = cardInfo.getGestno();
|
|
|
|
String patno = cardInfo.getPatno();
|
|
|
|
String patno = cardInfo.getPatno();
|
|
|
|
Date outdate = cardInfo.getOutdate();
|
|
|
|
// Date outdate = cardInfo.getOutdate();
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
String pathPrefix = cardInfo.getPat_path().substring(0, 2);
|
|
|
|
String outDateFormat = sdf.format(outdate);
|
|
|
|
/// 取消出院日期判断,日期可能不是出院日期
|
|
|
|
for (String lianZhongPatPicDir : lianZhongPatPicDirs) {
|
|
|
|
//SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
String dirName = new File(lianZhongPatPicDir).getName();
|
|
|
|
// String outDateFormat = sdf.format(outdate);
|
|
|
|
String disDatePart = dirName.substring(12);
|
|
|
|
Map<String, Set<String>> maybeMap = lianZhongPatPicDirMap.get(pathPrefix);
|
|
|
|
String comparePart = dirName.substring(2).substring(0, 10);
|
|
|
|
// gestno 或者 patno 进行 识别
|
|
|
|
comparePart = removeLeadingZeros(comparePart);
|
|
|
|
if (StringUtils.hasText(gestno)) {
|
|
|
|
// gestno 或者 patno 进行 识别
|
|
|
|
Set<String> picsByGestno = maybeMap.get(removeLeadingZeros(gestno));
|
|
|
|
if (StringUtils.hasText(gestno)) {
|
|
|
|
if(!CollectionUtils.isEmpty(picsByGestno) && picsByGestno.size() == 1){
|
|
|
|
if (comparePart.equals(removeLeadingZeros(gestno)) && outDateFormat.equals(disDatePart)) {
|
|
|
|
return new ArrayList<>(picsByGestno).get(0);
|
|
|
|
return lianZhongPatPicDir;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (comparePart.equals(removeLeadingZeros(patno)) && outDateFormat.equals(disDatePart)) {
|
|
|
|
|
|
|
|
return lianZhongPatPicDir;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Set<String> picsByPatno = maybeMap.get(removeLeadingZeros(patno));
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(picsByPatno) && picsByPatno.size() == 1){
|
|
|
|
|
|
|
|
return new ArrayList<>(picsByPatno).get(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|