Parcourir la source

Merge remote-tracking branch 'origin/dev' into dev

hill9868 il y a 5 ans
Parent
commit
f5451d6e65
39 fichiers modifiés avec 1603 ajouts et 64 suppressions
  1. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/DoctorZsInfoDao.java
  2. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 78 17
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  4. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyDeptDao.java
  5. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateOptionDao.java
  6. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserAnswerDao.java
  7. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserDao.java
  8. 219 11
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java
  9. 34 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  10. 3 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  11. 54 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java
  12. 56 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDeptDO.java
  13. 65 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeCategoryDO.java
  14. 286 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/BaseDoctorZsInfoDO.java
  15. 5 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyDeptDO.java
  16. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyInspLabelInfoDO.java
  17. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyLabelInfoDO.java
  18. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyQuestionsOptionDO.java
  19. 14 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateOptionDO.java
  20. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserAnswerDO.java
  21. 36 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyUserDO.java
  22. 37 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  23. 2 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyInspLabelInfoVO.java
  24. 2 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyLabelInfoVO.java
  25. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyQuestionsOptionVO.java
  26. 26 5
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateOptionVO.java
  27. 5 5
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateQuestionVO.java
  28. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyTemplateVO.java
  29. 145 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/survey/WlyySurveyUserVO.java
  30. 29 0
      common/common-util/src/main/java/com/yihu/jw/util/common/PercentageUtil.java
  31. 8 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  32. 6 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java
  33. 19 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDeptDao.java
  34. 18 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeCategoryDao.java
  35. 102 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  36. 28 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  37. 88 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java
  38. 111 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  39. 59 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java

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

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

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

@ -1732,10 +1732,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
               BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
               rs.put("winNo",org.getWinNo());
               rs.put("deptName",hospitalDOs.get(0).getDeptName());
                rs.put("deptCode",hospitalDOs.get(0).getDeptCode());
            }else{
               rs.put("hospital",null);
               rs.put("winNo",null);
               rs.put("deptName",null);
                rs.put("deptCode",null);
            }
@ -1992,7 +1994,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.photo AS photo," +
                "patient.birthday AS birthday," +
                "room.consult_type AS consult_type," +
                "(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.description AS description," +
                "room.reservation_type AS reservation_type," +
@ -2329,7 +2331,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND d.outpatient_type = '"+outpatientType+"' ";
            sql+=" AND d.outpatient_type like '%"+outpatientType+"%' ";
        }
    
        if(StringUtils.isNotBlank(keyName)){

Fichier diff supprimé car celui-ci est trop grand
+ 78 - 17
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


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

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

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

@ -11,7 +11,7 @@ import java.util.List;
 */
public interface SurveyTemplateOptionDao extends PagingAndSortingRepository<WlyySurveyTemplateOptionDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateOptionDO> {
    List<WlyySurveyTemplateOptionDO> findByTemplateQuestionCodeAndDelOrderBySortAsc(String templateQuestionCode,String del);
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String del);
    List<WlyySurveyTemplateOptionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);

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

@ -14,4 +14,7 @@ public interface SurveyUserAnswerDao extends PagingAndSortingRepository<WlyySurv
    List<WlyySurveyUserAnswerDO> findBySurveyTempCodeAndPatient(String surveyTempCode,String patient);
    List<WlyySurveyUserAnswerDO> findByTempQuestionCode(String tempQuestionCode);
    List<WlyySurveyUserAnswerDO> findBytempOptionCode(String tempOptionCode);
}

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

@ -4,8 +4,12 @@ import com.yihu.jw.entity.hospital.survey.WlyySurveyUserDO;
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 SurveyUserDao extends PagingAndSortingRepository<WlyySurveyUserDO, String>, JpaSpecificationExecutor<WlyySurveyUserDO> {
    List<WlyySurveyUserDO> findBySurveyTempCodeAndStatus(String surveyTempCode,Integer status);
}

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

@ -10,6 +10,8 @@ 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.util.common.IdCardUtil;
import com.yihu.jw.util.common.PercentageUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
@ -27,7 +29,7 @@ import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/9/6.
 * Created by Trick on 2019/9/6
 */
@Service
@Transactional
@ -243,15 +245,15 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
            totalSql+=" JOIN wlyy_survey_label_info i OM t.id = i.survey_temp_code";
            totalSql+=" JOIN wlyy_survey_label_info i ON t.id = i.survey_temp_code";
        }
        totalSql += " WHERE " +
                    " t.del = '1'";
        if(StringUtils.isNotBlank(title)){
            totalSql += " t.title like '%"+title+"%' ";
            totalSql += " AND t.title like '%"+title+"%' ";
        }
        if(StringUtils.isNotBlank(label)){
            totalSql += " i.label_code ='"+label+"'";
            totalSql += " AND i.label_code ='"+label+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
@ -273,15 +275,15 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
                " FROM " +
                " wlyy_survey_template t ";
        if(StringUtils.isNotBlank(label)){
            sql += " JOIN wlyy_survey_label_info i OM t.id = i.survey_temp_code";
            sql += " JOIN wlyy_survey_label_info i ON t.id = i.survey_temp_code";
        }
            sql += " WHERE " +
                   " t.del = '1'";
        if(StringUtils.isNotBlank(title)){
            sql += " t.title like '%"+title+"%' ";
            sql += " AND t.title like '%"+title+"%' ";
        }
        if(StringUtils.isNotBlank(label)){
            sql += " i.label_code ='"+label+"'";
            sql += " AND  i.label_code ='"+label+"'";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
@ -317,10 +319,10 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByTemplateQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                tq.setTemplateOptionVOs(optionVOs);
                tq.setOptionVOs(optionVOs);
            }
        }
        return templateVO;
@ -370,8 +372,8 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        //保存新问题选项
        if(StringUtils.isNotBlank(tempOpJson)){
            List<WlyySurveyTemplateOptionDO> questions = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
            surveyTemplateOptionDao.save(questions);
            List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
            surveyTemplateOptionDao.save(options);
        }
        //保存标签
