Browse Source

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

wangzhinan 4 năm trước cách đây
mục cha
commit
91f1224ca2

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

@ -14,6 +14,7 @@ import com.yihu.jw.util.common.PercentageUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,6 +23,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
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;
@ -60,6 +62,8 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
    private SurveyUserDao surveyUserDao;
    @Autowired
    private SurveyUserAnswerDao surveyUserAnswerDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 查询字典
     * 1.surveyLabel;2.surveyScreenLabel
@ -305,6 +309,39 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(list!=null&&list.size()>0){
            //设置标签
            for(WlyySurveyTemplateVO templateVO : list){
                String templateCode = templateVO.getId();
                String sqlUsed = "select t.used as \"used\" from wlyy_knowledge_article_user t where t.relation_code = '"+templateCode +"'";
                if(StringUtils.isNotEmpty(creater)){
                    sqlUsed += " and t.user_code = '"+creater+"'";
                }
                List<Map<String,Object>> listUsed = hibenateUtils.createSQLQuery(sqlUsed);
                for (Map<String,Object> map:listUsed){
                    Integer in = null;
                    if (listUsed.size()>0){
                        if (null!=listUsed.get(0)){
                            Object object = map.get("used");
                            if(object!=null){
                                if(object instanceof Integer){
                                    in = (Integer)object;
                                }else if(object instanceof String){
                                    in = Integer.parseInt((String)object);
                                }else if(object instanceof Double){
                                    in = (int)((double)object);
                                }else if(object instanceof Float){
                                    in = (int)((float)object);
                                }else if(object instanceof BigDecimal){
                                    in = ((BigDecimal)object).intValue();
                                }else if(object instanceof Long){
                                    in = ((Long)object).intValue();
                                }
                            }
                        }
                        templateVO.setUsed(in);
                    }
                }
                templateVO.setLabels(findSurveyTemplateLabel(templateVO.getId()));
            }
        }

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

