|
|
@ -69,7 +69,35 @@ public class LianZhongSyncController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据病案号和出院日期(yyyy-MM-dd),更新联众文件数据状态为0 ,需要重新同步 ")
|
|
|
|
|
|
|
|
@GetMapping("/updateState/byInpNoAndDisDate")
|
|
|
|
|
|
|
|
public CommonResult<String> updateStateByInpNoAndDisDate(@RequestParam("inpatientNo") String inpatientNo, @RequestParam("disDate") String disDate) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
List<CardInfo> cardInfos = dataQuery.dateQueryByInpNo(inpatientNo);
|
|
|
|
|
|
|
|
CardInfo cardInfo = null;
|
|
|
|
|
|
|
|
for (CardInfo info : cardInfos) {
|
|
|
|
|
|
|
|
if (disDate.equals(sdf.format(info.getOutdate()))) {
|
|
|
|
|
|
|
|
cardInfo = info;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Objects.isNull(cardInfo)) {
|
|
|
|
|
|
|
|
return CommonResult.failed("未找到 cardInfo 信息!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dataQuery.updateBatchState(cardInfo, 0);
|
|
|
|
|
|
|
|
return CommonResult.success("更新完成!");
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
|
|
|
return CommonResult.failed(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void sync(CardInfo cardInfo) throws IOException {
|
|
|
|
public void sync(CardInfo cardInfo) throws IOException {
|
|
|
|
|
|
|
|
String dir = "c:\\pic-makup\\" + cardInfo.getId();
|
|
|
|
|
|
|
|
// 创建File对象
|
|
|
|
|
|
|
|
File directory = new File(dir);
|
|
|
|
|
|
|
|
try {
|
|
|
|
String uniUrl = "http://192.168.8.74";
|
|
|
|
String uniUrl = "http://192.168.8.74";
|
|
|
|
List<Picture> pictures = dataQuery.getPictures(cardInfo.getId());
|
|
|
|
List<Picture> pictures = dataQuery.getPictures(cardInfo.getId());
|
|
|
|
if (pictures == null || pictures.size() == 0) {
|
|
|
|
if (pictures == null || pictures.size() == 0) {
|
|
|
@ -77,9 +105,7 @@ public class LianZhongSyncController {
|
|
|
|
dataQuery.updateBatchState(cardInfo, 5);
|
|
|
|
dataQuery.updateBatchState(cardInfo, 5);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String dir = "c:\\pic\\" + cardInfo.getId();
|
|
|
|
|
|
|
|
// 创建File对象
|
|
|
|
|
|
|
|
File directory = new File(dir);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断目录是否存在
|
|
|
|
// 判断目录是否存在
|
|
|
|
if (!directory.exists()) {
|
|
|
|
if (!directory.exists()) {
|
|
|
@ -95,10 +121,14 @@ public class LianZhongSyncController {
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
Future future = executor.submit(() -> {
|
|
|
|
Future future = executor.submit(() -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String cmd = "C:\\Debug\\lianzhong.exe 003 192.168.8.74 " + cardInfo.getId() + " " + picture.getPicid() + " " + cardInfo.getPatno() + " " + cardInfo.getOutdateStr() + " " + picture.getPicname() + " " + picture.getFileUrl() + " " + uniUrl + " " + picture.getRotatedegree();
|
|
|
|
String cmd = "C:\\Debug\\lianzhong.exe 003 192.168.8.74 " + cardInfo.getId() + " " + picture.getPicid() + " " + cardInfo.getPatno() + " " + cardInfo.getOutdateStr() + " " + picture.getPicname() + " " + picture.getMakeUpFileUrl() + " " + uniUrl + " " + picture.getRotatedegree();
|
|
|
|
// log.info(cmd);
|
|
|
|
// log.info(cmd);
|
|
|
|
java.lang.Process process = java.lang.Runtime.getRuntime().exec(cmd);//执行命令生成cube
|
|
|
|
java.lang.Process process = java.lang.Runtime.getRuntime().exec(cmd);//执行命令生成cube
|
|
|
|
process.waitFor();
|
|
|
|
process.waitFor();
|
|
|
|
|
|
|
|
File pictureFile = new File(picture.getMakeUpFileUrl());
|
|
|
|
|
|
|
|
if (!pictureFile.exists()) {
|
|
|
|
|
|
|
|
log.error("图片转换失败,命令为:{}", cmd);
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
@ -117,10 +147,16 @@ public class LianZhongSyncController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean complete=true;
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
List<UploadInfo> uploadInfos = new ArrayList<>();
|
|
|
|
List<UploadInfo> uploadInfos = new ArrayList<>();
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
files.add(new File(picture.getFileUrl()));
|
|
|
|
File pictureFile = new File(picture.getMakeUpFileUrl());
|
|
|
|
|
|
|
|
if(!pictureFile.exists()){
|
|
|
|
|
|
|
|
complete=false;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
files.add(pictureFile);
|
|
|
|
UploadInfo uploadInfo = new UploadInfo(cardInfo.getPatno(), cardInfo.getOutdateStr2(), picture.getPicname(), picture.getPicname(),
|
|
|
|
UploadInfo uploadInfo = new UploadInfo(cardInfo.getPatno(), cardInfo.getOutdateStr2(), picture.getPicname(), picture.getPicname(),
|
|
|
|
picture.getPickind(), cardInfo.getId(), cardInfo.getPatname(),
|
|
|
|
picture.getPickind(), cardInfo.getId(), cardInfo.getPatname(),
|
|
|
|
cardInfo.getIndateStr(), cardInfo.getPatsex(), cardInfo.getPatnum(),
|
|
|
|
cardInfo.getIndateStr(), cardInfo.getPatsex(), cardInfo.getPatnum(),
|
|
|
@ -129,6 +165,13 @@ public class LianZhongSyncController {
|
|
|
|
uploadInfos.add(uploadInfo);
|
|
|
|
uploadInfos.add(uploadInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (files.isEmpty()) {
|
|
|
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
|
|
|
// 删除文件
|
|
|
|
|
|
|
|
FileUploader.deleteFolder(directory);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 额外的表单字段参数
|
|
|
|
// 额外的表单字段参数
|
|
|
|
List<FormField> params = new ArrayList<>();
|
|
|
|
List<FormField> params = new ArrayList<>();
|
|
|
@ -142,10 +185,18 @@ public class LianZhongSyncController {
|
|
|
|
dataQuery.updateBatchState(cardInfo, 3);
|
|
|
|
dataQuery.updateBatchState(cardInfo, 3);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!complete) {
|
|
|
|
|
|
|
|
// 不完整
|
|
|
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,2);
|
|
|
|
|
|
|
|
}
|
|
|
|
// 删除文件
|
|
|
|
// 删除文件
|
|
|
|
File file = new File(dir);
|
|
|
|
FileUploader.deleteFolder(directory);
|
|
|
|
FileUploader.deleteFolder(file);
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
|
|
|
if (directory.exists()) {
|
|
|
|
|
|
|
|
FileUploader.deleteFolder(directory);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|