<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-1-15 上午11:00:23  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_VISIT_REPORT_HDS">
    <bm:fields>
        <bm:field name="visit_report_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VISIT_REPORT_ID" prompt="CON_VISIT_REPORT_HDS.VISIT_REPORT_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CON_VISIT_REPORT_HDS.COMPANY_ID"/>
        <bm:field name="visit_report_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VISIT_REPORT_DESC" prompt="CON_VISIT_REPORT_HDS.VISIT_REPORT_DESC"/>
        <bm:field name="visit_date" databaseType="DATE" datatype="java.util.Date" physicalName="VISIT_DATE" prompt="CON_VISIT_REPORT_HDS.VISIT_DATE"/>
        <bm:field name="visit_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VISIT_METHOD" prompt="CON_VISIT_REPORT_HDS.VISIT_METHOD"/>
        <bm:field name="visit_result" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VISIT_RESULT" prompt="CON_VISIT_REPORT_HDS.VISIT_RESULT"/>
        <bm:field name="tenant_id" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TENANT_ID" prompt="CON_VISIT_REPORT_HDS.TENANT_ID"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="CON_VISIT_REPORT_HDS.DOCUMENT_CATEGORY"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_VISIT_REPORT_HDS.OWNER_USER_ID"/>
        <bm:field name="bp_tenant_name" displayWidth="200" expression="(select m.bp_name from hls_bp_master m where m.bp_id=t1.tenant_id)" forDisplay="true" forInsert="false" forQuery="true" forUpdate="false" prompt="HLS.TENANT_CODE"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="visit_report_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="bp_tenant_name" queryExpression="exists(select 1 from hls_bp_master m where m.bp_name like ${@bp_tenant_name} and m.bp_id=t1.tenant_id)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="company_id=${/session/@company_id}"/>
    </bm:data-filters>
</bm:model>
