|
|
@@ -12,6 +12,7 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
import cn.hutool.crypto.asymmetric.KeyType;
|
|
|
import cn.hutool.crypto.asymmetric.RSA;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
@@ -50,6 +51,7 @@ import java.io.IOException;
|
|
|
import java.lang.annotation.Annotation;
|
|
|
import java.lang.reflect.Constructor;
|
|
|
import java.lang.reflect.Parameter;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
@@ -286,17 +288,18 @@ public class ArchiveServer {
|
|
|
|
|
|
public ResultVo<String> sort(TaskPatient data) {
|
|
|
ListUtil.batchList(data.getArchives(), PatientArchiveDao.class, BaseMapper::updateById);
|
|
|
-
|
|
|
JSONObject js = new JSONObject() {{
|
|
|
put("roomCode", data.getPatNo() + "_" + data.getTimes());
|
|
|
put("msg", new JSONObject() {{
|
|
|
put("code", "change");
|
|
|
- put("data", TokenUtil.getInstance().getTokenUserId());
|
|
|
+ put("data", new JSONObject() {{
|
|
|
+ put("code", TokenUtil.getInstance().getTokenUserId());
|
|
|
+ put("message", "排序");
|
|
|
+ }});
|
|
|
}}.toJSONString());
|
|
|
}};
|
|
|
-
|
|
|
socketService.sendArchiveRoomMsg(js);
|
|
|
- return ResultVoUtil.success();
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE, "排序成功。");
|
|
|
}
|
|
|
|
|
|
public ResultVo<PatientArchive> upload(MultipartFile file, String patNo, Integer times, String parent) {
|
|
|
@@ -331,7 +334,6 @@ public class ArchiveServer {
|
|
|
.createId(TokenUtil.getInstance().getTokenUserId())
|
|
|
.build();
|
|
|
ArchiveLog logger = getPatLog(patNo, times, "上传文件");
|
|
|
-
|
|
|
try {
|
|
|
FileUtil.writeBytes(file.getBytes(), path);
|
|
|
} catch (IOException e) {
|
|
|
@@ -339,10 +341,11 @@ public class ArchiveServer {
|
|
|
}
|
|
|
try {
|
|
|
patientArchiveDao.insert(build);
|
|
|
- logger.info("上传文件成功:文件名【】", filename);
|
|
|
+ logger.fileChangeSend(build.getCreateId(), "上传文件");
|
|
|
+ logger.info("上传文件成功:文件名【{}】", build.getName());
|
|
|
} catch (Exception e) {
|
|
|
FileUtil.del(path);
|
|
|
- logger.error("上传文件失败:文件名【】,错误信息:{}", filename, e.getMessage());
|
|
|
+ logger.error("上传文件失败:文件名【{}】,错误信息:{}", build.getName(), e.getMessage());
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, e.getMessage());
|
|
|
}
|
|
|
return ResultVoUtil.success(build);
|
|
|
@@ -361,6 +364,7 @@ public class ArchiveServer {
|
|
|
PatientArchive oldData = patientArchiveDao.selectById(archive.getId());
|
|
|
patientArchiveDao.deleteById(archive.getId());
|
|
|
logger.warn("删除文件:文件名 {}", oldData.getName());
|
|
|
+ logger.fileChangeSend(TokenUtil.getInstance().getTokenUserId(), "删除文件");
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
|
|
|
}
|
|
|
|
|
|
@@ -369,6 +373,7 @@ public class ArchiveServer {
|
|
|
archive.setCreateId(TokenUtil.getInstance().getTokenUserId());
|
|
|
patientArchiveDao.insert(archive);
|
|
|
ArchiveLog logger = getPatLog(archive, "新增文件夹");
|
|
|
+ logger.fileChangeSend(TokenUtil.getInstance().getTokenUserId(), "新增文件夹");
|
|
|
logger.info("名称:{}", archive.getName());
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
@@ -381,6 +386,7 @@ public class ArchiveServer {
|
|
|
PatientArchive oldData = patientArchiveDao.selectById(id);
|
|
|
ArchiveLog logger = getPatLog(oldData, "重命名");
|
|
|
logger.info("文件id:{},原名称:【{}】,新名称:【{}】", id, oldData.getName(), name);
|
|
|
+ logger.fileChangeSend(TokenUtil.getInstance().getTokenUserId(), "重命名文件");
|
|
|
patientArchiveDao.updateById(build);
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
|
|
|
}
|
|
|
@@ -397,5 +403,12 @@ public class ArchiveServer {
|
|
|
public ArchiveLog getPatLog(PatientArchive archive, String serverName) {
|
|
|
return getPatLog(archive.getPatNo(), archive.getTimes(), serverName);
|
|
|
}
|
|
|
+
|
|
|
+ public JSONArray getAllLog(String patNo, Integer times) {
|
|
|
+ String path = archiveData.getEmrPatientPath(patNo, times) + "/archive.txt";
|
|
|
+ String data = FileUtil.readString(path, StandardCharsets.UTF_8);
|
|
|
+ return new JSONArray("[" + data + "]");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|