Browse Source

Merge branch 'dev' of trick9191/wlyy2.0 into dev

trick9191 5 năm trước cách đây
mục cha
commit
1f49e9ce5f
40 tập tin đã thay đổi với 2421 bổ sung47 xóa
  1. 6 35
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 24 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  3. 16 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyDeptDao.java
  4. 17 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyInspLabelInfoDao.java
  5. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyLabelInfoDao.java
  6. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyQuestionDao.java
  7. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyQuestionsOptionDao.java
  8. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateDao.java
  9. 18 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateOptionDao.java
  10. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateQuestionDao.java
  11. 17 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserAnswerDao.java
  12. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserDao.java
  13. 517 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java
  14. 15 0
      business/base-service/src/main/java/com/yihu/jw/utils/EntityUtils.java
  15. 2 0
      business/base-service/src/mqConfig/esbmq-config.xml
  16. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  17. 54 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyDeptDO.java
  18. 42 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyInspLabelInfoDO.java
  19. 42 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyLabelInfoDO.java
  20. 113 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyQuestionDO.java
  21. 73 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyQuestionsOptionDO.java
  22. 95 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateDO.java
  23. 109 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateOptionDO.java
  24. 149 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateQuestionDO.java
  25. 99 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserAnswerDO.java
  26. 82 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserDO.java
  27. 19 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  28. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  29. 43 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyInspLabelInfoVO.java
  30. 43 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyLabelInfoVO.java
  31. 120 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyQuestionVO.java
  32. 63 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyQuestionsOptionVO.java
  33. 103 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateOptionVO.java
  34. 158 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateQuestionVO.java
  35. 123 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateVO.java
  36. 9 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  37. 14 5
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java
  38. 4 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ByteToInputStream.java
  39. 2 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/QrcodeUtil.java
  40. 125 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java

+ 6 - 35
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -694,15 +694,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public JSONObject checkOutpatient(String patient)throws Exception{
    public Map<String,Object> checkOutpatient(String patient)throws Exception{
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        JSONObject rs = new JSONObject();
        Map<String,Object> rs = new HashedMap();
        //1.余额判断改到前端判断
        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
        //2.判断是否有未结束的
        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
        if(list!=null&&list.size()>0){
            rs.put("outpatient",list.get(0));
            rs.put("code",-2);
            rs.put("mes","存在未结束的诊断");
            return rs;
@ -1106,7 +1107,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public JSONArray getDrugDictionary(String chargeCode,String pyKey,String winNo)throws Exception{
        return entranceService.MS53001(chargeCode,pyKey,null,winNo,"0",demoFlag);
        return entranceService.MS53001(chargeCode,pyKey,"0",winNo,"0",demoFlag);
    }
    /**
@ -2599,38 +2600,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private FileUploadService fileUploadService;
    public Map<String,Object> test() {
        try {
            TransRequest e = new TransRequest();
            e.setMethod("ehc.ehealthcard.authurl");
            e.setApp_id("1BQA48ETK000A718A8C000001FFAA482");
            e.setTerm_id("35020010001");
            e.setVersion("X.M.0.1");
            e.setTimestamp(DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss"));
            e.setSign_type("MD5");
            e.setEnc_type("AES");
            com.alibaba.fastjson.JSONObject bizContent = new com.alibaba.fastjson.JSONObject();
            String no = UUID.randomUUID().toString().substring(0,30);
            bizContent.put("out_authorize_no", no);
            bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
            e.setBiz_content(JSON.toJSONString(bizContent));
            EhcHandler ehcHandler = new EhcHandler("http://www.mstpay.com:1811/ehcService/gateway.do", "1BQA48ETK000A718A8C000001FFAA482", "35020010001", "1BQA48ETK001A718A8C00000FE996B9B");
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
            InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
            UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg","http://172.26.0.110:8888/");
            Map<String,Object> map = new HashedMap();
            map.put("fileName",uploadVO.getFileName());
            map.put("fileType",uploadVO.getFileType());
            map.put("fullUrl",uploadVO.getFullUrl());
            map.put("fullUri",uploadVO.getFullUri());
            map.put("out_authorize_no",no);
            return map;
        } catch (Exception var5) {
            var5.printStackTrace();
        }
    public Map<String,Object> test() throws Exception{
        entranceService.MS02014(false);
        return null;
    }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 24 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


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

@ -0,0 +1,16 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyDeptDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyInspLabelInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/12.
 */
public interface SurveyDeptDao extends PagingAndSortingRepository<WlyySurveyDeptDO, String>, JpaSpecificationExecutor<WlyySurveyDeptDO> {
    List<WlyySurveyDeptDO> findBySurveyTempCode(String surveyTempCode);
}

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

@ -0,0 +1,17 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyInspLabelInfoDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyLabelInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/10.
 */
public interface SurveyInspLabelInfoDao  extends PagingAndSortingRepository<WlyySurveyInspLabelInfoDO, String>, JpaSpecificationExecutor<WlyySurveyInspLabelInfoDO> {
    List<WlyySurveyInspLabelInfoDO> findBySurveyTempCode(String surveyTempCode);
}

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

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyLabelInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/10.
 */
public interface SurveyLabelInfoDao extends PagingAndSortingRepository<WlyySurveyLabelInfoDO, String>, JpaSpecificationExecutor<WlyySurveyLabelInfoDO> {
    List<WlyySurveyLabelInfoDO> findBySurveyTempCode(String surveyTempCode);
}

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

@ -0,0 +1,11 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyQuestionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyQuestionDao extends PagingAndSortingRepository<WlyySurveyQuestionDO, String>, JpaSpecificationExecutor<WlyySurveyQuestionDO> {
}

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

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyQuestionsOptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyQuestionsOptionDao extends PagingAndSortingRepository<WlyySurveyQuestionsOptionDO, String>, JpaSpecificationExecutor<WlyySurveyQuestionsOptionDO> {
    List<WlyySurveyQuestionsOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String del);
}

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

@ -0,0 +1,11 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyTemplateDao extends PagingAndSortingRepository<WlyySurveyTemplateDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateDO> {
}

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

@ -0,0 +1,18 @@
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.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyTemplateOptionDao extends PagingAndSortingRepository<WlyySurveyTemplateOptionDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateOptionDO> {
    List<WlyySurveyTemplateOptionDO> findByTemplateQuestionCodeAndDelOrderBySortAsc(String templateQuestionCode,String del);
    List<WlyySurveyTemplateOptionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);
}

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

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateQuestionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyTemplateQuestionDao extends PagingAndSortingRepository<WlyySurveyTemplateQuestionDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateQuestionDO> {
    List<WlyySurveyTemplateQuestionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);
}

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

