Browse Source

fix:[填报表单]药剂生成

master
15881625488@163.com 2 months ago
parent
commit
8d2cb74b0f
3 changed files with 87 additions and 172 deletions
  1. +44
    -66
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java
  2. +29
    -56
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java
  3. +14
    -50
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java

+ 44
- 66
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjServiceImpl.java View File

@ -74,13 +74,14 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
/**
* 开始配置
*
* @param form
* @return
*/
@Override
public void startConfiguration(StudyFormConfigurationForm form){
public void startConfiguration(StudyFormConfigurationForm form) {
Gyzj gyzj = this.getInfoByBh(form.getBh());
if(gyzj == null) {
if (gyzj == null) {
gyzj = new Gyzj();
gyzj.setBh(form.getBh());
gyzj.setStudyId(form.getStudyId());
@ -96,13 +97,14 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
/**
* 配置完成
*
* @param form
* @return
*/
@Override
public void configurationCompleted(StudyFormConfigurationForm form){
public void configurationCompleted(StudyFormConfigurationForm form) {
Gyzj gyzj = this.getInfoByBh(form.getBh());
if(gyzj == null) {
if (gyzj == null) {
gyzj = new Gyzj();
gyzj.setBh(form.getBh());
gyzj.setKc(form.getKc());
@ -131,13 +133,14 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
/**
* 分装
*
* @param form
* @return
*/
@Override
public void subpackage(StudyFormFillSubpackageForm form){
public void subpackage(StudyFormFillSubpackageForm form) {
Gyzj gyzj = this.getInfoByBh(form.getBh());
if(gyzj == null) {
if (gyzj == null) {
gyzj = new Gyzj();
gyzj.setBh(form.getBh());
this.save(gyzj);
@ -167,7 +170,7 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
Map<String, String> formData = new LinkedHashMap<>();
formData.put("母液编号", form.getBh());
formData.put("分装个数", String.valueOf(form.getList().size()));
formData.put("分装后编号及体积",String.join(",", fz));
formData.put("分装后编号及体积", String.join(",", fz));
formData.put("分装人", SecurityUtils.getNickName());
gyzjJcgjService.saveJcgj(gyzj.getId(), JcgjlxEnum.lc.getValue(), "分装", JcmcysEnum.orange.getValue(), formData, SecurityUtils.getLoginUser().getSysUser(), null);
}
@ -180,14 +183,15 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
/**
* 通过编号获取给药制剂
*
* @param bh
* @return
*/
@Override
public Gyzj getInfoByBh(String bh){
public Gyzj getInfoByBh(String bh) {
QueryWrapper<Gyzj> queryWrapper = Wrappers.query();
queryWrapper.eq("bh", bh);
return this.getOne(queryWrapper,false);
return this.getOne(queryWrapper, false);
}
@ -1447,19 +1451,14 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
public void genResource(StudyFormFill studyFormFill, Template template, String remark) {
Boolean mark = template.getProduct().equals(StudyFormFillResourceTypeEnum.gyzj.getValue()) ? true : false;
SysUser qmr = sysUserService.selectUserById(SecurityUtils.getUserId());
Long studyId = studyFormFill.getStudyId();
Long studyFormId = studyFormFill.getId();
// 生成/使用
String resource = studyFormFill.getResource();
Map<String, Gyzj> gyzjMap = new HashMap<>(10);
List<Gyzj> gyzjList = new ArrayList<>();
LinkedList<GyzjJcgj> jcgjList = new LinkedList<>();
LinkedList<GyzjTz> tzList = new LinkedList<>();
String empty = "[]";
if (StringUtils.isNotEmpty(resource) && !StringUtils.equals(empty, resource)) {
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(resource, StudyFormFillResource.class);
if (StringUtils.isNotEmpty(studyFormFill.getResource()) && !StringUtils.equals(empty, studyFormFill.getResource())) {
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(studyFormFill.getResource(), StudyFormFillResource.class);
List<StudyFormFillResource> tmp = studyFormFillResourceList.stream().filter(p -> (p.getType() == null && mark) || (p.getType() != null && StudyFormFillResourceTypeEnum.gyzj.getValue() == p.getType())).collect(Collectors.toList());
// 根据编号获取需要处置的列表
if (tmp.size() > 0) {
List<String> bhList = tmp.stream().map(StudyFormFillResource::getBh).collect(Collectors.toList());
LambdaQueryWrapper<Gyzj> queryWrapper = new LambdaQueryWrapper<>();
@ -1470,75 +1469,53 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
}
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) {
Gyzj gyzj = gyzjMap.get(studyFormFillResource.getBh());
//配置的才保存或更新
if (mark) {
if (studyFormFillResource.getType() == null) {
if (studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
Boolean isAdd=false;
if (gyzj == null) {
gyzj = new Gyzj();
gyzj.setStudyId(studyId);
gyzj.setBdId(studyFormId);
gyzj.setZjzt(ZjztEnum.wrk.getValue());
gyzj.setJyzt(JyztEnum.wjy.getValue());
gyzj.setMc(studyFormFillResource.getMc());
gyzj.setBh(studyFormFillResource.getBh());
gyzj.setLy(studyFormFillResource.getLy());
gyzj.setNd(String.valueOf(studyFormFillResource.getNd()));
gyzj.setNddw(studyFormFillResource.getNddw());
gyzj.setKc(String.valueOf(studyFormFillResource.getKc()));
gyzj.setKcdw(studyFormFillResource.getKcdw());
gyzj.setSxrq(DateUtils.parseDate(studyFormFillResource.getSxrq()));
}
if (gyzj.getId() == null) {
this.save(gyzj);
gyzjList.add(gyzj);
gyzjMap.put(gyzj.getBh(), gyzj);
// 稽查轨迹
jcgjList.add(gyzjJcgjService.getJcgj(gyzj.getId(), JcgjlxEnum.lc.getValue(), "配制完成", JcmcysEnum.green.getValue(), null, null, qmr, remark));
// 台账
tzList.add(gyzjTzService.getTzGen(gyzj.getId(), null, null, null, null, null, null, null, null, qmr, "配制完成", gyzj.getKc(), gyzj.getKcdw(), remark, studyFormFill.getId()));
} else {
this.updateById(gyzj);
gyzj = new Gyzj();isAdd=true;
gyzj.setStudyId(studyFormFill.getStudyId());
gyzj.setBdId(studyFormFill.getId());
}
gyzj.setZjzt(ZjztEnum.wrk.getValue());
gyzj.setJyzt(JyztEnum.wjy.getValue());
gyzj.setMc(studyFormFillResource.getMc());
gyzj.setBh(studyFormFillResource.getBh());
gyzj.setLy(studyFormFillResource.getLy());
gyzj.setNd(String.valueOf(studyFormFillResource.getNd()));
gyzj.setNddw(studyFormFillResource.getNddw());
gyzj.setKcdw(studyFormFillResource.getKcdw());
gyzj.setKc(studyFormFillResource.getKc());
gyzj.setSxrq(DateUtils.parseDate(studyFormFillResource.getSxrq()));
this.saveOrUpdate(gyzj);if(isAdd){gyzjList.add(gyzj);}gyzjMap.put(gyzj.getBh(), gyzj);
jcgjList.add(gyzjJcgjService.getJcgj(gyzj.getId(), JcgjlxEnum.lc.getValue(), "配制完成", JcmcysEnum.green.getValue(), null, null, qmr, remark));
tzList.add(gyzjTzService.getTzGen(gyzj.getId(), null, null, null, null, null, null, null, null, qmr, "配制完成", gyzj.getKc(), gyzj.getKcdw(), remark, studyFormFill.getId()));
}
studyFormFillResource.setType(StudyFormFillResourceTypeEnum.gyzj.getValue());
} else {
//使用的才更新 Resource
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){
if (gyzj != null) {
studyFormFillResource.setMc(gyzj.getMc()); studyFormFillResource.setNd(gyzj.getNd());studyFormFillResource.setNddw(gyzj.getNddw()); studyFormFillResource.setLy(gyzj.getLy());
studyFormFillResource.setSxrq(gyzj.getSxrq() != null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", gyzj.getSxrq()):"");
String syl = studyFormFillResource.getSyl();
if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) {
String kc = CalUnitTools.subTj(gyzj.getKc(), gyzj.getKcdw(), syl, studyFormFillResource.getSyldw());
gyzj.setKc(kc);
baseMapper.updateKc(gyzj.getId(), kc);
// 使用稽查轨迹
HashMap<String, String> formData = new LinkedHashMap<>();
formData.put("使用量", syl + studyFormFillResource.getSyldw());
// 稽查轨迹
jcgjList.add(gyzjJcgjService.getJcgj(gyzj.getId(), JcgjlxEnum.lc.getValue(), "使用", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), JctUtil.formatStr(GyzjJcnrUtil.getMapEn(formData)), qmr, remark));
// 台账
tzList.add(gyzjTzService.getTzGen(gyzj.getId(), null, null, null, null, null, null, null, null, qmr, "使用", syl, studyFormFillResource.getSyldw(), remark, studyFormFill.getId()));
}
gyzjMap.put(gyzj.getBh(), gyzj);
}
}
//更新 Resource
studyFormFill.setResource(JSONObject.toJSONString(studyFormFillResourceList));
}
}
if(gyzjMap.size() > 0&&studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
// 存储处置
cc(studyFormFill, gyzjMap, jcgjList, tzList, remark, qmr);
cz(studyFormFill, gyzjMap, jcgjList, tzList, remark, qmr);
if (gyzjMap.size() > 0 && studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
cc(studyFormFill, gyzjMap, jcgjList, tzList, remark, qmr);cz(studyFormFill, gyzjMap, jcgjList, tzList, remark, qmr);
}
if (jcgjList.size() > 0) {
gyzjJcgjService.saveBatch(jcgjList);
@ -1547,18 +1524,19 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
gyzjTzService.saveBatch(tzList);
}
if (gyzjList.size() > 0) {
studyGyzjService.saveBatch(studyId, gyzjList);
studyGyzjService.saveBatch(studyFormFill.getStudyId(), gyzjList);
}
}
/**
* 药剂存储
*
* @param studyFormFill
* @param template
* @param remark
*/
@Override
public void storageResource(StudyFormFill studyFormFill, Template template,String remark){
public void storageResource(StudyFormFill studyFormFill, Template template, String remark) {
Boolean mark = template.getProduct().equals(StudyFormFillResourceTypeEnum.gyzj.getValue()) ? true : false;
SysUser qmr = sysUserService.selectUserById(SecurityUtils.getUserId());
Long studyId = studyFormFill.getStudyId();
@ -1582,7 +1560,7 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
}
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) {
Gyzj gyzj = gyzjMap.get(studyFormFillResource.getBh());
if(gyzj!=null){
if (gyzj != null) {
gyzj.setCczt(CcztEnum.Cc.getValue());
this.updateById(gyzj);
}
@ -1641,7 +1619,7 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
}
}
/**
* 处置
*
@ -1682,8 +1660,8 @@ public class GyzjServiceImpl extends ServiceImpl implements IG
}
}
}
//endregion
//region 档案管理

+ 29
- 56
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java View File

@ -1232,19 +1232,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS
public void genResource(StudyFormFill studyFormFill, Template template, String remark) {
Boolean mark = template.getProduct().equals(StudyFormFillResourceTypeEnum.mjy.getValue()) ? true : false;
SysUser qmr = sysUserService.selectUserById(SecurityUtils.getUserId());
Long studyId = studyFormFill.getStudyId();
Long studyFormId = studyFormFill.getId();
// 生成/使用
String resource = studyFormFill.getResource();
Map<String, Mjy> mjyMap = new HashMap<>(10);
Map<String, Mjy> mjyMap = new HashMap<>(10);
List<Mjy> mjyList = new ArrayList<>();
LinkedList<MjyJcgj> jcgjList = new LinkedList<>();
LinkedList<MjyTz> tzList = new LinkedList<>();
String empty = "[]";
if (StringUtils.isNotEmpty(resource) && !StringUtils.equals(empty, resource)) {
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(resource, StudyFormFillResource.class);
if (StringUtils.isNotEmpty(studyFormFill.getResource()) && !StringUtils.equals(empty, studyFormFill.getResource())) {
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(studyFormFill.getResource(), StudyFormFillResource.class);
List<StudyFormFillResource> tmp = studyFormFillResourceList.stream().filter(p -> (p.getType() == null && mark) || (p.getType() != null && StudyFormFillResourceTypeEnum.mjy.getValue() == p.getType())).collect(Collectors.toList());
// 根据编号获取需要处置的列表
if (tmp.size() > 0) {
List<String> bhList = tmp.stream().map(StudyFormFillResource::getBh).collect(Collectors.toList());
LambdaQueryWrapper<Mjy> queryWrapper = new LambdaQueryWrapper<>();
@ -1256,74 +1251,52 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) {
Mjy mjy = mjyMap.get(studyFormFillResource.getBh());
if (mark) {
//配置的才保存或更新
if (studyFormFillResource.getType() == null) {
if (studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
if (studyFormFillResource.getType() == null ) {
if(studyFormFill.getSftb().equals(NormalEnum.no.getValue())){
Boolean isAdd=false;
if (mjy == null) {
mjy = new Mjy();
mjy.setStudyId(studyId);
mjy.setBdId(studyFormId);
mjy.setZjzt(ZjztEnum.wrk.getValue());
mjy.setJyzt(JyztEnum.wjy.getValue());
mjy.setMc(studyFormFillResource.getMc());
mjy.setBh(studyFormFillResource.getBh());
mjy.setNd(String.valueOf(studyFormFillResource.getNd()));
mjy.setNddw(studyFormFillResource.getNddw());
mjy.setLy(studyFormFillResource.getLy());
mjy.setKc(String.valueOf(studyFormFillResource.getKc()));
mjy.setKcdw(studyFormFillResource.getKcdw());
mjy.setSxrq(DateUtils.parseDate(studyFormFillResource.getSxrq()));
}
if (mjy.getId() == null) {
this.save(mjy);
mjyList.add(mjy);
mjyMap.put(mjy.getBh(), mjy);
// 稽查轨迹
jcgjList.add(mjyJcgjService.getJcgj(mjy.getId(), JcgjlxEnum.lc.getValue(), "配制完成", JcmcysEnum.green.getValue(), null, null, qmr, remark));
// 台账
tzList.add(mjyTzService.getTzGen(mjy.getId(), null, null, null, null, null, null, null, null, qmr, "配制完成", mjy.getKc(), mjy.getKcdw(), remark, studyFormFill.getId()));
} else {
this.updateById(mjy);
mjy = new Mjy();isAdd=true;
mjy.setStudyId(studyFormFill.getStudyId());
mjy.setBdId(studyFormFill.getId());
}
mjy.setZjzt(ZjztEnum.wrk.getValue());
mjy.setJyzt(JyztEnum.wjy.getValue());
mjy.setMc(studyFormFillResource.getMc());
mjy.setBh(studyFormFillResource.getBh());
mjy.setNd(String.valueOf(studyFormFillResource.getNd()));
mjy.setNddw(studyFormFillResource.getNddw());
mjy.setLy(studyFormFillResource.getLy());
mjy.setKc(studyFormFillResource.getKc());
mjy.setKcdw(studyFormFillResource.getKcdw());
mjy.setSxrq(DateUtils.parseDate(studyFormFillResource.getSxrq()));
this.saveOrUpdate(mjy);if(isAdd){mjyList.add(mjy);}mjyMap.put(mjy.getBh(), mjy);
jcgjList.add(mjyJcgjService.getJcgj(mjy.getId(), JcgjlxEnum.lc.getValue(), "配制完成", JcmcysEnum.green.getValue(), null, null, qmr, remark));
tzList.add(mjyTzService.getTzGen(mjy.getId(), null, null, null, null, null, null, null, null, qmr, "配制完成", mjy.getKc(), mjy.getKcdw(), remark, studyFormFill.getId()));
}
studyFormFillResource.setType(StudyFormFillResourceTypeEnum.mjy.getValue());
} else {
//使用的才更新 Resource
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) {
if (mjy != null) {
studyFormFillResource.setMc(mjy.getMc());studyFormFillResource.setNd(mjy.getNd());studyFormFillResource.setNddw(mjy.getNddw());studyFormFillResource.setLy(mjy.getLy());
studyFormFillResource.setSxrq(mjy.getSxrq() != null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", mjy.getSxrq()):"");
String syl = studyFormFillResource.getSyl();
if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) {
String kc = CalUnitTools.subTj(mjy.getKc(), mjy.getKcdw(), syl, studyFormFillResource.getSyldw());
mjy.setKc(kc);
baseMapper.updateKc(mjy.getId(), kc);
// 使用稽查轨迹
HashMap<String, String> formData = new LinkedHashMap<>();
formData.put("使用量", syl + studyFormFillResource.getSyldw());
// 稽查轨迹
jcgjList.add(mjyJcgjService.getJcgj(mjy.getId(), JcgjlxEnum.lc.getValue(), "使用", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), JctUtil.formatStr(MjyJcnrUtil.getMapEn(formData)), qmr, remark));
// 台账
tzList.add(mjyTzService.getTzGen(mjy.getId(), null, null, null, null, null, null, null, null, qmr, "使用", syl, studyFormFillResource.getSyldw(), remark, studyFormFill.getId()));
}
mjyMap.put(mjy.getBh(), mjy);
}
}
//更新 Resource
studyFormFill.setResource(JSONObject.toJSONString(studyFormFillResourceList));
}
}
if(mjyMap.size() > 0&&studyFormFill.getSftb().equals(NormalEnum.no.getValue())){
// 处置存储
cc(studyFormFill, mjyMap, jcgjList, tzList, remark, qmr);
cz(studyFormFill, mjyMap, jcgjList, tzList, remark, qmr);
if (mjyMap.size() > 0 && studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
cc(studyFormFill, mjyMap, jcgjList, tzList, remark, qmr); cz(studyFormFill, mjyMap, jcgjList, tzList, remark, qmr);
}
if (jcgjList.size() > 0) {
mjyJcgjService.saveBatch(jcgjList);
@ -1332,7 +1305,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS
mjyTzService.saveBatch(tzList);
}
if (mjyList.size() > 0) {
studyMjyService.saveBatch(studyId, mjyList);
studyMjyService.saveBatch(studyFormFill.getStudyId(), mjyList);
}
}
@ -1368,7 +1341,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS
}
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) {
Mjy mjy = mjyMap.get(studyFormFillResource.getBh());
if(mjy!=null){
if (mjy != null) {
mjy.setCczt(CcztEnum.Cc.getValue());
this.updateById(mjy);
}

+ 14
- 50
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java View File

@ -647,10 +647,6 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi
public void genResource(StudyFormFill studyFormFill, Template template) {
Boolean mark = template.getProduct().equals(StudyFormFillResourceTypeEnum.sj.getValue()) ? true : false;
SysUser qmr = sysUserService.selectUserById(SecurityUtils.getUserId());
Long studyId = studyFormFill.getStudyId();
Long studyFormId = studyFormFill.getId();
Long deptId = template.getDeptId();
// 生成/使用
String resource = studyFormFill.getResource();
Map<String, Sj> sjMap = new HashMap<>(16);
List<Sj> sjList = new ArrayList<>();
@ -660,7 +656,6 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi
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());
// 根据编号获取需要处置的列表
if (tmp.size() > 0) {
List<String> bhList = tmp.stream().map(StudyFormFillResource::getBh).collect(Collectors.toList());
LambdaQueryWrapper<Sj> queryWrapper = new LambdaQueryWrapper<>();
@ -669,23 +664,20 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi
for (Sj sj : sjList) {
sjMap.put(sj.getBh(), sj);
}
for (StudyFormFillResource studyFormFillResource : studyFormFillResourceList) {
Sj sj = sjMap.get(studyFormFillResource.getBh());
//配置的才保存或更新
if (mark) {
if (studyFormFillResource.getType() == null) {
if (studyFormFill.getSftb().equals(NormalEnum.no.getValue())) {
Boolean isAdd=false;
if (sj == null) {
sj = new Sj();
sj = new Sj();isAdd=true;
}
sj.setStudyId(studyId);
sj.setStudyFormId(studyFormId);
sj.setDeptId(deptId);
sj.setStudyId(studyFormFill.getStudyId());
sj.setStudyFormId(studyFormFill.getId());
sj.setDeptId(template.getDeptId());
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()));
@ -697,62 +689,34 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi
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);
this.saveOrUpdate(sj);if(isAdd){sjList.add(sj);}sjMap.put(sj.getBh(), sj);
jcgjList.add(sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "配制完成", "Formulation Completed", JcmcysEnum.green.getValue(), null, null, qmr));
tzList.add(sjTzService.genTz(sj.getId(), "配制完成", "Formulation Completed", sj.getKc(), sj.getKcdw(), null, qmr));
}
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()));
}
}
}
// 使用
if (sj != null) {
studyFormFillResource.setMc(sj.getMc());studyFormFillResource.setNd(sj.getNd());studyFormFillResource.setNddw(sj.getNddw());studyFormFillResource.setPh(sj.getPh());studyFormFillResource.setLy(sj.getLy());
studyFormFillResource.setSxrq(sj.getSxr() != null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", sj.getSxr()):"");
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())) {
// 存储
cc(studyFormFill, sjMap, jcgjList, tzList, qmr);
// 处置库存全变为0
cz(studyFormFill, sjMap, jcgjList, tzList, qmr);
cc(studyFormFill, sjMap, jcgjList, tzList, qmr);cz(studyFormFill, sjMap, jcgjList, tzList, qmr);
}
if (jcgjList.size() > 0) {
sjJcgjService.saveBatch(jcgjList);
}
if (jcgjList.size() > 0) {
if (tzList.size() > 0) {
sjTzService.saveBatch(tzList);
}
if (jcgjList.size() > 0) {
studySjService.saveBatch(studyId, sjList);
if (sjList.size() > 0) {
studySjService.saveBatch(studyFormFill.getStudyId(), sjList);
}
}

Loading…
Cancel
Save