| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | @Autowired |
| | | private SvyLibTemplateMapper svyLibTemplateMapper; |
| | | @Autowired |
| | | private Icd10AssociationMapper icd10AssociationMapper; |
| | | @Autowired |
| | | private SvyLibTemplateScriptMapper svyLibTemplateScriptMapper; |
| | | @Autowired |
| | | private SvyLibTemplateTargetoptionMapper svyLibTemplateTargetoptionMapper; |
| | | @Autowired |
| | | private TempDetpRelevanceMapper tempDetpRelevanceMapper; |
| | | @Autowired |
| | | private SvyLibTemplateTagMapper svyLibTemplateTagMapper; |
| | | |
| | | /** |
| | | * 查询问卷 |
| | |
| | | @Override |
| | | public SvyLibTemplate selectSvyLibTemplateBySvyid(Long svyid) { |
| | | return svyLibTemplateMapper.selectSvyLibTemplateBySvyid(svyid); |
| | | } |
| | | |
| | | @Override |
| | | public List<SvyLibTemplate> getSviLibTemplate(SvyLibTemplate svyLibTemplate) { |
| | | SvyLibTemplateReq svyLibTemplateReq=new SvyLibTemplateReq(); |
| | | svyLibTemplateReq.setSvyid(svyLibTemplate.getSvyid()); |
| | | svyLibTemplateReq.setCategoryid(svyLibTemplate.getCategoryid()); |
| | | svyLibTemplateReq.setDescription(svyLibTemplate.getDescription()); |
| | | return svyLibTemplateMapper.selectSvyLibTemplateList(svyLibTemplateReq); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<SvyLibTemplate> svyLibTemplates = svyLibTemplateMapper.selectSvyLibTemplateList(svyLibTemplateReq); |
| | | //添加题目 |
| | | for (int i = 0; i < svyLibTemplates.size(); i++) { |
| | | // SvyLibScript svyLibScript = new SvyLibScript(); |
| | | // svyLibScript.setSvyid(svyLibTemplates.get(i).getSvyid()); |
| | | // List<SvyLibScript> svyLibTopics = svyLibScriptMapper.selectSvyLibScriptList(svyLibScript); |
| | | SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript(); |
| | | svyLibTemplateScript.setSvyid(svyLibTemplates.get(i).getSvyid()); |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.selectSvyLibTemplateScriptList(svyLibTemplateScript); |
| | |
| | | } |
| | | } |
| | | //将题目放到问卷列表中 |
| | | svyLibTemplates.get(i).setSvyLibScripts(svyLibTemplateScripts); |
| | | svyLibTemplates.get(i).setSvyTemplateLibScripts(svyLibTemplateScripts); |
| | | |
| | | //获取每个问卷对应的科室 |
| | | TempDetpRelevance tempDetpRelevance = new TempDetpRelevance(); |
| | | tempDetpRelevance.setTempid(svyLibTemplates.get(i).getSvyid()); |
| | | List<TempDetpRelevance> tempDetpRelevances = tempDetpRelevanceMapper.selectTempDetpRelevanceList(tempDetpRelevance); |
| | | svyLibTemplates.get(i).setTempDetpRelevances(CollectionUtils.isNotEmpty(tempDetpRelevances) ? tempDetpRelevances : new ArrayList<>()); |
| | | |
| | | //获取标签 |
| | | SvyLibTemplateTag svyLibTemplateTag = new SvyLibTemplateTag(); |
| | | svyLibTemplateTag.setTemplateid(svyLibTemplates.get(i).getSvyid()); |
| | | List<SvyLibTemplateTag> svyLibTemplateTags = svyLibTemplateTagMapper.selectSvyLibTemplateTagList(svyLibTemplateTag); |
| | | svyLibTemplates.get(i).setSvyLibTemplateTagList(svyLibTemplateTags); |
| | | } |
| | | |
| | | //先将相同的id的icdname,整理到一块 |
| | |
| | | return libTemplates; |
| | | } |
| | | |
| | | // /** |
| | | // * 新增问卷 |
| | | // * |
| | | // * @param svyLibTemplate 问卷 |
| | | // * @return 结果 |
| | | // */ |
| | | // @Transactional |
| | | // @Override |
| | | // public int insertSvyLibTemplate(SvyLibTemplate svyLibTemplate) { |
| | | // svyLibTemplate.setCreateTime(DateUtils.getNowDate()); |
| | | // svyLibTemplateMapper.insertSvyLibTemplate(svyLibTemplate); |
| | | // //关联问卷疾病 |
| | | // for (String icdId : svyLibTemplate.getIcdID()) { |
| | | // Icd10Association icd10Association = new Icd10Association(); |
| | | // icd10Association.setIcd10code(icdId); |
| | | // icd10Association.setSvyid(svyLibTemplate.getSvyid()); |
| | | // icd10AssociationMapper.insertIcd10Association(icd10Association); |
| | | // } |
| | | // //新增问题题目 |
| | | // for (int i = 0; i < svyLibTemplate.getSvyLibScripts().size(); i++) { |
| | | // SvyLibScript svyLibScript = svyLibTemplate.getSvyLibScripts().get(i); |
| | | // svyLibScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | // //题目的选项目,直接用svy_topicoption表,用svyTopicidf去关联 |
| | | // svyLibScriptMapper.insertSvyLibScript(svyLibScript); |
| | | // } |
| | | // return 1; |
| | | // } |
| | | |
| | | /** |
| | | * 新增或修改问卷模板信息 |
| | | * |
| | | * @param svyLibTemplate |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer saveOrUpdateTemplate(SvyLibTemplate svyLibTemplate) { |
| | | Integer i = null; |
| | |
| | | i = svyLibTemplate.getSvyid().intValue(); |
| | | |
| | | //处理题目 |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplate.getSvyLibScripts())) { |
| | | for (SvyLibTemplateScript svyLibScript : svyLibTemplate.getSvyLibScripts()) { |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplate.getSvyTemplateLibScripts())) { |
| | | for (SvyLibTemplateScript svyLibScript : svyLibTemplate.getSvyTemplateLibScripts()) { |
| | | //对题目进行处理 |
| | | if (svyLibScript.getIsoperation() != null) { |
| | | //问题的操作不为空 |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | //标签处理 |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplate.getSvyLibTemplateTagList())) { |
| | | for (SvyLibTemplateTag svyLibTemplateTag : svyLibTemplate.getSvyLibTemplateTagList()) { |
| | | if (svyLibTemplateTag.getId() == null) { |
| | | //新增 |
| | | svyLibTemplateTag.setTemplateid(svyLibTemplate.getSvyid()); |
| | | svyLibTemplateTagMapper.insertSvyLibTemplateTag(svyLibTemplateTag); |
| | | } else { |
| | | svyLibTemplateTag.setTemplateid(svyLibTemplate.getSvyid()); |
| | | svyLibTemplateTagMapper.updateSvyLibTemplateTag(svyLibTemplateTag); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return i; |
| | | } |
| | | |