<?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="labTest" table="VISTA_HDSI.LABORATORY_TEST_60_EXT" lazy="false" node="labTest">

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

		<property name="dataNameX" type="big_decimal" column="DATA_NAME"/>

		<component node="orderedTestCode" name="orderedTestCode">
			<property name="code" column="OrderedTestCodeExt" type="java.lang.String" node="code"/>
			<property name="displayText" type="java.lang.String" node="displayText">
				<formula>
					(CASE
					WHEN (OrderedTestCodeExt IS NOT NULL) THEN OrderedTestTextExt
					ELSE NULL
					END) 
		 </formula>
			</property>
			<property name="codingSystem" type="java.lang.String" node="codingSystem">
				<formula>
					(CASE
					WHEN (OrderedTestCodeExt IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_64'
					ELSE NULL
					END) 
		 </formula>
			</property>
		</component>

		<property name="chemistryResults" formula="''" type="java.lang.String" node="chemistryResults"/>

	</class>

	<class entity-name="orderedTestCode" table="VISTA_HDSI.WKLD_CODE_64" lazy="false" node="orderedTestCode">

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

		<property name="defaultLoincCode" column="DEFAULT_LOINC_CODE" type="big_decimal" node="defaultLoincCode"/>

		<property name="code" column="WKLD_CODE" type="java.lang.String" node="code"/>

		<property name="displayText" type="java.lang.String" node="displayText">
			<formula>
				(CASE
				WHEN (PROCEDURE_01 IS NOT NULL) THEN PROCEDURE_01
				ELSE NULL
				END)
				</formula>
		</property>
		<property name="codingSystem" type="java.lang.String" node="codingSystem">
			<formula>
				(CASE
				WHEN (PROCEDURE_01 IS NOT NULL) THEN VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_64'
				ELSE NULL
				END)
        			</formula>
		</property>
	</class>

	<query name="MHVLabChemHemRead1.LabTestPromise.labTests"> 
	 <![CDATA[ 
	 from labTest labTest
	 where labTest.id = :labTestFieldNum
	 ]]>
	</query>

	<query name="MHVLabChemHemRead1.LabTestPromises.labTests.orderedTestCode1"> 
	 	<![CDATA[ 
	 		from orderedTestCode orderedTestCode
	 		where orderedTestCode.defaultLoincCode = :loincCode and orderedTestCode.code like :workLoadCode
	 	]]>
	</query>

	<query name="MHVLabChemHemRead1.LabTestPromises.labTests.orderedTestCode2"> 
	 	<![CDATA[ 
	 		from orderedTestCode orderedTestCode
	 		where orderedTestCode.defaultLoincCode = :loincCode
	 	]]>
	</query>
</hibernate-mapping>