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

<hibernate-mapping>
	<class entity-name="ImmunizationRead3" table="VISTA_HDSI.V_IMMUNIZATION_9000010_11_EXT" name="gov.va.med.cds.template.generated.immunizationskintests.ImmunizationEvent">

		<id name="idV" type="big_decimal">
			<column name="ROWID" />
			<generator class="assigned" />
		</id>

		<property name="idV" column="ROWID" type="big_decimal" insert="false" update="false" />

		<component name="contraIndication"  class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="CONTRAINDICATED" type="java.lang.String"  />
			<property name="displayText" type="java.lang.String" >
				<formula>
					(CASE
					WHEN ( CONTRAINDICATED = '0' ) THEN 'NO (OK TO USE IN THE FUTURE)'
					WHEN ( CONTRAINDICATED = '1' ) THEN 'YES (DO NOT REPEAT THIS VACCINE)'
					ELSE NULL
					END)
				</formula>
			</property>
		</component>

		<property name="date" formula="STRING(EVENT_DATE_AND_TIME,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" insert="false" update="false"/>

		<component name="recordIdentifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier" >
			<property name="identity" type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType" insert="false" update="false">
				<column name="RowId"/>
			</property>
			<property name="namespaceId" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_9000010_11'" type="java.lang.String"  />
			<property name="universalId" formula="VISTA_HDSI.HDSREPSQLUtil1_KSPDomainName()" type="java.lang.String" />
			<property name="universalIdType" formula="'DNS'" type="java.lang.String"  />
		</component>

		<component name="series" class="gov.va.med.cds.template.generated.basedatatypes.VACode" >
			<property name="alternateCode" column="SERIES" type="java.lang.String"  />
			<property name="alternateDisplayText"  >
				<formula>
					(CASE
					WHEN ( SERIES = 'P' ) THEN 'PARTIALLY COMPLETE'
					WHEN ( SERIES = 'C' ) THEN 'COMPLETE'
					WHEN ( SERIES = 'B' ) THEN 'BOOSTER'
					WHEN ( SERIES = '1' ) THEN 'SERIES 1'
					WHEN ( SERIES = '2' ) THEN 'SERIES 2'
					WHEN ( SERIES = '3' ) THEN 'SERIES 3'
					WHEN ( SERIES = '4' ) THEN 'SERIES 4'
					WHEN ( SERIES = '5' ) THEN 'SERIES 5'
					WHEN ( SERIES = '6' ) THEN 'SERIES 6'
					WHEN ( SERIES = '7' ) THEN 'SERIES 7'
					WHEN ( SERIES = '8' ) THEN 'SERIES 8'
					ELSE NULL
					END)
				</formula>
			</property>
		</component>

		<component name="visit" class="gov.va.med.cds.template.generated.common.ImmunizationSkinTestVisit">
			<component name="comments" class="gov.va.med.cds.template.generated.common.ImmunizationSkinTestVisit$Comments">
				<property name="singleComment" column="VisitComments" type="java.lang.String" />
			</component>
			<component name="serviceCategory" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
				<property name="alternateCode" column="ServiceCategory" type="java.lang.String"  />
				<property name="alternateDisplayText" type="java.lang.String">
					<formula>
						(CASE
						WHEN ( ServiceCategory = 'A' ) THEN 'AMBULATORY'
						WHEN ( ServiceCategory = 'H' ) THEN 'HOSPITALIZATION'
						WHEN ( ServiceCategory = 'I' ) THEN 'IN	HOSPITAL'
						WHEN ( ServiceCategory = 'C' ) THEN 'CHART REVIEW'
						WHEN ( ServiceCategory = 'T' ) THEN 'TELECOMMUNICATIONS'
						WHEN ( ServiceCategory = 'N' ) THEN 'NOT FOUND'
						WHEN ( ServiceCategory = 'S' ) THEN 'DAY SURGERY'
						WHEN ( ServiceCategory = 'O' ) THEN 'OBSERVATION'
						WHEN ( ServiceCategory = 'E' ) THEN 'EVENT (HISTORICAL)'
						WHEN ( ServiceCategory = 'R' ) THEN 'NURSING HOME'
						WHEN ( ServiceCategory = 'D' ) THEN 'DAILY HOSPITALIZATION DATA'
						WHEN ( ServiceCategory = 'X' ) THEN 'ANCILLARY PACKAGE DAILY DATA'
						ELSE NULL
						END)
					</formula>
				</property>
			</component>
			<property name="visitCheckOutDate" formula="STRING(VisitCheckOutDate,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" />
			<component name="visitDate" class="gov.va.med.cds.template.generated.basedatatypes.TimeInterval">
				<property name="low" formula="STRING(VisitDate,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType"  />
			</component>
			<component name="visitId" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier" >
				<property name="identity" column="VisitId" type="java.lang.String"  />
				<property name="namespaceId" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_9000010'" type="java.lang.String"  />
			</component>
			<property name="visitAdmitDate" formula="STRING(VISTA_HDSI.HDSREPSQLUtil1_VisitDateTime(VISIT),'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType"/>
		</component>

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

		<component name="patient" class="gov.va.med.cds.template.generated.common.PatientLite">
			<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonIdentifier">
				<property name="identity" column="PATIENT_NAME" type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType" insert="false" update="false" />
				<property name="assigningFacility" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()" type="java.lang.String" insert="false" update="false"  />
				<property name="assigningAuthority" formula="'USVHA'" type="java.lang.String"  />
			</component>
			<property name="name" formula="VISTA_HDSI.HDSREPSQLUtil1_PatientNE(PATIENT_NAME)" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false" />
		</component>
	
		<component name="diagnosis" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode"  type="java.lang.String" column="DIAGNOSISX" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSISX IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="DiagnosisAltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis2" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode"  type="java.lang.String" column="DIAGNOSIS2X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS2X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText"  type="java.lang.String" column="Diagnosis2AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis3" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode"  type="java.lang.String" column="DIAGNOSIS3X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS3X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis3AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis4" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode"  type="java.lang.String" column="DIAGNOSIS4X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS4X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis4AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis5" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode" type="java.lang.String" column="DIAGNOSIS5X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS5X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis5AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis6" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode" type="java.lang.String" column="DIAGNOSIS6X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS6X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis6AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis7" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode" type="java.lang.String" column="DIAGNOSIS7X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS7X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis7AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="diagnosis8" class="gov.va.med.cds.template.generated.common.Diagnosis">
			<component name="icdCodes" class="gov.va.med.cds.template.generated.common.Diagnosis$IcdCodes">
				<component name="singleIcdCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode" type="java.lang.String" column="DIAGNOSIS8X" />
					<property name="alternateCodingSystem" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( DIAGNOSIS8X IS NOT NULL )
							THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_80_.01'
							ELSE NULL
							END )
		        		</formula>
					</property>
					<property name="alternateDisplayText" type="java.lang.String" column="Diagnosis8AltDisplayText" insert="false" update="false" />
				</component>
			</component>
		</component>

		<component name="recordSource" class="gov.va.med.cds.template.generated.basedatatypes.HL72FacilityIdentifier">
			<property name="namespaceId" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_9000010_11'" type="java.lang.String"  />
			<property name="universalId" formula="VISTA_HDSI.HDSREPSQLUtil1_KSPDomainName()" type="java.lang.String" />
			<property name="universalIdType" formula="'DNS'" type="java.lang.String" />
		</component>

		<component name="editedFlag" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="EDITED_FLAG" type="java.lang.String"  />
		</component>

		<property name="auditTrail" column="AUDIT_TRAIL" type="java.lang.String"  />

		<property name="comments" column="COMMENTS" type="java.lang.String"  />

		<component name="verified" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="VERIFIED" type="java.lang.String"  />
		</component>

		<component name="orderingProvider" 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="ORDERING_PROVIDER" type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType" insert="false" update="false"/>
				<property name="assigningFacility" type="java.lang.String" >
					<formula>
						(CASE
						WHEN (ORDERING_PROVIDER IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()
						ELSE NULL
						END)
					</formula>
				</property>
				<property name="assigningAuthority" type="java.lang.String" >
					<formula>
						(CASE
						WHEN (ORDERING_PROVIDER IS NOT NULL) THEN 'USVHA'
						ELSE NULL
						END)
					</formula>
				</property>
			</component>
			<property name="idSourceTable" type="java.lang.String" >
				<formula>
					(CASE
					WHEN (ORDERING_PROVIDER IS NOT NULL) THEN 'VISTA200'
					ELSE NULL
					END)
				</formula>
			</property>
			<!-- The Performer is the Ordering Provider as well as per VHIM Mapping -->
			<property name="name" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType">
				<formula>
					(CASE
					WHEN (ORDERING_PROVIDER IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_MiscNameNE(ORDERING_PROVIDER)
					ELSE NULL
					END)
			 	</formula>
			</property>
		</component>

		<component name="remarks" class="gov.va.med.cds.template.generated.immunizationskintests.ImmunizationEvent$Remarks">
			<property name="SingleRemark" type="java.lang.String" column="REMARKSGWP" />
		</component>

		<component name="dataSource" class="gov.va.med.cds.template.generated.immunizationskintests.DataSource">
			<property name="sourceName" column="DATASOURCEX" type="java.lang.String" />
		</component>

		<component name="softwarePackage" class="gov.va.med.cds.template.generated.immunizationskintests.SoftwarePackage">
			<property name="name" column="PACKAGEX" type="java.lang.String" />
		</component>

		<component name="reactionObservationEvents" class="gov.va.med.cds.template.generated.immunizationskintests.ImmunizationEvent$ReactionObservationEvents">
			<component name="singleReactionObservationEvent" class="gov.va.med.cds.template.generated.immunizationskintests.ReactionObervationEvent">
				<component name="reaction" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="REACTION" type="java.lang.String" />
					<property name="displayText" type="java.lang.String" >
						<formula>
							(CASE
							WHEN ( REACTION = '0' ) THEN 'NONE'
							WHEN ( REACTION = '1' ) THEN 'FEVER'
							WHEN ( REACTION = '2' ) THEN 'IRRITABILITY'
							WHEN ( REACTION = '3' ) THEN 'LOCAL REACTION OR SWELLING'
							WHEN ( REACTION = '4' ) THEN 'VOMITING'
							WHEN ( REACTION = '5' ) THEN 'RASH OR ITCHING'
							WHEN ( REACTION = '6' ) THEN 'LETHARGY'
							WHEN ( REACTION = '7' ) THEN 'CONVULSIONS'
							WHEN ( REACTION = '8' ) THEN 'ARTHRITIS OR ARTHRALGIAS'
							WHEN ( REACTION = '9' ) THEN 'ANAPHYLAXIS OR COLLAPSE'
							WHEN ( REACTION = '10' ) THEN 'RESPIRATORY DISTRESS'
							WHEN ( REACTION = '11' ) THEN 'OTHER'
							ELSE NULL
							END)
						</formula>
					</property>
				</component>
			</component>
		</component>

		<component name="immunizationAdministered" class="gov.va.med.cds.template.generated.immunizationskintests.AdministeredImmunization">
			<property name="immunizationName" column="IMMUNIZATIONX" type="java.lang.String" />
			<property name="immunizationShortName" column="ImmunizationShortName" type="java.lang.String" />
		</component>
	</class>


	<query name="ImmunizationRead3.ImmunizationEvent.immunizationEvents"> 
		 <![CDATA[from ImmunizationRead3 imm where imm.patient.identifier.identity in (:pids)]]>
	</query>

</hibernate-mapping>
