Просмотр исходного кода

Merge branch 'dev' of humingfen/patient-co-management into dev

huangwenjie 7 лет назад
Родитель
Сommit
a40f34eeb1
20 измененных файлов с 1099 добавлено и 44 удалено
  1. 4 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  2. 53 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyAdviceController.java
  3. 64 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateAdviceController.java
  4. 10 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateController.java
  5. 58 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateResultController.java
  6. 23 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyAdviceDao.java
  7. 24 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateAdviceDao.java
  8. 28 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateResultDao.java
  9. 57 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyAdviceService.java
  10. 48 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateAdviceService.java
  11. 62 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateResultService.java
  12. 7 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateService.java
  13. 13 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/add_template.jsp
  14. 57 3
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/add_template_js.jsp
  15. 66 31
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/edit_template_js.jsp
  16. 121 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_advice.jsp
  17. 172 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_advice_js.jsp
  18. 8 5
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_list_js.jsp
  19. 90 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_result.jsp
  20. 134 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_result_js.jsp

+ 4 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -53,7 +53,10 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/admin/wlyyUserRole/importData",
                "/admin/questionnaire/importData",
                "/WEB—INF/views/**",
                "/admin/specialDisease/**"
                "/admin/specialDisease/**",
                "/admin/surveyTemplateResult/**",
                "/admin/surveyAdvice/**",
                "/admin/surveyTemplateAdvice/**"
        );
    }

+ 53 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyAdviceController.java

@ -0,0 +1,53 @@
package com.yihu.wlyy.controller.manager.survey;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.survey.SurveyAdvice;
import com.yihu.wlyy.service.manager.survey.SurveyAdviceService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * Created by humingfen on 2018/7/5.
 */
