Selaa lähdekoodia

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

Shi Kejing 4 vuotta sitten
vanhempi
commit
cab567c028
14 muutettua tiedostoa jossa 223 lisäystä ja 101 poistoa
  1. 1 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 0 1
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateOptionDao.java
  3. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserDao.java
  4. 169 78
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java
  5. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  7. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  8. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateOptionDO.java
  9. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateQuestionDO.java
  10. 10 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateOptionVO.java
  11. 10 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateQuestionVO.java
  12. 1 5
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  13. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java
  14. 4 4
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java

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

@ -6,7 +6,6 @@ import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorPatientDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.dict.DictDeptDescDO;
@ -76,7 +75,6 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -4323,7 +4321,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room ," +
                "base_patient p " +
                "WHERE  room.outpatient_id=op.id AND room.consult_type=2  AND p.id = op.patient" +
                " AND room.doctor IS NOT NULL and (p.online=0 OR P.online IS NULL) ";
                " AND room.doctor IS NOT NULL and (p.on_line=0 OR p.on_line IS NULL) ";
        if (StringUtils.isNoneBlank(dept)) {
            disconnectSql = disconnectSql + " and op.dept = '" + dept + "' ";
        }

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

@ -15,5 +15,4 @@ public interface SurveyTemplateOptionDao extends PagingAndSortingRepository<Wlyy
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String templateCode,String del);
    List<WlyySurveyTemplateOptionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);
}

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

@ -15,6 +15,6 @@ public interface SurveyUserDao extends PagingAndSortingRepository<WlyySurveyUser
    List<WlyySurveyUserDO> findBySurveyTempCodeAndStatus(String surveyTempCode,Integer status);
    @Query("from WlyySurveyUserDO c WHERE c.surveyTempCode = ?1 and c.patient =?2 and c.status =1 and c.createTime >= ?3")
    List<WlyySurveyUserDO> findBySurvey(String surveyTempCode,String patient,Date createTime);
    @Query("from WlyySurveyUserDO c WHERE c.surveyTempCode = ?1 and c.patient =?2 and c.status =1 ")
    List<WlyySurveyUserDO> findBySurvey(String surveyTempCode,String patient);
}

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

@ -21,6 +21,7 @@ import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.xpath.operations.Bool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -29,10 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by Trick on 2019/9/6
@ -107,7 +105,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //计算总数
        String totalSql ="SELECT" +
                " COUNT(1) AS total" +
                " COUNT(1) AS \"total\"" +
                " FROM" +
                " wlyy_survey_question q " +
                " WHERE q.del = '1' ";