@ -447,6 +449,30 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        return true;
    }
    /**
     * 保存部门问卷关系
     * @param dept
     * @param sdJsons
     * @return
     * @throws Exception
     */
    public Boolean saveDeptSurvey(String dept,String sdJsons)throws Exception{
        //删除之前关系
        List<WlyySurveyDeptDO> dels = surveyDeptDao.findByDept(dept);
        if(dels!=null&&dels.size()>0){
            surveyDeptDao.delete(dels);
        }
        if(StringUtils.isNotBlank(sdJsons)){
            List<WlyySurveyDeptDO> list = EntityUtils.jsonToList(sdJsons,WlyySurveyDeptDO.class);
            if(list!=null&&list.size()>0){
                surveyDeptDao.save(list);
            }
        }
        return true;
    }
    /**
     * 查询科室下问卷列表
     * @param dept
@ -473,6 +499,7 @@ 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 " +
                " FROM " +
@ -514,4 +541,185 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        List<WlyySurveyUserAnswerDO> list = surveyUserAnswerDao.findBySurveyTempCodeAndPatient(tempId,patient);
        return list;
    }
    /**
     * 查询问题情况
     * @param tempId
     * @return
     */
    public WlyySurveyTemplateVO findSurveyTemplateResult(String tempId) {
        WlyySurveyTemplateDO templateDO = surveyTemplateDao.findOne(tempId);
        WlyySurveyTemplateVO templateVO = convertToModel(templateDO,WlyySurveyTemplateVO.class);
        templateVO.setLabels(findSurveyTemplateLabel(tempId));
        templateVO.setInsplabels(findSurveyInspTemplateLabel(tempId));
        //查询所有答题过的用户,计算答题总数
        List<WlyySurveyUserDO> surveyUsers = surveyUserDao.findBySurveyTempCodeAndStatus(templateVO.getId(),1);
        Integer total =0;
        if(surveyUsers!=null&&surveyUsers.size()>0){
            total = surveyUsers.size();
        }
        templateVO.setAnswerCount(total);
        List<WlyySurveyTemplateQuestionDO> tqDOs = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(tempId,"1");
        if(tqDOs!=null&&tqDOs.size()>0){
            //设置问题
            List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
            convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
            templateVO.setTemplateQuestionVOs(tqVOs);
            //设置选项
            for(WlyySurveyTemplateQuestionVO tq:tqVOs){
                List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),"1");
                List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
                convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
                /**
                 * 统计每个选项选择的百分比
                 */
                if(optionVOs!=null&&optionVOs.size()>0){
                    for(WlyySurveyTemplateOptionVO vo:optionVOs){
                        Integer answerCount =0;
                        List<WlyySurveyUserAnswerDO> answerDOs = surveyUserAnswerDao.findBytempOptionCode(vo.getId());
                        if(answerDOs!=null&&answerDOs.size()>0){
                            answerCount = answerDOs.size();
                        }
                        vo.setPercentage(PercentageUtil.bs(answerCount,total)+"%");
                    }
                }
                tq.setOptionVOs(optionVOs);
            }
        }
        return templateVO;
    }
    /**
     * 综合查询问题答案
     * @param comment
     * @param content
     * @param tempQuestionCode
     * @param tempOptionCode
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop findQuestionInfoList(String comment, String content, String tempQuestionCode,String tempOptionCode,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " FROM " +
                " wlyy_survey_user_answer t " +
                " WHERE 1=1";
        if(StringUtils.isNotBlank(comment)){
            totalSql += " AND t.comment like '%"+comment+"%' ";
        }
        if(StringUtils.isNotBlank(content)){
            totalSql += " AND t.content  like '%"+content+"%'";
        }
        if(StringUtils.isNotBlank(tempQuestionCode)){
            totalSql += " AND t.temp_question_code ='"+tempQuestionCode+"'";
        }
        if(StringUtils.isNotBlank(tempOptionCode)){
            totalSql += " AND t.temp_option_code ='"+tempOptionCode+"'";
        }
        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.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" +
                " FROM " +
                " wlyy_survey_user_answer t " +
                " WHERE 1=1";
        if(StringUtils.isNotBlank(comment)){
            sql += " AND t.comment like '%"+comment+"%' ";
        }
        if(StringUtils.isNotBlank(content)){
            sql += " AND t.content  like '%"+content+"%'";
        }
        if(StringUtils.isNotBlank(tempQuestionCode)){
            sql += " AND t.temp_question_code ='"+tempQuestionCode+"'";
        }
        if(StringUtils.isNotBlank(tempOptionCode)){
            sql += " AND t.temp_option_code ='"+tempOptionCode+"'";
        }
        sql += " ORDER BY t.create_time DESC 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);
    }
    /**
     * 查询
     * @param title
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop findAnswerList(String title,Integer page,Integer size){
        String totalSql ="SELECT " +
                " COUNT(1) AS total" +
                " FROM " +
                " wlyy_survey_user t " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(title)){
            totalSql += " AND t.survey_temp_title like '%"+title+"%' ";
        }
        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.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" +
                " FROM " +
                " wlyy_survey_user t " +
                " JOIN base_patient p ON t.patient = p.id " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(title)){
            sql += " AND t.survey_temp_title like '%"+title+"%' ";
        }
        sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        List<WlyySurveyUserVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyUserVO.class));
        if(list!=null&&list.size()>0){
            for(WlyySurveyUserVO vo :list){
                vo.setAge(IdCardUtil.getAgeForIdcard(vo.getIdcard()));
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
}

+ 34 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1592,4 +1592,38 @@ public class ImService {
	public void sendWaiSocketMessage(String sender,String reciver,String content,String contentType){
		imUtil.sendMessage(sender,reciver,contentType,content);
	}
	
	/**
	 * 导诊的咨询对话
	 * @param patientCode
	 * @param session_id
	 * @return
	 */
	public String getPatientGuaidenceConsult(String patientCode, String session_id) throws Exception{
		
		Boolean re = false;
		re = imUtil.sessionIsExist(session_id);
		if(re){
			return session_id;
		}else{
			JSONObject participants = new JSONObject();
			participants.put(patientCode,0);
			JSONObject sessionJson  = imUtil.createSession(participants,imUtil.SESSION_TYPE_GUIDANCE_HOSPITAL,"居民求助导诊护士",session_id);
			if(sessionJson.getInteger("status") ==-1){
				throw  new RuntimeException(sessionJson.getString("message"));
			}else{
				return session_id;
			}
		}
	}
	
	/**
	 * 更新会话成员(新增或删除)
	 * @param sessionId 会话id
	 * @param user 新增的成员id
	 * @param oldUserId  删除的成员id
	 */
	public String updateParticipant(String sessionid, String userid, String olduserid)throws Exception {
		return imUtil.updateParticipant(sessionid,userid,olduserid);
	}
}

+ 3 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -673,6 +673,8 @@ public class ImUtil {
	public static final String SESSION_TYPE_PRESCRIPTION = "8";//续方
	public static final String SESSION_TYPE_EXAMINATION = "9";//在线复诊
	public static final String SESSION_TYPE_ONDOOR_NURSING = "11";//上门护理
	public static final String SESSION_TYPE_COLLABORATION_HOSPITAL = "12";///互联网医院协同门诊
	public static final String SESSION_TYPE_GUIDANCE_HOSPITAL = "14";//互联网医院居民导诊聊天
	public static final String SESSION_STATUS_PROCEEDINGS = "0";
	public static final String SESSION_STATUS_END = "1";
	
@ -696,4 +698,5 @@ public class ImUtil {
			return 0;
		}
	}
}