@Controller
@RequestMapping(value="admin/surveyAdvice/")
public class SurveyAdviceController extends BaseController {
    @Autowired
    private SurveyAdviceService surveyAdviceService;
    @RequestMapping(value = "findByDiseaseType", method = RequestMethod.POST)
    @ResponseBody
    public String findById(
            @ApiParam(name = "diseaseType",value = "疾病类型")
            @RequestParam(value = "diseaseType",required = true) Integer diseaseType,
            @ApiParam(name = "templateCode",value = "模板id")
            @RequestParam(value = "templateCode",required = true) String templateCode){
        try {
            List<SurveyAdvice> results = surveyAdviceService.findAdvice(diseaseType, templateCode);
            return write(200, "操作成功","data",results);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "saveOrUpdate", method = RequestMethod.POST)
    @ResponseBody
    public String saveResult(@ApiParam(name = "jsonData", value = "新增json",defaultValue = "")
                                 @RequestParam(value = "jsonData", required = true) String jsonData){
        try {
            SurveyAdvice advice = surveyAdviceService.saveOrUpdate(jsonData);
            return write(200,"保存成功","data",advice);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");
        }
    }
}

+ 64 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateAdviceController.java

@ -0,0 +1,64 @@
package com.yihu.wlyy.controller.manager.survey;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.survey.SurveyAdvice;
import com.yihu.wlyy.service.manager.survey.SurveyAdviceService;
import com.yihu.wlyy.service.manager.survey.SurveyTemplateAdviceService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * Created by humingfen on 2018/7/5.
 */
@Controller
@RequestMapping(value="admin/surveyTemplateAdvice/")
public class SurveyTemplateAdviceController extends BaseController {
    @Autowired
    private SurveyTemplateAdviceService templateAdviceService;
    @Autowired
    private SurveyAdviceService surveyAdviceService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initAdvice(Integer diseaseType, String templateCode,String mode){
        request.setAttribute("templateCode",templateCode);
        request.setAttribute("diseaseType",diseaseType);
        request.setAttribute("mode",mode);
        return "questionnaire/template/template_advice";
    }
    @RequestMapping(value = "saveOrUpdate", method = RequestMethod.POST)
    @ResponseBody
    public String saveResult(@ApiParam(name = "jsonData", value = "新增json",defaultValue = "")
                             @RequestParam(value = "jsonData", required = true) String jsonData,
                             @ApiParam(name = "templateCode", value = "新增json",defaultValue = "")
                             @RequestParam(value = "templateCode", required = true) String templateCode){
        try {
            templateAdviceService.saveOrUpdate(jsonData, templateCode);
            return write(200,"保存成功");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");
        }
    }
    @RequestMapping(value = "adviceList", method = RequestMethod.POST)
    @ResponseBody
    public String adviceList(@ApiParam(name = "templateCode", value = "新增json",defaultValue = "")
                             @RequestParam(value = "templateCode", required = true) String templateCode){
        try {
            List<SurveyAdvice> surveyAdviceList = surveyAdviceService.findAdviceByTemplateCode(templateCode);
            return write(200,"保存成功","data",surveyAdviceList);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");
        }
    }
}

+ 10 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateController.java

@ -41,6 +41,14 @@ public class SurveyTemplateController extends BaseController{
        return "questionnaire/template/import_question";
    }
    //跳转到问卷模板筛查结果列表---
    @RequestMapping(value = "initResult", method = RequestMethod.GET)
    public String initResult(String templateCode, Integer diseaseType, String mode){
        request.setAttribute("templateCode",templateCode);
        request.setAttribute("diseaseType",diseaseType);
        request.setAttribute("mode",mode);
        return "questionnaire/template/template_result";
    }
    @RequestMapping(value = "list", method = RequestMethod.GET)
    @ResponseBody
@ -129,8 +137,8 @@ public class SurveyTemplateController extends BaseController{
                               HttpServletRequest request){
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        try {
            surveyTemplateService.saveOrUpdate(jsonData,loginUser.getCode());
            return write(200,"保存成功");
            SurveyTemplate surveyTemplate = surveyTemplateService.saveOrUpdate(jsonData,loginUser.getCode());
            return write(200,"保存成功","data",surveyTemplate);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");

+ 58 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateResultController.java

@ -0,0 +1,58 @@
package com.yihu.wlyy.controller.manager.survey;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.survey.SurveyTemplateResult;
import com.yihu.wlyy.service.manager.survey.SurveyTemplateResultService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * Created by humingfen on 2018/7/5.
 */
@Controller
@RequestMapping(value="admin/surveyTemplateResult/")
public class SurveyTemplateResultController extends BaseController {
    @Autowired
    private SurveyTemplateResultService resultService;
    @RequestMapping(value = "findByTemplateCode", method = RequestMethod.POST)
    @ResponseBody
    public String findById(
            @ApiParam(name = "templateCode",value = "模板id")
            @RequestParam(value = "templateCode",required = true) String templateCode){
        try {
            List<SurveyTemplateResult> results = resultService.findByTemplateCode(templateCode);
            return write(200, "操作成功","data",results);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "save", method = RequestMethod.POST)
    @ResponseBody
    public String saveResult(@ApiParam(name = "jsonData", value = "新增json",defaultValue = "")
                               @RequestParam(value = "jsonData", required = true) String jsonData,
                             @ApiParam(name = "templateCode",value = "模板id")
                             @RequestParam(value = "templateCode",required = true) String templateCode,
                               HttpServletRequest request){
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        try {
            resultService.saveOrUpdate(jsonData,templateCode,loginUser.getCode());
            return write(200,"保存成功");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");
        }
    }
}

+ 23 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyAdviceDao.java

@ -0,0 +1,23 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyAdvice;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by humingfen on 2018/7/5.
 */
public interface SurveyAdviceDao extends PagingAndSortingRepository<SurveyAdvice,Long>,JpaSpecificationExecutor<SurveyAdvice> {
    @Query(value = "SELECT a.* from wlyy_survey_advice a LEFT JOIN (SELECT * from wlyy_survey_template_advice where template_code=?2) ta on a.code = ta.advice_code where a.disease_type=?1 and ta.advice_code is null",nativeQuery = true)
    List<SurveyAdvice> findAdvice(Integer diseaseType, String templateCode);
    @Query("select s from SurveyAdvice s where s.code = ?1")
    SurveyAdvice findByCode(String adviceCode);
    @Query(value = "SELECT a.* from wlyy_survey_template_advice ta LEFT JOIN wlyy_survey_advice a on ta.advice_code = a.code where ta.template_code = ?1",nativeQuery = true)
    List<SurveyAdvice> findAdviceByTemplateCode(String templateCode);
}

+ 24 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateAdviceDao.java

@ -0,0 +1,24 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyAdvice;
import com.yihu.wlyy.entity.survey.SurveyTemplateAdvice;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import javax.transaction.Transactional;
import java.util.List;
public interface SurveyTemplateAdviceDao extends PagingAndSortingRepository<SurveyTemplateAdvice,Long>,JpaSpecificationExecutor<SurveyTemplateAdvice> {
    List<SurveyTemplateAdvice> findByTemplateCode(String templateCode);
    @Query(value = "SELECT a.* from wlyy_survey_template_advice ta LEFT JOIN wlyy_survey_advice a on ta.advice_code = a.code where ta.template_code = ?1",nativeQuery = true)
    List<SurveyAdvice> findAdviceByTemplateCode(String templateCode);
    @Query("delete from SurveyTemplateAdvice s where s.templateCode=?1")
    @Modifying
    @Transactional
    void deleteByTemplateCode(String templateCode);
}

+ 28 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateResultDao.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateResult;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import javax.transaction.Transactional;
import java.util.List;
/**
 * Created by humingfen on 2018/7/5.
 */
public interface  SurveyTemplateResultDao extends PagingAndSortingRepository<SurveyTemplateResult,Long>,JpaSpecificationExecutor<SurveyTemplateResult> {
    @Query("select s from SurveyTemplateResult s where s.templateCode = ?1 and s.del = 1")
    List<SurveyTemplateResult> findByTemplateCode(String templateCode);
    @Query("update SurveyTemplateResult s set s.del = 0 where s.templateCode=?1 and s.del = 1")
    @Modifying
    @Transactional
    void deleteByTemplateCode(String templateCode);
    @Query("update SurveyTemplateResult s set s.del = 1 where s.id = ?1 and s.del = 0")
    @Modifying
    @Transactional
    void updateDel(long id);
}

+ 57 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyAdviceService.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.service.manager.survey;
import com.yihu.wlyy.entity.survey.SurveyAdvice;
import com.yihu.wlyy.entity.survey.SurveyTemplateAdvice;
import com.yihu.wlyy.repository.survey.SurveyAdviceDao;
import com.yihu.wlyy.util.ClazzReflect;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 问卷调查指导建议表
 * Created by hmf on 2018/7/5.
 */
@Service
public class SurveyAdviceService extends BaseJpaService<SurveyAdvice,Long> {
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    public SurveyAdvice saveOrUpdate(String jsonData) {
        JSONObject jsonObject = new JSONObject(jsonData);
        ClazzReflect clazzReflect = new ClazzReflect();
        SurveyAdvice surveyAdvice = new SurveyAdvice();
        surveyAdvice.setCode(getCode());
        surveyAdvice.setCzrq(new Date());
        clazzReflect.formatToClazz(surveyAdvice,jsonObject);
        surveyAdviceDao.save(surveyAdvice);
        return surveyAdvice;
    }
    public SurveyAdvice findById(Long id){
        return  surveyAdviceDao.findOne(id);
    }
    public List<SurveyAdvice> findAdvice(Integer diseaseType, String templateCode) {
        return surveyAdviceDao.findAdvice(diseaseType, templateCode);
    }
    public List<SurveyAdvice> findByCode(List<SurveyTemplateAdvice> templateAdviceList) {
        List<SurveyAdvice> surveyAdviceList = new ArrayList<>();
        for(SurveyTemplateAdvice templateAdvice : templateAdviceList){
            SurveyAdvice surveyAdvice = new SurveyAdvice();
            surveyAdvice = surveyAdviceDao.findByCode(templateAdvice.getAdviceCode());
            surveyAdviceList.add(surveyAdvice);
        }
        return surveyAdviceList;
    }
    public List<SurveyAdvice> findAdviceByTemplateCode(String templateCode) {
        return surveyAdviceDao.findAdviceByTemplateCode(templateCode);
    }
}

+ 48 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateAdviceService.java

@ -0,0 +1,48 @@
package com.yihu.wlyy.service.manager.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateAdvice;
import com.yihu.wlyy.repository.survey.SurveyTemplateAdviceDao;
import com.yihu.wlyy.util.ClazzReflect;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 问卷调查建议关联表
 * Created by hmf on 2018/7/5.
 */
@Service
public class SurveyTemplateAdviceService extends BaseJpaService<SurveyTemplateAdvice,Long> {
    @Autowired
    private SurveyTemplateAdviceDao templateAdviceDao;
    public void saveOrUpdate(String jsonData, String templateCode) {
        JSONArray array = new JSONArray(jsonData);
        List<SurveyTemplateAdvice> templateAdviceList = new ArrayList<>();
        templateAdviceDao.deleteByTemplateCode(templateCode);
        for(Object object:array) {
            JSONObject jsonObject = (JSONObject)object;
            ClazzReflect clazzReflect = new ClazzReflect();
            SurveyTemplateAdvice templateAdvice = new SurveyTemplateAdvice();
            templateAdvice.setCzrq(new Date());
            clazzReflect.formatToClazz(templateAdvice,jsonObject);
            templateAdviceList.add(templateAdvice);
        }
        templateAdviceDao.save(templateAdviceList);
    }
    public SurveyTemplateAdvice findById(Long id){
        return  templateAdviceDao.findOne(id);
    }
    public List<SurveyTemplateAdvice> findByTemplateCode(String templateCode) {
        return templateAdviceDao.findByTemplateCode(templateCode);
    }
}

+ 62 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateResultService.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.service.manager.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateResult;
import com.yihu.wlyy.repository.survey.SurveyTemplateResultDao;
import com.yihu.wlyy.util.ClazzReflect;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 问卷调查模板评分筛查表
 * Created by hmf on 2018/7/5.
 */
@Service
public class SurveyTemplateResultService extends BaseJpaService<SurveyTemplateResult,Long> {
    @Autowired
    private SurveyTemplateResultDao resultDao;
    public void saveOrUpdate(String jsonData, String templateCode, String loginUserId) {
        JSONArray array = new JSONArray(jsonData);
        List<SurveyTemplateResult> resultList = new ArrayList<>();
        resultDao.deleteByTemplateCode(templateCode);
        for(Object object:array) {
            JSONObject jsonObject = (JSONObject)object;
            ClazzReflect clazzReflect = new ClazzReflect();
            SurveyTemplateResult result = new SurveyTemplateResult();
            if(!jsonObject.isNull("id")&&StringUtils.isNotBlank(jsonObject.getString("id"))){
                result = this.findById(jsonObject.getLong("id"));
                if(result.getDel() == 0){
                    result.setDel(1);
                }
            }else {
                result.setCode(getCode());
                result.setCreateUserName(loginUserId + "");
                result.setCreateTime(new Date());
                result.setDel(1);
            }
            result.setUpdateTime(new Date());
            if(jsonObject.getString("highScore").equals("null")){
                jsonObject.remove("highScore");
            }
            clazzReflect.formatToClazz(result,jsonObject);
            resultList.add(result);
        }
        resultDao.save(resultList);
    }
    public SurveyTemplateResult findById(Long id){
        return  resultDao.findOne(id);
    }
    public List<SurveyTemplateResult> findByTemplateCode(String templateCode) {
        return resultDao.findByTemplateCode(templateCode);
    }
}

+ 7 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateService.java

@ -54,16 +54,17 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
    UserService userService;
    @Transactional
    public void saveOrUpdate(String jsonData,String loginUserId){
    public SurveyTemplate saveOrUpdate(String jsonData,String loginUserId){
        JSONArray array = new JSONArray(jsonData);
        List<SurveyTemplate> surveyTemplates = new ArrayList<>();
        List<SurveyTemplateQuestion> surveyTemplateQuestions = new ArrayList<>();
        List<SurveyTemplateOption> surveyTemplateOptions = new ArrayList<>();
        List<SurveyLabelInfo> surveyLabelInfos = new ArrayList<>();
        SurveyTemplate surveyTemplate = null;
        for(Object object:array){
            JSONObject jsonObject = (JSONObject)object;
            ClazzReflect clazzReflect = new ClazzReflect();
            SurveyTemplate surveyTemplate = new SurveyTemplate();
            surveyTemplate = new SurveyTemplate();
            if(!jsonObject.isNull("id")&&StringUtils.isNotBlank(jsonObject.getString("id"))){
                surveyTemplate = this.findById(jsonObject.getLong("id"));
            }else{
@ -73,6 +74,9 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
                surveyTemplate.setDel("1");
            }
            surveyTemplate.setUpdateTime(new Date());
            if(StringUtils.isBlank(jsonObject.getString("diseaseType"))){
                jsonObject.remove("diseaseType");
            }
            clazzReflect.formatToClazz(surveyTemplate,jsonObject);
            surveyTemplates.add(surveyTemplate);
@ -123,6 +127,7 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
        surveyTemplateQuestionService.save(surveyTemplateQuestions);
        surveyTemplateOptionService.save(surveyTemplateOptions);
        surveyLabelInfoService.save(surveyLabelInfos);
        return surveyTemplate;
    }
    public SurveyTemplate findById(Long id){

+ 13 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/add_template.jsp

@ -72,6 +72,12 @@
	<div class="div-next f-dn">
		<div id="div-form" data-role-form class="m-form-inline f-mt20">
			<div class="m-form-group">
				<label>发布机构</label>
				<div class="l-text-wrapper m-form-control essential">
					<input type="text" id="inp_organization" class="required ajax useTitle" required-title="发布机构不能为空">
				</div>
			</div>
			<div class="m-form-group">
				<label>问卷名称</label>
				<div class="l-text-wrapper m-form-control essential">
@ -90,6 +96,13 @@
				</div>
			</div>
			<div class="m-form-group" style="display:none" id="diseaseType">
				<label>筛查类型</label>
				<div class="l-text-wrapper m-form-control essential">
					<input type="text" id="inp_diseaseType" class="ajax useTitle" required-title="疾病类型不能为空">
				</div>
			</div>
		</div>
	</div>

+ 57 - 3
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/add_template_js.jsp

@ -10,6 +10,8 @@
			var Util = $.Util;
			var retrieve = null;
			var jValidation = $.jValidation;
			//判断是否为选中评分筛查按钮
			var flag = 0;
			/* *************************** 函数定义 ******************************* */
			function pageInit() {
@ -20,8 +22,25 @@
			retrieve = {
				$selWenJuan: $("#sel_wenjuan"),//选择问卷
                $diseaseType: $("#inp_diseaseType"),//疾病类型
				init: function () {
					var self = this;
                    $("#inp_organization").ligerTextBox({width: 240});
                    self.diseaseTypeBox = self.$diseaseType.ligerComboBox({
                        width: 240,
                        url: ctx + "/admin/specialDisease/list",
                        dataParmName: "data",
                        textField: "name",
                        valueField: "code",
                        isMultiSelect: false,
                        ajaxBeforeSend: function (xhr) {
                            if (ajaxHeaderName) {
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                            }
                        },
                    });
                    this.loadLabel();
					if($("#inp_template_id").val()!=""){
						$(".div-next").show();
						self.loadTemplateContent();
@ -29,7 +48,6 @@
						self.selectBind();
						$(".div-prev").show();
					}
					this.loadLabel();
					this.bindEvents();
				},
				selectBind:function(){
@ -129,13 +147,43 @@
						$(this).addClass("active");
					}).on("click",".div-checkbox-img",function(){
						$(this).toggleClass("active");
						// 判断是否选中评分筛查,以及是否显示疾病类型
                        if($(this).next().find("div").html() == "评分筛查"){
                            if( flag == 0){
                                var allLabel = $(".div-label-content .div-label");
                                for(var i=0;i<allLabel.length;i++){
                                    $(allLabel[i]).find(".div-checkbox-img").removeClass("active");
                                }
                                $(this).addClass("active");
                                $("#diseaseType").show();
                                $("#inp_diseaseType").addClass("required");
                                flag = 1;
                            }else{
                                $("#diseaseType").hide();
                                $("#inp_diseaseType").removeClass("required");
                                flag = 0;
                            }
                        }else{
                            var allLabel = $(".div-label-content .div-label");
                            for(var i=0;i<allLabel.length;i++){
                                var labelId = $(allLabel[i]).attr("data-id");
                                for(var j=0;j<allLabel.length;j++){
                                    if(labelId == 5){
                                        $(allLabel[i]).find(".div-checkbox-img").removeClass("active");
                                        break;
                                    }
                                }
                            }
                            $("#diseaseType").hide();
                            $("#inp_diseaseType").removeClass("required");
                            flag = 0;
                        }
					}).on("click","#pre_btn",function(){//上一步事件
						$(this).hide();
						$("#next_btn").show();
						$(".div-prev").show();
						$(".div-next").hide();
					}).on("click","#next_btn",function(){//下一步事件
						debugger
						if($(".div-prev").is(":hidden")){//上一步内容显示
							if (!validator.validate()) {
								return;
@ -156,9 +204,10 @@
								}
							}
							labelsName = labelsName.substring(0,labelsName.length-1);
							var diseaseType = self.diseaseTypeBox.getValue();
							var type = $(".div-prev").find(".div-radio-img.active").closest(".div-type").attr("data-type");
							var templateId = (self.$selWenJuan.val()==null || type=="1")? $("#inp_template_id").val():self.$selWenJuan.val();
							var templateData = {templateId:templateId,title:$("#inp_wenjuan_name").val(),comment:$("#tea_wenjuan_instruction").val(),labels:JSON.stringify(labelArr),labelsName:labelsName};
							var templateData = {templateId:templateId,organization:$("#inp_organization").val(),title:$("#inp_wenjuan_name").val(),comment:$("#tea_wenjuan_instruction").val(),labels:JSON.stringify(labelArr),labelsName:labelsName,diseaseType:diseaseType};
							sessionStorage.setItem("templateData", JSON.stringify(templateData));
							location.href =  ctx + '/admin/surveyTemplate/editTemplate?id='+templateId+'&mode='+$("#inp_mode").val();
						}else{//上一步内容隐藏
@ -199,12 +248,17 @@
								var labels = data.labels;
								$("#inp_wenjuan_name").val(data.title);
								$("#tea_wenjuan_instruction").val(data.comment);
                                $("#inp_organization").val(data.organization);
								var allLabel = $(".div-label-content .div-label");
								for(var i=0;i<allLabel.length;i++){
									var labelId = $(allLabel[i]).attr("data-id");
									for(var j=0;j<labels.length;j++){
										if(labelId==labels[j].label.toString()){
											$(allLabel[i]).find(".div-checkbox-img").addClass("active");
											if(labelId == 5){
                                                $("#diseaseType").show();
                                                self.diseaseTypeBox.selectValue(data.diseaseType);
                                            }
											break;
										}
									}

+ 66 - 31
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/edit_template_js.jsp

@ -22,6 +22,8 @@
			var divLuojiSettingDialog = null;
			var questionType = "";
			var templateData = JSON.parse(sessionStorage.getItem("templateData"));//上一个页面(新增或编辑模板页传过来的信息:问卷名称、问卷说明、问卷标签)
            var labelLength = JSON.parse(templateData.labels).length-1;
            var label = JSON.parse(templateData.labels)[labelLength].label;
			/* *************************** 函数定义 ******************************* */
			function pageInit() {
				retrieve.init();
@ -251,17 +253,18 @@
						var item = '<li class="choice" data-input="0" data-input-required="0" data-code="'+optionCode+'">'+
								'<div class="'+classz+'"></div>'+
								'<div class="position-relative">'+
								'<div class="edit-area edit-child-element" contenteditable="true" data-value="">'+
								'<div style="width:300px" class="edit-area edit-child-element" contenteditable="true" data-value="">'+
								'选项'+prevItemCount+
								'</div>'+
								'</div>'+
								'</li>';
								'</div>';
                        if(label == 5 && classz == "div-radio-img"){
                            item += '<div style="float:right"><input type="text" placeholder="填写分值" class="edit-area edit-child-element fieldValue" contenteditable="true" data-value=""></div>';
                        }
                        item += '</div></li>';
						appendItem.append(item);
					}).on("click",".add-area .batch-add-choice",function(){//批量增加选项事件
						self.clearButtonsActive();
						var questionItem = $(this).closest(".topic-type-question");
						self.$divPatchDialog.find(".batch-choices").val("");//清空原来的值
						divPatchDialog = $.ligerDialog.open({
							title: "批量添加选项框",
							width: 320,
@ -288,11 +291,13 @@
									itemStr += '<li class="choice" data-input="0" data-input-required="0" data-code="'+optionCode+'">'+
											'<div class="'+classz+'"></div>'+
											'<div class="position-relative">'+
											'<div class="edit-area edit-child-element" contenteditable="true" data-value="">'+
											'<div style="width:300px" class="edit-area edit-child-element" contenteditable="true" data-value="">'+
												patchItemArr[i]+
											'</div>'+
											'</div>'+
											'</li>';
											'</div>';
                                    if(label == 5 && classz == "div-radio-img"){
                                        itemStr += '<div style="float:right"><input type="text" placeholder="填写分值" class="edit-area edit-child-element fieldValue" contenteditable="true" data-value=""></div>';
                                    }
                                    itemStr += '</div></li>';
								}
							}
							appendItem.append(itemStr);
@ -790,6 +795,19 @@
						})
					}).on("click","#save_btn",function(){//保存问题事件
						self.clearButtonsActive();
						var flag = false;
                        $(".fieldValue").each(function(index,item){
                            if($(".fieldValue").length != 0){
                                if($(this).val() == ''){
                                    flag = true;
                                    $.Notice.error('请输入分值');
                                    return false;
                                };
                            }
                        });
                        if(flag){
                            return false;
                        }
						if($("#question_box").find(".topic-type-question").length==0){
							$.Notice.success('当前没有问题,请添加后再保存!');
							return false;
@ -829,7 +847,11 @@
						success: function (result) {
							if (result.status == 200) {
								$.Notice.success(result.msg);
								location.href =  ctx + '/admin/surveyTemplate/initial';
								if(label == 5) {
                                    location.href = ctx + '/admin/surveyTemplate/initResult?templateCode=' + result.data.code + '&diseaseType='+ result.data.diseaseType+ '&mode=' + $("#inp_mode").val();
                                }else{
                                    location.href = ctx + '/admin/surveyTemplate/initial';
                                }
							} else {
								$.Notice.error(result.msg);
							}
@ -875,7 +897,7 @@
													'</div>'+
												'</div>'+
											'</div>';
						var optionHtml = '<ul class="question-choice">';
						var optionHtml = '<ul id="question-choice" class="question-choice">';
						var itemHtml = "";
						var addAreaHtml = "";
						var operateHtml = "";
@ -892,11 +914,14 @@
								itemHtml+='<li class="choice" data-input="0" data-input-required="0" data-code="'+optionCode+'">'+
												'<div class="'+imgClass+'"></div>'+
												'<div class="position-relative">'+
													'<div class="edit-area edit-child-element" contenteditable="true" data-value="">'+
													'<div style="width:300px" class="edit-area edit-child-element" contenteditable="true" data-value="">'+
													optionData[j] +
													'</div>'+
												'</div>'+
										  '</li>';
													'</div>';
                                if(label == 5 && type=="0"){
                                    itemHtml += '<div style="float:right"><input type="text" placeholder="填写分值" class="edit-area edit-child-element fieldValue" contenteditable="true" data-value=""></div>';
                                }
                                itemHtml += '</div></li>';
							}else{//问答题
								itemHtml = '<li class="choice" data-input="0" data-input-required="0" data-code="'+optionCode+'">'+
												'<div style="padding:10px 0px;">'+
@ -1002,6 +1027,7 @@
							var haveComment = optionData[j].haveComment;
							var optionIsRequired = optionData[j].isRequired;
							var content = optionData[j].content;
                            var score = optionData[j].score;
							if(optionData[j].questionCodeNext!="" && optionData[j].questionCodeNext!=undefined){
								options.push({optionItem:optionCode,questionCodeNext:optionData[j].questionCodeNext,questionSortNext:optionData[j].questionSortNext});
							}
@ -1021,12 +1047,15 @@
								itemHtml+='<li class="choice" data-input="'+optionData[j].isRequired+'" data-input-required="'+optionData[j].haveComment+'" data-code="'+optionCode+'">'+
										'<div class="'+imgClass+'"></div>'+
										'<div class="position-relative">'+
										'<div class="edit-area edit-child-element"  contenteditable="true">'+
										'<div style="width:300px" class="edit-area edit-child-element"  contenteditable="true">'+
										content +
										'</div>'+
										'</div>'+
										remark+
										'</li>';
                                        '</div>';
                                if(label == 5 && type=="0"){
                                    itemHtml += '<div style="float:right"><input type="text"  class="edit-area edit-child-element fieldValue" contenteditable="true" value="'+score+'"></div>';
                                }
                                itemHtml += '</div>'+
                                    remark+
                                    '</li>';
							}else{//问答题
								itemHtml = '<li class="choice" data-code="'+optionCode+'">'+
										'<div style="padding:10px 0px;">'+
@ -1112,6 +1141,8 @@
					var templateComment = $(".div-wenjuan-title").find(".div-template-comment").html();//问卷说明
					var labels = JSON.parse(templateData.labels);//上一个页面已勾选的标签值
					var labelsName = templateData.labelsName;//标签中文值
                    var organization = templateData.organization;//发布机构
                    var diseaseType = templateData.diseaseType;//疾病类型
					var topicTypeQuestion =   $("#question_box").find(".topic-type-question");
					for(var i=0;i<topicTypeQuestion.length;i++){
						var item = $(topicTypeQuestion[i]);
@ -1139,6 +1170,8 @@
								var haveComment = $(optionItem[j]).find(".other-content").length>0?1:0;//是否有选项说明(0没有 1有)
								var optionIsRequired =  $(optionItem[j]).find(".other-required").length>0?1:0;////选项说明是否必填(0否 1是)
								var content = $(optionItem[j]).find(".edit-child-element").html();//选项内容
                                // var score = document.getElementById("fieldValue").value;//选项分值
                                var score = $(optionItem[j]).find(".fieldValue").val();
								var optionSort = j+1;//单题内排序
								var optionCode = $(optionItem[j]).attr("data-code");
								var optionQuestionCodeNext = "";//选项的下一个跳转code
@ -1153,15 +1186,15 @@
									}
								}
								optionData.push({"haveComment": haveComment,"content": content,"isRequired": optionIsRequired,"sort": optionSort,"code":optionCode,"questionCodeNext":optionQuestionCodeNext,"questionSortNext":optionQuestionCodeSort});
								optionData.push({"haveComment": haveComment,"content": content,"isRequired": optionIsRequired,"sort": optionSort,"code":optionCode,"questionCodeNext":optionQuestionCodeNext,"questionSortNext":optionQuestionCodeSort,"score":score});
							}
						}
						questions.push({"title": title,"code": questionCode,"comment": comment,"questionType": questionType,"isRequired":isRequired,"minNum": minNum,"maxNum": maxNum,"sort": questionSort,"questionCodeNext": questionCodeNext,"questionSortNext":questionCodeSort,"options": optionData})
					}
					if($("#inp_mode").val()=="add"){
						resultData.push({title:templateName,comment:templateComment,labels:labels,questions:questions});
						resultData.push({organization:organization,title:templateName,comment:templateComment,labels:labels,questions:questions,diseaseType:diseaseType});
					}else{
						resultData.push({id:templateData.templateId,title:templateName,comment:templateComment,labels:labels,questions:questions});
						resultData.push({id:templateData.templateId,organization:organization,title:templateName,comment:templateComment,labels:labels,questions:questions,diseaseType:diseaseType});
					}
					return resultData;
				},
@ -1170,7 +1203,6 @@
					var resultHtml = "";
					var templateName = $(".div-wenjuan-title").find(".div-template-name").html();//问卷标题
					var templateComment = $(".div-wenjuan-title").find(".div-template-comment").html();//问卷说明
					var labels = JSON.parse(templateData.labels);//上一个页面已勾选的标签值
					var labelsName = templateData.labelsName;//标签中文值
					var resultData = self.getSaveingData();
					debugger
@ -1180,7 +1212,7 @@
							var titleData = Tquestions[j].title;//标题
							var questionCodeNext =  Tquestions[j].questionCodeNext;
							var questionCodeSort =  Tquestions[j].questionSortNext;
							if(questionCodeNext!=""){
							if(questionCodeNext != null){
								titleData = Tquestions[j].title+questionCodeSort;
							}
							var questionSort = Tquestions[j].sort;
@ -1220,9 +1252,10 @@
								var haveComment = optionData[k].haveComment;
								var optionIsRequired = optionData[k].isRequired;
								var content = optionData[k].content;
								var score = optionData[k].score;
								var optionquestionCodeNext =  optionData[k].questionCodeNext;
								var optionquestionCodeSort =  optionData[k].questionSortNext;
								if(optionquestionCodeNext!=""){
								if(optionquestionCodeSort!= null){
									content = optionData[k].content+optionquestionCodeSort;
								}
								if(questionType=="0" || questionType=="1"){//单选题或多选题
@ -1242,11 +1275,13 @@
												'<div class="'+imgClass+'"></div>'+
												'<div class="position-relative">'+
												'<div class="edit-area edit-child-element">'+
													content +
												'</div>'+
												'</div>'+
													remark+
											'</li>';
													content;
									if(label == 5 && questionType=="0"){
                                        itemHtml += '<span style="float:right;color: #5c80d2;">'+ score + '分</span>';
                                    }
                                    itemHtml += '</div></div>'+
                                                  remark+
											    '</li>';
								}else{//问答题
									itemHtml = '<li class="choice">'+
											'<div style="padding:10px 0px;">'+

Разница между файлами не показана из-за своего большого размера
+ 121 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_advice.jsp


+ 172 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_advice_js.jsp

@ -0,0 +1,172 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href="${ctx}/static/develop/lib/select2/select2.min.css" rel="stylesheet">
<script src="${ctx}/static/develop/lib/select2/select2.js"></script>
<script>
    (function ($, win) {
        $(function () {
            /* ************************** 变量定义 ******************************** */
            // 通用工具类库
            var Util = $.Util;
            var retrieve = null;
            var jValidation = $.jValidation;
            var addAdvice=$("#addAdvice").clone();
            var infoDialog=null
            //判断是否为选中评分筛查按钮
            var flag = 0;
            /* *************************** 函数定义 ******************************* */
            function pageInit() {
                retrieve.init();
            }
            /* *************************** 模块初始化 ***************************** */
            win.closeInfoDialog = function () {
                infoDialog.close();
                $("#addAdvice").remove();
                $('body').append(addAdvice)
            };
            retrieve = {
                    init: function () {
                        var templateCode = $("#inp_templateCode").val();
                        var diseaseType = $("#inp_diseaseType").val();
                        var mode = $("#inp_mode").val();
                        if(mode == "edit"){
                            $.ajax({
                                url: ctx + "/admin/surveyTemplateAdvice/adviceList",
                                method: "post",
                                dataType: "json",
                                async: false,
                                data: {templateCode: templateCode},
                                success: function (result) {
                                    if(result.data.length != 0){
                                        var str='';
                                        for(var i in result.data){
                                            str+='<li class="list-item" data-code="'+result.data[i].code+'">'+result.data[i].advice+'</li>'
                                        }
                                        $('.right-list').append(str);
                                    }
                                },
                                error: function (data) {
                                    $.Notice.error("系统异常,请联系管理员!");
                                }
                            })
                        };
                        function findByDiseaseType(){
                            $.ajax({
                                url: ctx + "/admin/surveyAdvice/findByDiseaseType",
                                method: "post",
                                dataType: "json",
                                async: false,
                                data: {diseaseType: diseaseType,templateCode: templateCode},
                                success: function (result) {
                                    console.log(result)
                                    if(result.data.length != 0){
                                        var str='';
                                        for(var i in result.data){
                                            str+='<li class="list-item" data-code="'+result.data[i].code+'">'+result.data[i].advice+'</li>'
                                        }
                                        $('.left-list').append(str);
                                    }
                                },
                                error: function (data) {
                                    $.Notice.error("系统异常,请联系管理员!");
                                }
                            });
                        };
                        findByDiseaseType();
                        (function bindEven(){
                            $('.tree-list').on('click','.list-item',function(){
                                $(this).toggleClass('active');
                            })
                        })();
                        $(".jintou img").on('click',function(){
                            shift($(this).attr('data-action'))
                        });
                        function shift(arr){
                            var data=arr.split(',');
                            var yuan='';
                            var quxiang=data[0];
                            var isAll=data[1] || false;
                            if(quxiang=='left'){
                                yuan='right';
                            }else{
                                yuan='left';
                            }
                            var _append=isAll?$('.'+yuan+'-list').children():$('.'+yuan+'-list').find('.active');
                            $('.'+quxiang+'-list').append(_append.removeClass('active'));
                        };
                       //新建建议
                        $('.create-new').on('click',function(){
                            addAdvice.show()
                            infoDialog = $.ligerDialog.open({
                                title: "创建新建议标签",
                                width: 400,
                                height: 300,
                                target: addAdvice[0].outerHTML
                            });
                            $('body').on("click","#save_btn",function(){//关闭弹窗事件
                                var advice=$('.advice-content')[1].value;
                                if(!advice){
                                    infoDialog.close();
                                }
                                $.ajax({
                                    url: ctx + "/admin/surveyAdvice/saveOrUpdate",
                                    method: "post",
                                    dataType: "json",
                                    async: false,
                                    data: {jsonData: JSON.stringify({advice:advice,diseaseType:diseaseType})},
                                    success: function (result) {
                                        if(result.status == 200){
                                            $('.left-list').append('<li class="list-item" data-code="'+result.data.code+'">'+advice+'</li>');
                                            infoDialog.close();
                                        } else {
                                            $.Notice.error(result.msg);
                                        }
                                    },
                                    error: function (data) {
                                        $.Notice.error("系统异常,请联系管理员!");
                                    }
                                });
                            })
                        });
                       //			保存筛选表
                        $('.submit-btn').on('click',function(){
                            var going = true;
                            var codeArr=[];
                            $('.right-list li').each(function(index,item){
                                if($('.right-list li').length != 0){
                                    codeArr[index]={};
                                    var code=$(this).data('code')+'';
                                    codeArr[index].adviceCode=code;
                                    codeArr[index].templateCode=templateCode;
                                }
                            });
                            if(codeArr.length != 0){
                                $.ajax({
                                    url: ctx + "/admin/surveyTemplateAdvice/saveOrUpdate",
                                    method: "post",
                                    dataType: "json",
                                    async: false,
                                    data: {jsonData:JSON.stringify(codeArr),templateCode:templateCode},
                                    success: function (result) {
                                        console.log(result)
                                        location.href = ctx + '/admin/surveyTemplate/initial';
                                    },
                                    error: function (data) {
                                        console.log(data)
                                    }
                                });
                            }
                        })
                    }
            }
            /* *************************** 页面初始化 **************************** */
            pageInit();
        });
    })(jQuery, window);
</script>

+ 8 - 5
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_list_js.jsp

@ -241,7 +241,7 @@
						var titleData = Tquestions[j].title;//标题
						var questionCodeNext =  Tquestions[j].questionCodeNext;
						var questionCodeSort =  Tquestions[j].questionSortNext;
						if(questionCodeNext!=""){
						if(questionCodeNext != null){
							titleData = Tquestions[j].title+questionCodeSort;
						}
						var questionSort = Tquestions[j].sort;
@ -281,9 +281,10 @@
							var haveComment = optionData[k].haveComment;
							var optionIsRequired = optionData[k].isRequired;
							var content = optionData[k].content;
							var score = optionData[k].score;
							var optionquestionCodeNext =  optionData[k].questionCodeNext;
							var optionquestionCodeSort =  optionData[k].questionSortNext;
							if(optionquestionCodeNext!=""){
							if(optionquestionCodeNext != null){
								content = optionData[k].content+optionquestionCodeSort;
							}
							if(questionType=="0" || questionType=="1"){//单选题或多选题
@ -303,9 +304,11 @@
										'<div class="'+imgClass+'"></div>'+
										'<div class="position-relative">'+
										'<div class="edit-area edit-child-element">'+
										content +
										'</div>'+
										'</div>'+
										content;
								if(score != null){
                                    itemHtml += '<span style="float:right;color: #5c80d2;">'+ score + '分</span>';
                                }
                                itemHtml +=	'</div></div>'+
										remark+
										'</li>';
							}else{//问答题

+ 90 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_result.jsp

@ -0,0 +1,90 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/5 0005
  Time: 上午 11:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../../head/page_head.jsp" %>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="http://172.19.103.72:8080/wlyy_admin/static/develop/lib/bootstrap/css/bootstrap.css" />
    <style type="text/css">
        .flex-box{display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */         /* OLD - Firefox 19- (buggy but mostly works) */
            display: -ms-flexbox;      /* TWEENER - IE 10 */     /* NEW - Chrome */
            display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;}
        .flex-box-item{-webkit-box-flex: 1;      /* OLD - iOS 6-, Safari 3.1-6 */
            -moz-box-flex: 1;         /* OLD - Firefox 19- */
            -webkit-flex: 1;          /* Chrome */
            -ms-flex: 1;              /* IE 10 */
            width: 50%;               /* For old syntax, otherwise collapses. */
            flex: 1;                  /* NEW, Spec - Opera 12.1, Firefox 20+ */}
        .settings-content{padding-bottom: 40px;position: relative;}
        .page-title{font-size: 14px;font-weight: bold;padding: 10px 15px;border-bottom: 1px solid #ececec;margin-bottom: 20px;}
        .width100{width: 100%;}
        .mw100{max-width: 100px;}
        .h120{height: 120px!important;}
        .mr40{margin-left: 40px;}
        .mb20{margin-bottom: 20px;}
        .caozuo-btn{padding-top: 36px;padding-left: 0;}
        .caozuo-btn .btn{position: relative;}
        .caozuo-btn .btn+.btn{margin-top: 20px;}
        .result-row + .result-row{margin-top: 40px;}
        .plus-setting{display: inline-block;position: absolute;left: 70px;cursor: pointer;font-size: 18px;bottom: 10px;color: #fff;background-color: #2d9bd2;border-radius: 100%;width: 22px;height: 22px;line-height: 22px;text-align: center;}
        .xsyj{opacity: 0;position: absolute;left: 0;right: 0;top: 0;bottom: 0;}
        .xsyj i{display: none;}
        .xsyj:checked ~ i{width: 14px;position: absolute;right: 10px;top: 8px;height: 14px;display: inline-block;vertical-align: middle;background: url(http://172.19.103.72:8080/wlyy_admin/static/develop/images/yigouxuan_icon.png) center center / 100% 100% no-repeat;}
        .clear-fixed-buttom{height: 74px;}
        .submit-setting{position: fixed;height: 74px;line-height: 74px;left: 0;right: 0;bottom: 0;border-top: 1px solid #ececec;}
        .red-color{vertical-align: middle;color: red;}
        .red-prompt{position: absolute;bottom: 5px;left: 70px;right: 15px;margin-bottom: 0;}
        .plus-setting{display: inline-block;position: absolute;left: 70px;cursor: pointer;font-size: 18px;bottom: 30px;color: #fff;background-color: #2d9bd2;border-radius: 100%;width: 22px;height: 22px;line-height: 22px;text-align: center;}
        .settings-content{padding-bottom: 70px;position: relative;}
    </style>
</head>
<body>
<div class="c-container">
    <input type="hidden" id="inp_templateCode" value='${templateCode}'/>
    <input type="hidden" id="inp_diseaseType" value='${diseaseType}'/>
    <input type="hidden" id="inp_mode" value='${mode}'/>
    <p class="page-title">筛查结果设置</p>
    <div class="settings-content">
        <!--加号-->
        <span class="plus-setting">+</span>
        <p class="red-color red-prompt">null代表无上限</p>
        <div class="form-inline result-row clearfix">
            <div class="flex-box col-xs-10 fenzhi mb20">
                <span><span class="red-color">*</span>分值范围&nbsp;&nbsp;</span>
                <input type="text" class="form-control flex-box-item mw100 low_score">
                <span>&nbsp;&nbsp;~&nbsp;&nbsp;</span>
                <input type="text" class="form-control flex-box-item mw100 high_score">
                <span class="mr40"><span class="red-color">*</span>分析结果&nbsp;&nbsp;</span>
                <input type="text" class="form-control flex-box-item result"></div>
            <div class="col-xs-10 flex-box">
                <span style="align-self: flex-start;"><span class="red-color">*</span>筛查建议&nbsp;&nbsp;</span>
                <textarea rows="5" class="form-control flex-box-item h120 advice" placeholder="筛查建议"></textarea>
            </div>
            <div class="col-xs-2 caozuo-btn">
                <label class="btn btn-success width100">显示预警<input type="checkbox" class="xsyj"><i></i></label>
                <button class="btn btn-danger delete-btn width100">删除</button>
            </div>
        </div>
    </div>
    <div class="clear-fixed-buttom">
        <div class="submit-setting text-center">
            <button class="btn btn-primary submit-btn">保存筛选表</button>
        </div>
    </div>
</div>
</body>
<%@ include file="../../head/page_foot.jsp" %>
<%@ include file="template_result_js.jsp" %>
</html>

+ 134 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/questionnaire/template/template_result_js.jsp

@ -0,0 +1,134 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href="${ctx}/static/develop/lib/select2/select2.min.css" rel="stylesheet">
<script src="${ctx}/static/develop/lib/select2/select2.js"></script>
<script>
    (function ($, win) {
        $(function () {
            /* ************************** 变量定义 ******************************** */
            // 通用工具类库
            var Util = $.Util;
            var retrieve = null;
            var jValidation = $.jValidation;
            //判断是否为选中评分筛查按钮
            var flag = 0;
            /* *************************** 函数定义 ******************************* */
            function pageInit() {
                retrieve.init();
            }
            /* *************************** 模块初始化 ***************************** */
            retrieve = {
                init: function () {
                    var self = this;
                    var templateCode = $("#inp_templateCode").val();
                    var diseaseType = $("#inp_diseaseType").val();
                    var mode = $("#inp_mode").val();
                    // var ctx = "http://192.168.131.115:8180"
                    var cloneDiv = $('.result-row')[0].cloneNode(true);
                    if(mode == "edit"){
                        //这边加入提示动画
                        $.ajax({
                            url: ctx + "/admin/surveyTemplateResult/findByTemplateCode",
                            method: "post",
                            dataType: "json",
                            async: true,//同步获取
                            data: {"templateCode":templateCode},
                            success: function (res) {
                                var str='';
                                if(res.data && res.data.length){
                                    for(var i in res.data){
                                        var result=res.data[i];
                                        var checked="checked='checked'";
                                        str+='<div class="form-inline result-row clearfix"><input type="hidden" class="form-control flex-box-item mw100 id" value="'+result.id+'">\
                                            <div class="flex-box col-xs-10 fenzhi mb20">\
                                                <span><span class="red-color">*</span>分值范围&nbsp;&nbsp;</span>\
                                                <input type="text" class="form-control flex-box-item mw100 low_score" value="'+result.lowScore+'">\
                                                <span>&nbsp;&nbsp;~&nbsp;&nbsp;</span>\
                                                <input type="text" class="form-control flex-box-item mw100 high_score" value="'+result.highScore+'">\
                                                <span class="mr40"><span class="red-color">*</span>分析结果&nbsp;&nbsp;</span>\
                                                <input type="text" class="form-control flex-box-item result" value="'+result.result+'"></div>\
                                            <div class="col-xs-10 flex-box">\
                                                <span style="align-self: flex-start;"><span class="red-color">*</span>筛查建议&nbsp;&nbsp;</span>\
                                                <textarea rows="5" class="form-control flex-box-item h120 advice" placeholder="筛查建议">'+result.advice+'</textarea>\
                                            </div>\
                                            <div class="col-xs-2 caozuo-btn">\
                                                <label class="btn btn-success width100">显示预警<input type="checkbox" class="xsyj" '+(result.warning==1?checked:"")+'><i></i></label>\
                                                <button class="btn btn-danger delete-btn width100">删除</button>\
                                            </div>\
                                        </div>';
                                    }
                                }
                                str && $('.result-row').remove();
                                str && $('.settings-content').append(str);
                            },
                            error: function (data) {
                                console.log(data)
//							$.Notice.error("系统异常,请联系管理员!");
                            }
                        });
                    }
                    var submitArr = [];
                    $('.plus-setting').on('click', function () {
                        var clone = cloneDiv.cloneNode(true);
                        $('.settings-content').append(clone);
                    })
                    $('.submit-btn').on('click', function () {
                        var going = true;
                        $('.result-row').each(function (index, item) {
                            if (going) {
                                var low_score = $(this).find('.low_score').val();
                                var high_score = $(this).find('.high_score').val();
                                var advice = $(this).find('.advice').val();
                                var id = $(this).find('.id').val();
                                if (!low_score || !high_score || !advice) {
                                    going = false;
                                    alert('信息未填写完整')
                                    $('body,html').animate({
                                        scrollTop: 0
                                    }, 500);
                                }
                                submitArr[index] = {};
                                submitArr[index]['lowScore'] = $(this).find('.low_score').val();
                                submitArr[index]['highScore'] = $(this).find('.high_score').val();
                                submitArr[index]['result'] = $(this).find('.result').val();
                                submitArr[index]['advice'] = $(this).find('.advice').val();
                                submitArr[index]['warning'] = $(this).find('.xsyj').prop('checked') ? 1 : 0;
                                submitArr[index]['templateCode'] = templateCode;
                                if(id != null){
                                    submitArr[index]['id'] = id;
                                }
                            }
                        })
                        if (!going) return ;
                        $.ajax({
                            url: ctx + "/admin/surveyTemplateResult/save",
                            method: "post",
                            dataType: "json",
                            async: false,
                            data: {"jsonData":JSON.stringify(submitArr),templateCode:templateCode},
                            success: function (result) {
                                console.log(result);
                                location.href =  ctx + '/admin/surveyTemplateAdvice/initial?diseaseType='+diseaseType+'&templateCode=' + templateCode + '&mode=' + mode;
                            },
                            error: function (data) {
                                console.log(data)
//							$.Notice.error("系统异常,请联系管理员!");
                            }
                        });
                    });
                    (function(){
                        $('.settings-content').on('click','.delete-btn', function () {
                            $(this).parents('.result-row').remove();
                        });
                    })();
                },
            }
                    /* *************************** 页面初始化 **************************** */
        pageInit();
    });
    })(jQuery, window);
</script>