瀏覽代碼

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

humingfen 5 年之前
父節點
當前提交
44cf2dd250

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -206,7 +206,7 @@ public class FileUploadService {
    
    
    /**
     * 调用健康上传语音文件
     * 调用健康上传语音文件.
     * @param voices_Path
     * @return
     * @throws Exception

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

@ -869,12 +869,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+= " AND h.org_code = '"+orgCode+"'";
        }
        if(StringUtils.isNotBlank(chargeType)){
            sql+=" AND d.charge_type ='"+chargeType+"'";
            if("all".equals(chargeType)){
                //查询全部号源
            }else{
                sql+=" AND d.charge_type ='"+chargeType+"'";
            }
        }else{
            sql+=" AND d.charge_type is not null ";
        }
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND d.outpatient_type like'%"+outpatientType+"%'";
            if("all".equals(outpatientType)){
                //查询全部权限
            }else{
                sql+=" AND d.outpatient_type like'%"+outpatientType+"%'";
            }
        }else{
            sql+=" AND d.outpatient_type is not null ";
        }
@ -896,6 +904,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " AND t.start_time <='"+endDate+"'"+
                    " )";
        }
        logger.info("findDoctorByHospitalAndDept sql:"+sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){

+ 32 - 23
business/es-service/src/main/java/com/yihu/jw/es/es/ElasticFactory.java

@ -19,6 +19,7 @@ import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
 * 中山医院版本
 * Created by chenweida on 2017/6/5.
 */
@ -34,6 +35,8 @@ public class ElasticFactory {
    private String clusterName;
    @Value("${es.securityUser}")
    private String securityUser;
    @Value("${es.pwflag}")
    private String pwflag;
//-----------------------------------jestClient----------------------------------------
    /**
@ -75,7 +78,12 @@ public class ElasticFactory {
    public Client getTransportClient() {
        try {
            initTranClient();
            //1需要加密初始化
            if("1".equals(pwflag)){
                initTranClientPw();
            }else {
                initTranClient();
            }
            return transportClient;
        } catch (Exception e) {
            e.printStackTrace();
@ -85,37 +93,36 @@ public class ElasticFactory {
    /**
     * 9300
     *
     * 互联网医院版本需要密码
     * @throws UnknownHostException
     */
//    private synchronized void initTranClient() throws UnknownHostException {
//        if (transportClient == null) {
//            String[] hosts = tHost.split(",");
//            Settings settings = Settings.settingsBuilder()
//                    // .put("client.transport.sniff", true)//开启嗅探功能
//                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
//                    .build();
//
//            transportClient = TransportClient.builder().settings(settings).build();
//
//            for (String oneHost : hosts) {
//                String[] hostAndport = oneHost.split(":");
//                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
//            }
//        }
//    }
    private synchronized void initTranClientPw() throws Exception {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = getSettings();
            transportClient = TransportClient.builder().addPlugin(ShieldPlugin.class).settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
            }
        }
    }
    /**
     * 9300
     *
     * 厦门I健康版本不需要密码
     * @throws UnknownHostException
     */
    private synchronized void initTranClient() throws Exception {
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = getSettings();
            transportClient = TransportClient.builder().addPlugin(ShieldPlugin.class).settings(settings).build();
            Settings settings = Settings.settingsBuilder()
                    // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();
            transportClient = TransportClient.builder().settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
@ -123,6 +130,7 @@ public class ElasticFactory {
        }
    }
    /**
     * 配置连接
     * @return
@ -136,5 +144,6 @@ public class ElasticFactory {
        settingBuilder.put("transport.address.list", tHost);
        return settingBuilder.build();
    }
}

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

@ -569,6 +569,7 @@ public class ImService {
		String voiceIds = "";
		try {
			String voices = request.getParameter("voices");
			System.out.println("voices"+voices);
			if (org.apache.commons.lang3.StringUtils.isEmpty(voices)) {
				return voices;
			}
@ -602,12 +603,17 @@ public class ImService {
	public String saveVoiceToDisk(String mediaId,String wechat_appid) throws Exception {
		// 文件保存的临时路径
		String tempPath = upload_temp_path + File.separator;
		System.out.println("tempPath:"+tempPath);
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		System.out.println("datePath:"+datePath);
		// 重命名文件
		String fileBase =  DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000);
		System.out.println("fileBase:"+fileBase);
		String newFileName = fileBase+ ".amr";
		String mp3FileName  = fileBase + ".mp3";
		System.out.println("newFileName:"+newFileName);
		System.out.println("mp3FileName:"+mp3FileName);
		// 保存路径
		File uploadFile = new File(tempPath + datePath + newFileName);
		
@ -626,6 +632,8 @@ public class ImService {
			}
			String amrFilePath = tempPath+datePath+newFileName;
			String Mp3FilePath = tempPath+datePath+mp3FileName;
			System.out.println("amrFilePath:"+amrFilePath);
			System.out.println("Mp3FilePath:"+Mp3FilePath);
			fileUtil.changeToMp3(amrFilePath,Mp3FilePath);
			// 返回保存路径
			return Mp3FilePath;

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

@ -3,7 +3,7 @@ package com.yihu.jw.gateway.filter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.yihu.jw.gateway.log.service.BaseMethodLogService;
import com.yihu.jw.gateway.methlog.BaseMethodLogService;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import org.slf4j.Logger;
@ -30,7 +30,7 @@ import java.util.Enumeration;
import java.util.Iterator;
/**
 * Created by progr1mmer on 2017/12/27
 * Created by progr1mmer on 2017/12/27.
 */