+ 54 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java

@ -17,9 +17,14 @@ import java.util.Date;
public class KnowledgeArticleDO extends UuidIdentityEntity {
	
	private String createUser; // 创建人
	private String createUserName; // 创建人
	private String createUserDept; // 创建人科室CODE
	private String createUserDeptName; // 创建人科室名称
	private String title;   // 文章标题
	private String categoryFirst;    // 1级分类标识
	private String categoryFirstName;    // 1级分类标识
	private String categorySecond;    // 2级分类标识
	private String categorySecondName;    // 2级分类标识
	private String content; // 文章内容
	private String source;  // 文章来源--客服
	private String image;   // 封面图片
@ -29,6 +34,7 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
	private Date updateTime;  // 编辑时间
	private Integer del; // 是否删除,1正常,0删除
	private Integer status;// 0未审核 1已审核
	private String cancelReason;//退回理由
	
	
	public String getCreateUser() {
@ -118,4 +124,52 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public String getCancelReason() {
		return cancelReason;
	}
	
	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}
	
	public String getCreateUserName() {
		return createUserName;
	}
	
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	
	public String getCategoryFirstName() {
		return categoryFirstName;
	}
	
	public void setCategoryFirstName(String categoryFirstName) {
		this.categoryFirstName = categoryFirstName;
	}
	
	public String getCategorySecondName() {
		return categorySecondName;
	}
	
	public void setCategorySecondName(String categorySecondName) {
		this.categorySecondName = categorySecondName;
	}
	
	public String getCreateUserDept() {
		return createUserDept;
	}
	
	public void setCreateUserDept(String createUserDept) {
		this.createUserDept = createUserDept;
	}
	
	public String getCreateUserDeptName() {
		return createUserDeptName;
	}
	
	public void setCreateUserDeptName(String createUserDeptName) {
		this.createUserDeptName = createUserDeptName;
	}
}

+ 56 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDeptDO.java

@ -0,0 +1,56 @@
package com.yihu.jw.entity.hospital.article;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 健康文章部门关系表
 * @author huangwenjie
 * @date 2019/9/18 10:00
 */
@Entity
@Table(name = "wlyy_knowledge_article_dept")
public class KnowledgeArticleDeptDO extends UuidIdentityEntity {
	
	/**
	 * 文章ID
	 */
	private String articleId;
	
	/**
	 * 部门
	 */
	private String dept;
	
	/**
	 * 部门名称
	 */
	private String deptName;
	
	
	public String getDept() {
		return dept;
	}
	
	public void setDept(String dept) {
		this.dept = dept;
	}
	
	public String getDeptName() {
		return deptName;
	}
	
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	
	public String getArticleId() {
		return articleId;
	}
	
	public void setArticleId(String articleId) {
		this.articleId = articleId;
	}
}

+ 65 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeCategoryDO.java

@ -0,0 +1,65 @@
package com.yihu.jw.entity.hospital.article;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 健康文章分类
 * @author huangwenjie
 */
@Entity
@Table(name = "wlyy_knowledge_category")
public class KnowledgeCategoryDO extends UuidIdentityEntity {
	private String name;    // 分类名称
	@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 updateTime;  // 编辑时间
	private Integer del;    // 是否删除,1正常,0删除'
	private Long pid;   // 父id
	
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public Date getUpdateTime() {
		return updateTime;
	}
	
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public Integer getDel() {
		return del;
	}
	
	public void setDel(Integer del) {
		this.del = del;
	}
	
	public Long getPid() {
		return pid;
	}
	
	public void setPid(Long pid) {
		this.pid = pid;
	}
}

+ 286 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/BaseDoctorZsInfoDO.java

@ -0,0 +1,286 @@
package com.yihu.jw.entity.hospital.doctor;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/9/16.
 */
