LAPTOP-KB9HII50\70708 9 hónapja
szülő
commit
1c92c62ee9

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/label/WlyyPatientLabelDao.java

@ -26,4 +26,7 @@ public interface WlyyPatientLabelDao extends JpaRepository<WlyyPatientLabelDO, S
    @Query("from WlyyPatientLabelDO w where  w.patient=?1 and w.labelCode=?2 and w.labelType=?3 ")
    List<WlyyPatientLabelDO> findByPatient(String patient, String labelCode, String labelType);
    @Query("from WlyyPatientLabelDO w where w.labelType='4' and w.labelName=?1 ")
    List<WlyyPatientLabelDO> findByPatientLablelName(String labelName);
}

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/sign/dao/WlyySignDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.sign.dao;
import com.yihu.jw.entity.door.WlyySign;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
 * Created by yeshijie on 2024/7/16.
 */
public interface WlyySignDao extends JpaRepository<WlyySign, Long>, JpaSpecificationExecutor<WlyySign> {
}

+ 79 - 0
business/base-service/src/main/java/com/yihu/jw/utils/RequestParamUtil.java

@ -0,0 +1,79 @@
package com.yihu.jw.utils;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * Created by Bing on 2021/10/15.
 */
public class RequestParamUtil {
    public static String getParam(HttpServletRequest request){
        String result = null;
        try {
            String method= request.getMethod();
            if ("GET".equals(method)){
                result = "?"+request.getQueryString();
            }else if ("POST".equals(method)){
                String paramEnd = "";
                Map<String, String[]> parameterMap =  request.getParameterMap();
                for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
                    String k = entry.getKey();
                    String[] v = entry.getValue();
                    List<String> paramList = Arrays.asList(v.clone());
                    String paramStr = paramList.stream().map(String::valueOf).collect(Collectors.joining(","));
                    if (StringUtils.isNotBlank(paramStr)){
                        paramEnd += k+"="+paramStr+"&";
                    }
                }
                if (StringUtils.isNotBlank(paramEnd)){
                    paramEnd = paramEnd.substring(0,paramEnd.length()-1);
                    result = "?"+paramEnd;
                }
            }
            return result;
        }catch (Exception e){
            e.printStackTrace();
            return result;
        }
    }
    public static String getParamUrl(HttpServletRequest request){
        String result = null;
        try {
            String url =  request.getRequestURI();
            if(StringUtils.isNotBlank(url)&&url.contains("/")){
                url = url.substring(url.lastIndexOf("/"));
            }
            String method= request.getMethod();
            if ("GET".equals(method)){
                result = url+"?"+request.getQueryString();
            }else if ("POST".equals(method)){
                String paramEnd = "";
                Map<String, String[]> parameterMap =  request.getParameterMap();
                for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
                    String k = entry.getKey();
                    String[] v = entry.getValue();
                    List<String> paramList = Arrays.asList(v.clone());
                    String paramStr = paramList.stream().map(String::valueOf).collect(Collectors.joining(","));
                    if (StringUtils.isNotBlank(paramStr)){
                        paramEnd += k+"="+paramStr+"&";
                    }
                }
                if (StringUtils.isNotBlank(paramEnd)){
                   paramEnd = paramEnd.substring(0,paramEnd.length()-1);
                   result = url+"?"+paramEnd;
                }
            }
            return result;
        }catch (Exception e){
            e.printStackTrace();
            return result;
        }
    }
}

+ 10 - 0
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -30,6 +30,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RequestParamUtil;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -40,6 +41,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
@ -773,6 +775,14 @@ public class WlyyBusinessService {
        return re;
    }
    //通用请求接口
    public JSONObject commonGet(HttpServletRequest request,String api){
        String configId = "commonGet";
        String param = RequestParamUtil.getParam(request);
        JSONObject re = wlyyHttpService.sendWlyyMesGet(configId, api+param);
        return re;
    }
    //获取团队列表
    public JSONObject getAdminTeamList(String teamName, String town, String teamId, String leadName, Integer page, Integer pageSize, String hospital, String doctorName, String mobile) {
        String param = "?teamName=" + nullToTransfor(teamName) + "&leadName=" + nullToTransfor(leadName) + "&teamId=" + nullToTransfor(teamId)

+ 79 - 6
business/base-service/src/main/java/com/yihu/jw/wlyy/wlyyhttp/WlyyHttpService.java

@ -3,22 +3,31 @@ package com.yihu.jw.wlyy.wlyyhttp;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.third.wlyyinfo.OauthWlyyConfigDO;
import com.yihu.jw.exception.business.file_upload.FileWrongFormatException;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.wlyy.dao.OauthWlyyConfigDao;
import org.apache.commons.collections.map.HashedMap;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.*;
/**
 * Created by Trick on 2019/8/19.
@ -96,6 +105,72 @@ public class WlyyHttpService {
        }
        return null;
    }
    //上传图片
    public String request(MultipartFile file, String type,String configId) {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        try {
            OauthWlyyConfigDO oauthWlyyConfigDO = oauthWlyyConfigDao.findById(configId).orElse(null);
            //token获取accesstoken
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("appid", oauthWlyyConfigDO.getAppId()));
            params.add(new BasicNameValuePair("appSecret", oauthWlyyConfigDO.getAppSecret()));
            String res = httpClientUtil.post(oauthWlyyConfigDO.getTokenUrl(), params, "UTF-8");
            String token = null;
            JSONObject rsjson = JSONObject.parseObject(res);
            logger.info("sendWlyyMes token :" + rsjson.toString());
            Integer status = rsjson.getInteger("status");
            if (status == 10000) {
                token = rsjson.getJSONObject("result").getString("accesstoken");
                String fileName = file.getOriginalFilename();
                HttpPost httpPost = new HttpPost(oauthWlyyConfigDO.getUrl());
                MultipartEntityBuilder builder = MultipartEntityBuilder.create();
                httpPost.setHeader("accesstoken",token);
                builder.addBinaryBody("file", file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
                builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
                if (!org.springframework.util.StringUtils.isEmpty(type)) {
                    builder.addTextBody("type", type); //发送类型
                }
                logger.info("type===="+type);
                if (!isFileFlag(type)){
                    throw new FileWrongFormatException("不符合文件上传格式");
                }
                HttpEntity entity = builder.build();
                httpPost.setEntity(entity);
                HttpResponse response = httpClient.execute(httpPost);// 执行提交
                HttpEntity responseEntity = response.getEntity();
                if (responseEntity != null) {
                    // 将响应内容转换为字符串
                    result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
    public boolean isFileFlag(String type){
        type = type.toLowerCase();
        if (type.contains(".")){
            type = type.substring(type.lastIndexOf("."),type.length()-1);
        }
        logger.info(type);
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp3","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr"));
        if (!img.contains(type)) {
            return false;
        }
        return true;
    }
    /**
     * @param configId 配置ID
     * @param param key为param,的参数
@ -115,8 +190,6 @@ public class WlyyHttpService {
            Integer status = rsjson.getInteger("status");
            if (status == 10000) {
                //设置头部
                token = rsjson.getJSONObject("result").getString("accesstoken");
                Map<String,Object> headerMap = new HashedMap();