@ -125,21 +123,21 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(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 " +
                " 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 as \"del\", " +
                " q.create_time AS \"createTime\", " +
                " q.update_time AS \"updateTime\" " +
                " FROM " +
                " wlyy_survey_question q " +
                " WHERE q.del = '1' ";
@ -154,8 +152,23 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if (StringUtils.isNoneBlank(creater)){
            sql+=" AND q.creater ='"+creater+"' ";
        }
        sql += " ORDER BY q.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        sql += " ORDER BY q.create_time DESC  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql ="SELECT * FROM\n" +
                        "( SELECT A.*, ROWNUM RN FROM\n" +
                        "    ("+sql+") A \n" +
                        "    WHERE ROWNUM <= "+page*size+" ) \n" +
                        "       WHERE RN >= "+((page-1)*size+1);
            }else {
                sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
            }
        } else {
            sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
        }
        List<WlyySurveyQuestionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyQuestionVO.class));
        if(list!=null&&list.size()>0){
@ -197,6 +210,11 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //保存问题
        List<WlyySurveyQuestionDO> surveys = EntityUtils.jsonToList(sqjsons, WlyySurveyQuestionDO.class);
        for (WlyySurveyQuestionDO wlyySurveyQuestionDO:surveys){
            wlyySurveyQuestionDO.setCreateTime(new Date());
            wlyySurveyQuestionDO.setUpdateTime(new Date());
        }
        surveyQuestionDao.save(surveys);
        if(surveys!=null&&surveys.size()>0){
@ -223,6 +241,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
     */
    public Boolean updataSurveyQuestion(String sqjson,String sqOptionJson) throws Exception{
        WlyySurveyQuestionDO sq = objectMapper.readValue(sqjson,WlyySurveyQuestionDO.class);
        sq.setUpdateTime(new Date());
        surveyQuestionDao.save(sq);
        List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
@ -272,7 +291,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    public MixEnvelop findSurveyTemplate(String title,String creater,String label,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " COUNT(1) AS \"total\"" +
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
@ -287,26 +306,26 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            totalSql += " AND i.label_code ='"+label+"'";
        }
        if (StringUtils.isNoneBlank(creater)){
            totalSql +=" AND  t.creater = '"+creater+"' ";
            totalSql +=" AND  t.creater_code = '"+creater+"' ";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " t.id, " +
                " t.title, " +
                " t.template_comment AS templateComment, " +
                " t.organization, " +
                " t.creater, " +
                " t.creater_code, " +
                " t.create_time AS createTime, " +
                " t.del, " +
                " t.update_time AS updateTime" +
                " t.id as \"id\",  " +
                " t.title as \"title\", " +
                " t.template_comment AS \"templateComment\", " +
                " t.organization AS \"organization\", " +
                " t.creater AS \"creater\", " +
                " t.creater_code AS \"createrCode\", " +
                " t.create_time AS \"createTime\", " +
                " t.del AS \"del\", " +
                " t.update_time AS \"updateTime\"" +
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
@ -323,7 +342,23 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if (StringUtils.isNoneBlank(creater)){
            sql +=" AND  t.creater_code = '"+creater+"' ";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        sql += " ORDER BY t.create_time DESC  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (!flag){
                sql ="SELECT * FROM\n" +
                        "( SELECT A.*, ROWNUM RN FROM\n" +
                        "    ("+sql+") A \n" +
                        "    WHERE ROWNUM <= "+page*size+" ) \n" +
                        "       WHERE RN >= "+((page-1)*size+1);
                System.out.println(sql);
            }else {
                sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
            }
        } else {
            sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
        }
        List<WlyySurveyTemplateVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyTemplateVO.class));
@ -397,15 +432,19 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            //设置问题
            List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
            convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
            templateVO.setTemplateQuestionVOs(tqVOs);
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getCode(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                for (WlyySurveyTemplateOptionVO optionVO:optionVOs){
                    optionVO.setId(optionVO.getCode());
                }
                tq.setOptionVOs(optionVOs);
                tq.setId(tq.getCode());
            }
            templateVO.setTemplateQuestionVOs(tqVOs);
        }
        return templateVO;
    }
@ -433,7 +472,16 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
        WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
        String doctor = temp.getCreaterCode();
        if (StringUtils.isNotEmpty(temp.getId())){
            WlyySurveyTemplateDO templateDO = surveyTemplateDao.findOne(temp.getId());
            if(null!=templateDO){
                temp.setCreater(templateDO.getCreater());
                temp.setCreaterCode(templateDO.getCreaterCode());
                temp.setUpdateTime(new Date());
            }
        }
        temp.setCreateTime(new Date());
        temp.setUpdateTime(new Date());
        temp = surveyTemplateDao.save(temp);
        //删除原有问题
        List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
@ -443,6 +491,14 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //新增问题
        if(StringUtils.isNotBlank(tempQJson)){
            List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
            for (WlyySurveyTemplateQuestionDO wlyySurveyTemplateQuestionDO:questions){
                wlyySurveyTemplateQuestionDO.setTemplateCode(temp.getId());
                wlyySurveyTemplateQuestionDO.setCode(wlyySurveyTemplateQuestionDO.getId());
                wlyySurveyTemplateQuestionDO.setId(UUID.randomUUID().toString());
                wlyySurveyTemplateQuestionDO.setCreateTime(new Date());
                wlyySurveyTemplateQuestionDO.setUpdateTime(new Date());
            }
            surveyTemplateQuestionDao.save(questions);
        }
@ -455,6 +511,12 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //保存新问题选项
        if(StringUtils.isNotBlank(tempOpJson)){
            List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
            for (WlyySurveyTemplateOptionDO wlyySurveyTemplateOptionDO:options){
                wlyySurveyTemplateOptionDO.setTemplateCode(temp.getId());
                wlyySurveyTemplateOptionDO.setCode(wlyySurveyTemplateOptionDO.getId());
                wlyySurveyTemplateOptionDO.setId(UUID.randomUUID()+"");
            }
            surveyTemplateOptionDao.save(options);
        }
