<?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 default-lazy="false" default-cascade="all">
    
    <!-- otherCosigners: New Person and Name Components Classes -->
    <class entity-name="TiuManagedPractPartLiteOtherCosigners" table="VISTA_HDSI.TIU_MULTIPLE_SIG_8925_7_EXT" name="gov.va.med.cds.template.generated.tiu.ClincalDocumentEvent$OtherCosigners">
    
        <id name="idV" type="big_decimal">
            <column name="ROWID" />
            <generator class="assigned" />
        </id>
        
        <property name="tiuDocumentNumber" column="TIU_DOCUMENT_NUMBER" type="big_decimal" insert="false" update="false" />
        
        <component name="singleOtherCosigner" class="gov.va.med.cds.template.generated.common.ManagedPractitionerParticipationLite">
        
	        <property name="participationDate" formula="STRING(COSIGNATURE_DATETIME,'^',VISTA_HDSI.HDSREPSQLUtil1_StationNumber())" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" insert="false" update="false" />
	        <property name="signatureBlockName" column="COSIGNERS_SIGNATURE_BLOCK" type="java.lang.String" />
	        <property name="signatureBlockTitle" column="COSIGNERS_TITLE" type="java.lang.String" />
	        
	        <component name="signatureMode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite" >
	             <property name="codingSystem" type="java.lang.String" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_50.7'" />
	             <property name="displayText" type="java.lang.String">
	               <formula>
	                 (CASE
	                  WHEN ( COSIGNATURE_MODE = 'E' ) THEN 'ELECTRONIC'
	                  WHEN ( COSIGNATURE_MODE = 'C' ) THEN 'CHART'
	                  ELSE COSIGNATURE_MODE
	                  END )
                </formula>
	             </property>
	        </component>
	        <component name="practitioner" class="gov.va.med.cds.template.generated.common.PractitionerLite">
				<property name="identifier" formula="OtherCosignersNE||'^'||VISTA_HDSI.HDSREPSQLUtil1_StationNumber()" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonIdentifierUserType" insert="false" update="false"/>
				<property name="name" column="OtherCosignersNE" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false"/>
			</component>
        </component>
         
    </class>
    
    
    <!-- otherCosigners: New Person and Name Components Classes -->
    <class entity-name="TiuManagedPractPartLiteOtherCosignersDetail" table="VISTA_HDSI.TIU_MULTIPLE_SIG_8925_7_EXT" name="gov.va.med.cds.template.generated.common.ManagedPractitionerParticipationLite">
    
        <id name="idV" type="big_decimal">
            <column name="ROWID" />
            <generator class="assigned" />
        </id>
        
        <property name="tiuDocumentNumber" column="TIU_DOCUMENT_NUMBER" type="big_decimal" insert="false" update="false" />
        
        <property name="participationDate" formula="STRING(COSIGNATURE_DATETIME,'^',VISTA_HDSI.HDSREPSQLUtil1_StationNumber())" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" insert="false" update="false" />
        <property name="signatureBlockName" column="COSIGNERS_SIGNATURE_BLOCK" type="java.lang.String" />
        <property name="signatureBlockTitle" column="COSIGNERS_TITLE" type="java.lang.String" />
        
        <component name="signatureMode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite" >
             <property name="codingSystem" type="java.lang.String" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()||'_50.7'" />
             <property name="displayText" type="java.lang.String" >
                 <formula>
                   (CASE
                    WHEN ( COSIGNATURE_MODE = 'E' ) THEN 'ELECTRONIC'
                    WHEN ( COSIGNATURE_MODE = 'C' ) THEN 'CHART'
                    ELSE COSIGNATURE_MODE
                    END )
                </formula>
               </property>
        </component>
        
        <component name="practitioner" class="gov.va.med.cds.template.generated.common.PractitionerLite">
			<property name="identifier" formula="OtherCosignersNE||'^'||VISTA_HDSI.HDSREPSQLUtil1_StationNumber()" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonIdentifierUserType" insert="false" update="false"/>
			<property name="name" column="OtherCosignersNE" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false"/>
		</component>
        
    </class>

    <!-- otherExpectedCosigners: New Person and Name Components Classes -->
    <class entity-name="TiuManagedPractPartLiteOtherExpectedCosigners" table="VISTA_HDSI.TIU_MULTIPLE_SIG_8925_7_EXT" name="gov.va.med.cds.template.generated.tiu.ClincalDocumentEvent$OtherExpectedCosigners">
    
        <id name="idV" type="big_decimal">
            <column name="ROWID" />
            <generator class="assigned" />
        </id>
        
        <property name="tiuDocumentNumber" column="TIU_DOCUMENT_NUMBER" type="big_decimal" insert="false" update="false" />
        
         <component name="singleOtherExpectedCosigner" class="gov.va.med.cds.template.generated.common.PractitionerLite">
			<property name="identifier" formula="OtherExpectedCosignersNE||'^'||VISTA_HDSI.HDSREPSQLUtil1_StationNumber()" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonIdentifierUserType" insert="false" update="false"/>
			<property name="name" column="OtherExpectedCosignersNE" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false"/>
		</component>

    </class>
    
    
    <!-- Association otherExpectedCosigners Queries -->
    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherExpectedCosigners.date.documentClass">
        <![CDATA[
         select oec
         from TiuManagedPractPartLiteOtherExpectedCosigners oec, TiuDocumentListRead2 cd
         where cd.idV = oec.tiuDocumentNumber
            and cd.patient.identifier.identity in ( :pids )
         	and cd.referenceDate.timestamp between :startDate and :endDate
         	and VISTA_HDSI.HDSREPTIUUtil1_IsDocOfClass(cd.idV, :documentClass)=1 
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>
    
    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherExpectedCosigners.documentClass">
        <![CDATA[
         select oec
         from TiuManagedPractPartLiteOtherExpectedCosigners oec, TiuDocumentListRead2 cd
         where cd.idV = oec.tiuDocumentNumber
            and cd.patient.identifier.identity in ( :pids )
         	and VISTA_HDSI.HDSREPTIUUtil1_IsDocOfClass(cd.idV, :documentClass)=1 
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>


     <!-- Association otherExpectedCosigners Queries -->
    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherExpectedCosigners.date.documentType">
        <![CDATA[
         select oec
         from TiuManagedPractPartLiteOtherExpectedCosigners oec, TiuDocumentListRead2 cd
         where cd.idV = oec.tiuDocumentNumber
            and cd.patient.identifier.identity in ( :pids )
         	and cd.referenceDate.timestamp between :startDate and :endDate
         	and cd.standardizedDocumentType.code in ( :documentType )
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>

    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherExpectedCosigners.documentType">
        <![CDATA[
         select oec
         from TiuManagedPractPartLiteOtherExpectedCosigners oec, TiuDocumentListRead2 cd
         where cd.idV = oec.tiuDocumentNumber
            and cd.patient.identifier.identity in ( :pids )
         	and cd.standardizedDocumentType.code in ( :documentType )
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>
    
  
    <!-- Association otherCosigners Queries -->
    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherCosigners.date.documentClass">
        <![CDATA[
         select oc
         from TiuManagedPractPartLiteOtherCosigners oc, TiuDocumentListRead2 cd
         where cd.idV = oc.tiuDocumentNumber
         	and cd.patient.identifier.identity in ( :pids )
         	and cd.referenceDate.timestamp between :startDate and :endDate
         	and VISTA_HDSI.HDSREPTIUUtil1_IsDocOfClass(cd.idV, :documentClass)=1 
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>

    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherCosigners.documentClass">
        <![CDATA[
         select oc
         from TiuManagedPractPartLiteOtherCosigners oc, TiuDocumentListRead2 cd
         where cd.idV = oc.tiuDocumentNumber
         	and cd.patient.identifier.identity in ( :pids )
         	and VISTA_HDSI.HDSREPTIUUtil1_IsDocOfClass(cd.idV, :documentClass)=1 
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>

    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherCosigners.date.documentType">
        <![CDATA[
         select oc
         from TiuManagedPractPartLiteOtherCosigners oc, TiuDocumentListRead2 cd
         where cd.idV = oc.tiuDocumentNumber
         	and cd.patient.identifier.identity in ( :pids )
         	and cd.referenceDate.timestamp between :startDate and :endDate
         	and cd.standardizedDocumentType.code in ( :documentType )
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>

    <query name="TiuDocumentListRead2.ClinicalDocumentEvent.otherCosigners.documentType">
        <![CDATA[
         select oc
         from TiuManagedPractPartLiteOtherCosigners oc, TiuDocumentListRead2 cd
         where cd.idV = oc.tiuDocumentNumber
         	and cd.patient.identifier.identity in ( :pids )
         	and cd.standardizedDocumentType.code in ( :documentType )
         	and cd.statusCode.code in ('4501286','4501290','4501014')
      ]]>
    </query>
    
</hibernate-mapping>