diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java index c1afd9b..dbfa769 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java @@ -257,6 +257,14 @@ public class StudyFormFillController extends BaseController { return AjaxResult.success("操作成功"); } + /** + * 药剂存储过滤 + */ + @PostMapping("/yjccFilter") + @RequiresPermissions(value = {"business:studyFormFill:bj", "business:nonTrialFormFill:bj", "business:drugFormFill:bj"}, logical = Logical.OR) + public AjaxResult yjccFilter(@RequestBody StudyFormFill studyFormFill) { + return AjaxResult.success(studyFormFillService.yjccFilter(studyFormFill)); + } /** * 药剂存储 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyFormFillService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyFormFillService.java index d9ce715..fef1979 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyFormFillService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyFormFillService.java @@ -119,6 +119,13 @@ public interface IStudyFormFillService extends IService */ public void yjcc(StudyFormFill studyFormFill); + /** + * 药剂存储过滤 + * @param studyFormFill + * @return + */ + public String yjccFilter(StudyFormFill studyFormFill); + /** * 观察 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java index 45fde80..ac8a26f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java @@ -111,7 +111,7 @@ public class GyzjServiceImpl extends ServiceImpl implements IG gyzj.setBdId(form.getStudyFormId()); gyzj.setNd(form.getNd()); gyzj.setNddw(form.getNddw()); - gyzj.setZjzt(ZjztEnum.rk.getValue()); + gyzj.setZjzt(ZjztEnum.wrk.getValue()); gyzj.setJyzt(JyztEnum.wjy.getValue()); this.save(gyzj); } else { @@ -122,7 +122,7 @@ public class GyzjServiceImpl extends ServiceImpl implements IG gyzj.setBdId(form.getStudyFormId()); gyzj.setNd(form.getNd()); gyzj.setNddw(form.getNddw()); - gyzj.setZjzt(ZjztEnum.rk.getValue()); + gyzj.setZjzt(ZjztEnum.wrk.getValue()); gyzj.setJyzt(JyztEnum.wjy.getValue()); this.updateById(gyzj); } @@ -1577,25 +1577,11 @@ public class GyzjServiceImpl extends ServiceImpl implements IG } for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) { Gyzj gyzj = gyzjMap.get(studyFormFillResource.getBh()); - //配置的更新type - if (studyFormFillResource.getType() == null) { - studyFormFillResource.setType(StudyFormFillResourceTypeEnum.gyzj.getValue()); - } else { - //使用的更新 - studyFormFillResource.setMc(gyzj.getMc()); - studyFormFillResource.setNd(gyzj.getNd()); - studyFormFillResource.setNddw(gyzj.getNddw()); - studyFormFillResource.setLy(gyzj.getLy()); - if (gyzj.getSxrq() != null) { - studyFormFillResource.setSxrq(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", gyzj.getSxrq())); - } + if(gyzj!=null){ + gyzj.setCczt(CcztEnum.Cc.getValue()); + this.updateById(gyzj); } - gyzj.setCczt(CcztEnum.Cc.getValue()); - this.updateById(gyzj); - gyzjMap.put(gyzj.getBh(), gyzj); } - //更新 Resource - studyFormFill.setResource(JSONObject.toJSONString(studyFormFillResourceList)); } // 存储 cc(studyFormFill, gyzjMap, jcgjList, tzList, remark, qmr); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java index b0a449b..441f55f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java @@ -1236,7 +1236,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS Long studyFormId = studyFormFill.getId(); // 生成/使用 String resource = studyFormFill.getResource(); - Map mjyMap = new HashMap<>(10); + Map mjyMap = new HashMap<>(10); List mjyList = new ArrayList<>(); LinkedList jcgjList = new LinkedList<>(); LinkedList tzList = new LinkedList<>(); @@ -1364,25 +1364,11 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS } for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) { Mjy mjy = mjyMap.get(studyFormFillResource.getBh()); - //配置的更新type - if (studyFormFillResource.getType() == null) { - studyFormFillResource.setType(StudyFormFillResourceTypeEnum.mjy.getValue()); - } else { - //使用的更新 - studyFormFillResource.setMc(mjy.getMc()); - studyFormFillResource.setNd(mjy.getNd()); - studyFormFillResource.setNddw(mjy.getNddw()); - studyFormFillResource.setLy(mjy.getLy()); - if (mjy.getSxrq() != null) { - studyFormFillResource.setSxrq(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", mjy.getSxrq())); - } + if(mjy!=null){ + mjy.setCczt(CcztEnum.Cc.getValue()); + this.updateById(mjy); } - mjy.setCczt(CcztEnum.Cc.getValue()); - this.updateById(mjy); - mjyMap.put(mjy.getBh(), mjy); } - //更新 Resource - studyFormFill.setResource(JSONObject.toJSONString(studyFormFillResourceList)); } // 存储 cc(studyFormFill, mjyMap, jcgjList, tzList, remark, qmr); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java index 92a9eef..db12a7a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java @@ -1,16 +1,22 @@ package com.hxhq.business.service.impl; import java.util.*; +import java.util.stream.Collectors; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.*; +import com.hxhq.business.dto.study.StudyFormFillCc; import com.hxhq.business.dto.study.StudyFormFillListDto; +import com.hxhq.business.dto.study.StudyFormFillResource; import com.hxhq.business.enums.NormalEnum; import com.hxhq.business.enums.SnTypeEnum; import com.hxhq.business.enums.study.StudyFormFillBdztEnum; +import com.hxhq.business.enums.study.StudyFormFillResourceTypeEnum; import com.hxhq.business.enums.study.StudyTypeEnum; import com.hxhq.business.enums.template.ProductEnum; import com.hxhq.business.enums.zykgl.JcgjlxEnum; @@ -473,14 +479,82 @@ public class StudyFormFillServiceImpl extends ServiceImpl formData = new LinkedHashMap<>(); - formData.put("存储位置", "todo"); - formData.put("存储条件", "todo"); - formData.put("存储药剂", "todo"); - studyFormFillJcgjService.saveJcgj(studyFormFillOld.getId(), JcgjlxEnum.lc.getValue(), "存储", JcmcysEnum.green.getValue(), formData, qmr, null, null); + this.updateById(studyFormFillOld); + String cclist = studyFormFill.getCclist(); + String empty = "[]"; + if (StringUtils.isNotEmpty(cclist) && !StringUtils.equals(empty, cclist)) { + List studyFormFillJcgjList=new ArrayList<>(); + List studyFormFillCcList = JSONUtil.toList(cclist, StudyFormFillCc.class); + for (StudyFormFillCc studyFormFillCc : studyFormFillCcList) { + //稽查轨迹 + Map formData = new LinkedHashMap<>(); + formData.put("存储位置", studyFormFillCc.getCcwz()); + formData.put("存储条件", studyFormFillCc.getCctj()); + formData.put("存储药剂", String.join(",",studyFormFillCc.getList())); + studyFormFillJcgjList.add(studyFormFillJcgjService.getJcgj(studyFormFillOld.getId(), JcgjlxEnum.lc.getValue(), "存储", JcmcysEnum.green.getValue(), formData, qmr, null)); + } + if(studyFormFillJcgjList.size()>0){ + studyFormFillJcgjService.saveBatch(studyFormFillJcgjList); + } + } + } + } + + /** + * 药剂存储过滤 + * + * @param studyFormFill + */ + @Override + @Transactional(rollbackFor = Exception.class) + public String yjccFilter(StudyFormFill studyFormFill) { + List result=new ArrayList<>(); + if (studyFormFill.getId() != null) { + StudyFormFill studyFormFillOld = this.queryInfo(studyFormFill.getId()); + Template template = templateService.getById(studyFormFillOld.getTemplateId()); + String empty = "[]"; + if (StringUtils.isNotEmpty(studyFormFill.getResource()) && !StringUtils.equals(empty, studyFormFill.getResource())) { + List studyFormFillResourceList = JSONUtil.toList(studyFormFill.getResource(), StudyFormFillResource.class); + result = studyFormFillResourceList.stream().filter( + p -> (p.getType() != null)).collect(Collectors.toList()); + List tmp = studyFormFillResourceList.stream().filter( + p -> (p.getType() == null)).collect(Collectors.toList()); + if (tmp.size() > 0) { + List bhList = tmp.stream().map(StudyFormFillResource::getBh).collect(Collectors.toList()); + if(template.getProduct().equals(StudyFormFillResourceTypeEnum.mjy.getValue())){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(Mjy::getBh, bhList); + List mjyList = mjyService.list(queryWrapper); + Map mjyMap = new HashMap<>(10); + for (Mjy mjy : mjyList) { + mjyMap.put(mjy.getBh(), mjy); + } + for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) { + Mjy mjy = mjyMap.get(studyFormFillResource.getBh()); + if(mjy!=null){ + result.add(studyFormFillResource); + } + } + } + if(template.getProduct().equals(StudyFormFillResourceTypeEnum.gyzj.getValue())){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(Gyzj::getBh, bhList); + List gyzjList = gyzjService.list(queryWrapper); + Map gyzjMap = new HashMap<>(10); + for (Gyzj gyzj : gyzjList) { + gyzjMap.put(gyzj.getBh(), gyzj); + } + for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) { + Gyzj gyzj = gyzjMap.get(studyFormFillResource.getBh()); + if(gyzj!=null){ + result.add(studyFormFillResource); + } + } + } + } + } } + return JSONObject.toJSONString(result); } /**