<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
>


<hibernate-mapping default-lazy="false" default-cascade="all">
    <class entity-name="patientVisit" table="TIU_PATIENT_VISIT_V" lazy="false">
        <id name="id" type="java.lang.Long" >
            <column name="TIU_PATIENT_VISIT_ID" />
 			<generator class="sequence">
				<param name="sequence">tiu_patient_visit_seq_id</param>
			</generator>
        </id>


		<property name="patientClass" column="PATIENT_CLASS" type="java.lang.String" node="patientClass"/>
		
        <component name="assignedLocationIdentifier" node="assignedLocation">
			<property name="pointOfCare" column="ASSIGN_LOC_POINT_OF_CARE" type="java.lang.String" node="pointOfCare"/>
			<property name="room" column="ASSIGN_LOC_ROOM" type="java.lang.String" node="room"/>
			<property name="bed" column="ASSIGN_LOC_BED" type="java.lang.String" node="bed"/>
			<property name="facilityNamespaceId" column="ASSIGN_LOC_FCLTY_NMSPCID" type="java.lang.String" node="facilityNamespaceId"/>
			<property name="facilityUniversalId" column="ASSIGN_LOC_FCLTY_UNVSID" type="java.lang.String" node="facilityUniversalId"/>
			<property name="facilityUniversalIdType" column="ASSIGN_LOC_FCLTY_UNVSIDTYP" type="java.lang.String" node="facilityUniversalIdType"/>
			<property name="personLocationType" column="ASSIGN_LOC_PERS_LOC_TYP" type="java.lang.String" node="personLocationType"/>
			<property name="locationDescription" column="ASSIGN_LOC_DESCRIPTION" type="java.lang.String" node="locationDescription"/>
		</component>

		<component name="attendingPhysician" node="attendingPhysician">
			<component name="identifier" node="identifier">
				<property name="identity" column="ATND_PERSON_IDENTITY" type="java.lang.String" node="identity"/>
				<property name="assigningFacility" column="ATND_PERSON_ASGNING_FACILITY" type="java.lang.String" node="assigningFacility"/>
				<property name="assigningAuthority" column="ATND_PERSON_ASGNING_AUTHORITY" type="java.lang.String" node="assigningAuthority"/>
			</component>
	
	        <property name="idSourceTable" type="java.lang.String" node="idSourceTable">
	            <column name="ATND_PRACTITIONER_ID_SRC_TBL"/>
	        </property>
	
			<component name="name" node="name">
				<property name="prefix" column="ATND_NAME_PREFIX" type="java.lang.String" node="prefix"/>
				<property name="given" column="ATND_NAME_GIVEN" type="java.lang.String" node="given"/>
				<property name="middle" column="ATND_NAME_MIDDLE" type="java.lang.String" node="middle"/>
				<property name="family" column="ATND_NAME_FAMILY" type="java.lang.String" node="family"/>
				<property name="suffix" column="ATND_NAME_SUFFIX" type="java.lang.String" node="suffix"/>
				<property name="title" column="ATND_NAME_TITLE" type="java.lang.String" node="title"/>
			</component>
		</component>

		<property name="hospitalService" column="HOSPITAL_SERVICE" type="java.lang.String" node="hospitalService"/>

        <component name="serviceLocationIdentifier" node="serviceLocation">
			<property name="pointOfCare" column="SRVC_LOC_POINT_OF_CARE" type="java.lang.String" node="pointOfCare" />
			<property name="room" column="SRVC_LOC_ROOM" type="java.lang.String" node="room"/>
			<property name="bed" column="SRVC_LOC_BED" type="java.lang.String" node="bed"/>
			<property name="facilityNamespaceId" column="SRVC_LOC_FCLTY_NMSPCID" type="java.lang.String" node="facilityNamespaceId"/>
			<property name="facilityUniversalId" column="SRVC_LOC_FCLTY_UNVSID" type="java.lang.String" node="facilityUniversalId"/>
			<property name="facilityUniversalIdType" column="SRVC_LOC_FCLTY_UNVSIDTYP" type="java.lang.String" node="facilityUniversalIdType"/>
			<property name="personLocationType" column="SRVC_LOC_PERS_LOC_TYP" type="java.lang.String" node="personLocationType"/>
			<property name="locationDescription" column="SRVC_LOC_DESCRIPTION" type="java.lang.String" node="locationDescription"/>
		</component>

        <component name="visitDate" node="visitDate">
		  <property name="literal" type="gov.va.med.cds.persistence.hibernate.common.Dom4jPointInTimeUserType" node="literal">
			<column name="VISIT_DT" />
			<column name="VISIT_DT_NBR"/>
		  </property>
        </component>

		<property name="servicingFacility" column="SERVICE_FACILITY" type="java.lang.String" node="servicingFacility"/>

        <component name="admitDate" node="admitDate" >
		  <property name="literal" type="gov.va.med.cds.persistence.hibernate.common.Dom4jPointInTimeUserType" node="literal">
			<column name="ADMIT_DT" />
			<column name="ADMIT_DT_NBR"/>
		  </property>
        </component>
        
		<property name="visitId" column="VISIT_IDENTIFIER" type="java.lang.String" node="visitId"/>

        <component name="secondaryVisitDate" node="secondaryVisitDate" >
		  <property name="literal" type="gov.va.med.cds.persistence.hibernate.common.Dom4jPointInTimeUserType" node="literal">
			<column name="SECONDARY_VISIT_DT" />
			<column name="SECONDARY_VISIT_DT_NBR"/>
		  </property>
        </component>
        
	</class>
</hibernate-mapping>
