<?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="partialDispense40010" lazy="false" table="VISTA_HDSI.PRESCRIPTIOX_PARTIAL_52_2_EXT" name="gov.va.med.cds.template.generated.pharmacy.OutpatientMedicationDispense">

		<composite-id name="idV"  class="gov.va.med.cds.persistence.hibernate.common.VistaPharmacyCompositeRowIdUserType" >
			<key-property name="PRESCRIPTION" column="PRESCRIPTION" type="big_decimal"/>
			<key-property name="CHILDSUB1" column="CHILDSUB1" type="big_decimal"/>
	 	</composite-id> 
		
		<property name="prescription" column="PRESCRIPTION" type="big_decimal" insert="false" update="false" />

		<property name="singleComment" column="REMARKS" type="java.lang.String" />
	
		<property name="dispenseDate" formula="STRING(DISPENSED_DATE,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserTypeNoTimezone"  />

		<property name="fillDate" formula="STRING(PARTIAL_DATE,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserTypeNoTimezone"  />
		
		<component name="quantityDispensed" class="gov.va.med.cds.template.generated.basedatatypes.PhysicalQuantity">
			<property name="value" column="QTY" type="gov.va.med.cds.persistence.hibernate.common.VistaBigDecimalToStringUserType" />
		</component>
			
		<component name="currentProvider" class="gov.va.med.cds.template.generated.common.PractitionerLite">
			<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonIdentifier">
				<property name="identity" column="PROVIDER"  type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType"/>
				<property name="assigningFacility" type="java.lang.String" insert="false" update="false">
							<formula>
								(CASE
                         			WHEN (PROVIDER IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()
                         			ELSE NULL
                      			END)
							</formula>
						</property>
						<property name="assigningAuthority" type="java.lang.String">
							<formula>
								(CASE
                         			WHEN (PROVIDER IS NOT NULL) THEN 'USVHA'
                         			ELSE NULL
                      			END)
							</formula>
						</property>
					</component>
					<property name="idSourceTable" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (PROVIDER IS NOT NULL) THEN 'VISTA200'
                         		ELSE NULL
                      		END)
						</formula>
					</property>
			<property name="name" formula="VISTA_HDSI.HDSREPSQLUtil1_MiscNameNE(PROVIDER)" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false"/>
		</component>
			
		<property name="loginDate" formula="STRING(LOGIN_DATE,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserTypeNoTimezone" />
		<property name="daysSupply" column="DAYS_SUPPLY" type="gov.va.med.cds.persistence.hibernate.common.VistaIntegerToStringUserType" />
		
			<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier">
				<property name="identity" column="RowId" type="java.lang.String" />
				<property name="namespaceId" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_52.2'" type="java.lang.String" />
			</component>
		
			<property name="mailWindow" column="MAILWINDOW" type="java.lang.String" />
			<property name="releaseDate" formula="STRING(RELEASED_DATETIME,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserTypeNoTimezone"  />

			<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" type="java.lang.String" />
					<property name="displayText" column="DIVISIONX" type="java.lang.String" />
					<property name="codingSystem" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (DIVISION IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_52.2_.09' 
                         		ELSE NULL
                      		END)
						</formula>
					</property>
				</component>
				
				<component name="ncpdpId" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="NCPDP_NUMBER" type="java.lang.String" />
					<property name="codingSystem" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (NCPDP_NUMBER IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_52.2_.09' 
                         		ELSE NULL
                      		END)
						</formula>
					</property>
				</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">
					<property name="value" column="CURRENT_UNIT_PRICE_OF_DRUG" type="java.lang.String" />
				</component>			
				<property name="expirationDate" formula="STRING(DRUG_EXPIRATION_DATE,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" insert="false" update="false" />
				<property name="lotId" column="LOT_" type="java.lang.String" />
				<component name="ndc" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="NDC" type="java.lang.String" />
					<property name="codingSystem" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (NDC IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_52.2_.09' 
                         		ELSE NULL
                      		END)
						</formula>
					</property>
				</component>
			</component>

			<component name="pharmacist" class="gov.va.med.cds.template.generated.common.PractitionerParticipationLite">
				<component name="practitioner" class="gov.va.med.cds.template.generated.common.PractitionerLite">
					<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonIdentifier">
						<property name="identity" column="PHARMACIST_NAME"  type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType"/>
						<property name="assigningFacility" type="java.lang.String" insert="false" update="false">
							<formula>
								(CASE
                         			WHEN (PHARMACIST_NAME IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()
                         			ELSE NULL
                      			END)
							</formula>
						</property>
						<property name="assigningAuthority" type="java.lang.String">
							<formula>
								(CASE
                         			WHEN (PHARMACIST_NAME IS NOT NULL) THEN 'USVHA'
                         			ELSE NULL
                      			END)
							</formula>
						</property>
					</component>
					<property name="idSourceTable" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (PHARMACIST_NAME IS NOT NULL) THEN 'VISTA200'
                         		ELSE NULL
                      		END)
						</formula>
					</property>
					<property name="name" formula="VISTA_HDSI.HDSREPSQLUtil1_MiscNameNE(PHARMACIST_NAME)" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false" />
				</component>
			</component>
	</class>
</hibernate-mapping>
