Browse Source

问卷修改不保存操作人

wangjun 4 years ago
parent
commit
84faa70626

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateOptionDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateOptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -10,8 +11,8 @@ import java.util.List;
 * Created by Trick on 2019/9/6.
 */
public interface SurveyTemplateOptionDao extends PagingAndSortingRepository<WlyySurveyTemplateOptionDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateOptionDO> {
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String del);
    @Query("From WlyySurveyTemplateOptionDO c WHERE c.questionCode = ?1 and c.templateCode = ?2 and c.del = ?3")
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String templateCode,String del);
    List<WlyySurveyTemplateOptionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);

+ 2 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java

@ -401,7 +401,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                tq.setOptionVOs(optionVOs);
@ -434,12 +434,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
        String doctor = temp.getCreaterCode();
        BaseDoctorDO baseDoctorDO  = baseDoctorDao.findById(doctor);
        if (null!=baseDoctorDO){
            temp.setCreater(baseDoctorDO.getName());
        }
        temp = surveyTemplateDao.save(temp);
        //删除原有问题
        List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
        if(questionDODels!=null&&questionDODels.size()>0){
@ -701,7 +696,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                int tpCount = 0;