Browse Source

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

trick9191 5 years ago
parent
commit
defafed7b7

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

@ -1416,10 +1416,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Map<String,Object> result = new HashedMap();
        //调用his开方接口
        net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(),demoFlag);
        //如果无法解析his系统报文,his系统报错
        if(jsonObject==null){
            //记录http日志
            WlyyHttpLogDO log = new WlyyHttpLogDO();
            log.setCode("makeDiagnosis");
            log.setName("下诊断");
            log.setPatient(outpatientDO.getPatient());
            log.setDoctor(outpatientDO.getDoctor());
            log.setResponse("his系统异常,无法解析返回值");
            log.setRequest(jsonData.toJSONString());
            log.setStatus("-99");
            log.setCreateTime(new Date());
            wlyyHttpLogDao.save(log);
            //开方失败
            //更新处方状态
            prescription.setStatus(13);
            prescriptionDao.save(prescription);
            //记录开发失败日志
            prescriptionLogService.addPrescriptionLog(prescription.getId(),13,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date());
            //开方失败返回值
            result.put("code",-1);
            result.put("mes","开方失败,his系统异常");
            return result;
        }
        logger.info("调用his开方接口: "+jsonObject.toString());
        //判断返回结果
        String rs = jsonObject.getString("@RESULT");
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("makeDiagnosis");
@ -1448,11 +1473,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return result;
        }else{
            //开方失败
            prescription.setStatus(13);
            prescriptionDao.save(prescription);
            result.put("code",-1);
            result.put("mes",jsonObject.getString("@MSG"));
            //更新处方状态
            prescription.setStatus(13);
            prescriptionDao.save(prescription);
            //记录开发失败日志
            prescriptionLogService.addPrescriptionLog(prescription.getId(),13,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date());

+ 33 - 9
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DoctorPreSignService.java

@ -5,6 +5,9 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.dzqm.OauthDzqmConfigDO;
import com.yihu.jw.hospital.prescription.dao.OauthDzqmConfigDao;
import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
import com.yihu.jw.utils.dzqm.SignPictureService;
import com.yihu.jw.utils.dzqm.SignPictureServiceImplServiceLocator;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
@ -14,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URL;
import java.util.Map;
@ -39,23 +43,43 @@ public class DoctorPreSignService {
     * @throws Exception
     */
    public JSONObject getDoctorSign(String doctor)throws Exception{
        logger.info("getDoctorSign doctor:"+doctor);
        BaseDoctorDO doc = doctorDao.findOne(doctor);
        //获取配置参数
        OauthDzqmConfigDO dzqmConfigDO = oauthDzqmConfigDao.findOne("base_dzqm");
        SignPictureServiceImplServiceLocator locator = new SignPictureServiceImplServiceLocator();
        URL portAddress = new  URL(dzqmConfigDO.getUrl());
        SignPictureService service = locator.getSignPictureServiceImplPort(portAddress);
        Map<String,Object> params = new HashedMap();
        params.put("sys",dzqmConfigDO.getSys());
        params.put("idNumber",doc.getIdcard());
        params.put("idType",0);
        params.put("picType",0);
        HttpResponse httpResponse = HttpUtils.doGet(dzqmConfigDO.getUrl(),params);
        String rs = service.SOF_GetSignPicture(dzqmConfigDO.getSys(),doc.getIdcard(),"0","0");
        logger.info("getDoctorSign httpResponse:"+httpResponse.getContent());
        logger.info("getDoctorSign SOF_GetSignPicture:"+rs);
        JSONObject jsonObject = (JSONObject)JSONObject.parse(httpResponse.getContent());
        JSONObject jsonObject = (JSONObject)JSONObject.parse(rs);
        return jsonObject;
    }
    /**
     * dome
     * @param args
     */
    public static void main(String[] args) {
        SignPictureServiceImplServiceLocator locator = new SignPictureServiceImplServiceLocator();
        String url = "http://101.132.67.155:8080/PKISignPicture/services/v1?wsdl";
        try {
            URL portAddress = new  URL(url);
            SignPictureService service = locator.getSignPictureServiceImplPort(portAddress);
            String sys = "EMR";
            String idNumber = "123456789123456789";
            String idType = "0";
            String picType = "0";
            String result = service.SOF_GetSignPicture(sys, idNumber, idType, picType);
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java

@ -424,7 +424,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
                " i.`code`, " +
                " i.dept, " +
                " o.doctor, " +
                " o.register_date " +
                " o.register_date, " +
                " i.create_time, " +
                " p.`name`, " +
                " p.idcard, " +

+ 72 - 0
business/base-service/src/main/java/com/yihu/jw/utils/WebserviceUtil.java

@ -0,0 +1,72 @@
package com.yihu.jw.utils;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import java.util.Map;
/**
 * Created by hzp on 2017/7/31.
 * webservice调用服务
 **/
public class WebserviceUtil {
    private static Logger logger = LoggerFactory.getLogger(WebserviceUtil.class);
    /**
     * webservice 调用接口
     */
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
        try {
            logger.info("ca_url:"+urlString);
            logger.info("ca_namespace:"+namespace);
            logger.info("api:"+api);
            Service service = new Service();
            logger.info("=======>通过service创建call对象");
            Call call = (Call) service.createCall();// 通过service创建call对象
            logger.info("=======>设置service所在URL");
            // 设置service所在URL
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setOperationName(new QName(namespace, api));
            call.setUseSOAPAction(true);
            Object[] objs = null;
            logger.info("=======>组装参数:"+params.size());
            if(params!=null && params.size()>0)
            {
                logger.info("=======>遍历参数");
                objs = new Object[params.size()];
                int i=0;
                for(String key : params.keySet())
                {
                    logger.info("=======>参数key:"+key);
                    logger.info("=======>接口参数:"+key);
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                    logger.info("=======>参数值:"+params.get(key));
                    objs[i] = params.get(key);
                    i++;
                }
            }
            logger.info("=======>设置返回类型");
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
            logger.info("=======>开始请求");
            String  ret = (String)call.invoke(objs);
            logger.info("=======>请求结果:"+ret);
            logger.info("=======>请求结果.toString():"+ret.toString());
            return ret.toString();
        } catch (Exception e) {
            logger.info("=======>CA请求报错:"+e.getMessage());
            e.printStackTrace();
            throw e;
        }
    }
}

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/utils/dzqm/SignPictureService.java

@ -0,0 +1,12 @@
/**
 * SignPictureService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.dzqm;
public interface SignPictureService extends java.rmi.Remote {
    public String SOF_GetSignPicture(String sys, String idNumber, String idType, String picType) throws java.rmi.RemoteException;
}

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/utils/dzqm/SignPictureServiceImplService.java

@ -0,0 +1,16 @@
/**
 * SignPictureServiceImplService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.dzqm;
public interface SignPictureServiceImplService extends javax.xml.rpc.Service {
    public String getSignPictureServiceImplPortAddress();
    SignPictureService getSignPictureServiceImplPort() throws javax.xml.rpc.ServiceException;
    SignPictureService getSignPictureServiceImplPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}

+ 142 - 0
business/base-service/src/main/java/com/yihu/jw/utils/dzqm/SignPictureServiceImplServiceLocator.java

@ -0,0 +1,142 @@
/**
 * SignPictureServiceImplServiceLocator.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.dzqm;
public class SignPictureServiceImplServiceLocator extends org.apache.axis.client.Service implements SignPictureServiceImplService {
    public SignPictureServiceImplServiceLocator() {
    }
    public SignPictureServiceImplServiceLocator(org.apache.axis.EngineConfiguration config) {
        super(config);
    }
    public SignPictureServiceImplServiceLocator(String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
        super(wsdlLoc, sName);
    }
    // Use to get a proxy class for SignPictureServiceImplPort
    private String SignPictureServiceImplPort_address = "http://101.132.67.155:8080/PKISignPicture/services/v1";
    public String getSignPictureServiceImplPortAddress() {
        return SignPictureServiceImplPort_address;
    }
    // The WSDD service name defaults to the port name.
    private String SignPictureServiceImplPortWSDDServiceName = "SignPictureServiceImplPort";
    public String getSignPictureServiceImplPortWSDDServiceName() {
        return SignPictureServiceImplPortWSDDServiceName;
    }
    public void setSignPictureServiceImplPortWSDDServiceName(String name) {
        SignPictureServiceImplPortWSDDServiceName = name;
    }
    public SignPictureService getSignPictureServiceImplPort() throws javax.xml.rpc.ServiceException {
       java.net.URL endpoint;
        try {
            endpoint = new java.net.URL(SignPictureServiceImplPort_address);
        }
        catch (java.net.MalformedURLException e) {
            throw new javax.xml.rpc.ServiceException(e);
        }
        return getSignPictureServiceImplPort(endpoint);
    }
    public SignPictureService getSignPictureServiceImplPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
        try {
            SignPictureServiceImplServiceSoapBindingStub _stub = new SignPictureServiceImplServiceSoapBindingStub(portAddress, this);
            _stub.setPortName(getSignPictureServiceImplPortWSDDServiceName());
            return _stub;
        }
        catch (org.apache.axis.AxisFault e) {
            return null;
        }
    }
    public void setSignPictureServiceImplPortEndpointAddress(String address) {
        SignPictureServiceImplPort_address = address;
    }
    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (SignPictureService.class.isAssignableFrom(serviceEndpointInterface)) {
                SignPictureServiceImplServiceSoapBindingStub _stub = new SignPictureServiceImplServiceSoapBindingStub(new java.net.URL(SignPictureServiceImplPort_address), this);
                _stub.setPortName(getSignPictureServiceImplPortWSDDServiceName());
                return _stub;
            }
        }
        catch (Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        if (portName == null) {
            return getPort(serviceEndpointInterface);
        }
        String inputPortName = portName.getLocalPart();
        if ("SignPictureServiceImplPort".equals(inputPortName)) {
            return getSignPictureServiceImplPort();
        }
        else  {
            java.rmi.Remote _stub = getPort(serviceEndpointInterface);
            ((org.apache.axis.client.Stub) _stub).setPortName(portName);
            return _stub;
        }
    }
    public javax.xml.namespace.QName getServiceName() {
        return new javax.xml.namespace.QName("http://webservice.picture.pki.jhsec.com.cn/", "SignPictureServiceImplService");
    }
    private java.util.HashSet ports = null;
    public java.util.Iterator getPorts() {
        if (ports == null) {
            ports = new java.util.HashSet();
            ports.add(new javax.xml.namespace.QName("http://webservice.picture.pki.jhsec.com.cn/", "SignPictureServiceImplPort"));
        }
        return ports.iterator();
    }
    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(String portName, String address) throws javax.xml.rpc.ServiceException {
        
if ("SignPictureServiceImplPort".equals(portName)) {
            setSignPictureServiceImplPortEndpointAddress(address);
        }
        else 
{ // Unknown Port Name
            throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
        }
    }
    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(javax.xml.namespace.QName portName, String address) throws javax.xml.rpc.ServiceException {
        setEndpointAddress(portName.getLocalPart(), address);
    }
}

+ 134 - 0
business/base-service/src/main/java/com/yihu/jw/utils/dzqm/SignPictureServiceImplServiceSoapBindingStub.java

@ -0,0 +1,134 @@
/**
 * SignPictureServiceImplServiceSoapBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.dzqm;
public class SignPictureServiceImplServiceSoapBindingStub extends org.apache.axis.client.Stub implements SignPictureService {
    private java.util.Vector cachedSerClasses = new java.util.Vector();
    private java.util.Vector cachedSerQNames = new java.util.Vector();
    private java.util.Vector cachedSerFactories = new java.util.Vector();
    private java.util.Vector cachedDeserFactories = new java.util.Vector();
    static org.apache.axis.description.OperationDesc [] _operations;
    static {
        _operations = new org.apache.axis.description.OperationDesc[1];
        _initOperationDesc1();
    }
    private static void _initOperationDesc1(){
        org.apache.axis.description.OperationDesc oper;
        org.apache.axis.description.ParameterDesc param;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_GetSignPicture");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "sys"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "idNumber"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "idType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "picType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[0] = oper;
    }
    public SignPictureServiceImplServiceSoapBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }
    public SignPictureServiceImplServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }
    public SignPictureServiceImplServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        if (service == null) {
            super.service = new org.apache.axis.client.Service();
        } else {
            super.service = service;
        }
        ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
    }
    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call _call = super._createCall();
            if (super.maintainSessionSet) {
                _call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                _call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                _call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                _call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                _call.setTimeout(super.cachedTimeout);
            }
            if (super.cachedPortName != null) {
                _call.setPortName(super.cachedPortName);
            }
            java.util.Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                _call.setProperty(key, super.cachedProperties.get(key));
            }
            return _call;
        }
        catch (Throwable _t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
        }
    }
    public String SOF_GetSignPicture(String sys, String idNumber, String idType, String picType) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_GetSignPicture");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.picture.pki.jhsec.com.cn/", "SOF_GetSignPicture"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {sys, idNumber, idType, picType});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
}

+ 54 - 0
business/base-service/src/main/java/com/yihu/jw/utils/dzqm/SignPictureServiceProxy.java

@ -0,0 +1,54 @@
package com.yihu.jw.utils.dzqm;
public class SignPictureServiceProxy implements SignPictureService {
  private String _endpoint = null;
  private SignPictureService signPictureService = null;
  
  public SignPictureServiceProxy() {
    _initSignPictureServiceProxy();
  }
  
  public SignPictureServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initSignPictureServiceProxy();
  }
  
  private void _initSignPictureServiceProxy() {
    try {
      signPictureService = (new SignPictureServiceImplServiceLocator()).getSignPictureServiceImplPort();
      if (signPictureService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)signPictureService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)signPictureService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (signPictureService != null)
      ((javax.xml.rpc.Stub)signPictureService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public SignPictureService getSignPictureService() {
    if (signPictureService == null)
      _initSignPictureServiceProxy();
    return signPictureService;
  }
  
  public String SOF_GetSignPicture(String sys, String idNumber, String idType, String picType) throws java.rmi.RemoteException{
    if (signPictureService == null)
      _initSignPictureServiceProxy();
    return signPictureService.SOF_GetSignPicture(sys, idNumber, idType, picType);
  }
  
  
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dzqm/OauthDzqmConfigDO.java

@ -14,6 +14,7 @@ public class OauthDzqmConfigDO extends UuidIdentityEntity{
    private String sys;
    private String url;
    private String nameSpace;
    private String remark;
    public String getSys() {
@ -39,4 +40,12 @@ public class OauthDzqmConfigDO extends UuidIdentityEntity{
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getNameSpace() {
        return nameSpace;
    }
    public void setNameSpace(String nameSpace) {
        this.nameSpace = nameSpace;
    }
}