PCR检测提交时删除无需图片

dev
litao 3 years ago
parent 20848903c6
commit 1e0d464534
  1. 4
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  2. 16
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java
  3. 2
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java
  4. 69
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java
  5. 4
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/UserController.java
  6. 6
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -1390,7 +1390,7 @@ public class ExamineResultController extends BladeController {
* 上传检测结果照片
*/
@PostMapping("/resultPicture")
public R<String> resultPicture(@RequestParam MultipartFile file) {
return R.data(service.resultPicture(file));
public R<String> resultPicture(@RequestParam MultipartFile file, @RequestParam String examineId) {
return R.data(service.resultPicture(file,examineId));
}
}

@ -76,9 +76,9 @@ public class LargeScreenController extends BladeController {
int wt = entrtrustService.count(wrapper);
double wt1 = 0.00;
wt1 += wt;
double rate1 = 0;
int rate1 = 0;
if (count > 0) {
rate1 = wt1 / count * 100;
rate1 = (int) (wt1 / count * 100);
}
// 监督
wrapper.clear();
@ -88,9 +88,9 @@ public class LargeScreenController extends BladeController {
int jd = entrtrustService.count(wrapper);
double jd1 = 0.00;
jd1 += jd;
double rate2 = 0;
int rate2 = 0;
if (count > 0) {
rate2 = jd1 / count * 100;
rate2 = (int) (jd1 / count * 100);
}
// 仲裁
wrapper.clear();
@ -100,9 +100,9 @@ public class LargeScreenController extends BladeController {
int zc = entrtrustService.count(wrapper);
double zc1 = 0.00;
zc1 += zc;
double rate3 = 0;
int rate3 = 0;
if (count > 0) {
rate3 = zc1 / count * 100;
rate3 = (int) (zc1 / count * 100);
}
// 门诊
wrapper.clear();
@ -112,9 +112,9 @@ public class LargeScreenController extends BladeController {
int mz = entrtrustService.count(wrapper);
double mz1 = 0.00;
mz1 += mz;
double rate4 = 0;
int rate4 = 0;
if (count > 0) {
rate4 = mz1 / count * 100;
rate4 = (int) (mz1 / count * 100);
}
Map<String, Object> map = new HashMap<>();
map.put("yearPlan", yearPlan);

@ -19,5 +19,5 @@ public interface IExamineResultService extends BaseService<ExamineResult> {
void resultCommit(ExamineResult examineResult) throws Exception;
String resultPicture(MultipartFile file);
String resultPicture(MultipartFile file, String examineId);
}

@ -166,7 +166,7 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
}
@Override
public String resultPicture(MultipartFile file) {
public String resultPicture(MultipartFile file, String examineId) {
String fileName = "";
if (file != null) {
Random random = new Random();
@ -182,6 +182,23 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
e.printStackTrace();
}
}
if (examineId != null) {
// 检测对应结果对象
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ExamineResult::getExamineId, examineId);
ExamineResult examineResult1 = this.getOne(wrapper);
if (examineResult1 != null) {
String name = examineResult1.getPicturePath() + "," + fileName;
examineResult1.setPicturePath(name);
this.updateById(examineResult1);
} else {
ExamineResult examineResult = new ExamineResult();
examineResult.setExamineId(Long.parseLong(examineId));
examineResult.setPicturePath(fileName);
this.save(examineResult);
}
}
return fileName;
}
@ -203,9 +220,9 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
}
electronicSignature();
saves(entry);
Examine currExamine = examineService.getById(entry.getExamineId());
Examine byId = examineService.getById(entry.getExamineId());
// 判断当前检验是否是本科室里的最后一个检验
Long eTaskId = currExamine.getETaskId();
Long eTaskId = byId.getETaskId();
LambdaQueryWrapper<Examine> examineQueryWrapper = new LambdaQueryWrapper<>();
examineQueryWrapper.eq(Examine::getETaskId, eTaskId);
List<Examine> list = examineService.list(examineQueryWrapper);
@ -225,8 +242,11 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
// wrapper.eq(ETask::getDeptId, eTask.getFlowTo());
// ETask downTask = eTaskService.getOne(wrapper);
// currExamine.setTempTaskId(currExamine.getETaskId());
examineService.updateSimpleCurrPlace(currExamine.getETaskId(), currExamine.getDeptId(), 2);
examineService.updateSimpleCurrPlace(byId.getETaskId(), byId.getDeptId(), 2);
}
// 照片路径
String realPath = sysClient.getParamValue("electronic_signature_real_path").getData();
// 如果第一次提交实验结果
if (entry.getIsUpdate() == null || entry.getIsUpdate() != 1) {
// 发送提示消息
@ -245,7 +265,7 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
// if (entry.getExamineId() == null) {
// throw new Exception("必填参数为空!");
// }
Examine byId = examineService.getById(entry.getExamineId());
// Examine byId = examineService.getById(entry.getExamineId());
byId.setIsFinished("1");
byId.setStatus(0);
byId.setFinishTime(new Date());
@ -282,13 +302,27 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
wrapper.eq(ExamineResult::getExamineId, byId.getId());
// wrapper.eq(ExamineResult::getStatus, 0);
wrapper.isNull(ExamineResult::getInstrumentId);
// TODO 当有多个检测结果的时候,getOne报错
ExamineResult examineResult = this.getOne(wrapper);
entry.setId(examineResult.getId());
// 上传图片文件名
List<String> path = entry.getPath();
// 所有上传过的照片
String[] split = examineResult.getPicturePath().split(",");
if (CollectionUtils.isNotEmpty(path)) {
String picturePath = "";
// 过滤无用照片并删除
for (String s : split) {
boolean contains = path.contains(s);
if (!contains) {
// 获取图片路径
String realPath1 = realPath + s;
File file = new File(realPath1);
if (file.exists()) {
file.delete();
}
}
}
if (path.size() > 1) {
for (String s : path) {
String s1 = s + ",";
@ -298,6 +332,16 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
picturePath = path.get(0);
}
entry.setPicturePath(picturePath);
} else {
for (String s : split) {
// 获取图片路径
String realPath1 = realPath + s;
File file = new File(realPath1);
if (file.exists()) {
file.delete();
}
}
entry.setPicturePath("");
}
return this.updateById(entry);
}
@ -305,8 +349,21 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
else {
// 上传图片文件名
List<String> path = entry.getPath();
String[] split = entry.getPicturePath().split(",");
if (CollectionUtils.isNotEmpty(path)) {
String picturePath = "";
// 过滤无用照片并删除
for (String s : split) {
boolean contains = path.contains(s);
if (!contains) {
// 获取图片路径
String realPath1 = realPath + s;
File file = new File(realPath1);
if (file.exists()) {
file.delete();
}
}
}
if (path.size() > 1) {
for (String s : path) {
String s1 = s + ",";

@ -428,9 +428,9 @@ public class UserController {
double actual = 0.00;
actual += count;
// 满编率
double rate = 0;
int rate = 0;
if (rated > 0) {
rate = actual / rated * 100;
rate = (int) (actual / rated * 100);
}
// 硕士及以上人数
wrapper.clear();

@ -119,6 +119,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
file.delete();
}
}
if (byId.getAvatar() != null && !"".equals(byId.getAvatar()) && !user.getAvatar().equals(byId.getAvatar())) {
File file = new File(realPath + byId.getAvatar());
if (file.exists()) {
file.delete();
}
}
user.setPassword(null);
if (!"".equals(user.getElectronicSignature()) && user.getElectronicSignature() != null) {
Random random = new Random();

Loading…
Cancel
Save