@ -562,9 +624,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
     */
    public List<Map<String,Object>> findSurveyByDept(String dept){
        String sql = "SELECT " +
                " t.id, " +
                " t.title, " +
                " t.template_comment AS templateComment " +
                " t.id as \"id\", " +
                " t.title as \"title\", " +
                " t.template_comment AS \"templateComment\" " +
                " FROM " +
                " wlyy_survey_template t " +
                " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
@ -580,7 +642,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(result!=null&&result.size()>0){
            for(Map<String,Object> map:result){
                String tempId = (String)map.get("id");
                List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
                List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient);
                if(list!=null&&list.size()>0){
                    map.put("isAnswer",true);
                }else{
@ -598,9 +660,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    */
    public List<Map<String,Object>> findDeptBySurvey(String tempId){
        String sql ="SELECT " +
                " d.survey_temp_code AS surveyTempCode," +
                " d.dept, " +
                " d.dept_name AS deptName " +
                " d.survey_temp_code AS \"surveyTempCode\"," +
                " d.dept AS \"dept\", " +
                " d.dept_name AS \"deptName\" " +
                " FROM " +
                " wlyy_survey_template t " +
                " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
@ -635,6 +697,10 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
            for(WlyySurveyUserAnswerDO answerDO : answerDOs){
                answerDO.setSurverUserId(surveyUserDO.getId());
                answerDO.setCreateTime(new Date());
                /*WlyySurveyTemplateOptionDO surveyTemplateOptionDO = surveyTemplateOptionDao.findOne(answerDO.getTempOptionCode());
                answerDO.setTempQuestionCode(surveyTemplateOptionDO.getQuestionCode());
                answerDO.setTempOptionCode(surveyTemplateOptionDO.getCode());*/
            }
            surveyUserAnswerDao.save(answerDOs);
            BasePatientBusinessDO basePatientBusinessDO = basePatientBusinessDao.findByDoctorPatientRelationCode(surveyUserDO.getPatient(),surveyUserDO.getSurveyTempCode(),surveyUserDO.getDoctor());
@ -654,9 +720,11 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(StringUtils.isNotBlank(surverUserId)){
            list = surveyUserAnswerDao.findBySurverUserId(surverUserId);
        }else{
            List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
            List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient);
            System.out.println(surveys);
            if(surveys!=null&&surveys.size()>0){
                WlyySurveyUserDO wlyySurveyUserDO = surveys.get(0);
                System.out.println(wlyySurveyUserDO);
                list = surveyUserAnswerDao.findBySurverUserId(wlyySurveyUserDO.getId());
            }
        }
@ -680,7 +748,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            templateVO.setVisitDeptName(doctor.getVisitDeptName());
        }
        //查询所有答题过的用户,计算答题总数
        List<WlyySurveyUserDO> surveyUsers = surveyUserDao.findBySurveyTempCodeAndStatus(templateVO.getId(),1);
        List<WlyySurveyUserDO> surveyUsers = surveyUserDao.findBySurveyTempCodeAndStatus(tempId,1);
        Integer total =0;
        if(surveyUsers!=null&&surveyUsers.size()>0){
            total = surveyUsers.size();
@ -692,15 +760,14 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            //设置问题
            List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
            convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
            templateVO.setTemplateQuestionVOs(tqVOs);
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getCode(),tq.getTemplateCode(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                int tpCount = 0;
                List<WlyySurveyUserAnswerDO> answerQuestionDOs = surveyUserAnswerDao.findByTempQuestionCodeDistinctPatient(tq.getId(),tempId);
                List<WlyySurveyUserAnswerDO> answerQuestionDOs = surveyUserAnswerDao.findByTempQuestionCodeDistinctPatient(tq.getCode(),tempId);
                if(answerQuestionDOs!=null&&answerQuestionDOs.size()>0){
                    tpCount = answerQuestionDOs.size();
                }
@ -711,17 +778,19 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                if(optionVOs!=null&&optionVOs.size()>0){
                    for(WlyySurveyTemplateOptionVO vo:optionVOs){
                        Integer answerCount =0;
                        List<WlyySurveyUserAnswerDO> answerDOs = surveyUserAnswerDao.findBytempOptionCode(vo.getId(),vo.getTemplateCode());
                        List<WlyySurveyUserAnswerDO> answerDOs = surveyUserAnswerDao.findBytempOptionCode(vo.getCode(),vo.getTemplateCode());
                        if(answerDOs!=null&&answerDOs.size()>0){
                            answerCount = answerDOs.size();
                        }
                        vo.setPercentage(PercentageUtil.bs(answerCount,total)+"%");
                        vo.setOptCount(answerCount);
                        vo.setId(vo.getCode());
                    }
                }
                tq.setOptionVOs(optionVOs);
                tq.setId(tq.getCode());
            }
            templateVO.setTemplateQuestionVOs(tqVOs);
        }
        return templateVO;
    }
@ -736,10 +805,10 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
     * @param size
     * @return
     */
    public MixEnvelop findQuestionInfoList(String comment, String content, String tempQuestionCode,String tempOptionCode,Integer page,Integer size){
    public MixEnvelop findQuestionInfoList(String comment, String tempId,String content, String tempQuestionCode,String tempOptionCode,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " COUNT(1) AS \"total\"" +
                " FROM " +
                " wlyy_survey_user_answer t " +
                " WHERE 1=1";
@ -755,26 +824,29 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(StringUtils.isNotBlank(tempOptionCode)){
            totalSql += " AND t.temp_option_code ='"+tempOptionCode+"'";
        }
        if(StringUtils.isNotBlank(tempId)){
            totalSql += " AND t.survey_temp_code ='"+tempId+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " t.id, " +
                " t.survey_temp_code AS surveyTempCode, " +
                " t.temp_question_code AS tempQuestionCode, " +
                " t.question_type AS questionType, " +
                " t.temp_option_code AS tempOptionCode, " +
                " t.comment, " +
                " t.content, " +
                " t.patient," +
                " t.patient_name AS patientName," +
                " t.score," +
                " t.create_time AS createTime" +
                " t.id as \"id\", " +
                " t.survey_temp_code AS \"surveyTempCode\", " +
                " t.temp_question_code AS \"tempQuestionCode\", " +
                " t.question_type AS \"questionType\", " +
                " t.temp_option_code AS \"tempOptionCode\", " +
                " t.comment AS \"comment\", " +
                " t.content AS \"content\", " +
                " t.patient AS \"patient\"," +
                " t.patient_name AS \"patientName\"," +
                " t.score AS \"score\"," +
                " t.create_time AS \"createTime\"" +
                " FROM " +
                " wlyy_survey_user_answer t " +
                " WHERE 1=1";
@ -790,8 +862,26 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(StringUtils.isNotBlank(tempOptionCode)){
            sql += " AND t.temp_option_code ='"+tempOptionCode+"'";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        if(StringUtils.isNotBlank(tempId)){
            sql += " AND t.survey_temp_code ='"+tempId+"'";
        }
        sql += " ORDER BY t.create_time DESC  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql ="SELECT * FROM\n" +
                        "( SELECT A.*, ROWNUM RN FROM\n" +
                        "    ("+sql+") A \n" +
                        "    WHERE ROWNUM <= "+page*size+" ) \n" +
                        "       WHERE RN >= "+((page-1)*size+1);
            }else {
                sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
            }
        } else {
            sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
        }
        List<WlyySurveyUserAnswerDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyUserAnswerDO.class));
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
@ -807,7 +897,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    public MixEnvelop findAnswerList(String tempId,String patient,String patientName,String title,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " COUNT(1) AS \"total\"" +
                " FROM " +
                " wlyy_survey_user t " +
                " WHERE 1=1 and t.status = 1 ";
@ -827,24 +917,24 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " t.id, " +
                " t.survey_temp_code AS surveyTempCode, " +
                " t.survey_temp_title AS surveyTempTitle, " +
                " t.patient," +
                " t.patient_name AS patientName," +
                " t.dept," +
                " t.dept_name AS deptName," +
                " t.doctor," +
                " t.doctor_name AS doctorName," +
                " t.status," +
                " t.end_time AS endTime," +
                " t.create_time AS createTime," +
                " p.idcard," +
                " p.sex" +
                " t.id as \"id\", " +
                " t.survey_temp_code AS \"surveyTempCode\", " +
                " t.survey_temp_title AS \"surveyTempTitle\", " +
                " t.patient as \"patient\"," +
                " t.patient_name AS \"patientName\"," +
                " t.dept as \"dept\"," +
                " t.dept_name AS \"deptName\"," +
                " t.doctor AS \"doctor\"," +
                " t.doctor_name AS \"doctorName\"," +
                " t.status AS \"status\"," +
                " t.end_time AS \"endTime\"," +
                " t.create_time AS \"createTime\"," +
                " p.idcard as \"idcard\"," +
                " p.sex as \"sex\"" +
                " FROM " +
                " wlyy_survey_user t " +
                " JOIN base_patient p ON t.patient = p.id " +
@ -904,4 +994,5 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
}

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
    /*@GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
  /* @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -611,7 +611,7 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    }
    @Column(name = "online")
    @Column(name = "on_line")
    public String getOnline() {
        return online;
    }

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -652,7 +652,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    }
    @Column(name = "online")
    @Column(name = "on_line")
    public String getOnline() {
        return online;
    }

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

@ -15,6 +15,7 @@ import javax.persistence.Table;
public class WlyySurveyTemplateOptionDO  {
    private String id;
    private String code;
    private String templateCode;//模板编码',
    private String questionCode;//模板问题编码',关联wlyy_survey_template_question
    private String content;//选项内容',
@ -115,4 +116,12 @@ public class WlyySurveyTemplateOptionDO  {
    public void setHaveComment(Integer haveComment) {
        this.haveComment = haveComment;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

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

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

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

@ -9,7 +9,8 @@ import io.swagger.annotations.ApiModelProperty;
 */
@ApiModel(value = "WlyySurveyTemplateOptionVO", description = "问卷调查模板问题选项")
public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "业务id", example = "模块1")
    private String code;//模板编码',
    @ApiModelProperty(value = "模板编码", example = "模块1")
    private String templateCode;//模板编码',
    @ApiModelProperty(value = "模板问题编码", example = "模块1")
