<?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="SkintestRead3" table="VISTA_HDSI.V_SKIN_TEST_9000010_12_EXT" name="gov.va.med.cds.template.generated.immunizationskintests.SkinTestProcedure">

		<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" />

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

		<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_12'" 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="testCode" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
			<property name="alternateCode" column="SKIN_TEST" type="gov.va.med.cds.persistence.hibernate.common.VistaIntegerToStringUserType" insert="false" update="false"/>
			<property name="alternateDisplayText" column="SKINTESTX" type="java.lang.String"/>
		</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="comment" column="VisitComments" type="java.lang.String" />
			</component>
			<component name="serviceCategory" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
				<property name="alternateCode" column="VisitServiceCategoryAltCode" type="java.lang.String" />
				<property name="alternateDisplayText" node="alternateDisplayText" type="java.lang.String">
					<formula>
						(CASE
						WHEN ( VisitServiceCategoryAltCode = 'A' ) THEN 'AMBULATORY'
						WHEN ( VisitServiceCategoryAltCode = 'H' ) THEN 'HOSPITALIZATION'
						WHEN ( VisitServiceCategoryAltCode = 'I' ) THEN 'IN	HOSPITAL'
						WHEN ( VisitServiceCategoryAltCode = 'C' ) THEN 'CHART REVIEW'
						WHEN ( VisitServiceCategoryAltCode = 'T' ) THEN 'TELECOMMUNICATIONS'
						WHEN ( VisitServiceCategoryAltCode = 'N' ) THEN 'NOT FOUND'
						WHEN ( VisitServiceCategoryAltCode = 'S' ) THEN 'DAY SURGERY'
						WHEN ( VisitServiceCategoryAltCode = 'O' ) THEN 'OBSERVATION'
						WHEN ( VisitServiceCategoryAltCode = 'E' ) THEN 'EVENT (HISTORICAL)'
						WHEN ( VisitServiceCategoryAltCode = 'R' ) THEN 'NURSING HOME'
						WHEN ( VisitServiceCategoryAltCode = 'D' ) THEN 'DAILY HOSPITALIZATION DATA'
						WHEN ( VisitServiceCategoryAltCode = '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="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" />
			
		</component>

		<component name="skinTestProcedureCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="CptCode" type="java.lang.String"/>
			<property name="displayText" column="CptCodeShortName" type="java.lang.String"/>
			<property name="codingSystem" type="java.lang.String">
				<formula>
					(CASE
					WHEN (( CptCode IS NOT NULL ) OR (CptCodeShortName IS
					NOT NULL))
					THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_81'
					ELSE NULL
					END )
				</formula>
			</property>
		</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_12'" 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="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="skintestObservation" class="gov.va.med.cds.template.generated.immunizationskintests.SkinTestObservation">
			<property name="dateRead" formula="STRING(DATE_READ,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" />
			<component name="reading" node="gov.va.med.cds.template.generated.basedatatypes.PhysicalQuantity">
				<property name="value" formula="STRING(READING,' mm')" type="java.lang.String"/>
			</component>
			<component name="testResults" node="gov.va.med.cds.template.generated.immunizationskintests.SkinTestObservation$TestResults">
				<component name="singleResult" class="gov.va.med.cds.template.generated.basedatatypes.VACode">
					<property name="alternateCode" type="java.lang.String" column="RESULTS" />
					<property name="alternateDisplayText" type="java.lang.String">
						<formula>
							(CASE
							WHEN ( RESULTS = 'P' ) THEN 'POSITIVE'
							WHEN ( RESULTS = 'N' ) THEN 'NEGATIVE'
							WHEN ( RESULTS = 'D' ) THEN 'DOUBTFUL'
							WHEN ( RESULTS = 'O' ) THEN 'NO TAKE'
							ELSE NULL
							END)
						</formula>
					</property>
				</component>
			</component>
		</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="dataSource" class="gov.va.med.cds.template.generated.immunizationskintests.DataSource">
			<property name="sourceName" column="DATASOURCEX" type="java.lang.String"  />
		</component>

		<component name="softwarePackage" node="softwarePackage">
			<property name="name" column="PACKAGEX" 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>
			<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>

	</class>

	<query name="SkintestRead3.SkinTestProcedure.skinTestProcedures"> 
		 <![CDATA[from SkintestRead3 skintest where skintest.patient.identifier.identity in (:pids)]]>
	</query>
</hibernate-mapping>
