<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select hpca.plan_id,
            	   hpca.check_confirm_desc, --(合同履行与管理要求落实情况)说明
            	   hpca.product_check_conclusion,	--生产制造类检查结果说明
            	   hpca.product_company_conclusion,	--生产制造类企业总结分析
			       hpcp.project_id,
			       (select pp.project_name from prj_project pp where pp.project_id = hpcp.project_id) project_name,--项目名称
			       (select hpcal.virtual_con_number from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) virtual_con_number, --合同号
			       (select hpcal.bp_id_tenant_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) bp_id_tenant_n,--主承租人
			       (select hpcal.lease_organization_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) lease_organization_n,--业务部门
			       (select hpcal.bp_id_tenant_sec_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) bp_id_tenant_sec_n,--联合承租人
			       (select hpcal.guarantor_names from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) guarantor_names,--主担保人
			       (select hpcal.gua_assurance_duty_way_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) gua_assurance_duty_way_n,--担保方式
			       (select hpcal.lease_item_description from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) lease_item_description,--租赁物描述
			       (select hpcal.business_type_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) business_type_n,--租赁业务类型
			       (select hpcal.con_lease_term from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) con_lease_term,--租赁期限
			       to_char((select hpcal.sum_pay_principal from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') sum_pay_principal,--投放金额
			       (select hpcal.con_annual_pay_times from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) con_annual_pay_times,--租金支付频率
			       to_char((select hpcal.sum_remain_principal from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') sum_remain_principal,--本金余额
			       (select hpcal.binary_classification_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) binary_classification_n,--电源类型
			       (select hpcal.hn_industry_classification_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) hn_industry_classification_n,--项目类型
			       to_char((select hpcal.remain_due_amount from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') remain_due_amount,--租金余额
			       to_char((select hpcal.sum_due_amount from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') sum_due_amount,--未回收租金总额
			       to_char((select hpcal.sum_penalty_amount from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') sum_penalty_amount, --逾期金额
             	   to_char((select hpcal.remain_deposit_amount from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id),'FM999,999,999,999,990.00') remain_deposit_amount,--保证金余额
			       hpca.actual_number,      --租后检查编号
			       hpca.actual_check_date,  --实际检查日期
			       hpca.actual_check_location,--检查地点
			       hpca.financing_purpose,--融资用途
			       hpca.actual_check_person, --实际检查人员
			       hpca.actual_check_manager,--实际检查负责人员
			       (select hpcal.account_flag_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) account_flag_n,--监管账户
			       hpca.first_check_flag,--是否首次检查
			       (select v.code_value_name from sys_code_values_v v where v.code = 'YES_NO'and v.code_value = hpca.first_check_flag) first_check_flag_n,
			       (select hpcal.actual_check_method_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) actual_check_method_n,--检查方式
			       (select hpcal.five_class_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) sum_due_amount,--五级分类
			       (select hpcal.contact_info_id_n from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id)||':'|| 
			       (select hpcal.bp_cell_phone from hn_prj_check_actual_lv hpcal where hpcal.check_id = hpca.check_id) contact_info_cell_phone,--企业负责人员及联系方式
			       hpca.last_check_date            --上次检查时间
			from hn_prj_check_actual hpca,
			     hn_prj_check_plan hpcp
			where hpca.actual_check_method = 'SCENE' AND
			      hpca.plan_id = hpcp.plan_id AND
			      hpca.check_id = ${@check_id}
      			]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="check_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
