<?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[
            function lov_query() {
                var living_situation_details;
                var ownship_of_house_details;
                var house_loans_flag_details;
                try {
                    var living_situation_bm = $bm('app.lov.app_hls_living_situation_list');
                    var ownship_of_house_bm = $bm('app.lov.app_hls_ownship_of_house_list');
                    var house_loans_flag_bm = $bm('app.lov.app_hls_house_loans_flag_list');
            
                    var living_situation_map = living_situation_bm.queryAsMap();
                    var ownship_of_house_map = ownship_of_house_bm.queryAsMap();
                    var house_loans_flag_map = house_loans_flag_bm.queryAsMap();
            
                    living_situation_details = living_situation_map.getChildren();
                    ownship_of_house_details = ownship_of_house_map.getChildren();
                    house_loans_flag_details = house_loans_flag_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,
                    living_situation_list: [],
                    ownship_of_house_list: [],
                    house_loans_flag_list: []
                };
            
                var living_situation_list = result.living_situation_list;
                var ownship_of_house_list = result.ownship_of_house_list;
                var house_loans_flag_list = result.house_loans_flag_list;
            
                if (living_situation_details) {
                    for (var j = 0;j < living_situation_details.length;j++) {
                        var living_situation_detail = living_situation_details[j];
                        living_situation_list.push({
                            "code": living_situation_detail.code,
                            "name": living_situation_detail.name
                        });
                    }
                }
                if (ownship_of_house_details) {
                    for (var m = 0;m < ownship_of_house_details.length;m++) {
                        var ownship_of_house_detail = ownship_of_house_details[m];
                        ownship_of_house_list.push({
                            "code": ownship_of_house_detail.code,
                            "name": ownship_of_house_detail.name
                        });
                    }
                }
                if (house_loans_flag_details) {
                    for (var n = 0;n < house_loans_flag_details.length;n++) {
                        var house_loans_flag_detail = house_loans_flag_details[n];
                        house_loans_flag_list.push({
                            "code": house_loans_flag_detail.code,
                            "name": house_loans_flag_detail.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>