@ -132,4 +133,12 @@ public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    public void setOptCount(Integer optCount) {
        this.optCount = optCount;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

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

@ -13,7 +13,8 @@ import java.util.List;
 */
@ApiModel(value = "WlyySurveyTemplateQuestionVO", description = "问卷调查模板问题")
public class WlyySurveyTemplateQuestionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问题id", example = "模块1")
    private String code;//问题id
    @ApiModelProperty(value = "问题标题", example = "模块1")
    private String title;//问题标题',
    @ApiModelProperty(value = "问题说明(可为null)", example = "模块1")
@ -46,6 +47,14 @@ public class WlyySurveyTemplateQuestionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "选项问题答题人数", example = "模块1")
    private Integer tqCount;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }

+ 1 - 5
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -1,7 +1,5 @@
package com.yihu.jw.gateway.filter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
@ -30,7 +28,6 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
@ -268,8 +265,7 @@ public class BasicZuulFilter extends ZuulFilter {
        String badStr = "and |exec |execute |insert |select |delete |update |drop |chr |mid |master |truncate |" +
                "declare | sitename |net user|xp_cmdshell|or |exec |execute |create |" +
                "table |from |grant |use |group_concat|column_name|" +
                "information_schema.columns|table_schema|union |where |select |update |order |by |like |" +
                "--|%";//过滤掉的sql关键字,可以手动添加
                "information_schema.columns|table_schema|union |where |select |update |order |by |like |" ;//过滤掉的sql关键字,可以手动添加
        String[] badStrs = badStr.split("\\|");
        for (int i = 0; i < badStrs.length; i++) {
            if (str.indexOf(badStrs[i]) >= 0) {

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

@ -208,6 +208,8 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "统计-查询问题情况")
    public MixEnvelop findQuestionInfoList(@ApiParam(name = "comment", value = "选项备注")
                                           @RequestParam(value = "comment",required = false) String comment,
                                           @ApiParam(name = "temId", value = "选项内容,问答题内容")
                                           @RequestParam(value = "temId",required = false)String temId,
                                           @ApiParam(name = "content", value = "选项内容,问答题内容")
                                           @RequestParam(value = "content",required = false)String content,
                                           @ApiParam(name = "tempQuestionCode", value = "问题code")
@ -218,7 +220,7 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "page",required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findQuestionInfoList(comment,content,tempQuestionCode,tempOptionCode,page, size);
        return surveyService.findQuestionInfoList(comment,temId,content,tempQuestionCode,tempOptionCode,page, size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerList)
    @ApiOperation(value = "统计-综合查询问题答案")

+ 4 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java

@ -102,12 +102,12 @@ public class WlyyDeviceService {
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filter = new StringBuilder();
        String sql =" SELECT i.* ,p.name userName FROM device.wlyy_patient_health_index i left join wlyy.wlyy_sign_family s on i.`user` = s. patient and s.`status`>0, wlyy.wlyy_patient p WHERE i.user=p.code ";
        String countSql =" SELECT count(1) as num FROM device.wlyy_patient_health_index i left join wlyy.wlyy_sign_family s on i.`user` = s. patient and s.`status`>0, wlyy.wlyy_patient p WHERE i.user=p.code ";
        String sql =" SELECT i.* ,i.name userName FROM device.wlyy_patient_health_index i WHERE 1=1 ";
        String countSql =" SELECT count(1) as num FROM device.wlyy_patient_health_index i WHERE 1=1 ";
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            filter.append(" AND p.name LIKE '%"+userName+"%' ");
            filter.append(" AND i.name LIKE '%"+userName+"%' ");
        }
        if(!StringUtils.isEmpty(deviceSn)){
@ -150,7 +150,7 @@ public class WlyyDeviceService {
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and s.hospital in ("+orgUserService.getUserOrg(orgList)+") ";
            sql += " and i.hospital in ("+orgUserService.getUserOrg(orgList)+") ";
        }
        String f = filter.toString();