|
|
|
@ -659,7 +659,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
String empty = "[]"; |
|
|
|
if (StringUtils.isNotEmpty(resource) && !StringUtils.equals(empty, resource)) { |
|
|
|
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(resource, StudyFormFillResource.class); |
|
|
|
List<StudyFormFillResource> tmp= studyFormFillResourceList.stream().filter(p -> (p.getType() == null && mark) || (p.getType()!=null&&StudyFormFillResourceTypeEnum.sj.getValue()==p.getType())).collect(Collectors.toList()); |
|
|
|
List<StudyFormFillResource> tmp = studyFormFillResourceList.stream().filter(p -> (p.getType() == null && mark) || (p.getType() != null && StudyFormFillResourceTypeEnum.sj.getValue() == p.getType())).collect(Collectors.toList()); |
|
|
|
// 根据编号获取需要处置的列表 |
|
|
|
if (tmp.size() > 0) { |
|
|
|
List<String> bhList = tmp.stream().map(StudyFormFillResource::getBh).collect(Collectors.toList()); |
|
|
|
@ -673,81 +673,85 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) { |
|
|
|
Sj sj = sjMap.get(studyFormFillResource.getBh()); |
|
|
|
//配置的才保存,或更新 |
|
|
|
if (studyFormFillResource.getType() == null) { |
|
|
|
if(studyFormFill.getSftb().equals(NormalEnum.no.getValue())) { |
|
|
|
if (sj == null) { |
|
|
|
sj = new Sj(); |
|
|
|
if (mark) { |
|
|
|
if (studyFormFillResource.getType() == null) { |
|
|
|
if (studyFormFill.getSftb().equals(NormalEnum.no.getValue())) { |
|
|
|
if (sj == null) { |
|
|
|
sj = new Sj(); |
|
|
|
} |
|
|
|
sj.setStudyId(studyId); |
|
|
|
sj.setStudyFormId(studyFormId); |
|
|
|
sj.setDeptId(deptId); |
|
|
|
sj.setZjzt(ZjztEnum.rk.getValue()); |
|
|
|
sj.setJyzt(JyztEnum.wjy.getValue()); |
|
|
|
sj.setDeptId(template.getDeptId()); |
|
|
|
|
|
|
|
sj.setMc(studyFormFillResource.getMc()); |
|
|
|
sj.setBh(studyFormFillResource.getBh()); |
|
|
|
sj.setNd(String.valueOf(studyFormFillResource.getNd())); |
|
|
|
sj.setNddw(studyFormFillResource.getNddw()); |
|
|
|
sj.setKc(studyFormFillResource.getKc()); |
|
|
|
sj.setKcdw(studyFormFillResource.getKcdw()); |
|
|
|
sj.setLy(studyFormFillResource.getLy()); |
|
|
|
sj.setSxr(DateUtils.parseDate(studyFormFillResource.getSxrq())); |
|
|
|
sj.setPzrq(studyFormFill.getStartDate()); |
|
|
|
sj.setYxzq(studyFormFillResource.getYxzq()); |
|
|
|
sj.setYxzqdw(studyFormFillResource.getYxzqdw()); |
|
|
|
|
|
|
|
if (sj.getId() == null) { |
|
|
|
this.save(sj); |
|
|
|
// 稽查轨迹 |
|
|
|
SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "配制完成", "Formulation Completed", |
|
|
|
JcmcysEnum.green.getValue(), null, null, qmr); |
|
|
|
jcgjList.add(sjJcgj); |
|
|
|
|
|
|
|
// 台账 |
|
|
|
SjTz sjTz = sjTzService.genTz(sj.getId(), "配制完成", "Formulation Completed", sj.getKc(), sj.getKcdw(), null, qmr); |
|
|
|
tzList.add(sjTz); |
|
|
|
} else { |
|
|
|
this.updateById(sj); |
|
|
|
} |
|
|
|
sjMap.put(sj.getBh(), sj); |
|
|
|
sjList.add(sj); |
|
|
|
} |
|
|
|
sj.setStudyId(studyId); |
|
|
|
sj.setStudyFormId(studyFormId); |
|
|
|
sj.setDeptId(deptId); |
|
|
|
sj.setZjzt(ZjztEnum.rk.getValue()); |
|
|
|
sj.setJyzt(JyztEnum.wjy.getValue()); |
|
|
|
sj.setDeptId(template.getDeptId()); |
|
|
|
|
|
|
|
sj.setMc(studyFormFillResource.getMc()); |
|
|
|
sj.setBh(studyFormFillResource.getBh()); |
|
|
|
sj.setNd(String.valueOf(studyFormFillResource.getNd())); |
|
|
|
sj.setNddw(studyFormFillResource.getNddw()); |
|
|
|
sj.setKc(studyFormFillResource.getKc()); |
|
|
|
sj.setKcdw(studyFormFillResource.getKcdw()); |
|
|
|
sj.setLy(studyFormFillResource.getLy()); |
|
|
|
sj.setSxr(DateUtils.parseDate(studyFormFillResource.getSxrq())); |
|
|
|
sj.setPzrq(studyFormFill.getStartDate()); |
|
|
|
sj.setYxzq(studyFormFillResource.getYxzq()); |
|
|
|
sj.setYxzqdw(studyFormFillResource.getYxzqdw()); |
|
|
|
|
|
|
|
if (sj.getId() == null) { |
|
|
|
this.save(sj); |
|
|
|
// 稽查轨迹 |
|
|
|
SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "配制完成", "Formulation Completed", |
|
|
|
JcmcysEnum.green.getValue(), null, null, qmr); |
|
|
|
jcgjList.add(sjJcgj); |
|
|
|
|
|
|
|
// 台账 |
|
|
|
SjTz sjTz = sjTzService.genTz(sj.getId(), "配制完成", "Formulation Completed", sj.getKc(), sj.getKcdw(), null, qmr); |
|
|
|
tzList.add(sjTz); |
|
|
|
} else { |
|
|
|
this.updateById(sj); |
|
|
|
studyFormFillResource.setType(StudyFormFillResourceTypeEnum.sj.getValue()); |
|
|
|
} else { |
|
|
|
//使用的才更新 Resource |
|
|
|
studyFormFillResource.setMc(sj.getMc()); |
|
|
|
studyFormFillResource.setNd(sj.getNd()); |
|
|
|
studyFormFillResource.setNddw(sj.getNddw()); |
|
|
|
studyFormFillResource.setKc(sj.getKc()); |
|
|
|
studyFormFillResource.setKcdw(sj.getKcdw()); |
|
|
|
studyFormFillResource.setPh(sj.getPh()); |
|
|
|
studyFormFillResource.setLy(sj.getLy()); |
|
|
|
if (sj.getSxr() != null) { |
|
|
|
studyFormFillResource.setSxrq(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", sj.getSxr())); |
|
|
|
} |
|
|
|
sjMap.put(sj.getBh(), sj); |
|
|
|
sjList.add(sj); |
|
|
|
} |
|
|
|
studyFormFillResource.setType(StudyFormFillResourceTypeEnum.sj.getValue()); |
|
|
|
}else{ |
|
|
|
//使用的才更新 Resource |
|
|
|
studyFormFillResource.setMc(sj.getMc()); |
|
|
|
studyFormFillResource.setNd(sj.getNd()); |
|
|
|
studyFormFillResource.setNddw(sj.getNddw()); |
|
|
|
studyFormFillResource.setKc(sj.getKc()); |
|
|
|
studyFormFillResource.setKcdw(sj.getKcdw()); |
|
|
|
studyFormFillResource.setPh(sj.getPh()); |
|
|
|
studyFormFillResource.setLy(sj.getLy()); |
|
|
|
if(sj.getSxr()!=null){ |
|
|
|
studyFormFillResource.setSxrq(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",sj.getSxr())); |
|
|
|
} |
|
|
|
} |
|
|
|
// 使用 |
|
|
|
syl(studyFormFillResource, sj, jcgjList, tzList, qmr); |
|
|
|
sjMap.put(sj.getBh(), sj); |
|
|
|
if (sj != null) { |
|
|
|
syl(studyFormFillResource, sj, jcgjList, tzList, qmr); |
|
|
|
sjMap.put(sj.getBh(), sj); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//更新 Resource |
|
|
|
studyFormFill.setResource(JSONObject.toJSONString(studyFormFillResourceList)); |
|
|
|
} |
|
|
|
if(sjMap.size() > 0&&studyFormFill.getSftb().equals(NormalEnum.no.getValue())) { |
|
|
|
if (sjMap.size() > 0 && studyFormFill.getSftb().equals(NormalEnum.no.getValue())) { |
|
|
|
// 存储 |
|
|
|
cc(studyFormFill, sjMap, jcgjList, tzList, qmr); |
|
|
|
// 处置,库存全变为0 |
|
|
|
cz(studyFormFill, sjMap, jcgjList, tzList, qmr); |
|
|
|
} |
|
|
|
if(jcgjList.size()>0){ |
|
|
|
if (jcgjList.size() > 0) { |
|
|
|
sjJcgjService.saveBatch(jcgjList); |
|
|
|
} |
|
|
|
if(jcgjList.size()>0){ |
|
|
|
if (jcgjList.size() > 0) { |
|
|
|
sjTzService.saveBatch(tzList); |
|
|
|
} |
|
|
|
if(jcgjList.size()>0){ |
|
|
|
if (jcgjList.size() > 0) { |
|
|
|
studySjService.saveBatch(studyId, sjList); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -777,17 +781,17 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 开始配置 |
|
|
|
* |
|
|
|
* @param form |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void startConfiguration(StudyFormConfigurationForm form){ |
|
|
|
public void startConfiguration(StudyFormConfigurationForm form) { |
|
|
|
Sj sj = this.getSjByBh(form.getBh()); |
|
|
|
StudySubject studySubject = studySubjectService.getById(form.getStudySubjectId()); |
|
|
|
if(sj == null) { |
|
|
|
if (sj == null) { |
|
|
|
sj = new Sj(); |
|
|
|
sj.setBh(form.getBh()); |
|
|
|
sj.setPzrq(new Date()); |
|
|
|
@ -807,15 +811,16 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
|
|
|
|
/** |
|
|
|
* 配置完成 |
|
|
|
* |
|
|
|
* @param form |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void configurationCompleted(StudyFormConfigurationForm form){ |
|
|
|
public void configurationCompleted(StudyFormConfigurationForm form) { |
|
|
|
Sj sj = this.getSjByBh(form.getBh()); |
|
|
|
StudySubject studySubject = studySubjectService.getById(form.getStudySubjectId()); |
|
|
|
|
|
|
|
if(sj == null) { |
|
|
|
if (sj == null) { |
|
|
|
sj = new Sj(); |
|
|
|
sj.setBh(form.getBh()); |
|
|
|
sj.setKc(form.getKc()); |
|
|
|
@ -847,13 +852,14 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
|
|
|
|
/** |
|
|
|
* 分装 |
|
|
|
* |
|
|
|
* @param form |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void subpackage(StudyFormFillSubpackageForm form){ |
|
|
|
public void subpackage(StudyFormFillSubpackageForm form) { |
|
|
|
Sj sj = this.getSjByBh(form.getBh()); |
|
|
|
if(sj == null) { |
|
|
|
if (sj == null) { |
|
|
|
sj = new Sj(); |
|
|
|
sj.setBh(form.getBh()); |
|
|
|
this.save(sj); |
|
|
|
@ -893,7 +899,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
Map<String, String> jcnrMap = new LinkedHashMap<>(); |
|
|
|
jcnrMap.put("母液编号", form.getBh()); |
|
|
|
jcnrMap.put("分装个数", String.valueOf(form.getList().size())); |
|
|
|
jcnrMap.put("分装后编号及体积",String.join(",", fz)); |
|
|
|
jcnrMap.put("分装后编号及体积", String.join(",", fz)); |
|
|
|
jcnrMap.put("分装人", SecurityUtils.getNickName()); |
|
|
|
jcgj.setJcnr(JctUtil.formatStr(jcnrMap)); |
|
|
|
sjJcgjService.save(jcgj); |
|
|
|
@ -928,7 +934,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
tzList.add(sjTz); |
|
|
|
} |
|
|
|
} |
|
|
|
if(list.size()>0){ |
|
|
|
if (list.size() > 0) { |
|
|
|
baseMapper.updateCc(list, studyFormFillCc.getCctj(), studyFormFillCc.getCcwz()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -937,6 +943,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
|
|
|
|
/** |
|
|
|
* 处置 |
|
|
|
* |
|
|
|
* @param studyFormFill |
|
|
|
* @param sjMap |
|
|
|
* @param jcgjList |
|
|
|
@ -974,7 +981,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
tzList.add(sjTz); |
|
|
|
} |
|
|
|
} |
|
|
|
if(list.size()>0){ |
|
|
|
if (list.size() > 0) { |
|
|
|
baseMapper.updateKcBatch(list, "0"); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1201,11 +1208,11 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
@Override |
|
|
|
public void autoJyExpireReturn() { |
|
|
|
QueryWrapper<Sj> queryWrapper = Wrappers.query(); |
|
|
|
queryWrapper.eq("jyzt",JyztEnum.jyz.getValue()); |
|
|
|
queryWrapper.eq("jyzt", JyztEnum.jyz.getValue()); |
|
|
|
queryWrapper.apply("jyjsrq<{0}", DateUtils.getTime()); |
|
|
|
List<Sj> sjList=this.list(queryWrapper); |
|
|
|
List<SjJcgj> jcgjList=new ArrayList<>(); |
|
|
|
for(Sj sj:sjList){ |
|
|
|
List<Sj> sjList = this.list(queryWrapper); |
|
|
|
List<SjJcgj> jcgjList = new ArrayList<>(); |
|
|
|
for (Sj sj : sjList) { |
|
|
|
sj.setJyzt(JyztEnum.wjy.getValue()); |
|
|
|
//稽查轨迹 |
|
|
|
SjJcgj jcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "到期自动归还", "Check-out End on Time", |
|
|
|
@ -1213,7 +1220,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi |
|
|
|
jcgjList.add(jcgj); |
|
|
|
} |
|
|
|
this.updateBatchById(sjList); |
|
|
|
if(jcgjList.size()>0){ |
|
|
|
if (jcgjList.size() > 0) { |
|
|
|
sjJcgjService.saveBatch(jcgjList); |
|
|
|
} |
|
|
|
} |
|
|
|
|