Browse Source

问卷问题修改

wangjun 4 years ago
parent
commit
72f70a3e6a

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

@ -29,10 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by Trick on 2019/9/6
@ -287,7 +284,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            totalSql += " AND i.label_code ='"+label+"'";
        }
        if (StringUtils.isNoneBlank(creater)){
            totalSql +=" AND  t.creater = '"+creater+"' ";
            totalSql +=" AND  t.creater_code = '"+creater+"' ";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
@ -433,7 +430,13 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
        WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
        String doctor = temp.getCreaterCode();
        if (StringUtils.isNotEmpty(temp.getId())){
            WlyySurveyTemplateDO templateDO = surveyTemplateDao.findOne(temp.getId());
            if(null!=templateDO){
                temp.setCreater(templateDO.getCreater());
                temp.setCreaterCode(templateDO.getCreaterCode());
            }
        }
        temp = surveyTemplateDao.save(temp);
        //删除原有问题
        List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
@ -443,6 +446,12 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //新增问题
        if(StringUtils.isNotBlank(tempQJson)){
            List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
            for (WlyySurveyTemplateQuestionDO wlyySurveyTemplateQuestionDO:questions){
                wlyySurveyTemplateQuestionDO.setTemplateCode(temp.getId());
                wlyySurveyTemplateQuestionDO.setTitle(temp.getTitle());
                wlyySurveyTemplateQuestionDO.setCode(wlyySurveyTemplateQuestionDO.getId());
                wlyySurveyTemplateQuestionDO.setId(UUID.randomUUID().toString());
            }
            surveyTemplateQuestionDao.save(questions);
        }
@ -455,6 +464,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //保存新问题选项
        if(StringUtils.isNotBlank(tempOpJson)){
            List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
            for (WlyySurveyTemplateOptionDO wlyySurveyTemplateOptionDO:options){
                wlyySurveyTemplateOptionDO.setTemplateCode(temp.getId());
            }
            surveyTemplateOptionDao.save(options);
        }

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateQuestionDO.java

@ -17,6 +17,7 @@ import java.util.Date;
public class WlyySurveyTemplateQuestionDO {
    private String id;
    private String code;//问题id
    private String title;//问题标题',
    private String questionComment;//问题说明(可为null)',
    private Integer questionType;//问题类型(0单选 1多选 2问答)',
@ -41,6 +42,14 @@ public class WlyySurveyTemplateQuestionDO {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }