`
jhyimu2005
  • 浏览: 185730 次
  • 性别: Icon_minigender_2
  • 来自: 苏州
社区版块
存档分类
最新评论

Spirng + cxf 提供webservice接口

 
阅读更多
Spring的配置文件
<jaxws:endpoint id="patientWebService" implementor="#patientWebServiceImpl" address="/EMPIJaxRpcWS" publish="true" > 
</jaxws:endpoint>
解释 id="patientWebService" 是接口的注解名称
implementor="#patientWebServiceImpl" 是实现接口累的注解名称

package com.founder.gbsc.hc.empi.ws;

import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@SOAPBinding(use=SOAPBinding.Use.ENCODED, style=SOAPBinding.Style.RPC)
@WebService(serviceName="patientWebService", targetNamespace="http://ws.empi.hc.gbsc.founder.com")
public interface IPatientWebService {

	public void createPerson( WSPerson person) throws EMPIException_Exception; 
	 
	public  ArrayOfWSPerson queryLinkedPersons( Identifier personIdentifier) throws EMPIException_Exception; 
	 
	public  WSPerson queryMasterByIdentifier( Identifier masterIdentifier) throws EMPIException_Exception; 
	 
	public  ArrayOfIdentifier queryLinkedPersonIdentifiers( Identifier personIdentifier) throws EMPIException_Exception; 
	 
	public void updateMaster( WSPerson master) throws EMPIException_Exception; 
	 
	public void createPersonWithMasterIdentifierSpecified( Identifier masterIdentifier, WSPerson person) throws EMPIException_Exception; 
	 
	public void mergePerson( Identifier retiredPersonIdentifier, Identifier survivingPersonIdentifier) throws EMPIException_Exception; 
	 
	public  IdentifierDomain queryIdentifierDomainByCode(java.lang.String domainCode) throws EMPIException_Exception; 
	 
	public void attachPersonToMaster( Identifier personIentifier, Identifier masterIdentifier) throws EMPIException_Exception; 
	 
	public  WSPersonPagedQueryResult queryPersons(int startingIndex,int pageSize, PersonQueryCriteria criteria) throws EMPIException_Exception; 
	 
	public  ArrayOfIdentifierDomain queryIdentifierDomains() throws EMPIException_Exception; 
	 
	public void updatePerson( WSPerson person) throws EMPIException_Exception; 
	 
	public  ArrayOfWSPerson queryMasterByAttributes( WSPerson master) throws EMPIException_Exception; 
	 
	public  WSPersonPagedQueryResult queryMasters(int startingIndex,int pageSize, PersonQueryCriteria criteria) throws EMPIException_Exception; 
	 
	public void createMaster( WSPerson master) throws EMPIException_Exception; 
	 
	/**
	 * 通过患者本地ID查询患者
	 * @param personIdentifier 患者本地ID
	 * @return  从EMPI系统中返回的患者记录
	 * @throws EMPIException_Exception
	 */
	/*@WebResult(name = "queryPersonByIdentifierReturn", targetNamespace = "")
    @RequestWrapper(localName = "queryPersonByIdentifier", targetNamespace = "http://ws.empi.hc.gbsc.founder.com", className = "com.ibm.gbsc.hc.empi.ws.QueryPersonByIdentifier")
    @WebMethod(action = "queryPersonByIdentifier")
    @ResponseWrapper(localName = "queryPersonByIdentifierResponse", targetNamespace = "http://ws.empi.hc.gbsc.founder.com", className = "com.ibm.gbsc.hc.empi.ws.QueryPersonByIdentifierResponse")*/
	public  WSPerson queryPersonByIdentifier(@WebParam(name="personIdentifier")Identifier personIdentifier) throws EMPIException_Exception; 
	 
	public void mergeMaster( Identifier retriedMasterIdentifier, Identifier survivingMasterIdentifier) throws EMPIException_Exception;
	
	public  ArrayOfWSPerson queryPersonByAttributes( WSPerson person) throws EMPIException_Exception;
	
	public  ArrayOfWSPerson queryAttachedPersons( Identifier masterIdentifier) throws EMPIException_Exception;

	 public  Identifier createPersonAndMasterImmediately(WSPerson person) throws EMPIException_Exception;
	 
	 public void deletePerson( Identifier personIdentifier) throws EMPIException_Exception;
	 
	 public void deleteMaster( Identifier masterIdentifer) throws EMPIException_Exception;
	 
	 /**
	  * 通过患者的主索引号来查询属于同一患者的所有患者ID
	  * @param masterIdentifier 患者主索引ID(EMPI ID)
	  * @return
	  * @throws EMPIException_Exception
	  */
	/*@WebResult(name = "queryAttachedPersonIdentifiersReturn", targetNamespace = "")
    @RequestWrapper(localName = "queryAttachedPersonIdentifiers", targetNamespace = "http://ws.empi.hc.gbsc.founder.com", className = "com.ibm.gbsc.hc.empi.ws.QueryAttachedPersonIdentifiers")
    @WebMethod(action = "queryAttachedPersonIdentifiers")
    @ResponseWrapper(localName = "queryAttachedPersonIdentifiersResponse", targetNamespace = "http://ws.empi.hc.gbsc.founder.com", className = "com.ibm.gbsc.hc.empi.ws.QueryAttachedPersonIdentifiersResponse")*/
	 public ArrayOfIdentifier queryAttachedPersonIdentifiers(@WebParam(name="masterIdentifier")Identifier masterIdentifier) throws EMPIException_Exception;
	 
	 public void detachPersonFromMaster( Identifier personIentifier, Identifier masterIdentifier) throws EMPIException_Exception;
}

实现类

package com.founder.gbsc.hc.empi.ws;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.founder.fasf.util.ObjectUtil;
import com.founder.ids.common.IdsConstants;
import com.founder.ids.entity.Patient;
import com.founder.rcp.common.WebServiceCaller;
import com.founder.rcp.patient.adapter.MessageProcessor;
import com.founder.rcp.patient.adapter.PatientAdapter;
import com.founder.rcp.patient.adapter.PatientAdapterFactory;
import com.founder.rcp.patient.adapter.PatientOperatorType;

@SOAPBinding(use=SOAPBinding.Use.ENCODED, style=SOAPBinding.Style.RPC)
@Service("patientWebServiceImpl")
@WebService(targetNamespace="http://ws.empi.hc.gbsc.founder.com" )
public class PatientWebServiceImpl implements IPatientWebService {

	private static final Logger LOG = Logger.getLogger(PatientWebServiceImpl.class.getName());

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#createPersonAndMasterImmediately( WSPerson  person )*
     */
	@Override
    public  Identifier createPersonAndMasterImmediately(WSPerson person) throws EMPIException_Exception    { 
        LOG.info("Executing operation createPersonAndMasterImmediately");
        System.out.println(person);
        try {
             Identifier _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#deletePerson( Identifier  personIdentifier )*
     */
	@Override
    public void deletePerson( Identifier personIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation deletePerson");
        System.out.println(personIdentifier);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#deleteMaster( Identifier  masterIdentifer )*
     */
	@Override
    public void deleteMaster( Identifier masterIdentifer) throws EMPIException_Exception    { 
        LOG.info("Executing operation deleteMaster");
        System.out.println(masterIdentifer);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#detachPersonFromMaster( Identifier  personIentifier ,) Identifier  masterIdentifier )*
     */
    @Override
    public void detachPersonFromMaster( Identifier personIentifier, Identifier masterIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation detachPersonFromMaster");
        System.out.println(personIentifier);
        System.out.println(masterIdentifier);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#createPerson( WSPerson  person )*
     */
    @Override
    public void createPerson( WSPerson person) throws EMPIException_Exception    { 
        LOG.info("Executing operation createPerson");
        System.out.println(person);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryLinkedPersons( Identifier  personIdentifier )*
     */
    @Override
    public  ArrayOfWSPerson queryLinkedPersons( Identifier personIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryLinkedPersons");
        System.out.println(personIdentifier);
        try {
             ArrayOfWSPerson _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryMasterByIdentifier( Identifier  masterIdentifier )*
     */
    @Override
    public  WSPerson queryMasterByIdentifier( Identifier masterIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryMasterByIdentifier");
        System.out.println(masterIdentifier);
        try {
             WSPerson _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryLinkedPersonIdentifiers( Identifier  personIdentifier )*
     */
    @Override
    public  ArrayOfIdentifier queryLinkedPersonIdentifiers( Identifier personIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryLinkedPersonIdentifiers");
        System.out.println(personIdentifier);
        try {
             ArrayOfIdentifier _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#updateMaster( WSPerson  master )*
     */
    @Override
    public void updateMaster( WSPerson master) throws EMPIException_Exception    { 
        LOG.info("Executing operation updateMaster");
        System.out.println(master);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#createPersonWithMasterIdentifierSpecified( Identifier  masterIdentifier ,) WSPerson  person )*
     */
    @Override
    public void createPersonWithMasterIdentifierSpecified( Identifier masterIdentifier, WSPerson person) throws EMPIException_Exception    { 
        LOG.info("Executing operation createPersonWithMasterIdentifierSpecified");
        System.out.println(masterIdentifier);
        System.out.println(person);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#mergePerson( Identifier  retiredPersonIdentifier ,) Identifier  survivingPersonIdentifier )*
     */
    @Override
    public void mergePerson( Identifier retiredPersonIdentifier, Identifier survivingPersonIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation mergePerson");
        System.out.println(retiredPersonIdentifier);
        System.out.println(survivingPersonIdentifier);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryIdentifierDomainByCode(java.lang.String  domainCode )*
     */
    @Override
    public  IdentifierDomain queryIdentifierDomainByCode(java.lang.String domainCode) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryIdentifierDomainByCode");
        System.out.println(domainCode);
        try {
             IdentifierDomain _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#attachPersonToMaster( Identifier  personIentifier ,) Identifier  masterIdentifier )*
     */
    @Override
    public void attachPersonToMaster( Identifier personIentifier, Identifier masterIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation attachPersonToMaster");
        System.out.println(personIentifier);
        System.out.println(masterIdentifier);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryPersons(int  startingIndex ,)int  pageSize ,) PersonQueryCriteria  criteria )*
     */
    @Override
    public  WSPersonPagedQueryResult queryPersons(int startingIndex,int pageSize, PersonQueryCriteria criteria) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryPersons");
        System.out.println(startingIndex);
        System.out.println(pageSize);
        System.out.println(criteria);
        try {
             WSPersonPagedQueryResult _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryIdentifierDomains(*
     */
    @Override
    public  ArrayOfIdentifierDomain queryIdentifierDomains() throws EMPIException_Exception    { 
        LOG.info("Executing operation queryIdentifierDomains");
        try {
             ArrayOfIdentifierDomain _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#updatePerson( WSPerson  person )*
     */
    @Override
    public void updatePerson( WSPerson person) throws EMPIException_Exception    { 
        LOG.info("Executing operation updatePerson");
        System.out.println(person);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryMasterByAttributes( WSPerson  master )*
     */
    @Override
    public  ArrayOfWSPerson queryMasterByAttributes( WSPerson master) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryMasterByAttributes");
        System.out.println(master);
        try {
             ArrayOfWSPerson _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryMasters(int  startingIndex ,)int  pageSize ,) PersonQueryCriteria  criteria )*
     */
    @Override
    public  WSPersonPagedQueryResult queryMasters(int startingIndex,int pageSize, PersonQueryCriteria criteria) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryMasters");
        System.out.println(startingIndex);
        System.out.println(pageSize);
        System.out.println(criteria);
        try {
             WSPersonPagedQueryResult _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#createMaster( WSPerson  master )*
     */
    @Override
    public void createMaster( WSPerson master) throws EMPIException_Exception    { 
        LOG.info("Executing operation createMaster");
        System.out.println(master);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }


    @Override
    public ArrayOfIdentifier queryAttachedPersonIdentifiers(@WebParam(name="masterIdentifier")Identifier masterIdentifier) throws EMPIException_Exception { 
        LOG.info("Executing operation queryAttachedPersonIdentifiers");
        
        ArrayOfIdentifier arrayOfIdentifier = new ArrayOfIdentifier();
        List<Identifier> identifier = arrayOfIdentifier.getIdentifier();
        //若给的条件不足返回
       if (!this.validateInputData(masterIdentifier)) return arrayOfIdentifier;
        Patient patient = this.getPatientByData(masterIdentifier);
        
        try {
             WebServiceCaller wsc = initWebServiceCaller(PatientOperatorType.QUERY);
				String responeseXML = wsc.invoke(patient, IdsConstants.QUERY_PERSON);
				List<Patient> ps = new MessageProcessor().convertXMLToPatient(responeseXML);
				
				if(ObjectUtil.isNotEmpty(ps)){
					for(Patient temp: ps) {
						identifier.add(this.transIdentifier(temp));
					}
					return arrayOfIdentifier;
				}
            return arrayOfIdentifier;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

    private WebServiceCaller initWebServiceCaller(PatientOperatorType type) {
		PatientAdapter patientAdapter = PatientAdapterFactory.createPatientAdapter(type);
		WebServiceCaller wsc = new WebServiceCaller(patientAdapter);
		return wsc;
	}
    
    private Patient getPatientByData(Identifier masterIdentifier){
    	Patient patient = new Patient();
    	String code = masterIdentifier.getDomain().getCode().trim();
    	if (StringUtils.endsWith(code, "EMPI_PID")) {
    		patient.setEmpiId(masterIdentifier.getIdentifier());
    	} else if (StringUtils.endsWith(code, "PKUPH_IHIS_PID")) {
    		patient.setEmpiLocalId(WSPatientConstants.PKUPH_IHIS_PID);
    		patient.setPatientId(masterIdentifier.getIdentifier());
    	} else if (StringUtils.endsWith(code, "PKUPH_OHIS_PID")) {
    		patient.setEmpiLocalId(WSPatientConstants.PKUPH_OHIS_PID);
    		patient.setPatientId(masterIdentifier.getIdentifier());
    	}
    	return patient;
    }
    
    private Identifier transIdentifier(Patient patient) {
    	Identifier identifier = new Identifier();
    	identifier.setIdentifier(patient.getPatientId());
    	if (StringUtils.endsWith(patient.getEmpiLocalId(), WSPatientConstants.PKUPH_OHIS_PID)) {
    		identifier.getDomain().setCode("PKUPH_OHIS_PID");//1表示是门诊的患者
    	} else {
    		identifier.getDomain().setCode("PKUPH_IHIS_PID");
    	}
    	return identifier;
    }
    
    private Boolean validateInputData(Identifier masterIdentifier) {
    	
    	 if (ObjectUtil.isNullOrEmpty(masterIdentifier)) {
         	return false;
         }
         
    	 if (ObjectUtil.isNullOrEmpty(masterIdentifier.getDomain())) {
          	return false;
          }
    	 
         if (ObjectUtil.isNullOrEmpty(masterIdentifier.getIdentifier())) {
         	return false;
         }
         if (ObjectUtil.isNullOrEmpty(masterIdentifier.getDomain().getCode().trim())) {
          	return false;
          }
         return true;
    }
    
    /**
	 * 通过患者本地ID查询患者
	 * @param personIdentifier 患者本地ID
	 * @return  从EMPI系统中返回的患者记录
	 * @throws EMPIException_Exception
	 */
    @Override
    public  WSPerson queryPersonByIdentifier(@WebParam(name="personIdentifier")Identifier personIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryPersonByIdentifier");
        WSPerson wsPerson = new WSPerson();
        if (!this.validateInputData(personIdentifier)) return wsPerson;
        Patient patient = this.getPatientByData(personIdentifier);
        
        try {
             WebServiceCaller wsc = initWebServiceCaller(PatientOperatorType.QUERY);
				String responeseXML = wsc.invoke(patient, IdsConstants.QUERY_PERSON);
				List<Patient> ps = new MessageProcessor().convertXMLToPatient(responeseXML);
				
				if(ObjectUtil.isNotEmpty(ps)){
					return this.transWSPerson(ps.get(0), personIdentifier);
				}
            return wsPerson;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    private WSPerson transWSPerson(Patient patient, Identifier personIdentifier) {
    	WSPerson wsPerson = new WSPerson();
    	
    	wsPerson.getPersonIdentifier().getDomain().setCode(personIdentifier.getDomain().getCode().trim());
    	wsPerson.getPersonIdentifier().setIdentifier(patient.getPatientId());//
    	wsPerson.getMasterIdentifier().getDomain().setCode("EMPI_PID");
    	wsPerson.getMasterIdentifier().setIdentifier(patient.getEmpiId());//
    	
    	PersonName personName = new PersonName();
    	personName.setFullName(patient.getName());
    	ArrayOfPersonName arrayOfPersonName = new ArrayOfPersonName();
    	List<PersonName> personNames = arrayOfPersonName.getPersonName();
    	personNames.add(personName);
    	wsPerson.setNames(arrayOfPersonName);//患者姓名
    	wsPerson.setDateOfBirth(dateToXmlDate(patient.getBirthDate()));//出生日期
    	wsPerson.setIdentities(getIdentifiers(patient));//
    	wsPerson.setBirthPlace(patient.getBirthPlace());//出生地
    	if(ObjectUtil.isNotEmpty(patient.getGender())) {
    		wsPerson.setGender(getGender(patient.getGender()));//性别
    	}
    	return wsPerson;
    }
    
    private String getGender(String gender) {
    	
    	if (StringUtils.equals(gender, "1")) {
    		return "M";
    	} else if (StringUtils.equals(gender, "2")) {
    		return "F";
    	}
    	return null;
    }
    /**
     * 为WSPerson获取 ArrayOfIdentifier对象
     * @param patient
     * @return
     */
    private ArrayOfIdentifier getIdentifiers(Patient patient) {
    	ArrayOfIdentifier arrayOfIdentifier = new ArrayOfIdentifier();
    	List<Identifier> identifiers = arrayOfIdentifier.getIdentifier();
    	if (StringUtils.equals(patient.getCertType(), "01")) {//身份证
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("PASSPORT_NO");
    		identifier.setIdentifier(patient.getCertNo());
    		identifiers.add(identifier);
    	}
    	if (StringUtils.equals(patient.getCertType(), "03")) {//护照
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("ASSPORT_NO");
    		identifier.setIdentifier(patient.getCertNo());
    		identifiers.add(identifier);
    	}
    	if (ObjectUtil.isNotEmpty(patient.getHealthCardNo())) {//社会保险号
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("SSN");
    		identifier.setIdentifier(patient.getHealthCardNo());
    		identifiers.add(identifier);
    	}
    	
    	if (ObjectUtil.isNotEmpty(patient.getEmpiId())) {
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("EMPI_PID");
    		identifier.setIdentifier(patient.getEmpiId());
    		identifiers.add(identifier);
    	}
    	if (StringUtils.endsWith(patient.getEmpiLocalId(), WSPatientConstants.PKUPH_IHIS_PID)) {
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("PKUPH_IHIS_PID");
    		identifier.setIdentifier(patient.getPatientId());
    		identifiers.add(identifier);
    	} else if (StringUtils.endsWith(patient.getEmpiLocalId(), WSPatientConstants.PKUPH_OHIS_PID)) {
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("PKUPH_OHIS_PID");
    		identifier.setIdentifier(patient.getPatientId());
    		identifiers.add(identifier);
    	}
    	if (ObjectUtil.isNotEmpty(patient.getConfirmId())){//北大人民医院就诊卡号
    		Identifier identifier = new Identifier();
    		IdentifierDomain domain = identifier.getDomain();
    		domain.setCode("PKUPH_MEDICAL_CARD_NO");
    		identifier.setIdentifier(patient.getConfirmId());
    		identifiers.add(identifier);
    	}
    	
    	return arrayOfIdentifier;
    }
    
/** 
* 将Date类转换为XMLGregorianCalendar 
* @param date 
* @return  
*/  
public static XMLGregorianCalendar dateToXmlDate(Date date){
	if (ObjectUtil.isNullOrEmpty(date)) return null;
	Calendar cal = Calendar.getInstance();  
	cal.setTime(date);  
	DatatypeFactory dtf = null;  
	try {  
		dtf = DatatypeFactory.newInstance();  
	} catch (DatatypeConfigurationException e) {  
	}  
	XMLGregorianCalendar dateType = dtf.newXMLGregorianCalendar();  
	dateType.setYear(cal.get(Calendar.YEAR));  
	//由于Calendar.MONTH取值范围为0~11,需要加1  
	dateType.setMonth(cal.get(Calendar.MONTH)+1);  
	dateType.setDay(cal.get(Calendar.DAY_OF_MONTH));  
	dateType.setHour(cal.get(Calendar.HOUR_OF_DAY));  
	dateType.setMinute(cal.get(Calendar.MINUTE));  
	dateType.setSecond(cal.get(Calendar.SECOND));  
	return dateType;  
}   

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#mergeMaster( Identifier  retriedMasterIdentifier ,) Identifier  survivingMasterIdentifier )*
     */
    @Override
    public void mergeMaster( Identifier retriedMasterIdentifier, Identifier survivingMasterIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation mergeMaster");
        System.out.println(retriedMasterIdentifier);
        System.out.println(survivingMasterIdentifier);
        try {
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryPersonByAttributes( WSPerson  person )*
     */
    @Override
    public  ArrayOfWSPerson queryPersonByAttributes( WSPerson person) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryPersonByAttributes");
        System.out.println(person);
        try {
             ArrayOfWSPerson _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
         
    }

    /* (non-Javadoc)
     * @see  EMPIJaxRpcWS#queryAttachedPersons( Identifier  masterIdentifier )*
     */
    @Override
    public  ArrayOfWSPerson queryAttachedPersons( Identifier masterIdentifier) throws EMPIException_Exception    { 
        LOG.info("Executing operation queryAttachedPersons");
        System.out.println(masterIdentifier);
        try {
             ArrayOfWSPerson _return = null;
            return _return;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }
    
}




web.xml文件

<servlet>          
<servlet-name>CXFServlet</servlet-name>           
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>           
<load-on-startup>1</load-on-startup>      
</servlet>       
<servlet-mapping>        
<servlet-name>CXFServlet</servlet-name>        
<url-pattern>/services/*</url-pattern>     
</servlet-mapping>
分享到:
评论

相关推荐

    使用Eclipse+Maven+Spring+CXF构建的WebService服务

    Web项目中基于Maven与Spring整合的WebService之cxf的实现⬇️ 详情请参考如下链接: https://locqi.github.io/locqi.com/2018/09/05/Eclipse+Maven+Spring+CXF-create-WebService/

    Spring+cxf请求webService

    【Spring+CXF请求WebService详解】 在Java开发领域,Spring框架以其强大的依赖注入和面向切面编程能力被广泛应用,而CXF则是一个优秀的开源服务开发框架,支持SOAP和RESTful服务。当Spring与CXF结合使用时,可以...

    Spring + cxf = webservice 完整实例源码免费下载

    Spring + cxf = webservice 完整实例源码免费下载 完全免费。此资源仅为文档提供。 版权为百度文档 "Spring + cxf = webservice 完整实例源码免费下载" 所有。

    Spring+CXF+tomcat开发webservice

    这个项目"Spring+CXF+tomcat开发webservice"旨在教你如何利用这些技术搭建一个完整的Web服务环境,包括服务端和服务端客户端的实现。 **Spring** 是一个广泛使用的Java企业级应用开发框架,它提供了依赖注入(DI)...

    spring+cxf 开发webservice

    它还可以处理RESTful Web服务,通过JAX-RS标准接口提供服务。CXF的强项在于其易于使用和高度可定制性。 3. **Web Service**:Web服务是一种通过网络进行通信的软件系统,通常使用SOAP消息协议,可以通过WSDL(Web...

    spring+CXF实现WebService(http+https)

    CXF作为Web服务提供商,它支持SOAP和RESTful两种风格的服务,能够与Spring无缝对接。通过Spring的ApplicationContext配置,我们可以管理CXF服务的生命周期,实现服务的发布和消费。 2. **创建WebService**: 使用...

    spring+cxf的webservice

    标题中的“spring+cxf的webservice”指的是使用Spring框架与Apache CXF库共同构建Web服务的过程。Apache CXF是一个开源的Java框架,主要用于创建和消费Web服务,它支持SOAP、RESTful等多种通信协议。Spring框架则是...

    Spring+cxf=webservice 的jar包1

    【Spring+cxf=WebService】是将Spring框架与Apache CXF集成来实现Web服务的一种常见方式。Spring是一个强大的Java企业级应用开发框架,它提供了一种模块化和灵活的方式来组织和管理应用程序的组件。而CXF则是一个...

    SpringBoot+Mybatis+CXF框架,实现Restful api与 WebService api接口的大实验

    3. 接下来,我们需要实现Restful API和WebService API接口,使用Spring Boot的Restful API和CXF框架来实现学生信息的增删改查操作。 4. 最后,我们需要测试Restful API和WebService API接口,确保其正常工作。 结论...

    Spring+CXF 发布WebService服务

    本文将深入探讨如何使用Spring和CXF来发布WebService服务。 首先,Spring是一个开源的Java平台,它提供了全面的编程和配置模型,用于简化企业级应用的开发。Spring框架的核心特性包括依赖注入、面向切面编程(AOP)...

    Spring+cxf=webservice 的jar包2

    标题中的“Spring+cxf=webservice 的jar包2”表明这是一个与Spring框架和Apache CXF相关的Web服务实现项目。在Java开发中,Spring是一个广泛使用的轻量级框架,用于简化企业级应用的开发,而CXF则是一个开源的服务栈...

    mybatis+spring+cxf Webservice框架

    【标题】"mybatis+spring+cxf Webservice框架"是一个集成性的开发框架,它结合了三个主流的技术组件:MyBatis、Spring和Apache CXF,用于构建高效、灵活且易于维护的Web服务。MyBatis是一个优秀的持久层框架,Spring...

    Spring+CXF开发WebService源代码

    本教程将基于"Spring+CXF开发WebService源代码"的主题,深入探讨如何利用这两者创建和消费Web服务。 首先,Spring是一个开源的应用框架,提供了一个全面的编程和配置模型,适用于Java应用程序。它为开发企业级应用...

    ibatis+spring+cxf+mysql搭建webservice的客户端

    ibatis+spring+cxf+mysql搭建webservice的客户端,文章地址在http://blog.csdn.net/cenyi2013/article/details/17315755. 服务端源码的下载地址在http://download.csdn.net/detail/cenyi2012/6712729

    maven+spring+cxf webservice demo

    【标题】"maven+spring+cxf webservice demo"是一个基于Maven、Spring和CXF框架的Web服务示例项目,旨在展示如何整合这三个技术来创建和消费Web服务。Maven是项目管理和构建工具,Spring提供了强大的依赖注入和面向...

    源码-springboot+cxf实现webservice服务端

    ### 源码分析:Spring Boot + CXF 实现WebService服务端 #### 一、概述 随着企业级应用之间的交互需求日益增长,跨平台、跨语言的服务调用变得尤为重要。WebService作为一种成熟且广泛采用的技术标准,能够很好地...

    Spring+CXF开发WebService

    使用 CXF 做 webservice 简单例子 Apache CXF 是一个开放源代码框架,提供了用于方便地构建和开发 Web 服务的可靠基础架构。它允许创建高性能和可扩展的服务,您可以将这样的服务部署在 Tomcat 和基于 Spring 的轻...

    Spring+CXF实现WebService

    服务端代码通常会有Spring的配置文件、CXF的Servlet配置以及服务接口和服务实现类。客户端代码则会有CXF客户端代理的生成和使用。通过研究这些代码,你可以更深入地理解Spring和CXF如何协同工作来实现Web服务。 ...

    springboot+CXF发布webservice接口

    总之,通过Spring Boot与CXF的集成,我们可以轻松地在Spring Boot应用中发布Web服务接口,提供基于SOAP的通信方式。这不仅简化了开发流程,还利用了Spring Boot的自动化配置和CXF的强大功能,为构建高效、可维护的...

    Spring+CXF发布webservice

    至于“工具”,这里可能指的是CXF提供的工具,如CXF的WSdl2Java生成器,可以将WSDL文件转换为Java类,或者Java2WSDL工具,可以从Java接口生成WSDL。 总的来说,结合Spring和CXF发布Web服务是一个强大且灵活的方法,...

Global site tag (gtag.js) - Google Analytics