<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="app/app_login_check.js"><![CDATA[
        //商业伙伴NP_基本信息_下拉框
            function lov_query() { 
                var academic_background_details;
                var marital_status_details;
                var id_type_details;
                var gender_details;
                var province_details;
                var city_details;
                var district_details;
                try {
                    var academic_background_bm = $bm('app.bp_master.hls_academic_background_list');
                    var marital_status_bm = $bm('app.bp_master.hls_marital_status_list');
                    var id_type_bm  = $bm('app.bp_master.hls_id_type_list');
                    var gender_bm = $bm('app.bp_master.app_hls_gender_list');
                    var province_bm = $bm('app.bp_master.app_hls_province_list');
                    var city_bm = $bm('app.bp_master.app_hls_city_list');
                    var district_bm = $bm('app.bp_master.app_hls_district_list');
                    
                    var academic_background_map = academic_background_bm.queryAsMap();
                    var marital_status_map = marital_status_bm.queryAsMap();
                    var id_type_map = id_type_bm.queryAsMap();
                    var gender_map = gender_bm.queryAsMap();
                    var province_map = province_bm.queryAsMap();
                    var city_map = city_bm.queryAsMap();
                    var district_map = district_bm.queryAsMap();
                    
                    academic_background_details = academic_background_map.getChildren();
                    marital_status_details = marital_status_map.getChildren();
                    id_type_details = id_type_map.getChildren();
                    gender_details = gender_map.getChildren();
                    province_details = province_map.getChildren();
                    city_details = city_map.getChildren();
                    district_details = district_map.getChildren();
                    
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                    
                } catch (e) {
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
            
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    
                    academic_background_list: [],
                    marital_status_list: [],
                    id_type_list: [],
                    gender_list: [],
                    province_list: [],
                    city_list: [],
                    disctict_list: []
                };
                
                var academic_background_list = result.academic_background_list;
                var marital_status_list = result.marital_status_list;
                var id_type_list = result.id_type_list;
                var gender_list = result.gender_list;
                var province_list = result.province_list;
                var city_list = result.city_list;
                var disctict_list = result.disctict_list;
            	
            	for (var j = 0;j < academic_background_details.length;j++) {
                    var academic_background_detail = academic_background_details[j];
                    academic_background_list.push({
                        "code": academic_background_detail.code,
                        "code_name": academic_background_detail.code_name
                    });
                }
            	for (var j = 0;j < marital_status_details.length;j++) {
                    var marital_status_detail = marital_status_details[j];
                    marital_status_list.push({
                        "code": marital_status_detail.code,
                        "code_name": marital_status_detail.code_name
                    });
                }
            	for (var j = 0;j < id_type_details.length;j++) {
                    var id_type_detail = id_type_details[j];
                    id_type_list.push({
                        "code": id_type_detail.code,
                        "code_name": id_type_detail.code_name
                    });
                }
            	for (var j = 0;j < gender_details.length;j++) {
                    var gender_detail = gender_details[j];
                    gender_list.push({
                        "code": gender_detail.code,
                        "code_name": gender_detail.code_name
                    });
                }
                for (var j = 0;j < province_details.length;j++) {
                    var province_detail = province_details[j];
                    province_list.push({
                        "code": province_detail.code,
                        "code_name": province_detail.code_name
                    });
                }
            	for (var j = 0;j < city_details.length;j++) {
                    var city_detail = city_details[j];
                    city_list.push({
                        "code": city_detail.code,
                        "code_name": city_detail.code_name
                    });
                }
                for (var j = 0;j < district_details.length;j++) {
                    var district_detail = district_details[j];
                    disctict_list.push({
                        "code": district_detail.code,
                        "code_name": district_detail.code_name
                    });
                }
                $ctx.parameter.json = JSON.stringify(result);
            }
            
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                lov_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>
