Selaa lähdekoodia

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

liubing 3 vuotta sitten
vanhempi
commit
2bf686ab69

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -145,13 +145,15 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "codeOrName", required = false) String codeOrName,
            @ApiParam(name = "orgStatus", value = "机构状态")
            @RequestParam(value = "orgStatus", required = false) String orgStatus,
            @ApiParam(name = "userId", value = "用户id(过滤测试机构)")
            @RequestParam(value = "userId", required = false) String userId,
            @ApiParam(name = "orgType", value = "机构类型: 1.等级医院 2.社区医院3.养老机构 4.教育机构")
            @RequestParam(value = "orgType", required = false) String orgType,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = baseOrgService.queryOrgBaseInfoList(codeOrName, orgStatus,orgType,page,size,wechatId);
        JSONObject result = baseOrgService.queryOrgBaseInfoList(codeOrName, orgStatus,orgType,page,size,wechatId,userId);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }

+ 31 - 38
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -11,12 +11,13 @@ import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
@ -25,12 +26,12 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import sun.misc.Unsafe;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
/**
@ -76,6 +77,8 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseOrgUserDao  baseOrgUserDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Value("${wechat.flag}")
    private boolean flag;
@ -86,43 +89,27 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @param orgStatus
     * @return
     */
    public JSONObject queryOrgBaseInfoList(String codeOrName,String orgStatus,String orgType,int page,int size,String wechatId) throws Exception {
    public JSONObject queryOrgBaseInfoList(String codeOrName,String orgStatus,String orgType,int page,int size,String wechatId,String userId) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String codeOrNameValue = null == codeOrName ? "" : codeOrName;
//        String sql = "select id as \"id\",code as \"code\",name as \"name\",case del when 1 then '有效' else '失效' end as status as \"del\",concat(province_name,city_name,town_name,address) as \"address\" " +
//                " from base_org " +
//                " where " +
//                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
//                " or " +
//                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
//                " and" +
//                " (del = '{orgStatus}' or ''='{orgStatus}')" +
//                "  order by create_time desc ";
//        String finalSql = sql
//
//                .replace("{code}", "%" + codeOrNameValue + "%")
//                .replace("{name}", "%" + codeOrNameValue + "%")
//                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
//
//        String countSql = "SELECT count(id)" +
//                " FROM base_org " +
//                " WHERE " +
//                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
//                " OR " +
//                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
//                " AND" +
//                " (del = '{orgStatus}' OR ''='{orgStatus}')";
//        String finalCountSql = countSql
//                .replace("{code}", "%" + codeOrNameValue + "%")
//                .replace("{name}", "%" + codeOrNameValue + "%")
//                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
//        Logger.getAnonymousLogger().info("finalSql="+finalSql);
//        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(finalSql,page,size);
//        Logger.getAnonymousLogger().info("finalCountSql="+finalCountSql);
        String filters = "";
        if(!StringUtil.isBlank(userId)){
           //判断当前用户是否不需要过滤测试机构
            List<WlyyHospitalSysDictDO>  dictDOs = hospitalSysDictDao.findByDictNameAndDictCode("jkzl_user",userId);
            if(dictDOs.size()==0){
                //需要过滤
                String sql = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
                List<Map<String,Object>> list =  jdbcTemplate.queryForList(sql);
                if(list.size()>0){
                    String orgCodes = String.valueOf(list.get(0).get("orgCodes"));
                    orgCodes = orgCodes.replaceAll(",","','");
                    filters = " and code not in ('"+orgCodes+"')";
                }
            }
        }
        String codeOrNameValue = null == codeOrName ? "" : codeOrName;
                String sql = "SELECT\n" +
                        "\tID AS \"id\",\n" +
                        "\tcode AS \"code\",\n" +
@ -154,6 +141,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
                if (!StringUtil.isBlank(orgType)){
                    sql+=" and type = '"+orgType+"'";
                }
                if(!StringUtil.isBlank(filters)){
                    sql+= filters;
                }
                sql+="  ORDER BY\n" +
                        "\tcreate_time DESC";
                String finalSql = sql;
@ -200,6 +190,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        if (!StringUtil.isBlank(orgStatus)){
            countSql+=" and del = '"+orgStatus+"'";
        }
        if(!StringUtil.isBlank(filters)){
            countSql+= filters;
        }
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        Integer count = jdbcTemplate.queryForObject(countSql, Integer.class);
        result.put("count", count);

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -78,7 +78,7 @@ public class ConsultService {
    public Map<String,Object> findLastOnlineConsult(String patient,String orgCode){
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT " +
                " b.consult, " +
                " b.consult,b.doctor, " +
                " b.type,b.status " +
                "FROM " +
                " wlyy_consult_team b, " +
@ -92,6 +92,8 @@ public class ConsultService {
        if(list.size()>0){
            map = list.get(0);
            map.put("sessionId",String.valueOf(map.get("consult"))+"_"+patient+"_23");
            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor")));
            map.put("doctorName",doctorDO.getName());
        }
        return map;
    }