@ -39,7 +39,16 @@ public class WlyySurveyTemplateVO extends UuidIdentityVO {
    private List<WlyySurveyTemplateQuestionVO> templateQuestionVOs;
    @ApiModelProperty(value = "有效作答人数", example = "模块1")
    private Integer answerCount;//修改时间',
    @ApiModelProperty(value = "是否常用", example = "模块1")
    private Integer used;//是否常用1常用0不常用,
    public Integer getUsed() {
        return used;
    }
    public void setUsed(Integer used) {
        this.used = used;
    }
    public String getTitle() {
        return title;

+ 7 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictJobTitleEndpoint.java

@ -1,6 +1,8 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.dict.DictJobTitleService;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.restmodel.base.dict.DictJobTitleVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -36,6 +38,8 @@ public class DictJobTitleEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DictJobTitleService dictJobTitleService;
    @Autowired
    private DictDoctorDutyService dictDoctorDutyService;
    @PostMapping(value = BaseRequestMapping.DictJobTitle.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
@ -89,15 +93,15 @@ public class DictJobTitleEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.DictJobTitle.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<DictJobTitleVO> list(
    public ListEnvelop<DictDoctorDutyDO> list(
            @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) throws Exception {
        List<DictJobTitleDO> dictJobTitles = dictJobTitleService.search(fields, filters, sorts);
        return success(dictJobTitles, DictJobTitleVO.class);
        List<DictDoctorDutyDO> dictJobTitles = dictDoctorDutyService.search(fields, filters, sorts);
        return success(dictJobTitles, DictDoctorDutyDO.class);
    }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -207,7 +207,7 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "根据区域获取机构列表")
    public Envelop getOrgListByTown(
            @ApiParam(name = "doctorCode", value = "townCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @RequestParam(value = "doctorCode", required = false    ) String doctorCode,
            @ApiParam(name = "townCode", value = "townCode")
            @RequestParam(value = "townCode", required = true) String townCode) throws Exception {
        JSONObject jsonObject = baseDoctorService.getOrgListByTownAndDoctorCode(doctorCode,townCode);

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java

@ -43,6 +43,7 @@ public class BaseDoctorRoleInfoEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorRoleDictService baseDoctorRoleDictService;
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.CREATE)
    @ApiOperation(value = "创建")
    public Envelop create(

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

@ -235,7 +235,7 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.getSurveyList)
    @ApiOperation(value = "查询问卷模板")
    public Envelop getUsedList(@ApiParam(name = "title", value = "模板名称")
    public MixEnvelop getUsedList(@ApiParam(name = "title", value = "模板名称")
                                     @RequestParam(value = "title",required = false) String title,
                               @ApiParam(name = "doctor", value = "医生id")
                                     @RequestParam(value = "doctor",required = false) String doctor,
@ -245,7 +245,7 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "page",required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页大小",defaultValue = "10")
                                     @RequestParam(value = "pageSize",required = true,defaultValue = "10")Integer pageSize)throws Exception {
        return success(businessService.getUsedList(title,doctor,used,page,pageSize));
        return businessService.getUsedList(title,doctor,used,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.setUsed)

+ 69 - 16
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java

@ -10,8 +10,11 @@ import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
import com.yihu.jw.hospital.survey.service.SurveyService;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.survey.WlyySurveyLabelInfoVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
@ -44,6 +47,8 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
	private SurveyTemplateDao surveyTemplateDao;
	@Autowired
	private HibenateUtils hibenateUtils;
	@Autowired
	private SurveyService surveyService;
	/**
	 *
	 * @param id
@ -205,47 +210,78 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
		knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		surveyTemplateDao.save(wlyySurveyTemplateDO);
	}
	public List<Map<String,Object>> getUsedList(String title,String doctor,Integer used,Integer page,Integer pageSize) {
	public MixEnvelop getUsedList(String title, String doctor, Integer used, Integer page, Integer pageSize) {
		StringBuffer sql = new StringBuffer();
		sql.append("select a.id AS \"id\" ,a.title AS \"title\",a.template_comment AS \"template_comment\" ," +
				" a.organization AS \"organization\",a.create_time AS \"create_time\" ," +
				"a.creater AS \"creater\"FROM wlyy_survey_template a ");
		MixEnvelop mixEnvelop = new MixEnvelop();
		sql.append("SELECT " +
				" t.id, " +
				" b.used as \"used\","+
				" t.title, " +
				" t.template_comment AS templateComment, " +
				" t.organization, " +
				" t.creater, " +
				" t.create_time AS createTime, " +
				" t.del, " +
				" t.update_time AS updateTime" +
				" FROM " +
				" wlyy_survey_template t ");
		//1为查询常用
		if (null != used) {
			if (1 == used) {
				sql.append("JOIN wlyy_knowledge_article_user b on a.id = b.relation_code " +
						"where 1=1");
				sql.append("JOIN wlyy_knowledge_article_user b on t.id = b.relation_code ");
				sql.append("JOIN wlyy_survey_label_info i ON t.id = i.survey_temp_code where 1=1");
				sql.append(" and b.used = 1");
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.title like '%" + title + "%'");
					sql.append(" and t.title like '%" + title + "%'");
				}
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.creater = '" + doctor + "'");
					sql.append(" and t.creater = '" + doctor + "'");
				}
				String sqlCount = "select Count(1) as \"total\" from ("+sql+") l";
				List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
				List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount);
				Long count = 0L;
				if (listCount.size()>0){
					count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
				}
				if (list.size() > 0) {
					for (Map<String, Object> map : list) {
						List<WlyySurveyLabelInfoVO>  wlyySurveyLabelInfoVOS= surveyService.findSurveyTemplateLabel(null==map.get("id")?"":map.get("id").toString());
						String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
						String creater = null == map.get("creater") ? "" : map.get("creater").toString();
						map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
						map.put("labels",wlyySurveyLabelInfoVOS);
						BaseDoctorDO doctorDO = doctorDao.findById(creater);
						if (null!=doctor){
							map.put("doctrName", doctorDO.getName());
						}
					}
				}
				return list;
				mixEnvelop.setPageSize(pageSize);
				mixEnvelop.setCurrPage(page);
				mixEnvelop.setTotalCount(count.intValue());
				mixEnvelop.setDetailModelList(list);
				return mixEnvelop;
				//0为查询模板
			} else {
				sql.append("where a.del = 1");
				sql.append("JOIN wlyy_survey_label_info i ON t.id = i.survey_temp_code where 1=1");
				sql.append(" and t.del = 1");
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.title like '%" + title + "%'");
					sql.append(" and t.title like '%" + title + "%'");
				}
				String sqlCount = "select Count(1) as \"total\" from ("+sql+") l";
				List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
				List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount);
				Long count = 0L;
				if (listCount.size()>0){
					count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
				}
				if (list.size() > 0) {
					for (Map<String, Object> map : list) {
						List<WlyySurveyLabelInfoVO>  wlyySurveyLabelInfoVOS= surveyService.findSurveyTemplateLabel(null==map.get("id")?"":map.get("id").toString());
						map.put("labels",wlyySurveyLabelInfoVOS);
						String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
						String creater = null == map.get("creater") ? "" : map.get("creater").toString();
						map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
@ -255,20 +291,33 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
						}
					}
				}
				return list;
				mixEnvelop.setPageSize(pageSize);
				mixEnvelop.setCurrPage(page);
				mixEnvelop.setTotalCount(count.intValue());
				mixEnvelop.setDetailModelList(list);
				return mixEnvelop;
			}
			//空位查我的问卷
		} else {
			sql.append("where a.del = 1");
			sql.append("JOIN wlyy_survey_label_info i ON t.id = i.survey_temp_code where 1=1");
			sql.append(" and t.del = 1");
			if (StringUtils.isNotEmpty(doctor)) {
				sql.append(" and a.creater = '" + doctor + "'");
				sql.append(" and t.creater = '" + doctor + "'");
			}
			if (StringUtils.isNotEmpty(doctor)) {
				sql.append(" and a.title like '%" + title + "%'");
				sql.append(" and t.title like '%" + title + "%'");
			}
			String sqlCount = "select Count(1) as \"total\" from ("+sql+") l";
			List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
			List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount);
			Long count = 0L;
			if (listCount.size()>0){
				count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
			}
			if (list.size() > 0) {
				for (Map<String, Object> map : list) {
					List<WlyySurveyLabelInfoVO>  wlyySurveyLabelInfoVOS= surveyService.findSurveyTemplateLabel(null==map.get("id")?"":map.get("id").toString());
					map.put("labels",wlyySurveyLabelInfoVOS);
					String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
					String creater = null == map.get("creater") ? "" : map.get("creater").toString();
					map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
@ -279,7 +328,11 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
				}
			}
			return list;
			mixEnvelop.setPageSize(pageSize);
			mixEnvelop.setCurrPage(page);
			mixEnvelop.setTotalCount(count.intValue());
			mixEnvelop.setDetailModelList(list);
			return mixEnvelop;
		}
	}
}

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

@ -9,11 +9,13 @@ import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyUserDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDeptDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
@ -53,6 +55,8 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	private ImUtil imUtil;
	@Autowired
	private SurveyUserDao surveyUserDao;
	@Autowired
	private SurveyTemplateDao surveyTemplateDao;
	
	/**
	 * 删除,支持批量
@ -251,7 +255,15 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
					wlyySurveyUserDO.setSurveyTempCode(patientBusinessDO.getRelationCode());
					wlyySurveyUserDO.setSurveyTempTitle(patientBusinessDO.getRelationName());
					wlyySurveyUserDO.setCreateTime(new Date());
					surveyUserDao.save(wlyySurveyUserDO);
					wlyySurveyUserDO = surveyUserDao.save(wlyySurveyUserDO);
					JSONObject object = new JSONObject();
					WlyySurveyTemplateDO wlyySurveyTemplateDO = surveyTemplateDao.findOne(wlyySurveyUserDO.getSurveyTempCode());
					if (null!=wlyySurveyTemplateDO){
						object.put("title",wlyySurveyTemplateDO.getTitle());
						object.put("content",wlyySurveyTemplateDO.getTemplateComment());
						object.put("id",wlyySurveyTemplateDO.getId());
					}
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "17", object.toJSONString(),"1");
				}
			}