@Component
public class BasicZuulFilter extends ZuulFilter {

+ 61 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseMethodLogDO.java

@ -0,0 +1,61 @@
package com.yihu.jw.gateway.methlog;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2020/2/19.
 */
@Entity
@Table(name = "base_method_log")
public class BaseMethodLogDO extends UuidIdentityEntity {
    private String uuid;
    private String name;
    private String ip;
    private String method;
    private Date createTime;
    public String getUuid() {
        return uuid;
    }
    public void setUuid(String uuid) {
        this.uuid = uuid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 10 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseMethodLogDao.java

@ -0,0 +1,10 @@
package com.yihu.jw.gateway.methlog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2020/2/19.
 */
public interface BaseMethodLogDao extends PagingAndSortingRepository<BaseMethodLogDO, String>, JpaSpecificationExecutor<BaseMethodLogDO> {
}

+ 88 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseMethodLogService.java

@ -0,0 +1,88 @@
package com.yihu.jw.gateway.methlog;
import com.yihu.jw.gateway.log.dao.*;
import com.yihu.jw.gateway.log.entity.*;
import com.yihu.jw.gateway.useragent.UserAgent;
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 javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
/**
 * Created by Trick on 2020/2/19.
 */
@Service
@Transactional
public class BaseMethodLogService {
    private static final Logger logger = LoggerFactory.getLogger(com.yihu.jw.gateway.log.service.BaseMethodLogService.class);
    @Autowired
    private com.yihu.jw.gateway.log.dao.BaseMethodLogDao baseMethodLogDao;
    @Autowired
    private UserAgent userAgent;
    /**
     * 存储操作日志
     */
    public void saveMethodLog(HttpServletRequest request){
        try{
            logger.info("saveMethodLog");
            com.yihu.jw.gateway.log.entity.BaseMethodLogDO log = new com.yihu.jw.gateway.log.entity.BaseMethodLogDO();
            log.setUuid(userAgent.getUID());
            log.setName(userAgent.getUNAME());
            log.setIp(getIpAddress(request));
            log.setCreateTime(new Date());
            log.setMethod(request.getRequestURI());
            baseMethodLogDao.save(log);
            logger.info("saveMethodLog success");
        }catch (Exception e){
            logger.info("saveMethodLog error"+e.toString());
        }
    }
    /**
     * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址。
     * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
     * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串
     * @param request
     * @return
     */
    private String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
            if("127.0.0.1".equals(ip)||"0:0:0:0:0:0:0:1".equals(ip)){
                //根据网卡取本机配置的IP
                InetAddress inet=null;
                try {
                    inet = InetAddress.getLocalHost();
                } catch (UnknownHostException e) {
                    e.printStackTrace();
                }
                ip= inet.getHostAddress();
            }
        }
        return ip;
    }
}

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

@ -496,7 +496,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			String noncestr = UUID.randomUUID().toString();
			long timestamp = System.currentTimeMillis() / 1000;
			String url = pageUrl;
			logger.info("getSign.url="+url);
			String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
			logger.info("getSign.str="+str);
			// sha1加密
			String signature = SHA1(str);
			map.put("noncestr", noncestr);

+ 8 - 0
svr/svr-internet-hospital/src/main/resources/application.yml

@ -133,6 +133,7 @@ im:
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -196,6 +197,7 @@ im:
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -266,6 +268,7 @@ im:
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
@ -349,6 +352,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -422,6 +426,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -493,6 +498,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -562,6 +568,7 @@ FileTempPath:
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
@ -637,6 +644,7 @@ testPattern:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
es:
  pwflag: 0 # 1需要密码,0不需要密码
  index:
    Statistics: hlw_quota_test
  type: