The emergency department (ED] represents an important transition of care for patients, where understanding the patient health condition is critical to forming an appropriate plan of care. Because many emergency referral visits are unplanned and urgent, this information may not be conveyed in advance to ED physicians. Loss of this data can lead to costly over-testing in the ED referral, or worse, an inappropriate disposition for the patient. In this study, we follow the XDS-MS (Cross-Enterprise Sharing of Medical Summaries) profile and present methods to imp1ement a prototype of an Emergency department system for referral documents. The system will not only retrieve the patient's critical medical information, but also generate the XML-based CDA R2 document automatically. The CDA document can be shared among different hospital emergency departments immediately. It can not only facilitate the referral process but also solve the problem of patient's health information loses and facilitate sharing across different emergency departments.