Ver código fonte

问卷调查

Trick 5 anos atrás
pai
commit
881ccd8851

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

@ -13,4 +13,7 @@ import java.util.List;
public interface SurveyDeptDao extends PagingAndSortingRepository<WlyySurveyDeptDO, String>, JpaSpecificationExecutor<WlyySurveyDeptDO> {
    List<WlyySurveyDeptDO> findBySurveyTempCode(String surveyTempCode);
    List<WlyySurveyDeptDO> findByDept(String dept);
}

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

@ -449,6 +449,30 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        return true;
    }
    /**
     * 保存部门问卷关系
     * @param dept
     * @param sdJsons
     * @return
     * @throws Exception
     */
    public Boolean saveDeptSurvey(String dept,String sdJsons)throws Exception{
        //删除之前关系
        List<WlyySurveyDeptDO> dels = surveyDeptDao.findByDept(dept);
        if(dels!=null&&dels.size()>0){
            surveyDeptDao.delete(dels);
        }
        if(StringUtils.isNotBlank(sdJsons)){
            List<WlyySurveyDeptDO> list = EntityUtils.jsonToList(sdJsons,WlyySurveyDeptDO.class);
            if(list!=null&&list.size()>0){
                surveyDeptDao.save(list);
            }
        }
        return true;
    }
    /**
     * 查询科室下问卷列表
     * @param dept
@ -536,6 +560,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(surveyUsers!=null&&surveyUsers.size()>0){
            total = surveyUsers.size();
        }
        templateVO.setAnswerCount(total);
        List<WlyySurveyTemplateQuestionDO> tqDOs = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(tempId,"1");
        if(tqDOs!=null&&tqDOs.size()>0){
@ -619,7 +644,8 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " t.score," +
                " t.create_time AS createTime" +
                " FROM " +
                " wlyy_survey_user_answer t ";
                " wlyy_survey_user_answer t " +
                " WHERE 1=1";
        if(StringUtils.isNotBlank(comment)){
            sql += " AND t.comment like '%"+comment+"%' ";
        }
@ -652,9 +678,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " COUNT(1) AS total" +
                " FROM " +
                " wlyy_survey_user t " +
                " WHERE 1=1";
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(title)){
            totalSql += " AND t.title like '%"+title+"%' ";
            totalSql += " AND t.survey_temp_title like '%"+title+"%' ";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
@ -669,7 +695,6 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " t.survey_temp_title AS surveyTempTitle, " +
                " t.patient," +
                " t.patient_name AS patientName," +
                " t.score," +
                " t.dept," +
                " t.dept_name AS deptName," +
                " t.doctor," +
@ -683,7 +708,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " JOIN base_patient p ON t.patient = p.id " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(title)){
            sql += " AND t.title like '%"+title+"%' ";
            sql += " AND t.survey_temp_title like '%"+title+"%' ";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";

+ 8 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -473,11 +473,19 @@ public class BaseHospitalRequestMapping {
        public static final String delSurveyTemplate  = "/delSurveyTemplate";
        public static final String saveSurveyDept  = "/saveSurveyDept";
        public static final String saveDeptSurvey  = "/saveDeptSurvey";
        public static final String findSurveyByDept  = "/findSurveyByDept";
        public static final String findDeptBySurvey  = "/findDeptBySurvey";
        public static final String saveSurveyAnswer  = "/saveSurveyAnswer";
        public static final String findAnswerBySurveyTempCode  = "/findAnswerBySurveyTempCode";
        public static final String findSurveyTemplateResult  = "/findSurveyTemplateResult";
        public static final String findQuestionInfoList  = "/findQuestionInfoList";
        public static final String findAnswerList  = "/findAnswerList";
    }

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateVO.java

@ -37,6 +37,8 @@ public class WlyySurveyTemplateVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问题", example = "模块1")
    private List<WlyySurveyTemplateQuestionVO> templateQuestionVOs;
    @ApiModelProperty(value = "有效作答人数", example = "模块1")
    private Integer answerCount;//修改时间',
    public String getTitle() {
@ -120,4 +122,12 @@ public class WlyySurveyTemplateVO extends UuidIdentityVO {
    public void setTemplateQuestionVOs(List<WlyySurveyTemplateQuestionVO> templateQuestionVOs) {
        this.templateQuestionVOs = templateQuestionVOs;
    }
    public Integer getAnswerCount() {
        return answerCount;
    }
    public void setAnswerCount(Integer answerCount) {
        this.answerCount = answerCount;
    }
}

+ 46 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java

@ -126,13 +126,22 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    //=================调查问卷居民查询\答题
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyDept)
    @ApiOperation(value = "模板-设置模板发送的科室")
    public ObjEnvelop saveSurveyDept(@ApiParam(name = "tempId", value = "模板实体json")
    public ObjEnvelop saveSurveyDept(@ApiParam(name = "tempId", value = "模板ID")
                                     @RequestParam(value = "tempId",required = true)String tempId,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = true)String sdJsons)throws Exception {
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveSurveyDept(tempId,sdJsons));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveDeptSurvey)
    @ApiOperation(value = "模板-设置科室发送的模板")
    public ObjEnvelop saveDeptSurvey(@ApiParam(name = "dept", value = "部门code")
                                     @RequestParam(value = "dept",required = true)String dept,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveDeptSurvey(dept,sdJsons));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyByDept)
    @ApiOperation(value = "模板-查询部门下发放的问卷")
    public ListEnvelop findSurveyByDept(@ApiParam(name = "dept", value = "科室")
@ -142,7 +151,7 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findDeptBySurvey)
    @ApiOperation(value = "模板-查询模板下的科室")
    public ListEnvelop findDeptBySurvey(@ApiParam(name = "tempId", value = "模板实体json")
    public ListEnvelop findDeptBySurvey(@ApiParam(name = "tempId", value = "模板ID")
                                        @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findDeptBySurvey(tempId));
    }
@ -165,5 +174,39 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findAnswerBySurveyTempCode(patient,tempId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplateResult)
    @ApiOperation(value = "统计-查询问题情况")
    public ObjEnvelop findSurveyTemplateResult(@ApiParam(name = "tempId", value = "模板ID")
                                                @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findSurveyTemplateResult(tempId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findQuestionInfoList)
    @ApiOperation(value = "统计-查询问题情况")
    public MixEnvelop findQuestionInfoList(@ApiParam(name = "comment", value = "选项备注")
                                           @RequestParam(value = "comment",required = false) String comment,
                                           @ApiParam(name = "content", value = "选项内容,问答题内容")
                                           @RequestParam(value = "content",required = false)String content,
                                           @ApiParam(name = "tempQuestionCode", value = "问题code")
                                           @RequestParam(value = "tempQuestionCode",required = false)String tempQuestionCode,
                                           @ApiParam(name = "tempOptionCode", value = "选项code")
                                           @RequestParam(value = "tempOptionCode",required = false)String tempOptionCode,
                                           @ApiParam(name = "page", value = "第几页,1开始")
                                           @RequestParam(value = "page",required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findQuestionInfoList(comment,content,tempQuestionCode,tempOptionCode,page, size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerList)
    @ApiOperation(value = "统计-综合查询问题答案")
    public MixEnvelop findAnswerList(@ApiParam(name = "title", value = "标题")
                                     @RequestParam(value = "title",required = false) String title,
                                     @ApiParam(name = "page", value = "第几页,1开始")
                                     @RequestParam(value = "page",required = true)Integer page,
                                     @ApiParam(name = "size", value = "每页大小")
                                     @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findAnswerList(title,page,size);
    }
    //=================
}