<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZHANGXING  
    $Date: 2014-1-3 下午02:46:41  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_VISIT_REPORT_HDS" defaultOrderBy="t1.visit_date desc">
    <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" insertExpression="${/session/@company_id}" physicalName="COMPANY_ID" prompt="CON_VISIT_REPORT_HDS.COMPANY_ID" updateExpression="${/session/@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" defaultValue="VISIT_REPORT" 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_name" expression="(select m.bp_name from hls_bp_master m where m.bp_id=tenant_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="visit_report_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <!-- <bm:query-field field="visit_report_desc" queryOperator="like"/> -->
        <bm:query-field field="tenant_id" queryOperator="="/>
        <bm:query-field field="visit_method" queryOperator="="/>
        <bm:query-field field="visit_result" queryOperator="="/>
        <bm:query-field field="visit_date" queryOperator="="/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="company_id=${/session/@company_id}"/>
    </bm:data-filters>
</bm:model>