@Entity
@Table(name = "base_doctor_zs_info")
public class BaseDoctorZsInfoDO extends IntegerIdentityEntity {
    private String staffCode;
    private String staffName;
    private String deptId;
    private String deptName;
    private String idNumber;
    private String sexCode;
    private String sexName;
    private Date dateBirth;
    private String addrHome;
    private String mobileNo;
    private String major;
    private String educationName;
    private String degreeName;
    private Date entryDate;
    private Date arriveHospDate;
    private String staffCategCode;
    private String StaffCategName;
    private String titleLevelCode;
    private String titleLevelName;
    private String staffStatusCode;
    private String staffStatusName;
    private String levelCode;
    private String levelName;
    private String degreeCode;
    private String ethnicCode;
    private String ethnicName;
    private String politicalStatus;
    private String politicalStatusName;
    private String practiceCertificateNo;
    private String skillCertificateNo;
    public String getStaffCode() {
        return staffCode;
    }
    public void setStaffCode(String staffCode) {
        this.staffCode = staffCode;
    }
    public String getStaffName() {
        return staffName;
    }
    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }
    public String getDeptId() {
        return deptId;
    }
    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getIdNumber() {
        return idNumber;
    }
    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }
    public String getSexCode() {
        return sexCode;
    }
    public void setSexCode(String sexCode) {
        this.sexCode = sexCode;
    }
    public String getSexName() {
        return sexName;
    }
    public void setSexName(String sexName) {
        this.sexName = sexName;
    }
    public Date getDateBirth() {
        return dateBirth;
    }
    public void setDateBirth(Date dateBirth) {
        this.dateBirth = dateBirth;
    }
    public String getAddrHome() {
        return addrHome;
    }
    public void setAddrHome(String addrHome) {
        this.addrHome = addrHome;
    }
    public String getMobileNo() {
        return mobileNo;
    }
    public void setMobileNo(String mobileNo) {
        this.mobileNo = mobileNo;
    }
    public String getMajor() {
        return major;
    }
    public void setMajor(String major) {
        this.major = major;
    }
    public String getEducationName() {
        return educationName;
    }
    public void setEducationName(String educationName) {
        this.educationName = educationName;
    }
    public String getDegreeName() {
        return degreeName;
    }
    public void setDegreeName(String degreeName) {
        this.degreeName = degreeName;
    }
    public Date getEntryDate() {
        return entryDate;
    }
    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }
    public Date getArriveHospDate() {
        return arriveHospDate;
    }
    public void setArriveHospDate(Date arriveHospDate) {
        this.arriveHospDate = arriveHospDate;
    }
    public String getStaffCategCode() {
        return staffCategCode;
    }
    public void setStaffCategCode(String staffCategCode) {
        this.staffCategCode = staffCategCode;
    }
    public String getStaffCategName() {
        return StaffCategName;
    }
    public void setStaffCategName(String staffCategName) {
        StaffCategName = staffCategName;
    }
    public String getTitleLevelCode() {
        return titleLevelCode;
    }
    public void setTitleLevelCode(String titleLevelCode) {
        this.titleLevelCode = titleLevelCode;
    }
    public String getTitleLevelName() {
        return titleLevelName;
    }
    public void setTitleLevelName(String titleLevelName) {
        this.titleLevelName = titleLevelName;
    }
    public String getStaffStatusCode() {
        return staffStatusCode;
    }
    public void setStaffStatusCode(String staffStatusCode) {
        this.staffStatusCode = staffStatusCode;
    }
    public String getStaffStatusName() {
        return staffStatusName;
    }
    public void setStaffStatusName(String staffStatusName) {
        this.staffStatusName = staffStatusName;
    }
    public String getLevelCode() {
        return levelCode;
    }
    public void setLevelCode(String levelCode) {
        this.levelCode = levelCode;
    }
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
    public String getDegreeCode() {
        return degreeCode;
    }
    public void setDegreeCode(String degreeCode) {
        this.degreeCode = degreeCode;
    }
    public String getEthnicCode() {
        return ethnicCode;
    }
    public void setEthnicCode(String ethnicCode) {
        this.ethnicCode = ethnicCode;
    }
    public String getEthnicName() {
        return ethnicName;
    }
    public void setEthnicName(String ethnicName) {
        this.ethnicName = ethnicName;
    }
    public String getPoliticalStatus() {
        return politicalStatus;
    }
    public void setPoliticalStatus(String politicalStatus) {
        this.politicalStatus = politicalStatus;
    }
    public String getPoliticalStatusName() {
        return politicalStatusName;
    }
    public void setPoliticalStatusName(String politicalStatusName) {
        this.politicalStatusName = politicalStatusName;
    }
    public String getPracticeCertificateNo() {
        return practiceCertificateNo;
    }
    public void setPracticeCertificateNo(String practiceCertificateNo) {
        this.practiceCertificateNo = practiceCertificateNo;
    }
    public String getSkillCertificateNo() {
        return skillCertificateNo;
    }
    public void setSkillCertificateNo(String skillCertificateNo) {
        this.skillCertificateNo = skillCertificateNo;
    }
}

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

