<?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" [
	<!ENTITY pharmacist SYSTEM 		"classpath://gov/va/med/cds/persistence/hibernate/common/PharmacistPractitionerParticipationPojo.hbm">
	<!ENTITY currentProvider SYSTEM	"classpath://gov/va/med/cds/persistence/hibernate/common/CurrentProviderPractitionerLitePojo.hbm">
]>

<hibernate-mapping default-lazy="false" default-cascade="all">
	<class entity-name="OriginalMedicationDispense" table="OUTPATIENT_MED_DSP_V" lazy="false" discriminator-value="O" name="gov.va.med.cds.template.generated.pharmacy.OutpatientMedicationDispense1">
		<id name="id" type="java.lang.Long">
			<column name="OUTPATIENT_MED_DSP_ID"/>
			<generator class="sequence">
				<param name="sequence">outpatient_med_dsp_seq_id</param>
			</generator>
		</id>
		
		<discriminator column="discriminator" type="character"/>
		
		<!-- From super class MedicationDispense.  One more superclass item mapped in the set list at the bottom. -->
		<component name="comments"  class="gov.va.med.cds.template.generated.pharmacy.MedicationDispense1$Comments">
			<list name="comment" table="DISPENSE_COMMENT_V" fetch="subselect" batch-size="100">
				<key column="OUTPATIENT_MED_DSP_ID" not-null="true" update="false"/>
				<list-index column="LINE_NBR"/>
				<element type="java.lang.String" column="DISPENSE_COMMENTS" />
			</list>
		</component>
		<component name="currentProviderComments"  class="gov.va.med.cds.template.generated.pharmacy.MedicationDispense1$CurrentProviderComments">
			<list name="currentProviderComment" table="CURRENT_PROVIDER_COMMENT_V" fetch="subselect" batch-size="100">
				<key column="OUTPATIENT_MED_DSP_ID" not-null="true" update="false"/>
				<list-index column="LINE_NBR"/>
				<element type="string" column="PROVIDER_COMMENTS" />
			</list>
		</component>
		<property name="dispenseDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType">
			<column name="DISPENSE_DT"/>
			<column name="DISPENSE_DT_NBR"/>
		</property>
		<property name="fillDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
			<column name="FILL_DT"/>
			<column name="FILL_DT_NBR"/>
		</property>
		<property name="loginDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
			<column name="LOGIN_DT"/>
			<column name="LOGIN_DT_NBR"/>
		</property>
		<component name="quantityDispensed" class="gov.va.med.cds.template.generated.basedatatypes.PhysicalQuantity">
			<property name="value" column="QTYDISPENSED_VAL" type="java.lang.String" />
			<component name="unit" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
				<property name="code" column="QTYDISPENSED_UOM_CODE" type="java.lang.String" />
				<property name="displayText" column="QTYDISPENSED_UOM_DSPLYTXT" type="java.lang.String" />
				<property name="codingSystem" column="QTYDISPENSED_UOM_CODSYS" type="java.lang.String" />
			</component>
		</component>
		<property name="numberOfRefillsRemaining" column="NUM_REFILLS_REMAINING" type="integer" />
		<!-- From the subclass -->
		<property name="daysSupply" column="DAYS_SUPPLY" type="java.lang.String" />
		<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier">
			<property name="identity" column="IDENTIFIER_IDENTITY" type="java.lang.String" />
			<property name="namespaceId" column="IDENTIFIER_NAMESPACEID" type="java.lang.String" />
			<property name="universalId" column="IDENTIFIER_UNIVERSALID" type="java.lang.String" />
			<property name="universalIdType" column="IDENTIFIER_UNIVERSTYP" type="java.lang.String"/>
		</component>
		<component name="levelOfUnderstanding" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="LVLUNDERSTANDING_CODE" type="java.lang.String" />
			<property name="displayText" column="LVLUNDERSTANDING_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="LVLUNDERSTANDING_CODSYS" type="java.lang.String" />
		</component>
		<property name="mailWindow" column="MAIL_WINDOW" type="java.lang.String" />
		<property name="releaseDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
			<column name="RELEASE_DT"/>
			<column name="RELEASE_DT_NBR"/>
		</property>
		<component name="wasPatientCounseled" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="PATIENT_COUNSELED_CODE" type="java.lang.String" />
			<property name="displayText" column="PATIENT_COUNSELED_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="PATIENT_COUNSELED_CODSYS" type="java.lang.String" />
		</component>
		<component name="cmopEventStatus" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="CMOP_EVNT_STATUS_CODE" type="java.lang.String" />
			<property name="displayText" column="CMOP_EVNT_STATUS_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="CMOP_EVNT_STATUS_CODSYS" type="java.lang.String" />
		</component>
		<component name="division" class="gov.va.med.cds.template.generated.common.PharmacyDivision">
			<component name="divisionId" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
				<property name="code" column="DIVISION_ID_CODE" type="java.lang.String" />
				<property name="displayText" column="DIVISION_ID_DSPLYTXT" type="java.lang.String" />
				<property name="codingSystem" column="DIVISION_ID_CODSYS" type="java.lang.String"/>
			</component>
			<component name="ncpdpId" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
				<property name="code" column="DIV_NCPDPID_CODE" type="java.lang.String" />
				<property name="displayText" column="DIV_NCPDPID_DSPLYTXT" type="java.lang.String" />
				<property name="codingSystem" column="DIV_NCPDPID_CODSYS" type="java.lang.String" />
			</component>
		</component>
		
		<component name="dispensedDrug" class="gov.va.med.cds.template.generated.pharmacy.DispensedDrugInstance">
			<component name="drugUnitPrice" class="gov.va.med.cds.template.generated.basedatatypes.Money">
				<component name="currency" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="DRUG_UNITPRICE_CODE" type="java.lang.String" />
					<property name="displayText" column="DRUG_UNITPRICE_DSPLYTXT" type="java.lang.String" />
					<property name="codingSystem" column="DRUG_UNITPRICE_CODSYS" type="java.lang.String" />
				</component>
				<property name="value" column="DRUG_UNITPRICE_VAL" type="java.lang.String" />
			</component>
			<property name="expirationDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType">
				<column name="EXPIRATION_DT"/>
				<column name="EXPIRATION_DT_NBR"/>
			</property>
			<property name="lotId" column="LOT_ID" type="java.lang.String" />
			<component name="ndc" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
				<property name="code" column="NDC_CODE" type="java.lang.String" />
				<property name="displayText" column="NDC_DSPLYTXT" type="java.lang.String" />
				<property name="codingSystem" column="NDC_CODSYS" type="java.lang.String" />
			</component>
		</component>
		
		<!-- import from .../common/PharmacistPractitionerParticipation.hbm -->
		&pharmacist;

		<!-- import from .../common/CurrentProviderPractitionerLite.hbm -->
		&currentProvider;

    </class>
</hibernate-mapping>
