<?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 lazy="false" entity-name="activityLog40010" table="VISTA_HDSI.PRESCRIPTIOX_ACTIVITY_LOG_52_3" name="gov.va.med.cds.template.generated.pharmacy.ActivityLog" >
	
		<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="id" column="PRESCRIPTION" type="gov.va.med.cds.persistence.hibernate.common.VistaRowIdUserType" insert="false" update="false" />
	 	
	 	<property name="prescription" column="PRESCRIPTION" type="big_decimal" insert="false" update="false" />
		
		<property name="activityDate" formula="STRING(ACTIVITY_LOG,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserTypeNoTimezone" />
		
            <component name="reason" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
                <property name="code" type="java.lang.String">
                    <formula>
                    (CASE
                    WHEN ( REASON = 'HOLD' ) THEN 'H'
                    WHEN ( REASON = 'UNHOLD' ) THEN 'U'
                    WHEN ( REASON = 'DISCONTINUED' ) THEN 'C'
                    WHEN ( REASON = 'EDIT' ) THEN 'E'
                    WHEN ( REASON = 'RENEWED' ) THEN 'L'
                    WHEN ( REASON = 'PARTIAL' ) THEN 'P'
                    WHEN ( REASON = 'REINSTATE' ) THEN 'R'
                    WHEN ( REASON = 'REPRINT' ) THEN 'W'
                    WHEN ( REASON = 'SUSPENDED' ) THEN 'S'
                    WHEN ( REASON = 'RETURNED' ) THEN 'I'
                    WHEN ( REASON = 'INTERVENTION' ) THEN 'V'
                    WHEN ( REASON = 'DELETED' ) THEN 'D'
                    WHEN ( REASON = 'DRUG INTERACTION' ) THEN 'A'
                    WHEN ( REASON = 'PROCESSED' ) THEN 'B'
                    WHEN ( REASON = 'INTERFACE' ) THEN 'X'
                    WHEN ( REASON = 'PATIENT INST' ) THEN 'G'
                    WHEN ( REASON = 'PKI/DEA' ) THEN 'K'
                    WHEN ( REASON = 'DISPENSE COMPLETION' ) THEN 'N'
                    WHEN ( REASON = 'ECME' ) THEN 'M'
                    ELSE NULL
                    END)
                </formula>
                </property>
                <property name="displayText" column="REASON" type="java.lang.String" />
                <property name="codingSystem" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_52.3'" type="java.lang.String" />
            </component>

			<component name="initiator"  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="INITIATOR_OF_ACTIVITY" type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType" />
						<property name="assigningFacility" type="java.lang.String" insert="false" update="false">
							<formula>
								(CASE
                         			WHEN (INITIATOR_OF_ACTIVITY IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()
                         			ELSE NULL
                      			END)
							</formula>
						</property>
						<property name="assigningAuthority" type="java.lang.String">
							<formula>
								(CASE
                         			WHEN (INITIATOR_OF_ACTIVITY IS NOT NULL) THEN 'USVHA'
                         			ELSE NULL
                      			END)
							</formula>
						</property>
					</component>
					<property name="idSourceTable" type="java.lang.String">
						<formula>
							(CASE
                         		WHEN (INITIATOR_OF_ACTIVITY IS NOT NULL) THEN 'VISTA200'
                         		ELSE NULL
                      		END)
						</formula>
					</property>
					<property name="name" formula="VISTA_HDSI.HDSREPSQLUtil1_MiscNameNE(INITIATOR_OF_ACTIVITY)" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false" />
				</component>	
			</component>
		<property name="comment" column="COMMENT" type="java.lang.String"/>
	</class>
</hibernate-mapping>