@ -0,0 +1,17 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyInspLabelInfoDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyUserAnswerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyUserAnswerDao extends PagingAndSortingRepository<WlyySurveyUserAnswerDO, String>, JpaSpecificationExecutor<WlyySurveyUserAnswerDO> {
    List<WlyySurveyUserAnswerDO> findBySurveyTempCodeAndPatient(String surveyTempCode,String patient);
}

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

@ -0,0 +1,11 @@
package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyUserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/9/6.
 */
public interface SurveyUserDao extends PagingAndSortingRepository<WlyySurveyUserDO, String>, JpaSpecificationExecutor<WlyySurveyUserDO> {
}

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

@ -0,0 +1,517 @@
package com.yihu.jw.hospital.survey.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.survey.*;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.survey.dao.*;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.survey.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/9/6.
 */
@Service
@Transactional
public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQuestionDao> {
    @Autowired
    private WlyyHospitalSysDictDao sysDictDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private SurveyQuestionDao surveyQuestionDao;
    @Autowired
    private SurveyQuestionsOptionDao surveyQuestionsOptionDao;
    @Autowired
    private SurveyTemplateDao surveyTemplateDao;
    @Autowired
    private SurveyTemplateQuestionDao surveyTemplateQuestionDao;
    @Autowired
    private SurveyTemplateOptionDao surveyTemplateOptionDao;
    @Autowired
    private SurveyLabelInfoDao surveyLabelInfoDao;
    @Autowired
    private SurveyInspLabelInfoDao surveyInspLabelInfoDao;
    @Autowired
    private SurveyDeptDao surveyDeptDao;
    @Autowired
    private SurveyUserDao surveyUserDao;
    @Autowired
    private SurveyUserAnswerDao surveyUserAnswerDao;
    /**
     * 查询字典
     * 1.surveyLabel;2.surveyScreenLabel
     * @param name
     * @return
     */
    public List<WlyyHospitalSysDictVO> findSurveyLabel(String name){
        List<WlyyHospitalSysDictVO> list = new ArrayList<>();
        return convertToModels(sysDictDao.findByDictName(name),list,WlyyHospitalSysDictVO.class);
    }
    /**
     * 查询问题
     * @param title
     * @param questionType
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop findSurveyQuestion(String title,Integer questionType,Integer page,Integer size)throws Exception{
        //计算总数
        String totalSql ="SELECT" +
                " COUNT(1) AS total" +
                " FROM" +
                " wlyy_survey_question q " +
                " WHERE q.del = '1' ";
        if(StringUtils.isNotBlank(title)){
            totalSql+=" AND q.title like '%"+title+"%'";
        }
        if(questionType!=null){
            totalSql+=" AND q.question_type ="+questionType;
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        //计算总数
        String sql ="SELECT " +
                " q.id AS id, " +
                " q.title AS title, " +
                " q.question_comment AS questionComment, " +
                " q.question_type AS questionType, " +
                " q.is_required AS isRequired, " +
                " q.min_num AS minNum, " +
                " q.max_num AS maxNum, " +
                " q.del, " +
                " q.create_time AS createTime, " +
                " q.update_time AS updateTime " +
                " FROM " +
                " wlyy_survey_question q " +
                " WHERE q.del = '1' ";
        if(StringUtils.isNotBlank(title)){
            sql+=" AND q.title like '%"+title+"%'";
        }
        if(questionType!=null){
            sql+=" AND q.question_type ="+questionType;
        }
        sql += " ORDER BY q.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        List<WlyySurveyQuestionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyQuestionVO.class));
        if(list!=null&&list.size()>0){
            for(WlyySurveyQuestionVO sq:list){
                List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
                if(optionDOs!=null&&optionDOs.size()>0){
                    List<WlyySurveyQuestionsOptionVO> optionVOs = new ArrayList<>();
                    sq.setOptionVOs(convertToModels(optionDOs,optionVOs,WlyySurveyQuestionsOptionVO.class));
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    /**
     * 查询问题单条
     * @param surveyId
     * @return
     */
    public WlyySurveyQuestionVO findBySurveyId(String surveyId){
        WlyySurveyQuestionDO sq = surveyQuestionDao.findOne(surveyId);
        WlyySurveyQuestionVO surveyQuestionVO = convertToModel(sq,WlyySurveyQuestionVO.class);
        List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
        if(optionDOs!=null&&optionDOs.size()>0){
            List<WlyySurveyQuestionsOptionVO> optionVOs = new ArrayList<>();
            surveyQuestionVO.setOptionVOs(convertToModels(optionDOs,optionVOs,WlyySurveyQuestionsOptionVO.class));
        }
        return surveyQuestionVO;
    }
    /**
     * 保存问题
     * @param sqOptionJson
     * @return
     * @throws Exception
     */
    public Boolean saveSurveyQuestion(String sqjsons,String sqOptionJson)throws Exception{
        //保存问题
        List<WlyySurveyQuestionDO> surveys = EntityUtils.jsonToList(sqjsons, WlyySurveyQuestionDO.class);
        surveyQuestionDao.save(surveys);
        if(surveys!=null&&surveys.size()>0){
            for(WlyySurveyQuestionDO sq:surveys){
                List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
                if(optionDOs!=null&&optionDOs.size()>0){
                    surveyQuestionsOptionDao.delete(optionDOs);
                }
                if(StringUtils.isNotBlank(sqOptionJson)){
                    List<WlyySurveyQuestionsOptionDO> options = EntityUtils.jsonToList(sqOptionJson, WlyySurveyQuestionsOptionDO.class);
                    surveyQuestionsOptionDao.save(options);
                }
            }
        }
        return true;
    }
    /**
     * 单个编辑问题
     * @param sqjson
     * @param sqOptionJson
     * @return
     * @throws Exception
     */
    public Boolean updataSurveyQuestion(String sqjson,String sqOptionJson) throws Exception{
        WlyySurveyQuestionDO sq = objectMapper.readValue(sqjson,WlyySurveyQuestionDO.class);
        surveyQuestionDao.save(sq);
        List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
        if(optionDOs!=null&&optionDOs.size()>0){
            surveyQuestionsOptionDao.delete(optionDOs);
        }
        if(StringUtils.isNotBlank(sqOptionJson)){
            List<WlyySurveyQuestionsOptionDO> options = EntityUtils.jsonToList(sqOptionJson, WlyySurveyQuestionsOptionDO.class);
            surveyQuestionsOptionDao.save(options);
        }
        return true;
    }
    /**
     * 删除问题
     * @param ids
     * @return
     */
    public Boolean delSurveyQuestion(String ids){
        String sids[] =ids.split(",");
        if(sids!=null&&ids.length()>0){
            for(String id:sids){
                WlyySurveyQuestionDO del = surveyQuestionDao.findOne(id);
                if(del!=null){
                    surveyQuestionDao.delete(del);
                }
                List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(id,"1");
                if(optionDOs!=null&&optionDOs.size()>0){
                    surveyQuestionsOptionDao.delete(optionDOs);
                }
            }
        }
        return true;
    }
    //=====================问卷模板=====================================
    /**
     *  查询模板列表
     * @param title
     * @param label
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop findSurveyTemplate(String title,String label,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
            totalSql+=" JOIN wlyy_survey_label_info i OM t.id = i.survey_temp_code";
        }
        totalSql += " WHERE " +
                    " t.del = '1'";
        if(StringUtils.isNotBlank(title)){
            totalSql += " t.title like '%"+title+"%' ";
        }
        if(StringUtils.isNotBlank(label)){
            totalSql += " i.label_code ='"+label+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        String sql = "SELECT " +
                " t.id, " +
                " t.title, " +
                " t.template_comment AS templateComment, " +
                " t.organization, " +
                " t.creater, " +
                " t.create_time AS createTime, " +
                " t.del, " +
                " t.update_time AS updateTime" +
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
            sql += " JOIN wlyy_survey_label_info i OM t.id = i.survey_temp_code";
        }
            sql += " WHERE " +
                   " t.del = '1'";
        if(StringUtils.isNotBlank(title)){
            sql += " t.title like '%"+title+"%' ";
        }
        if(StringUtils.isNotBlank(label)){
            sql += " i.label_code ='"+label+"'";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        List<WlyySurveyTemplateVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyTemplateVO.class));
        if(list!=null&&list.size()>0){
            //设置标签
            for(WlyySurveyTemplateVO templateVO : list){
                templateVO.setLabels(findSurveyTemplateLabel(templateVO.getId()));
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    /**
     * 获取问卷模板详情
     * @param tempId
     * @return
     */
    public WlyySurveyTemplateVO findSurveyTemplateById(String tempId){
        WlyySurveyTemplateDO templateDO = surveyTemplateDao.findOne(tempId);
        WlyySurveyTemplateVO templateVO = convertToModel(templateDO,WlyySurveyTemplateVO.class);
        templateVO.setLabels(findSurveyTemplateLabel(tempId));
        templateVO.setInsplabels(findSurveyInspTemplateLabel(tempId));
        List<WlyySurveyTemplateQuestionDO> tqDOs = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(tempId,"1");
        if(tqDOs!=null&&tqDOs.size()>0){
            //设置问题
            List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
            convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
            templateVO.setTemplateQuestionVOs(tqVOs);
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByTemplateQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                tq.setTemplateOptionVOs(optionVOs);
            }
        }
        return templateVO;
    }
    public List<WlyySurveyLabelInfoVO> findSurveyTemplateLabel(String tempId){
        List<WlyySurveyLabelInfoDO> list = surveyLabelInfoDao.findBySurveyTempCode(tempId);
        List<WlyySurveyLabelInfoVO> rs = new ArrayList<>();
        return convertToModels(list,rs,WlyySurveyLabelInfoVO.class);
    }
    public List<WlyySurveyInspLabelInfoVO> findSurveyInspTemplateLabel(String tempId){
        List<WlyySurveyInspLabelInfoDO> list = surveyInspLabelInfoDao.findBySurveyTempCode(tempId);
        List<WlyySurveyInspLabelInfoVO> rs = new ArrayList<>();
        return convertToModels(list,rs,WlyySurveyInspLabelInfoVO.class);
    }
    /**
     * 保存,更新模板
     * @param tempJson
     * @param tempQJson
     * @param tempOpJson
     * @return
     * @throws Exception
     */
    public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
        WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
        temp = surveyTemplateDao.save(temp);
        //删除原有问题
        List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
        if(questionDODels!=null&&questionDODels.size()>0){
            surveyTemplateQuestionDao.delete(questionDODels);
        }
        //新增问题
        if(StringUtils.isNotBlank(tempQJson)){
            List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
            surveyTemplateQuestionDao.save(questions);
        }
        //删除原有问题选项
        List<WlyySurveyTemplateOptionDO> optionDODels = surveyTemplateOptionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
        if(optionDODels!=null&&optionDODels.size()>0){
            surveyTemplateOptionDao.delete(optionDODels);
        }
        //保存新问题选项
        if(StringUtils.isNotBlank(tempOpJson)){
            List<WlyySurveyTemplateOptionDO> questions = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
            surveyTemplateOptionDao.save(questions);
        }
        //保存标签
        List<WlyySurveyLabelInfoDO> labelDels = surveyLabelInfoDao.findBySurveyTempCode(temp.getId());
        if(labelDels!=null&&labelDels.size()>0){
            surveyLabelInfoDao.delete(labelDels);
        }
        if(StringUtils.isNotBlank(labelJson)){
            List<WlyySurveyLabelInfoDO> labels = EntityUtils.jsonToList(labelJson, WlyySurveyLabelInfoDO.class);
            surveyLabelInfoDao.save(labels);
        }
        //删除检查标签
        List<WlyySurveyInspLabelInfoDO> labelInspDels = surveyInspLabelInfoDao.findBySurveyTempCode(temp.getId());
        if(labelDels!=null&&labelDels.size()>0){
            surveyInspLabelInfoDao.delete(labelInspDels);
        }
        //保存检查标签
        if(StringUtils.isNotBlank(labelInspJson)){
            List<WlyySurveyInspLabelInfoDO> labels = EntityUtils.jsonToList(labelInspJson, WlyySurveyInspLabelInfoDO.class);
            surveyInspLabelInfoDao.save(labels);
        }
        return true;
    }
    /**
     * 删除
     * @param tempId
     * @return
     */
    public Boolean delSurveyTemplate(String tempId){
        WlyySurveyTemplateDO temp = surveyTemplateDao.findOne(tempId);
        if(temp!=null){
            //删除原有问题
            List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
            if(questionDODels!=null&&questionDODels.size()>0){
                surveyTemplateQuestionDao.delete(questionDODels);
            }
            //删除原有问题选项
            List<WlyySurveyTemplateOptionDO> optionDODels = surveyTemplateOptionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
            if(optionDODels!=null&&optionDODels.size()>0){
                surveyTemplateOptionDao.delete(optionDODels);
            }
            surveyTemplateDao.delete(temp);
        }
        return true;
    }
    //=======================调查问卷发送=====================
    /**
     * 保存问卷科室关系
     * @param tempId
     * @param sdJsons
     * @return
     * @throws Exception
     */
    public Boolean saveSurveyDept(String tempId,String sdJsons)throws Exception{
        //删除之前关系
        List<WlyySurveyDeptDO> dels = surveyDeptDao.findBySurveyTempCode(tempId);
        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
     * @return
     */
    public List<Map<String,Object>> findSurveyByDept(String dept){
        String sql = "SELECT " +
                " t.id, " +
                " t.title, " +
                " t.template_comment AS templateComment " +
                " FROM " +
                " wlyy_survey_template t " +
                " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
                " WHERE " +
                " d.dept = '"+dept+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 查询问卷下科室
     * @param tempId
     * @return
     */
    public List<Map<String,Object>> findDeptBySurvey(String tempId){
        String sql ="SELECT " +
                " d.dept, " +
                " d.dept_name AS deptName " +
                " FROM " +
                " wlyy_survey_template t " +
                " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
                " WHERE " +
                " t.id = '"+tempId+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     *
     * @param suJson
     * @param suaJsons
     * @return
     * @throws Exception
     */
    public Boolean saveSurveyAnswer(String suJson,String suaJsons)throws Exception{
        WlyySurveyUserDO surveyUserDO = objectMapper.readValue(suJson,WlyySurveyUserDO.class);
        surveyUserDao.save(surveyUserDO);
        //删除问题答案
        List<WlyySurveyUserAnswerDO> dels = surveyUserAnswerDao.findBySurveyTempCodeAndPatient(surveyUserDO.getSurveyTempCode(),surveyUserDO.getPatient());
        if(dels!=null&&dels.size()>0){
            surveyUserAnswerDao.delete(dels);
        }
        //保存答案
        if(StringUtils.isNotBlank(suaJsons)){
            List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
            surveyUserAnswerDao.save(answerDOs);
        }
        return true;
    }
    public List<WlyySurveyUserAnswerDO> findAnswerBySurveyTempCode(String patient,String tempId){
        List<WlyySurveyUserAnswerDO> list = surveyUserAnswerDao.findBySurveyTempCodeAndPatient(tempId,patient);
        return list;
    }
}

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/utils/EntityUtils.java

@ -1,7 +1,11 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
public class EntityUtils {
@ -17,4 +21,15 @@ public class EntityUtils {
        return entity;
    }
    public static <T> List<T> jsonToList(String json, Class<T> target)throws Exception{
        com.alibaba.fastjson.JSONArray array = JSON.parseArray(json);
        List<T> list = new ArrayList<>();
        for(int i=0;i<array.size();i++){
            com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject)array.get(i);
            T t = objectMapper.readValue(object.toJSONString(),target);
            list.add(t);
        }
        return list;
    }
}

+ 2 - 0
business/base-service/src/mqConfig/esbmq-config.xml

@ -63,6 +63,8 @@
				<BS16010_1>EwellQ.S60.BS16010.GET</BS16010_1>
				<BS16011_0>EwellQ.S60.BS16011.PUT</BS16011_0>
				<BS16011_1>EwellQ.S60.BS16011.GET</BS16011_1>
				<MS02014_0>EwellQ.S60.MS02014.PUT</MS02014_0>
				<MS02014_1>EwellQ.S60.MS02014.GET</MS02014_1>
			</QUEUES>
		</QMGR.S60>
	</MQCONFIG>

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -164,6 +164,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;
    /**
	 * 就诊时间
	 */
@ -548,4 +553,12 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setDoctorCancelRemark(String doctorCancelRemark) {
        this.doctorCancelRemark = doctorCancelRemark;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}

+ 54 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyDeptDO.java

@ -0,0 +1,54 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.IntegerIdentityEntity;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Trick on 2019/9/12.
 */
@Entity
@Table(name = "wlyy_survey_dept")
public class WlyySurveyDeptDO extends IntegerIdentityEntity {
    /**
     * 问卷模板关系表
     */
    private String surveyTempCode;
    /**
     * 问卷部门
     */
    private String dept;
    /**
     * 问卷部门名称
     */
    private String deptCode;
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptCode() {
        return deptCode;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
}

+ 42 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyInspLabelInfoDO.java

@ -0,0 +1,42 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Trick on 2019/9/10.
 */
@Entity
@Table(name = "wlyy_survey_insp_label_info")
public class WlyySurveyInspLabelInfoDO extends UuidIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String labelCode;//(筛查类型code)',
    private String labelName;//(筛查类型name)',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

+ 42 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyLabelInfoDO.java

@ -0,0 +1,42 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Trick on 2019/9/10.
 */
@Entity
@Table(name = "wlyy_survey_label_info")
public class WlyySurveyLabelInfoDO extends UuidIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String labelCode;//(1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查)',
    private String labelName;//(1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查)',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

+ 113 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyQuestionDO.java

@ -0,0 +1,113 @@
package com.yihu.jw.entity.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_question")
public class WlyySurveyQuestionDO {
    private String id;
    private String title;//问题标题',
    private String questionComment;//问题说明(可为null)',
    private Integer questionType;//问题类型(0单选 1多选 2问答)',
    private Integer isRequired;//是否必答(0否 1是)',
    private Integer minNum;//最小答案个数(多选有效)',
    private Integer maxNum;//最大答案个数(多选有效)',
    private String del;//删除标志(1正常,0删除)',
    private Date createTime;//创建时间',
    private Date updateTime;//修改时间',
    @Id
    @Column(name = "id", unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 73 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyQuestionsOptionDO.java

@ -0,0 +1,73 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_questions_option")
public class WlyySurveyQuestionsOptionDO {
    private String id;
    private String questionCode;//题库问题编码',
    private String content;//选项内容',
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    private Integer sort;//单题内排序',
    private String del;//删除标志(1正常,0删除)',
    @Id
    @Column(name = "id", unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getQuestionCode() {
        return questionCode;
    }
    public void setQuestionCode(String questionCode) {
        this.questionCode = questionCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 95 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateDO.java

@ -0,0 +1,95 @@
package com.yihu.jw.entity.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_template")
public class WlyySurveyTemplateDO {
    private String id;
    private String title;//模板标题',
    private String templateComment;//模板说明',
    private String creater;//创建人',
    private String organization;//发布机构',
    private String del;//删除标志(1正常,0删除)',
    private Date createTime;//创建时间',
    private Date updateTime;//修改时间',
    @Id
    @Column(name = "id", unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getTemplateComment() {
        return templateComment;
    }
    public void setTemplateComment(String templateComment) {
        this.templateComment = templateComment;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public String getOrganization() {
        return organization;
    }
    public void setOrganization(String organization) {
        this.organization = organization;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 109 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateOptionDO.java

@ -0,0 +1,109 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_template_option")
public class WlyySurveyTemplateOptionDO  {
    private String id;
    private String templateCode;//模板编码',
    private String templateQuestionCode;//模板问题编码',
    private String content;//选项内容',
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    private Integer score;//选项分值',
    private String questionCodeNext;//下一题问题编码(问答题逻辑跳转)',
    private String questionSortNext;//下一题问题所属sort排序',
    private String del;//删除标志(1正常,0删除)',
    private Integer sort;//单题内排序',
    @Id
    @Column(name = "id", unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public String getTemplateQuestionCode() {
        return templateQuestionCode;
    }
    public void setTemplateQuestionCode(String templateQuestionCode) {
        this.templateQuestionCode = templateQuestionCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getScore() {
        return score;
    }
    public void setScore(Integer score) {
        this.score = score;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public String getQuestionSortNext() {
        return questionSortNext;
    }
    public void setQuestionSortNext(String questionSortNext) {
        this.questionSortNext = questionSortNext;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

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

@ -0,0 +1,149 @@
package com.yihu.jw.entity.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_template_question")
public class WlyySurveyTemplateQuestionDO {
    private String id;
    private String title;//问题标题',
    private String questionComment;//问题说明(可为null)',
    private Integer questionType;//问题类型(0单选 1多选 2问答)',
    private String templateCode;//模板编码',
    private Integer isRequired;//是否必答(0否 1是)',
    private Integer minNum;//最小答案个数(多选有效)',
    private Integer maxNum;//最大答案个数(多选有效)',
    private String questionCodeNext;//下一题问题编码(问答题逻辑跳转)',
    private String questionSortNext;//下一题问题所属sort排序',
    private Integer sort;//排序',
    private String del;//删除标志(1正常,0删除)',
    private Date createTime;//创建时间',
    private Date updateTime;//修改时间',
    @Id
    @Column(name = "id", unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public String getQuestionSortNext() {
        return questionSortNext;
    }
    public void setQuestionSortNext(String questionSortNext) {
        this.questionSortNext = questionSortNext;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 99 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserAnswerDO.java

@ -0,0 +1,99 @@
package com.yihu.jw.entity.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_user_answer")
public class WlyySurveyUserAnswerDO extends UuidIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String tempQuestionCode;//问答题题目编码',
    private Integer questionType;//
    private String tempOptionCode;//问卷选项编码',
    private String content;//问答题答案/选择题,问答题的中文',
    private String patient;//患者ID',
    private String patientName;//患者姓名',
    private Integer score;//得分',
    private Date createTime;//答案填写时间',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getTempQuestionCode() {
        return tempQuestionCode;
    }
    public void setTempQuestionCode(String tempQuestionCode) {
        this.tempQuestionCode = tempQuestionCode;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public String getTempOptionCode() {
        return tempOptionCode;
    }
    public void setTempOptionCode(String tempOptionCode) {
        this.tempOptionCode = tempOptionCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getScore() {
        return score;
    }
    public void setScore(Integer score) {
        this.score = score;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 82 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserDO.java

@ -0,0 +1,82 @@
package com.yihu.jw.entity.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/6.
 */
@Entity
@Table(name = "wlyy_survey_user")
public class WlyySurveyUserDO extends UuidIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String surveyTempTitle;//模板标题
    private String patient;//患者ID',
    private String patientName;//
    private Integer status;//是否已答(0未答 1已答 2放弃)',
    private Date endTime;//完成时间(放弃时间)',
    private Date createTime;//调查时间(居民接受时间)',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getSurveyTempTitle() {
        return surveyTempTitle;
    }
    public void setSurveyTempTitle(String surveyTempTitle) {
        this.surveyTempTitle = surveyTempTitle;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

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

@ -454,4 +454,23 @@ public class BaseHospitalRequestMapping {
        
    }
    /**
     * 问卷调查
     */
    public static class WlyySurvey extends Basic{
        public static final String PREFIX  = "/survey";
        public static final String findSurveyLabel  = "/findSurveyLabel";
        public static final String findSurveyQuestion  = "/findSurveyQuestion";
        public static final String findBySurveyId  = "/findBySurveyId";
        public static final String saveSurveyQuestion  = "/saveSurveyQuestion";
        public static final String updataSurveyQuestion  = "/updataSurveyQuestion";
        public static final String delSurveyQuestion  = "/delSurveyQuestion";
        public static final String findSurveyTemplate  = "/findSurveyTemplate";
        public static final String findSurveyTemplateById  = "/findSurveyTemplateById";
        public static final String saveSurveyTemplate  = "/saveSurveyTemplate";
        public static final String delSurveyTemplate  = "/delSurveyTemplate";
    }
}

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java

@ -199,6 +199,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "1已经评价,0或其他未评价", example = "模块1")
    private String evaluateStatus;
    /**
     * 1.在线复诊2.协同门诊
     */
    @ApiModelProperty(value = "1.在线复诊2.协同门诊", example = "模块1")
    private String outpatientType;
    public String getAdmNo() {
        return admNo;
    }
@ -429,4 +435,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setEvaluateStatus(String evaluateStatus) {
        this.evaluateStatus = evaluateStatus;
    }
    public String getOutpatientType() {
        return outpatientType;
    }
    public void setOutpatientType(String outpatientType) {
        this.outpatientType = outpatientType;
    }
}

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

@ -0,0 +1,43 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2019/9/10.
 */
@ApiModel(value = "WlyySurveyInspLabelInfoVO", description = "问卷模板筛查标签")
public class WlyySurveyInspLabelInfoVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问卷模板编码", example = "模块1")
    private String surveyTempCode;//问卷模板编码',
    @ApiModelProperty(value = "筛查类型code", example = "模块1")
    private String labelCode;//(筛查类型code)',
    @ApiModelProperty(value = "筛查类型name", example = "模块1")
    private String labelName;//(筛查类型name)',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

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

@ -0,0 +1,43 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2019/9/10.
 */
@ApiModel(value = "WlyySurveyLabelInfoVO", description = "问卷模板标签")
public class WlyySurveyLabelInfoVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问卷模板编码", example = "模块1")
    private String surveyTempCode;//问卷模板编码',
    @ApiModelProperty(value = "1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查", example = "模块1")
    private String labelCode;//(1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查)',
    @ApiModelProperty(value = "1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查", example = "模块1")
    private String labelName;//(1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查)',
    public String getSurveyTempCode() {
        return surveyTempCode;
    }
    public void setSurveyTempCode(String surveyTempCode) {
        this.surveyTempCode = surveyTempCode;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

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

@ -0,0 +1,120 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2019/9/9.
 */
@ApiModel(value = "WlyySurveyQuestionVO", description = "问卷调查")
public class WlyySurveyQuestionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问题标题", example = "模块1")
    private String title;//问题标题',
    @ApiModelProperty(value = "问题说明", example = "模块1")
    private String questionComment;//问题说明(可为null)',
    @ApiModelProperty(value = "问题类型(0单选 1多选 2问答", example = "模块1")
    private Integer questionType;//问题类型(0单选 1多选 2问答)',
    @ApiModelProperty(value = "是否必答(0否 1是)", example = "模块1")
    private Integer isRequired;//是否必答(0否 1是)',
    @ApiModelProperty(value = "最小答案个数(多选有效)", example = "模块1")
    private Integer minNum;//最小答案个数(多选有效)',
    @ApiModelProperty(value = "最大答案个数(多选有效)", example = "模块1")
    private Integer maxNum;//最大答案个数(多选有效)',
    @ApiModelProperty(value = "删除标志(1正常,0删除)", example = "模块1")
    private String del;//删除标志(1正常,0删除)',
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;//创建时间',
    @ApiModelProperty(value = "修改时间", example = "模块1")
    private Date updateTime;//修改时间',
    @ApiModelProperty(value = "选项目", example = "模块1")
    private List<WlyySurveyQuestionsOptionVO> optionVOs;
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public List<WlyySurveyQuestionsOptionVO> getOptionVOs() {
        return optionVOs;
    }
    public void setOptionVOs(List<WlyySurveyQuestionsOptionVO> optionVOs) {
        this.optionVOs = optionVOs;
    }
}

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

@ -0,0 +1,63 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2019/9/9.
 */
@ApiModel(value = "WlyySurveyQuestionVO", description = "问卷调查选项")
public class WlyySurveyQuestionsOptionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "题库问题编码", example = "模块1")
    private String questionCode;//题库问题编码',
    @ApiModelProperty(value = "选项内容", example = "模块1")
    private String content;//选项内容',
    @ApiModelProperty(value = "选项说明是否必填(0否 1是)", example = "模块1")
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    @ApiModelProperty(value = "单题内排序", example = "模块1")
    private Integer sort;//单题内排序',
    @ApiModelProperty(value = "删除标志", example = "模块1")
    private String del;//删除标志(1正常,0删除)',
    public String getQuestionCode() {
        return questionCode;
    }
    public void setQuestionCode(String questionCode) {
        this.questionCode = questionCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -0,0 +1,103 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2019/9/9.
 */
@ApiModel(value = "WlyySurveyTemplateOptionVO", description = "问卷调查模板问题选项")
public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "模板编码", example = "模块1")
    private String templateCode;//模板编码',
    @ApiModelProperty(value = "模板问题编码", example = "模块1")
    private String templateQuestionCode;//模板问题编码',
    @ApiModelProperty(value = "选项内容", example = "模块1")
    private String content;//选项内容',
    @ApiModelProperty(value = "选项说明是否必填(0否 1是)", example = "模块1")
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    @ApiModelProperty(value = "选项分值", example = "模块1")
    private Integer score;//选项分值',
    @ApiModelProperty(value = "下一题问题编码(问答题逻辑跳转)", example = "模块1")
    private String questionCodeNext;//下一题问题编码(问答题逻辑跳转)',
    @ApiModelProperty(value = "下一题问题所属sort排序", example = "模块1")
    private String questionSortNext;//下一题问题所属sort排序',
    @ApiModelProperty(value = "删除标志(1正常,0删除)", example = "模块1")
    private String del;//删除标志(1正常,0删除)',
    @ApiModelProperty(value = "单题内排序", example = "模块1")
    private Integer sort;//单题内排序',
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public String getTemplateQuestionCode() {
        return templateQuestionCode;
    }
    public void setTemplateQuestionCode(String templateQuestionCode) {
        this.templateQuestionCode = templateQuestionCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getScore() {
        return score;
    }
    public void setScore(Integer score) {
        this.score = score;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public String getQuestionSortNext() {
        return questionSortNext;
    }
    public void setQuestionSortNext(String questionSortNext) {
        this.questionSortNext = questionSortNext;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

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

@ -0,0 +1,158 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2019/9/9.
 */
@ApiModel(value = "WlyySurveyTemplateQuestionVO", description = "问卷调查模板问题")
public class WlyySurveyTemplateQuestionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问题标题", example = "模块1")
    private String title;//问题标题',
    @ApiModelProperty(value = "问题说明(可为null)", example = "模块1")
    private String questionComment;//问题说明(可为null)',
    @ApiModelProperty(value = "问题类型(0单选 1多选 2问答)", example = "模块1")
    private Integer questionType;//问题类型(0单选 1多选 2问答)',
    @ApiModelProperty(value = "模板编码", example = "模块1")
    private String templateCode;//模板编码',
    @ApiModelProperty(value = "是否必答(0否 1是)", example = "模块1")
    private Integer isRequired;//是否必答(0否 1是)',
    @ApiModelProperty(value = "最小答案个数(多选有效)", example = "模块1")
    private Integer minNum;//最小答案个数(多选有效)',
    @ApiModelProperty(value = "最大答案个数(多选有效)", example = "模块1")
    private Integer maxNum;//最大答案个数(多选有效)',
    @ApiModelProperty(value = "下一题问题编码(问答题逻辑跳转)", example = "模块1")
    private String questionCodeNext;//下一题问题编码(问答题逻辑跳转)',
    @ApiModelProperty(value = "下一题问题所属sort排序", example = "模块1")
    private String questionSortNext;//下一题问题所属sort排序',
    @ApiModelProperty(value = "排序", example = "模块1")
    private Integer sort;//排序',
    @ApiModelProperty(value = "删除标志(1正常,0删除)", example = "模块1")
    private String del;//删除标志(1正常,0删除)',
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;//创建时间',
    @ApiModelProperty(value = "修改时间", example = "模块1")
    private Date updateTime;//修改时间',
    @ApiModelProperty(value = "选项", example = "模块1")
    private List<WlyySurveyTemplateOptionVO> templateOptionVOs;
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public Integer getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public String getQuestionSortNext() {
        return questionSortNext;
    }
    public void setQuestionSortNext(String questionSortNext) {
        this.questionSortNext = questionSortNext;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public List<WlyySurveyTemplateOptionVO> getTemplateOptionVOs() {
        return templateOptionVOs;
    }
    public void setTemplateOptionVOs(List<WlyySurveyTemplateOptionVO> templateOptionVOs) {
        this.templateOptionVOs = templateOptionVOs;
    }
}

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

@ -0,0 +1,123 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/9/9.
 */
@ApiModel(value = "WlyySurveyTemplateVO", description = "问卷调查模板")
public class WlyySurveyTemplateVO extends UuidIdentityVO {
    @ApiModelProperty(value = "模板标题", example = "模块1")
    private String title;//模板标题',
    @ApiModelProperty(value = "模板说明", example = "模块1")
    private String templateComment;//模板说明',
    @ApiModelProperty(value = "创建人", example = "模块1")
    private String creater;//创建人',
    @ApiModelProperty(value = "发布机构", example = "模块1")
    private String organization;//发布机构',
    @ApiModelProperty(value = "删除标志(1正常,0删除)", example = "模块1")
    private String del;//删除标志(1正常,0删除)',
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;//创建时间',
    @ApiModelProperty(value = "修改时间", example = "模块1")
    private Date updateTime;//修改时间',
    @ApiModelProperty(value = "标签", example = "模块1")
    private List<WlyySurveyLabelInfoVO> labels;
    @ApiModelProperty(value = "标签", example = "模块1")
    private List<WlyySurveyInspLabelInfoVO> insplabels;
    @ApiModelProperty(value = "问题", example = "模块1")
    private List<WlyySurveyTemplateQuestionVO> templateQuestionVOs;
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getTemplateComment() {
        return templateComment;
    }
    public void setTemplateComment(String templateComment) {
        this.templateComment = templateComment;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public String getOrganization() {
        return organization;
    }
    public void setOrganization(String organization) {
        this.organization = organization;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public List<WlyySurveyLabelInfoVO> getLabels() {
        return labels;
    }
    public void setLabels(List<WlyySurveyLabelInfoVO> labels) {
        this.labels = labels;
    }
    public List<WlyySurveyInspLabelInfoVO> getInsplabels() {
        return insplabels;
    }
    public void setInsplabels(List<WlyySurveyInspLabelInfoVO> insplabels) {
        this.insplabels = insplabels;
    }
    public List<WlyySurveyTemplateQuestionVO> getTemplateQuestionVOs() {
        return templateQuestionVOs;
    }
    public void setTemplateQuestionVOs(List<WlyySurveyTemplateQuestionVO> templateQuestionVOs) {
        this.templateQuestionVOs = templateQuestionVOs;
    }
}

+ 9 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -698,8 +698,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/getOauthQRCodeImg", method = RequestMethod.GET)
    public ObjEnvelop getOauthQRCodeImg(){
        logger.info("/oauth/getOauthQRCodeImg:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return ObjEnvelop.getSuccess("success", oauthYlzConfigService.getOauthQRCodeImg());
        try{
            logger.info("/oauth/getOauthQRCodeImg1:"+" startTime:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            Map<String,Object> rs = oauthYlzConfigService.getOauthQRCodeImg();
            logger.info("/oauth/getOauthQRCodeImg2:"+" endTime:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS") );
            return ObjEnvelop.getSuccess("success", rs);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("getOauthQRCodeImg error");
        }
    }
    @RequestMapping(value = "/oauth/checkQRCodeLogin", method = RequestMethod.POST)

+ 14 - 5
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -15,6 +15,7 @@ import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,7 +33,6 @@ import java.util.UUID;
 * Created by Trick on 2019/7/26.
 */
@Service
@Transactional
public class OauthYlzConfigService {
    private static final Logger logger = LoggerFactory.getLogger(OauthYlzConfigService.class);
@ -91,9 +91,9 @@ public class OauthYlzConfigService {
    public Map<String,Object> getOauthQRCodeImg(){
        try {
            logger.info("getOauthQRCode dao1:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            logger.info("getOauthQRCodeImg dao1:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
            logger.info("getOauthQRCode dao2:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            logger.info("getOauthQRCodeImg dao2:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            TransRequest e = new TransRequest();
            e.setMethod("ehc.ehealthcard.authurl");
            e.setApp_id(oauthYlzConfigDO.getAppId());
@ -136,6 +136,7 @@ public class OauthYlzConfigService {
     * @param authorizeNo
     * @return
     */
    @Transactional
    public Map<String,Object> checkOauthQRCode(String authorizeNo){
        Map<String,Object> rsMap = new HashedMap();
@ -156,6 +157,8 @@ public class OauthYlzConfigService {
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("checkOauthQRCode TransResponse :"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS")+" "+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            String ret_code = json.getString("ret_code");
@ -165,12 +168,18 @@ public class OauthYlzConfigService {
                if("succ".equals(auth_status)){
                    String idcard = biz.getString("id_no");
                    BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
                    if(patientDO == null){
                    if(StringUtils.isNotBlank(idcard)&&patientDO == null){
                        BasePatientDO patient = new BasePatientDO();
                        String salt = UUID.randomUUID().toString().substring(0,5);
                        String mobile = biz.getString("mobile_phone");
                        String pw = idcard.substring(mobile.length()-6);
                        String pw = null;
                        if(StringUtils.isNotBlank(mobile)){
                            pw = mobile.substring(mobile.length()-6);
                        }else{
                            pw = idcard.substring(idcard.length()-6);
                        }
                        patient.setIdcard(idcard);
                        patient.setName(biz.getString("user_name"));

+ 4 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ByteToInputStream.java

@ -36,6 +36,7 @@ public class ByteToInputStream {
        }catch (Exception e){
            logger.error(e.toString());
        }finally {
            inStream.close();
            swapStream.close();
        }
        return in2b;
@ -45,8 +46,9 @@ public class ByteToInputStream {
        // 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
        byte[] data = null;
        // 读取图片字节数组
        ByteArrayOutputStream swapStream = null;
        try {
            ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
            swapStream = new ByteArrayOutputStream();
            byte[] buff = new byte[100];
            int rc = 0;
            while ((rc = in.read(buff, 0, 100)) > 0) {
@ -58,6 +60,7 @@ public class ByteToInputStream {
        } finally {
            if (in != null) {
                try {
                    swapStream.close();
                    in.close();
                } catch (IOException e) {
                    logger.error(e.toString());

+ 2 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/QrcodeUtil.java

@ -59,9 +59,8 @@ public class QrcodeUtil {
            hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
            hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
            hints.put(EncodeHintType.MARGIN, 0);
            BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
              BarcodeFormat.QR_CODE, size, size, hints);
             os = new ByteArrayOutputStream();
            BitMatrix bitMatrix = new MultiFormatWriter().encode(content,BarcodeFormat.QR_CODE, size, size, hints);
            os = new ByteArrayOutputStream();
            MatrixToImageWriter.writeToStream(bitMatrix, imgType, os);
            return new ByteArrayInputStream(os.toByteArray());
        } catch (Exception e) {

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

@ -0,0 +1,125 @@
package com.yihu.jw.hospital.endpoint.survey;
import com.yihu.jw.hospital.survey.service.SurveyService;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2019/9/10.
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.WlyySurvey.PREFIX)
@Api(value = "问卷调查", description = "问卷调查", tags = {"问卷调查"})
public class SurveyEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SurveyService surveyService;
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyLabel)
    @ApiOperation(value = "问题-查询字典")
    public ListEnvelop findSurveyLabel(@ApiParam(name = "name", value = "1.surveyLabel 标签;2.surveyScreenLabel 问卷类型")
                                       @RequestParam(value = "name",required = true) String name) throws Exception {
        List<WlyyHospitalSysDictVO> vos = surveyService.findSurveyLabel(name);
        return success(vos);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyQuestion)
    @ApiOperation(value = "问题-获取问卷问题列表")
    public MixEnvelop findSurveyQuestion(@ApiParam(name = "title", value = "标题")
                                          @RequestParam(value = "title",required = false) String title,
                                         @ApiParam(name = "questionType", value = "问题类型")
                                          @RequestParam(value = "questionType",required = false)Integer questionType,
                                         @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.findSurveyQuestion(title,questionType,page,size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findBySurveyId)
    @ApiOperation(value = "问题-获取问卷问题详情(单条)")
    public ObjEnvelop findBySurveyId(@ApiParam(name = "surveyId", value = "问卷Id")
                                     @RequestParam(value = "surveyId",required = true) String surveyId) throws Exception {
        return success(surveyService.findBySurveyId(surveyId));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyQuestion)
    @ApiOperation(value = "问题-批量保存问卷问题")
    public ObjEnvelop saveSurveyQuestion(@ApiParam(name = "sqjsons", value = "问题实体列表json")
                                         @RequestParam(value = "sqjsons",required = true)String sqjsons,
                                         @ApiParam(name = "sqOptionJson", value = "选项实体列表json")
                                         @RequestParam(value = "sqOptionJson",required = false)String sqOptionJson) throws Exception {
        return success(surveyService.saveSurveyQuestion(sqjsons,sqOptionJson));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.updataSurveyQuestion)
    @ApiOperation(value = "问题-更新问题(单条)")
    public ObjEnvelop updataSurveyQuestion(@ApiParam(name = "sqjson", value = "问题实体json")
                                           @RequestParam(value = "sqjson",required = true)String sqjson,
                                           @ApiParam(name = "sqOptionJson", value = "选项实体列表json")
                                           @RequestParam(value = "sqOptionJson",required = false)String sqOptionJson) throws Exception {
        return success(surveyService.updataSurveyQuestion(sqjson,sqOptionJson));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.delSurveyQuestion)
    @ApiOperation(value = "问题-批量删除")
    public ObjEnvelop delSurveyQuestion(@ApiParam(name = "ids", value = "问题实体ID,逗号分割")
                                        @RequestParam(value = "ids",required = true)String ids) throws Exception {
        return success(surveyService.delSurveyQuestion(ids));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplate)
    @ApiOperation(value = "模板-查询模板列表")
    public MixEnvelop findSurveyTemplate(@ApiParam(name = "title", value = "标题")
                                              @RequestParam(value = "title",required = false) String title,
                                          @ApiParam(name = "label", value = "标签code")
                                              @RequestParam(value = "label",required = false)String label,
                                          @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.findSurveyTemplate( title, label, page, size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplateById)
    @ApiOperation(value = "模板-获取模板详情(单条)")
    public ObjEnvelop findSurveyTemplateById(@ApiParam(name = "tempId", value = "模板ID")
                                             @RequestParam(value = "tempId",required = true) String tempId) throws Exception {
        return success(surveyService.findSurveyTemplateById(tempId));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyTemplate)
    @ApiOperation(value = "问题-批量保存问卷问题")
    public ObjEnvelop saveSurveyTemplate(@ApiParam(name = "tempJson", value = "模板实体json")
                                         @RequestParam(value = "tempJson",required = true)String tempJson,
                                         @ApiParam(name = "tempQJson", value = "模板问题列表json")
                                         @RequestParam(value = "tempQJson",required = false)String tempQJson,
                                         @ApiParam(name = "tempOpJson", value = "模板问题选项列表json")
                                         @RequestParam(value = "tempOpJson",required = false)String tempOpJson,
                                         @ApiParam(name = "labelJson", value = "模板标签json")
                                         @RequestParam(value = "labelJson",required = false)String labelJson,
                                         @ApiParam(name = "labelInspJson", value = "模板筛查标签json")
                                         @RequestParam(value = "labelInspJson",required = false)String labelInspJson) throws Exception {
        return success(surveyService.saveSurveyTemplate(tempJson,tempQJson,tempOpJson,labelJson,labelInspJson));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.delSurveyTemplate)
    @ApiOperation(value = "模板-批量删除")
    public ObjEnvelop delSurveyTemplate(@ApiParam(name = "tempId", value = "模板实体json")
                                        @RequestParam(value = "tempId",required = true)String tempId) throws Exception {
        return success(surveyService.delSurveyTemplate(tempId));
    }
}