@ -26,7 +26,7 @@ public class WlyySurveyDeptDO extends IntegerIdentityEntity {
    /**
     * 问卷部门名称
     */
    private String deptCode;
    private String deptName;
    public String getSurveyTempCode() {
        return surveyTempCode;
@ -44,11 +44,11 @@ public class WlyySurveyDeptDO extends IntegerIdentityEntity {
        this.dept = dept;
    }
    public String getDeptCode() {
        return deptCode;
    public String getDeptName() {
        return deptName;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
}

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyInspLabelInfoDO.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
@ -10,7 +11,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "wlyy_survey_insp_label_info")
public class WlyySurveyInspLabelInfoDO extends UuidIdentityEntity {
public class WlyySurveyInspLabelInfoDO extends IntegerIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String labelCode;//(筛查类型code)',

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyLabelInfoDO.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity.hospital.survey;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
@ -10,7 +11,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "wlyy_survey_label_info")
public class WlyySurveyLabelInfoDO extends UuidIdentityEntity {
public class WlyySurveyLabelInfoDO extends IntegerIdentityEntity {
    private String surveyTempCode;//问卷模板编码',
    private String labelCode;//(1满意度、2糖尿病、3高血压、4生活日常,5疾病筛查)',

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

@ -17,6 +17,7 @@ public class WlyySurveyQuestionsOptionDO {
    private String id;
    private String questionCode;//题库问题编码',
    private String content;//选项内容',
    private Integer haveComment;//是否有备注,0没有,1有
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    private Integer sort;//单题内排序',
    private String del;//删除标志(1正常,0删除)',
@ -70,4 +71,12 @@ public class WlyySurveyQuestionsOptionDO {
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(Integer haveComment) {
        this.haveComment = haveComment;
    }
}

+ 14 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateOptionDO.java

@ -16,8 +16,9 @@ public class WlyySurveyTemplateOptionDO  {
    private String id;
    private String templateCode;//模板编码',
    private String templateQuestionCode;//模板问题编码',
    private String questionCode;//模板问题编码',关联wlyy_survey_template_question
    private String content;//选项内容',
    private Integer haveComment;//是否有备注,0没有,1有
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    private Integer score;//选项分值',
    private String questionCodeNext;//下一题问题编码(问答题逻辑跳转)',
@ -43,12 +44,12 @@ public class WlyySurveyTemplateOptionDO  {
        this.templateCode = templateCode;
    }
    public String getTemplateQuestionCode() {
        return templateQuestionCode;
    public String getQuestionCode() {
        return questionCode;
    }
    public void setTemplateQuestionCode(String templateQuestionCode) {
        this.templateQuestionCode = templateQuestionCode;
    public void setQuestionCode(String questionCode) {
        this.questionCode = questionCode;
    }
    public String getContent() {
@ -106,4 +107,12 @@ public class WlyySurveyTemplateOptionDO  {
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(Integer haveComment) {
        this.haveComment = haveComment;
    }
}

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

@ -18,6 +18,7 @@ public class WlyySurveyUserAnswerDO extends UuidIdentityEntity {
    private String tempQuestionCode;//问答题题目编码',
    private Integer questionType;//
    private String tempOptionCode;//问卷选项编码',
    private String comment;//选项的备注
    private String content;//问答题答案/选择题,问答题的中文',
    private String patient;//患者ID',
    private String patientName;//患者姓名',
@ -96,4 +97,12 @@ public class WlyySurveyUserAnswerDO extends UuidIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getComment() {
        return comment;
    }
    public void setComment(String comment) {
        this.comment = comment;
    }
}

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

@ -18,6 +18,10 @@ public class WlyySurveyUserDO extends UuidIdentityEntity {
    private String surveyTempTitle;//模板标题
    private String patient;//患者ID',
    private String patientName;//
    private String dept;//部门
    private String deptName;//部门名称
    private String doctor;  //医生
    private String doctorName;//医生名称
    private Integer status;//是否已答(0未答 1已答 2放弃)',
    private Date endTime;//完成时间(放弃时间)',
    private Date createTime;//调查时间(居民接受时间)',
@ -79,4 +83,36 @@ public class WlyySurveyUserDO extends UuidIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

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

@ -341,6 +341,12 @@ public class BaseHospitalRequestMapping {
    
        //获取微信签名
        public static final String getSign ="/getSign";
        
        //获取居民-导诊的咨询对话
        public static final String getPatientGuaidenceConsult = "getPatientGuaidenceConsult";
        
        //更新会话成员(新增或删除)
        public static final String updateConsultParticipant = "updateConsultParticipant";
        
@ -442,6 +448,9 @@ public class BaseHospitalRequestMapping {
        //添加/修改文章
        public static final String saveArticle  = "/saveArticle";
    
        //审核/退回文章
        public static final String reviewArticle  = "/reviewArticle";
    
        //新增/修改分类
        public static final String saveCategory  = "/saveCategory";
        
@ -450,6 +459,18 @@ public class BaseHospitalRequestMapping {
        
        //根据分类code删除分类
        public static final String updateDel  = "/updateDel";
    
        //设置文章发送的科室
        public static final String saveArticleDept  = "/saveArticleDept";
    
        //根据文章查找科室
        public static final String findDeptByArticle  = "/findDeptByArticle";
    
        //根据科室查找文章
        public static final String findArticleByDept  = "/findArticleByDept";
    
        //设置部门发送文章
        public static final String saveDeptArticle  = "/saveDeptArticle";
        
        
    }
@ -472,5 +493,21 @@ public class BaseHospitalRequestMapping {
        public static final String saveSurveyTemplate  = "/saveSurveyTemplate";
        public static final String delSurveyTemplate  = "/delSurveyTemplate";
        public static final String saveSurveyDept  = "/saveSurveyDept";
        public static final String saveDeptSurvey  = "/saveDeptSurvey";
        public static final String findSurveyByDept  = "/findSurveyByDept";
        public static final String findDeptBySurvey  = "/findDeptBySurvey";
        public static final String saveSurveyAnswer  = "/saveSurveyAnswer";
        public static final String findAnswerBySurveyTempCode  = "/findAnswerBySurveyTempCode";
        public static final String findSurveyTemplateResult  = "/findSurveyTemplateResult";
        public static final String findQuestionInfoList  = "/findQuestionInfoList";
        public static final String findAnswerList  = "/findAnswerList";
    }
}

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

@ -1,6 +1,6 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
 * Created by Trick on 2019/9/10.
 */
@ApiModel(value = "WlyySurveyInspLabelInfoVO", description = "问卷模板筛查标签")
public class WlyySurveyInspLabelInfoVO extends UuidIdentityVO {
public class WlyySurveyInspLabelInfoVO extends IntegerIdentityVO {
    @ApiModelProperty(value = "问卷模板编码", example = "模块1")
    private String surveyTempCode;//问卷模板编码',

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

@ -1,5 +1,6 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -8,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 * Created by Trick on 2019/9/10.
 */
@ApiModel(value = "WlyySurveyLabelInfoVO", description = "问卷模板标签")
public class WlyySurveyLabelInfoVO extends UuidIdentityVO {
public class WlyySurveyLabelInfoVO extends IntegerIdentityVO {
    @ApiModelProperty(value = "问卷模板编码", example = "模块1")
    private String surveyTempCode;//问卷模板编码',

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

@ -14,6 +14,8 @@ public class WlyySurveyQuestionsOptionVO extends UuidIdentityVO {
    private String questionCode;//题库问题编码',
    @ApiModelProperty(value = "选项内容", example = "模块1")
    private String content;//选项内容',
    @ApiModelProperty(value = "是否有备注,0没有,1有", example = "模块1")
    private Integer haveComment;
    @ApiModelProperty(value = "选项说明是否必填(0否 1是)", example = "模块1")
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    @ApiModelProperty(value = "单题内排序", example = "模块1")
@ -60,4 +62,12 @@ public class WlyySurveyQuestionsOptionVO extends UuidIdentityVO {
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(Integer haveComment) {
        this.haveComment = haveComment;
    }
}

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

@ -13,9 +13,11 @@ public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "模板编码", example = "模块1")
    private String templateCode;//模板编码',
    @ApiModelProperty(value = "模板问题编码", example = "模块1")
    private String templateQuestionCode;//模板问题编码',
    private String questionCode;//模板问题编码',
    @ApiModelProperty(value = "选项内容", example = "模块1")
    private String content;//选项内容',
    @ApiModelProperty(value = "是否有备注,0没有,1有", example = "模块1")
    private String haveComment;
    @ApiModelProperty(value = "选项说明是否必填(0否 1是)", example = "模块1")
    private Integer isRequired;//选项说明是否必填(0否 1是)',
    @ApiModelProperty(value = "选项分值", example = "模块1")
@ -29,6 +31,9 @@ public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "单题内排序", example = "模块1")
    private Integer sort;//单题内排序',
    @ApiModelProperty(value = "百分比", example = "模块1")
    private String percentage;
    public String getTemplateCode() {
        return templateCode;
    }
@ -37,12 +42,12 @@ public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
        this.templateCode = templateCode;
    }
    public String getTemplateQuestionCode() {
        return templateQuestionCode;
    public String getQuestionCode() {
        return questionCode;
    }
    public void setTemplateQuestionCode(String templateQuestionCode) {
        this.templateQuestionCode = templateQuestionCode;
    public void setQuestionCode(String questionCode) {
        this.questionCode = questionCode;
    }
    public String getContent() {
@ -100,4 +105,20 @@ public class WlyySurveyTemplateOptionVO extends UuidIdentityVO {
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(String haveComment) {
        this.haveComment = haveComment;
    }
    public String getPercentage() {
        return percentage;
    }
    public void setPercentage(String percentage) {
        this.percentage = percentage;
    }
}

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

@ -42,7 +42,7 @@ public class WlyySurveyTemplateQuestionVO extends UuidIdentityVO {
    private Date updateTime;//修改时间',
    @ApiModelProperty(value = "选项", example = "模块1")
    private List<WlyySurveyTemplateOptionVO> templateOptionVOs;
    private List<WlyySurveyTemplateOptionVO> optionVOs;
    public String getTitle() {
        return title;
@ -148,11 +148,11 @@ public class WlyySurveyTemplateQuestionVO extends UuidIdentityVO {
        this.updateTime = updateTime;
    }
    public List<WlyySurveyTemplateOptionVO> getTemplateOptionVOs() {
        return templateOptionVOs;
    public List<WlyySurveyTemplateOptionVO> getOptionVOs() {
        return optionVOs;
    }
    public void setTemplateOptionVOs(List<WlyySurveyTemplateOptionVO> templateOptionVOs) {
        this.templateOptionVOs = templateOptionVOs;
    public void setOptionVOs(List<WlyySurveyTemplateOptionVO> optionVOs) {
        this.optionVOs = optionVOs;
    }
}

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

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

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

@ -0,0 +1,145 @@
package com.yihu.jw.restmodel.hospital.survey;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2019/9/17.
 */
@ApiModel(value = "WlyySurveyUserVO", description = "问卷调查")
public class WlyySurveyUserVO extends UuidIdentityVO {
    @ApiModelProperty(value = "问卷模板编码", example = "模块1")
    private String surveyTempCode;//问卷模板编码',
    @ApiModelProperty(value = "模板标题", example = "模块1")
    private String surveyTempTitle;//模板标题
    @ApiModelProperty(value = "患者ID", example = "模块1")
    private String patient;//患者ID',
    @ApiModelProperty(value = "患者", example = "模块1")
    private String patientName;//
    @ApiModelProperty(value = "部门", example = "模块1")
    private String dept;//部门
    @ApiModelProperty(value = "部门名称", example = "模块1")
    private String deptName;//部门名称
    @ApiModelProperty(value = "医生", example = "模块1")
    private String doctor;  //医生
    @ApiModelProperty(value = "医生名称", example = "模块1")
    private String doctorName;//医生名称
    @ApiModelProperty(value = "是否已答", example = "模块1")
    private Integer status;//是否已答(0未答 1已答 2放弃)',
    @ApiModelProperty(value = "完成时间", example = "模块1")
    private Date endTime;//完成时间(放弃时间)',
    @ApiModelProperty(value = "调查时间", example = "模块1")
    private Date createTime;//调查时间(居民接受时间)',
    @ApiModelProperty(value = "身份证", example = "模块1")
    private String idcard;
    @ApiModelProperty(value = "年龄", example = "模块1")
    private Integer age;
    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 String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
}

+ 29 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/PercentageUtil.java

@ -0,0 +1,29 @@
package com.yihu.jw.util.common;
import java.math.BigDecimal;
/**
 * Created by Trick on 2019/9/17.
 */
public class PercentageUtil {
    /**
     * 求百分比
     * @param a
     * @param b
     * @return
     */
    public static double bs(int a, int b) {
        if(b==0||a==0){
            return 0;
        }
        return ((new BigDecimal((float) a / b).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue()) * 100);
    }
//    public static void main(String[] args) {
//        double v = bs(0,545);
//        String str = v+"%";
//        System.out.println(str);
//    }
}

+ 8 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -335,6 +335,14 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return success(obj);
    }
    @GetMapping(value = "/MS02014")
    @ApiOperation(value = "医生详细信息同步")
    public ObjEnvelop MS02014() throws Exception {
        int obj = entranceService.MS02014(demoFlag);
        System.out.println("共同步"+obj+"位医生!");
        return success(obj);
    }
    @GetMapping(value = "/ehospitalNotice")
    @ApiOperation(value = "互联网医院通知")
    public ObjEnvelop ehospitalNotice(

+ 6 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java

@ -2,7 +2,11 @@ package com.yihu.jw.hospital.dao.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
 * 健康文章DAO
@ -10,4 +14,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleDao extends PagingAndSortingRepository<KnowledgeArticleDO, String>, JpaSpecificationExecutor<KnowledgeArticleDO> {
	@Query("select a from KnowledgeArticleDO a where a.del=1 and category = :category")
	List<KnowledgeArticleDO> findByCategory(@Param("category") String category);
}

+ 19 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDeptDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.hospital.dao.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 健康文章部门关系DAO
 * @author huangwenjie
 * @date 2019/9/18 10:03
 */
public interface KnowledgeArticleDeptDao extends PagingAndSortingRepository<KnowledgeArticleDeptDO, String>, JpaSpecificationExecutor<KnowledgeArticleDeptDO> {
	
	List<KnowledgeArticleDeptDO> findByArticleId(String articleId);
	
	List<KnowledgeArticleDeptDO> findByDept(String dept);
}

+ 18 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeCategoryDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.hospital.dao.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
/**
 * 健康文章分类
 * @author huangwenjie
 */
public interface KnowledgeCategoryDao extends PagingAndSortingRepository<KnowledgeCategoryDO, String>, JpaSpecificationExecutor<KnowledgeCategoryDO> {
	@Query("update KnowledgeCategoryDO c set c.del = 0 where c.id = :id")
	@Modifying
	void updateDel(@Param("id") String id);
}

+ 102 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java

@ -1,9 +1,13 @@
package com.yihu.jw.hospital.endpoint.article;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
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;
@ -26,9 +30,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private KnowledgeArticleService  knowledgeArticleService;
	
	@Autowired
	private KnowledgeCategoryService knowledgeCategoryService;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
	public ListEnvelop searchKnowledgePageList(
	public Envelop searchKnowledgePageList(
//			@ApiParam(name = "category_first", value = "1级分类编码")
//			@RequestParam(value = "category_first", required = false) String category_first,
//			@ApiParam(name = "category_secend", value = "2级分类编码")
@ -51,7 +58,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		List<KnowledgeArticleDO> result  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
		List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
		List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
		
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
		
		return success(result);
	}
	
@ -81,4 +94,91 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
		knowledgeArticleService.saveArticle(jsonData);
		return success("操作成功");
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
	@ApiOperation(value = "审核/退回文章")
	public Envelop saveArticle(
			@ApiParam(name = "articleId", value = "文章ID")
			@RequestParam(value = "articleId", required = true) String articleId,
			@ApiParam(name = "status", value = "0未审核,1已审核,2退回")
			@RequestParam(value = "status", required = true) Integer status,
			@ApiParam(name = "reason", value = "退回理由")
			@RequestParam(value = "reason", required = false) String reason
	)throws Exception {
		knowledgeArticleService.reviewArticle(articleId,status,reason);
		return success("操作成功");
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchCategoryList)
	@ApiOperation(value = "获取分类列表")
	public ListEnvelop searchCategoryList(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		List<KnowledgeCategoryDO> result  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
		return success(result);
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveCategory)
	@ApiOperation(value = "保存/更新分类")
	public Envelop saveCategory(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		knowledgeCategoryService.saveCategory(jsonData);
		return success("操作成功");
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.updateDel)
	@ApiOperation(value = "根据分类code删除分类")
	public Envelop updateDel(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
		Boolean flag = knowledgeCategoryService.updateDel(id);
		if (!flag) {
			return success("操作成功");
		}else{
			return failed("操作失败");
		}
		
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticleDept)
	@ApiOperation(value = "设置文章发送的科室")
	public ObjEnvelop saveArticleDept(@ApiParam(name = "articleId", value = "文章ID")
	                                 @RequestParam(value = "articleId",required = true)String articleId,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = true)String sdJsons)throws Exception {
		return success(knowledgeArticleService.saveArticleDept(articleId,sdJsons));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findDeptByArticle)
	@ApiOperation(value = "查询文章下的科室")
	public ListEnvelop findDeptByArticle(@ApiParam(name = "articleId", value = "文章ID")
	                                    @RequestParam(value = "articleId",required = true)String articleId)throws Exception {
		return success(knowledgeArticleService.findDeptByArticle(articleId));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByDept)
	@ApiOperation(value = "查询部门下发放的文章")
	public ListEnvelop findArticleByDept(@ApiParam(name = "dept", value = "科室")
	                                    @RequestParam(value = "dept",required = true)String dept)throws Exception {
		return success(knowledgeArticleService.findArticleByDept(dept));
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveDeptArticle)
	@ApiOperation(value = "设置科室发送的文章")
	public ObjEnvelop saveDeptArticle(@ApiParam(name = "dept", value = "部门code")
	                                 @RequestParam(value = "dept",required = true)String dept,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
		return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
	}
}

+ 28 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -244,14 +244,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "when", value = "发病时间")
			@RequestParam(value = "when",required = true) String when,
			@RequestParam(value = "when",required = false) String when,
			@ApiParam(name = "symptoms", value = "主述")
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "images", value = "图片")
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:1专家咨询")
			@ApiParam(name = "type", value = "咨询类型:1专家咨询 14导诊助手")
			@RequestParam(value = "type",required = false) Integer type)throws Exception{
		
		System.out.println("symptoms="+symptoms);
@ -264,7 +264,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//		}
		
		ConsultTeamDo consult = new ConsultTeamDo();
		// 设置咨询类型:9:在线复诊  13专家咨询
		// 设置咨询类型:1专家咨询  14导诊助手
		consult.setType(type);
		// 设置发病时间
		consult.setWhen(when);
@ -279,7 +279,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//		int res = 0;
//		JSONArray dts = null;
		synchronized (patient.intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
			JSONObject re = imService.addTeamConsult(consult, patient,doctor);
			JSONObject re = null;
			re = imService.addTeamConsult(consult, patient,doctor);
//			res = re.getInteger("status");
//			dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
		}
@ -416,6 +417,29 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			throw new Exception(e.getMessage());
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getPatientGuaidenceConsult)
	@ApiOperation(value = "导诊的咨询对话", notes = "导诊的咨询对话")
	public Envelop getPatientGuaidenceConsult(@ApiParam(name = "patientCode", value = "居民CODE")
	                       @RequestParam(value = "patientCode", required = true)String patientCode) throws Exception {
		String session_id = patientCode+"_guidance_14";
		session_id = imService.getPatientGuaidenceConsult(patientCode,session_id);
		return success(session_id);
	}
	
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.updateConsultParticipant)
	@ApiOperation(value = "更新会话成员(新增或删除)", notes = "更新会话成员(新增或删除)")
	public Envelop updateConsultParticipant(@ApiParam(name = "sessionid", value = "会话ID", defaultValue = "1")
	                                       @RequestParam(value = "sessionid", required = true) String sessionid,
	                                       @ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
	                                       @RequestParam(value = "userid", required = true) String userid,
	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
	                                       @RequestParam(value = "olduserid", required = false) String olduserid)throws Exception{
		imService.updateParticipant(sessionid,userid,olduserid);
		return success("操作成功");
	}
	
}

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

@ -2,7 +2,6 @@ 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;
@ -117,9 +116,96 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.delSurveyTemplate)
    @ApiOperation(value = "模板-批量删除")
    @ApiOperation(value = "模板-删除模板")
    public ObjEnvelop delSurveyTemplate(@ApiParam(name = "tempId", value = "模板实体json")
                                        @RequestParam(value = "tempId",required = true)String tempId) throws Exception {
        return success(surveyService.delSurveyTemplate(tempId));
    }
    //=================调查问卷居民查询\答题
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyDept)
    @ApiOperation(value = "模板-设置模板发送的科室")
    public ObjEnvelop saveSurveyDept(@ApiParam(name = "tempId", value = "模板ID")
                                     @RequestParam(value = "tempId",required = true)String tempId,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveSurveyDept(tempId,sdJsons));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveDeptSurvey)
    @ApiOperation(value = "模板-设置科室发送的模板")
    public ObjEnvelop saveDeptSurvey(@ApiParam(name = "dept", value = "部门code")
                                     @RequestParam(value = "dept",required = true)String dept,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveDeptSurvey(dept,sdJsons));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyByDept)
    @ApiOperation(value = "模板-查询部门下发放的问卷")
    public ListEnvelop findSurveyByDept(@ApiParam(name = "dept", value = "科室")
                                        @RequestParam(value = "dept",required = true)String dept)throws Exception {
        return success(surveyService.findSurveyByDept(dept));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findDeptBySurvey)
    @ApiOperation(value = "模板-查询模板下的科室")
    public ListEnvelop findDeptBySurvey(@ApiParam(name = "tempId", value = "模板ID")
                                        @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findDeptBySurvey(tempId));
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyAnswer)
    @ApiOperation(value = "模板-保存问卷答案")
    public ObjEnvelop saveSurveyAnswer(@ApiParam(name = "suJson", value = "发送状态json")
                                     @RequestParam(value = "suJson",required = true)String suJson,
                                     @ApiParam(name = "suaJsons", value = "答案集合json")
                                     @RequestParam(value = "suaJsons",required = true)String suaJsons)throws Exception {
        return success(surveyService.saveSurveyAnswer(suJson, suaJsons));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerBySurveyTempCode)
    @ApiOperation(value = "模板-查询用户问卷答案")
    public ListEnvelop findAnswerBySurveyTempCode(@ApiParam(name = "patient", value = "居民ID")
                                                  @RequestParam(value = "patient",required = true)String patient,
                                                  @ApiParam(name = "tempId", value = "模板id")
                                                  @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findAnswerBySurveyTempCode(patient,tempId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplateResult)
    @ApiOperation(value = "统计-查询问题情况")
    public ObjEnvelop findSurveyTemplateResult(@ApiParam(name = "tempId", value = "模板ID")
                                                @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findSurveyTemplateResult(tempId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findQuestionInfoList)
    @ApiOperation(value = "统计-查询问题情况")
    public MixEnvelop findQuestionInfoList(@ApiParam(name = "comment", value = "选项备注")
                                           @RequestParam(value = "comment",required = false) String comment,
                                           @ApiParam(name = "content", value = "选项内容,问答题内容")
                                           @RequestParam(value = "content",required = false)String content,
                                           @ApiParam(name = "tempQuestionCode", value = "问题code")
                                           @RequestParam(value = "tempQuestionCode",required = false)String tempQuestionCode,
                                           @ApiParam(name = "tempOptionCode", value = "选项code")
                                           @RequestParam(value = "tempOptionCode",required = false)String tempOptionCode,
                                           @ApiParam(name = "page", value = "第几页,1开始")
                                           @RequestParam(value = "page",required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findQuestionInfoList(comment,content,tempQuestionCode,tempOptionCode,page, size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerList)
    @ApiOperation(value = "统计-综合查询问题答案")
    public MixEnvelop findAnswerList(@ApiParam(name = "title", value = "标题")
                                     @RequestParam(value = "title",required = false) String title,
                                     @ApiParam(name = "page", value = "第几页,1开始")
                                     @RequestParam(value = "page",required = true)Integer page,
                                     @ApiParam(name = "size", value = "每页大小")
                                     @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findAnswerList(title,page,size);
    }
    //=================
}

+ 111 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java

@ -1,7 +1,10 @@
package com.yihu.jw.hospital.service.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyDeptDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDeptDao;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
@ -9,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
@ -22,6 +27,9 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	@Autowired
	private KnowledgeArticleDao knowledgeArticleDao;
	
	@Autowired
	private KnowledgeArticleDeptDao knowledgeArticleDeptDao;
	
	/**
	 * 删除,支持批量
	 * @param id
@ -63,4 +71,107 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
			return  one;
		}
	}
	
	//审核/退回文章
	public KnowledgeArticleDO reviewArticle(String articleId,Integer status,String reason) throws Exception{
		
		KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleDao.findOne(articleId);
		if (null == knowledgeArticleDO) {
			throw new Exception("该文章不存在");
		} else {
			knowledgeArticleDO.setStatus(status);
			knowledgeArticleDO.setUpdateTime(new Date());
			if(StringUtils.isNotBlank(reason)){
				knowledgeArticleDO.setCancelReason(reason);
			}
			knowledgeArticleDao.save(knowledgeArticleDO);
			return  knowledgeArticleDO;
		}
	}
	
	/**
	 * 保存文章科室关系
	 * @param articleId
	 * @param sdJsons
	 * @return
	 * @throws Exception
	 */
	public Boolean saveArticleDept(String articleId,String sdJsons)throws Exception{
		
		//删除之前关系
		List<KnowledgeArticleDeptDO> list = knowledgeArticleDeptDao.findByArticleId(articleId);
		if(list!=null&&list.size()>0){
			knowledgeArticleDeptDao.delete(list);
		}
		
		if(org.apache.commons.lang3.StringUtils.isNotBlank(sdJsons)){
			List<KnowledgeArticleDeptDO> _list = EntityUtils.jsonToList(sdJsons,KnowledgeArticleDeptDO.class);
			if(_list!=null&&_list.size()>0){
				knowledgeArticleDeptDao.save(_list);
			}
		}
		return true;
	}
	
	/**
	 * 查询文章下科室
	 * @param articleId
	 * @return
	 */
	public List<Map<String,Object>> findDeptByArticle(String articleId)throws Exception{
		String sql ="SELECT " +
				" d.article_id AS articleId," +
				" d.dept, " +
				" d.dept_name AS deptName " +
				" FROM " +
				" wlyy_knowledge_article t " +
				" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
				" WHERE " +
				" t.id = '"+articleId+"'";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		return list;
	}
	
	/**
	 * 查询部门下的文章
	 * @param dept
	 * @return
	 */
	public List<Map<String,Object>> findArticleByDept(String dept)throws Exception{
		String sql = "SELECT " +
				" t.id, " +
				" t.title, " +
				" t.create_time AS create_time ," +
				" t.image AS image " +
				" FROM " +
				" wlyy_knowledge_article t " +
				" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
				" WHERE " +
				" d.dept = '"+dept+"'";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		return list;
	}
	
	/**
	 * 设置部门发送文章
	 * @param dept
	 * @param sdJsons
	 * @return
	 */
	public Boolean saveDeptArticle(String dept, String sdJsons) throws Exception{
		
		//删除之前关系
		List<KnowledgeArticleDeptDO> dels = knowledgeArticleDeptDao.findByDept(dept);
		if(dels!=null&&dels.size()>0){
			knowledgeArticleDeptDao.delete(dels);
		}
		
		if(org.apache.commons.lang3.StringUtils.isNotBlank(sdJsons)){
			List<KnowledgeArticleDeptDO> list = EntityUtils.jsonToList(sdJsons,KnowledgeArticleDeptDO.class);
			if(list!=null&&list.size()>0){
				knowledgeArticleDeptDao.save(list);
			}
		}
		return true;
	}
}

+ 59 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java

@ -0,0 +1,59 @@
package com.yihu.jw.hospital.service.consult;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeCategoryDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * 健康文章分类
 * @author huangwenjie
 */
@Service
public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO, KnowledgeCategoryDao> {
	@Autowired
	private KnowledgeCategoryDao knowledgeCategoryDao;
	@Autowired
	private KnowledgeArticleDao articleDao;
	
	@Autowired
	private ObjectMapper objectMapper;
	
	public KnowledgeCategoryDO saveCategory(String jsonData) throws Exception {
		jsonData = URLDecoder.decode(jsonData,"utf-8");
		KnowledgeCategoryDO knowledgeCategoryDO = objectMapper.readValue(jsonData, KnowledgeCategoryDO.class);
		if (null == knowledgeCategoryDO.getPid()) {
			knowledgeCategoryDO.setPid(0l);
		}
		if (null == knowledgeCategoryDO.getId()) {
			// 新增
			knowledgeCategoryDO.setCreateTime(new Date());
			knowledgeCategoryDO.setDel(1);
		} else {
			KnowledgeCategoryDO one = knowledgeCategoryDao.findOne(knowledgeCategoryDO.getId());
			knowledgeCategoryDO.setId(one.getId());
			knowledgeCategoryDO.setDel(one.getDel());
			knowledgeCategoryDO.setUpdateTime(new Date());
		}
		return knowledgeCategoryDao.save(knowledgeCategoryDO);
	}
	
	public Boolean updateDel(String code) {
		List<KnowledgeArticleDO> byCategory = articleDao.findByCategory(code);
		if (null != byCategory && byCategory.size() > 0) {
			return false;
		}
		knowledgeCategoryDao.updateDel(code);
		return true;
	}
}