<?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 name="gov.va.med.cds.template.generated.pharmacy.OutpatientMedicationPromise" table="OUTPATIENT_MED_PRM30_V" lazy="false" >
		<id name="id" type="java.lang.Long">
			<column name="OUTPATIENT_MED_PRM_ID"/>
			<generator class="sequence">
				<param name="sequence">outpatient_med_prm_seq_id</param>
			</generator>
		</id>
		
		<!-- From superclass.  Additional maps in the set section below -->
		<component name="recordIdentifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier">
			<property name="identity" column="RECORDIDENTIFIER_IDENTITY" type="java.lang.String" />
			<property name="namespaceId" column="RECORDIDENTIFIER_NAMESPACEID" type="java.lang.String" />
			<property name="universalId" column="RECORDIDENTIFIER_UNIVERSALID" type="java.lang.String" />
			<property name="universalIdType" column="RECORDIDENTIFIER_UNIVERSTYP" type="java.lang.String" />
		</component>
		<property name="pdtsPrescriptionId" column="PDTS_PRESCRIPTION_ID" type="java.lang.String"/>
		<property name="prescriptionId" column="PRESCRIPTION_ID" type="java.lang.String"/>
		<property name="pharmacyPatientType" column="PHARMACY_PATIENT_TYP" type="java.lang.String"/>
		
		<component name="specialDrugTracking" class="gov.va.med.cds.template.generated.pharmacy.SpecialDrugTracking">
			<!--&drugTracking;-->
			 <component name="totalDailyDosage" class="gov.va.med.cds.template.generated.basedatatypes.PhysicalQuantity">
				<property name="value" column="TOT_DAILY_DOSAGE_VAL" type="java.lang.String" />
	        	<component name="unit" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="TOT_DAILY_DOSAGE_UOM_CODE" type="java.lang.String"  />
					<property name="displayText" column="TOT_DAILY_DOSAGE_UOM_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="TOT_DAILY_DOSAGE_UOM_CODSYS" type="java.lang.String"  />
				</component>
			</component>
       	 	<component name="wbcObservation" class="gov.va.med.cds.template.generated.pharmacy.WbcObservation">
        		<component name="count" class="gov.va.med.cds.template.generated.basedatatypes.PhysicalQuantity">
					<property name="value" column="WBC_OBS_CNT_VAL" type="java.lang.String" />
	        		<component name="unit" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
						<property name="code" column="WBC_OBS_CNTUOM_CODE" type="java.lang.String"  />
						<property name="displayText" column="WBC_OBS_CNTUOM_DSPLYTXT" type="java.lang.String"  />
						<property name="codingSystem" column="WBC_OBS_CNTUOM_CODSYS" type="java.lang.String"  />
					</component>
				</component>
       	 		<property name="testDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
        			<column name="TESTDATE_TM"/>
        			<column name="TESTDATE_TM_NBR"/>
        		</property>
			</component>
		</component>
		
		<!--&dataEnterer;-->
		<component name="dataEnterer" class="gov.va.med.cds.template.generated.common.PractitionerParticipationLite" >
        	<property name="comment" column="DATA_PRACTITIONER_COMMENTS" type="java.lang.String" />
    		<property name="time" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
    			<column name="DATA_PRACTITIONER_TM"/>
    			<column name="DATA_PRACTITIONER_TM_NBR"/>
    		</property>
       	 	<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="DATA_PERSON_IDENTITY" type="java.lang.String"  />
    				<property name="assigningFacility" column="DATA_PERSON_ASGNING_FACILITY" type="java.lang.String" />
    				<property name="assigningAuthority" column="DATA_PERSON_ASGNING_AUTHORITY" type="java.lang.String"  />
    			</component>
            	<property name="idSourceTable" column="DATA_PRACTITIONER_ID_SRC_TBL" type="java.lang.String" />
    			<component name="name"  class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonName" >
    				<property name="prefix" column="DATA_NAME_PREFIX" type="java.lang.String"  />
    				<property name="given" column="DATA_NAME_GIVEN" type="java.lang.String"  />
    				<property name="middle" column="DATA_NAME_MIDDLE" type="java.lang.String"/>
    				<property name="family" column="DATA_NAME_FAMILY" type="java.lang.String" />
    				<property name="suffix" column="DATA_NAME_SUFFIX" type="java.lang.String" />
    				<property name="title" column="DATA_NAME_TITLE" type="java.lang.String" />
    			</component>
			</component>
		</component>
		
		<component name="pharmacyRequest" node="pharmacyRequest">
			<!--&cosigner;-->
			<component name="cosigner" class="gov.va.med.cds.template.generated.common.PractitionerParticipationLite" >
        		<property name="comment" column="COSN_PRACTITIONER_COMMENTS" type="java.lang.String"/>
    			<property name="time" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
    				<column name="COSN_PRACTITIONER_TM"/>
    				<column name="COSN_PRACTITIONER_TM_NBR"/>
    			</property>
				<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="COSN_PERSON_IDENTITY" type="java.lang.String"  />
    					<property name="assigningFacility" column="COSN_PERSON_ASGNING_FACILITY" type="java.lang.String" />
    					<property name="assigningAuthority" column="COSN_PERSON_ASGNING_AUTHORITY" type="java.lang.String" />
    				</component>
            		<property name="idSourceTable" column="COSN_PRACTITIONER_ID_SRC_TBL" type="java.lang.String"  />
    				<component name="name" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonName" >
    					<property name="prefix" column="COSN_NAME_PREFIX" type="java.lang.String"  />
    					<property name="given" column="COSN_NAME_GIVEN" type="java.lang.String" />
    					<property name="middle" column="COSN_NAME_MIDDLE" type="java.lang.String" />
    					<property name="family" column="COSN_NAME_FAMILY" type="java.lang.String"/>
    					<property name="suffix" column="COSN_NAME_SUFFIX" type="java.lang.String" />
    					<property name="title" column="COSN_NAME_TITLE" type="java.lang.String" />
    				</component>
				</component>
			</component>
			<!--&pharmacyRequestMedicine;-->
			<component name="orderedMedication" node="orderedMedication">
				<component name="cmopDrugCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="PR_CMOPDRUG_CODE" type="java.lang.String"  />
					<property name="displayText" column="PR_CMOPDRUG_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="PR_CMOPDRUG_CODSYS" type="java.lang.String"  />
				</component>

	        	<component name="medicationCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElement">
					<property name="code" column="PR_MEDICATION_CODE" type="java.lang.String"  />
					<property name="displayText" column="PR_MEDICATION_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="PR_MEDICATION_CODSYS" type="java.lang.String"  />
					<property name="alternateCode" column="PR_MEDICATION_ALT_CODE" type="java.lang.String"  />
					<property name="alternateDisplayText" column="PR_MEDICATION_ALT_DSPLYTXT" type="java.lang.String"  />
					<property name="alternateCodingSystem" column="PR_MEDICATION_ALT_CODSYS" type="java.lang.String"  />
				</component>

	        	<component name="otcCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="PR_OTC_CODE" type="java.lang.String"  />
					<property name="displayText" column="PR_OTC_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="PR_OTC_CODSYS" type="java.lang.String"  />
				</component>

	        	<component name="tradeName" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="PR_TRADE_NAME_CODE" type="java.lang.String" />
					<property name="displayText" column="PR_TRADE_NAME_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="PR_TRADE_NAME_CODSYS" type="java.lang.String"  />
				</component>
			</component>

			<!--&pharmacyRequest;-->
		     <component name="genericRequestIdentifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72EntityIdentifier">
				<property name="identity" column="IDENTIFIER_IDENTITY" type="java.lang.String" />
				<property name="namespaceId" column="IDENTIFIER_NAMESPACEID" type="java.lang.String"/>
				<property name="universalId" column="IDENTIFIER_UNIVERSALID" type="java.lang.String" />
				<property name="universalIdType" column="IDENTIFIER_UNIVERSTYP" type="java.lang.String"/>
			</component>
			<component name="orderLocationIdentifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72LocationIdentifier">
            	<property name="pointOfCare" column="ORDER_LOC_POINT_OF_CARE" type="java.lang.String" />
            	<property name="room" column="ORDER_LOC_ROOM" type="java.lang.String" />
            	<property name="bed" column="ORDER_LOC_BED" type="java.lang.String"/>
            	<property name="facilityNamespaceId" column="ORDER_LOC_FCLTY_NMSPCID" type="java.lang.String"/>
            	<property name="facilityUniversalId" column="ORDER_LOC_FCLTY_UNVSID" type="java.lang.String" />
            	<property name="facilityUniversalIdType" column="ORDER_LOC_FCLTY_UNVSIDTYP" type="java.lang.String" />
            	<property name="personLocationType" column="ORDER_LOC_PERS_LOC_TYP" type="java.lang.String" />
            	<property name="locationDescription" column="ORDER_LOC_DESCRIPTION" type="java.lang.String"  />
        	</component>
			<component name="orderedItem" class="gov.va.med.cds.template.generated.common.PharmacyOrderableItem">
		    	<component name="itemCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="ITEM_CODE" type="java.lang.String"  />
					<property name="displayText" column="ITEM_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="ITEM_CODSYS" type="java.lang.String"  />
				</component>
	    		<component name="dosageFormCode" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
					<property name="code" column="DOSAGE_FORM_CODE" type="java.lang.String"  />
					<property name="displayText" column="DOSAGE_FORM_DSPLYTXT" type="java.lang.String"  />
					<property name="codingSystem" column="DOSAGE_FORM_CODSYS" type="java.lang.String"  />
				</component>
			</component>
			<component name="orderingInstitutionIdentifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72OrganizationIdentifier">
            	<property name="name" column="ORD_INST_NAME" type="java.lang.String"/>
            	<property name="identity" column="ORD_INST_IDENTITY" type="java.lang.String"  />
            	<property name="assigningAuthority" column="ORD_INST_ASSIGNING_AUTHORITY" type="java.lang.String"/>
       		</component>
			<property name="orderDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
    			<column name="ORDER_DT"/>
    			<column name="ORDER_DT_NBR"/>
    		</property>
			<property name="status" column="PHARMACY_REQ_STATUS" type="java.lang.String"  />
		 	<component name="statusModifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
				<property name="code" column="STATUS_MODIFIER_CODE" type="java.lang.String" />
				<property name="displayText" column="STATUS_MODIFIER_DSPLYTXT" type="java.lang.String"  />
				<property name="codingSystem" column="STATUS_MODIFIER_CODSYS" type="java.lang.String"  />
		 	</component>
		</component>
		
		<!--  From subclass -->
		<!--&patientLite;-->
		<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_IDENTITY" type="java.lang.String" not-null="true" />
				<property name="assigningFacility" column="PATIENT_ASSIGNING_FACILITY" type="java.lang.String" not-null="true" />
				<property name="assigningAuthority" column="PATIENT_ASSIGNING_AUTHORITY" type="java.lang.String" />
			</component>
	
			<component name="name" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonName">
				<property name="prefix" column="PATIENT_NAME_PREFIX" type="java.lang.String" />
				<property name="given" column="PATIENT_NAME_GIVEN" type="java.lang.String" />
				<property name="middle" column="PATIENT_NAME_MIDDLE" type="java.lang.String" />
				<property name="family" column="PATIENT_NAME_FAMILY" type="java.lang.String" />
				<property name="suffix" column="PATIENT_NAME_SUFFIX" type="java.lang.String" />
				<property name="title" column="PATIENT_NAME_TITLE" type="java.lang.String" />
			</component>
	
		</component>
		
		<property name="expirationDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
			<column name="OUTPMED_EXPIRATION_DT"/>
			<column name="OUTPMED_EXPIRATION_DT_NBR"/>
		</property>
		
		<property name="lastDispenseDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >	
				<column name="LAST_DISPENSE_DT"/>
				<column name="LAST_DISPENSE_DT_NBR"/>
		</property>
		<property name="numberOfRefillsAuthorized" column="NUM_REFILLS_AUTHORIZED" type="integer"/>
		
		<list name="patientInstructions" cascade="all" table="PATIENT_INSTRUCTION_V" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false" />
			<list-index column="LINE_NBR"  />
			<element type="string" column="PATIENT_INSTRUCTIONS" />
		</list> 
		
		<list name="otherPatientInstructions" table="OTHER_PATIENT_INSTRUCTION_V" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true"/>
			<list-index column="LINE_NBR"/>
			<element type="string" column="OTHER_PATIENT_INSTRUCTIONS" />
		</list> 
		<list name="expandedPatientInstructions" table="EXPANDED_PATIENT_INSTRUCTION_V" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true"/>
			<list-index column="LINE_NBR"/>
			<element type="string" column="EXPAND_PATIENT_INSTRUCTIONS" />
		</list>
		<list name="pharmacyInstructions" table="PHARMACY_INSTRUCTION_V" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true"/>
			<list-index column="LINE_NBR"/>
			<element type="string" column="PHARMACY_INSTRUCTIONS" />
		</list>
		<list name="sig" table="OUTPPHARM_SIG_V" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true"/>
			<list-index column="LINE_NBR"/>
			<element type="string" column="PRESCRIPTION_SIG_TXT" />
		</list>
		
		<component name="digitalSignatureIndicator" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="DIGITAL_SIGNATURE_CODE" type="java.lang.String" />
			<property name="displayText" column="DIGITAL_SIGNATURE_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="DIGITAL_SIGNATURE_CODSYS" type="java.lang.String" />
		</component>
		<component name="copayTransactionType" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="COPAY_TX_TYP_CODE" type="java.lang.String" />
			<property name="displayText" column="COPAY_TX_TYP_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="COPAY_TX_TYP_CODSYS" type="java.lang.String" />
		</component>
		<component name="transitionalRxBenefit" class="gov.va.med.cds.template.generated.basedatatypes.HL72CodedElementLite">
			<property name="code" column="TRANS_RX_BENEFIT_CODE" type="java.lang.String" />
			<property name="displayText" column="TRANS_RX_BENEFIT_DSPLYTXT" type="java.lang.String" />
			<property name="codingSystem" column="TRANS_RX_BENEFIT_CODSYS" type="java.lang.String" />
		</component>

		<list name="treatmentFactor" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="TreatmentFactor" />
		</list>
		
		<list name="originalDispenseSet" where="discriminator='O'" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="OriginalMedicationDispense" />
		</list>
		
		<list name="refillDispense" where="discriminator='R'" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="RefillMedicationDispense" />
		</list>
		<list name="partialDispense" where="discriminator='P'" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="PartialMedicationDispense" />
		</list>
		
		<component name="cancel" class="gov.va.med.cds.template.generated.pharmacy.CancelAct">
			<property name="cancelDate" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
				<column name="CANCEL_DT"/>
				<column name="CANCEL_DT_NBR"/>
			</property>
			
			<list name="comments" table="CANCEL_COMMENT_V" >
				<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
				<list-index column="LINE_NBR"/>
				<element type="string" column="CANCEL_COMMENTS" />
			</list>
		</component>
		
		<list name="medicationInstructions" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="MedicationInstruction" />
		</list>
		
		<!--&finisher;-->
		<component name="finisher" class="gov.va.med.cds.template.generated.common.PractitionerParticipationLite">
        	<property name="comment" column="FNSH_PRACTITIONER_COMMENTS" type="java.lang.String" />

        	
    		<property name="time" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
    			<column name="FNSH_PRACTITIONER_TM"/>
    			<column name="FNSH_PRACTITIONER_TM_NBR"/>
    		</property>
			
 			<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="FNSH_PERSON_IDENTITY" type="java.lang.String" />
					<property name="assigningFacility" column="FNSH_PERSON_ASGNING_FACILITY" type="java.lang.String"  />
					<property name="assigningAuthority" column="FNSH_PERSON_ASGNING_AUTHORITY" type="java.lang.String"  />
				</component>

        		<property name="idSourceTable" column="FNSH_PRACTITIONER_ID_SRC_TBL" type="java.lang.String" />

				<component name="name" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonName" >
					<property name="prefix" column="FNSH_NAME_PREFIX" type="java.lang.String"  />
					<property name="given" column="FNSH_NAME_GIVEN" type="java.lang.String"  />
					<property name="middle" column="FNSH_NAME_MIDDLE" type="java.lang.String"  />
					<property name="family" column="FNSH_NAME_FAMILY" type="java.lang.String"  />
					<property name="suffix" column="FNSH_NAME_SUFFIX" type="java.lang.String"  />
					<property name="title" column="FNSH_NAME_TITLE" type="java.lang.String"  />
				</component>
			</component>
    	</component>
    	
        <list name="activityLog" >
			<key column="OUTPATIENT_MED_PRM_ID" not-null="true" update="false"/>
			<list-index column="LINE_NBR"/>
			<one-to-many entity-name="ActivityLog" />
		</list>
		
		<component name="recordSource" class="gov.va.med.cds.template.generated.basedatatypes.HL72FacilityIdentifier">
			<property name="namespaceId" column="RECORDSOURCE_NAMESPACEID" type="java.lang.String" node="namespaceId"/>
			<property name="universalId" column="RECORDSOURCE_UNIVERSALID" type="java.lang.String" node="universalId"/>
			<property name="universalIdType" column="RECORDSOURCE_UNIVERSTYP" type="java.lang.String" node="universalIdType"/>
		</component>
		
		<property name="recordVersion" column="RECORD_VERSION" type="integer"/>
		
		<property name="recordUpdateTime" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType" >
			<column name="RECORD_UPDATE_TM"/>
			<column name="RECORD_UPDATE_TM_NBR"/>
		</property>
		
		<property name="requestId" column="REQUEST_ID" type="java.lang.String"/>
	</class>
	
</hibernate-mapping>
