`
jhyimu2005
  • 浏览: 181637 次
  • 性别: 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>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics