[Confirm Result - Corporate] #13

Open
opened 2023-08-21 08:49:34 +07:00 by sindhu · 0 comments
Owner

- file devone VUE
/home/one/project/one/one-ui/test/vuex/confirm-one-result

- file devone api
/home/one/project/one/one-api/application/controllers/confirm-result (all files)

ketentuan agar tersaring datanya

  $sql_cek_data = "
        select OneResultConfirmT_OrderHeaderID
        from one_result_confirm
        where OneResultConfirmStatus IN ('C','R','E')
        AND OneResultConfirmRetry <= 5
        AND OneResultConfirmIsActive = 'Y'
        AND OneResultConfirmT_OrderHeaderID = ?
        ";

fungsi menjadi

function individu($headerID, $uploadID = "", $debug = "")
    {
        // $arr_sp = $this->get_report($uploadID);
        $arr_sp = $this->get_report();
        $result = [];
        foreach ($arr_sp as $sp) {
            $key = str_replace("sp_", "", $sp);
            $sql = "call {$sp}(?,'admin')";

            if ($sp == "sp_rpt_mcu_resume_cp_r") {
                $sql = "call {$sp}(?,1,'admin')";
                $resumeID = $this->get_resume_id($headerID);
                $resp = $this->get_sp($sql, [$resumeID]);
            } elseif ($sp == "sp_rpt_mcu_resume_cp_r_eng") {
                $sql = "call {$sp}(?,2,'admin')";
                $resumeID = $this->get_resume_id($headerID);
                $resp = $this->get_sp($sql, [$resumeID]);
            } elseif ($sp == "sp_rpt_t_hasil_so") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id($headerID);
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_bdm") {
                $sql = "call {$sp}(?,2,'admin')";
                $resp = $this->get_sp($sql, [$headerID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$headerID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_elmd") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "elmd"
                );

                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_elmd-audio") {
                $xsp = "sp_rpt_t_hasil_so_elmd";
                $sql = "call {$xsp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "audio"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$xsp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_elmd-ecg") {
                $xsp = "sp_rpt_t_hasil_so_elmd";
                $sql = "call {$xsp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "ecg"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$xsp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_elmd-treadmill") {
                $xsp = "sp_rpt_t_hasil_so_elmd";
                $sql = "call {$xsp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "treadmill"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$xsp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_dummy_pajanan") {
                $arr_sub_url = [
                    "pribadi",
                    "faktor_ergonomi",
                    "faktor_biologi",
                    "faktor_fisik",
                    "faktor_kimia",
                    "faktor_psikologi",
                ];
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "pajanan"
                );
                $new_data = ["pajanan" => []];

                if ($resultEntryID > 0) {
                    foreach ($arr_sub_url as $s_url) {
                        $new_data["pajanan"][$s_url] = $this->get_fisik_pajanan(
                            $s_url,
                            $resultEntryID,
                            "k3"
                        );
                    }
                }
                $arr_sub_url = [
                    "pribadi",
                    "keluhan_saat_ini_new",
                    "riwayat_phobia",
                    "riwayat_obat",
                    "riwayat_penyakit",
                    "riwayat_hidup",
                    "riwayat_keluarga",
                    "tanda_vital",
                    "status_gizi",
                    "keadaan_umum",
                    "mulut",
                    "gigi",
                    "visus",
                    "kepala_wajah",
                    "mata",
                    "telinga",
                    "thorax",
                    "paru",
                    "jantung",
                    "integumen",
                    "sistem",
                    "anggota",
                    "genitourinaria",
                    "perut",
                    "leher",
                    "hidung",
                    "persepsi_warna",
                ];
                $new_data["fisik"] = [];
                $new_data["riwayat"] = [];
                if ($resultEntryID > 0) {
                    foreach ($arr_sub_url as $s_url) {
                        $new_data["fisik"][$s_url] = $this->get_fisik(
                            $s_url,
                            $resultEntryID,
                            "fisik"
                        );
                        $new_data["riwayat"][$s_url] = $this->get_fisik(
                            $s_url,
                            $resultEntryID,
                            "riwayat"
                        );
                    }
                }

                $resp = ["data" => $new_data, "status" => 0];
            } elseif ($sp == "sp_rpt_t_hasil_so_layanan") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "layanan"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_manthoux") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "manthoux"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_manthoux_sampling") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "manthoux"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_usg") {
                $sql = "call {$sp}(?,2,'admin')";
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "usg"
                );
                $resp = $this->get_sp($sql, [$resultEntryID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$resultEntryID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_rpt_t_hasil_so_xray") {
                $sql = "call {$sp}(?,2,'admin')";
                $resp = $this->get_sp($sql, [$headerID]);
                $new_data = [];
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 2;
                    $new_data[] = $d;
                }
                $sql = "call {$sp}(?,1,'admin')";
                $resp = $this->get_sp($sql, [$headerID]);
                foreach ($resp["data"] as $d) {
                    $d["M_LangID"] = 1;
                    $new_data[] = $d;
                }
                $resp["data"] = $new_data;
            } elseif ($sp == "sp_dummy_fisik") {
                $arr_sub_url = [
                    "pribadi",
                    "keluhan_saat_ini_new",
                    "riwayat_phobia",
                    "riwayat_obat",
                    "riwayat_penyakit",
                    "riwayat_hidup",
                    "riwayat_keluarga",
                    "tanda_vital",
                    "status_gizi",
                    "keadaan_umum",
                    "mulut",
                    "gigi",
                    "visus",
                    "kepala_wajah",
                    "mata",
                    "telinga",
                    "thorax",
                    "paru",
                    "jantung",
                    "integumen",
                    "sistem",
                    "anggota",
                    "genitourinaria",
                    "perut",
                    "leher",
                    "hidung",
                    "persepsi_warna",
                ];
                $resultEntryID = $this->get_so_result_entry_id(
                    $headerID,
                    "fisik"
                );
                $new_data = ["fisik" => [], "riwayat" => []];
                if ($resultEntryID > 0) {
                    foreach ($arr_sub_url as $s_url) {
                        $new_data["fisik"][$s_url] = $this->get_fisik(
                            $s_url,
                            $resultEntryID,
                            "fisik"
                        );
                        $new_data["riwayat"][$s_url] = $this->get_fisik(
                            $s_url,
                            $resultEntryID,
                            "riwayat"
                        );
                    }
                }
                $resp = ["data" => $new_data, "status" => 0];
            } else {
                $resp = $this->get_sp($sql, [$headerID]);
            }
            if ($resp["status"] == -1) {
                $this->error_reply_gz("Err $sp : " . $resp["message"]);
                exit();
            }
            $result[$key] = $resp["data"];
            if ($key == "dummy_pajanan") {
                $result["dummy_fisik"] = $resp["data"];
            }
        }
        if ($debug != "") {
            echo json_encode(["status" => "OK", "result" => $result]);
            exit();
        }

        // cek data
        $sql_cek_data = "
        select OneResultConfirmT_OrderHeaderID
        from one_result_confirm
        where OneResultConfirmStatus IN ('C','R','E')
        AND OneResultConfirmRetry <= 5
        AND OneResultConfirmIsActive = 'Y'
        AND OneResultConfirmT_OrderHeaderID = ?
        ";

        $qry_cek_data = $this->db->query($sql_cek_data,[
            $headerID
        ]);
        if(!$qry_cek_data){
            $this->db->trans_rollback();
            $this->sys_error_db("select cek data one_result_confirm by orderId", $this->db);
            exit;
        }
        $row_cek_data = $qry_cek_data->result_array();

        if (count($row_cek_data) > 0) {
            // field t_orderheader by order id
            $fields_object = $this->get_field_by_order_id($headerID);

            // field t_orderheader all
            $t_orderheader_all = $this->get_field_t_order_header_by_order_id($headerID);

            // field patient and address
            $M_PatientID = $fields_object['M_PatientID'];
            $m_patient_all = $this->get_field_m_patient_by_m_patient_id($M_PatientID);

            // field m_company
            $M_CompanyID = $fields_object['M_CompanyID'];
            $m_company_all = $this->get_field_m_company_by_m_company_id($M_CompanyID);

            // field t_orderdetail
            $t_orderdetail_all = $this->get_field_t_orderdetail_by_order_id($headerID);

            // field m_doctor dan m_doctoraddress
            $m_doctor_all = $this->get_field_m_doctor_by_order_id($headerID);

            // field m_mou
            $T_OrderHeaderM_MouID = $fields_object['T_OrderHeaderM_MouID'];
            $m_mou_all = $this->get_field_m_mou_by_order_id($T_OrderHeaderM_MouID);

            // field so_resultentry
            $so_entry_all = $this->get_field_so_resultentry_by_order_id($headerID);

            echo json_encode(
                [
                    "status" => "OK",
                    "message" => "Data Ditemukan",
                    "OneResultConfirmT_OrderHeaderID" => $fields_object['OneResultConfirmT_OrderHeaderID'],
                    "T_OrderHeaderID" => $fields_object['T_OrderHeaderID'],
                    'branch_id' => $fields_object['branch_id'],
                    'branch_code' => $fields_object['branch_code'],
                    "NIK" => $fields_object['NIK'],
                    "NO_REG" => $fields_object['NO_REG'],
                    "PID" => $fields_object['PID'],
                    "NO_HP" => $fields_object['NO_HP'],
                    "T_OrderHeaderDate" => $fields_object['T_OrderHeaderDate'],
                    "M_CompanyID" => $fields_object['M_CompanyID'],
                    "T_OrderHeaderM_MouID" => $fields_object['T_OrderHeaderM_MouID'],
                    "M_PatientID" => $fields_object['M_PatientID'],
                    "t_orderheader_json" => ($t_orderheader_all),
                    "patient" => ($m_patient_all),
                    "m_company_json" => ($m_company_all),
                    "t_orderdetail_json" => ($t_orderdetail_all),
                    "doctor" => ($m_doctor_all),
                    "m_mou_json" => ($m_mou_all),
                    // "report" => $result,
                    "so_resultentry" => $so_entry_all
                ]
            );
        }else{
            echo json_encode(
                [
                    "status"=>"ERR",
                    "message"=>"Data Tidak Ditemukan order ID $headerID"
                ]
            );
        }

       

        // echo $this->reply_gz(
        //     json_encode(
        //         [
        //             "status" => "OK", 
        //             "header" => $header_patient,
        //             "result" => $result
        //         ]
        //     )
        // );
    }
**- file devone VUE** /home/one/project/one/one-ui/test/vuex/confirm-one-result **- file devone api** /home/one/project/one/one-api/application/controllers/confirm-result (all files) **ketentuan agar tersaring datanya** ``` $sql_cek_data = " select OneResultConfirmT_OrderHeaderID from one_result_confirm where OneResultConfirmStatus IN ('C','R','E') AND OneResultConfirmRetry <= 5 AND OneResultConfirmIsActive = 'Y' AND OneResultConfirmT_OrderHeaderID = ? "; ``` **fungsi menjadi** ``` function individu($headerID, $uploadID = "", $debug = "") { // $arr_sp = $this->get_report($uploadID); $arr_sp = $this->get_report(); $result = []; foreach ($arr_sp as $sp) { $key = str_replace("sp_", "", $sp); $sql = "call {$sp}(?,'admin')"; if ($sp == "sp_rpt_mcu_resume_cp_r") { $sql = "call {$sp}(?,1,'admin')"; $resumeID = $this->get_resume_id($headerID); $resp = $this->get_sp($sql, [$resumeID]); } elseif ($sp == "sp_rpt_mcu_resume_cp_r_eng") { $sql = "call {$sp}(?,2,'admin')"; $resumeID = $this->get_resume_id($headerID); $resp = $this->get_sp($sql, [$resumeID]); } elseif ($sp == "sp_rpt_t_hasil_so") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id($headerID); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_bdm") { $sql = "call {$sp}(?,2,'admin')"; $resp = $this->get_sp($sql, [$headerID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$headerID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_elmd") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "elmd" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_elmd-audio") { $xsp = "sp_rpt_t_hasil_so_elmd"; $sql = "call {$xsp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "audio" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$xsp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_elmd-ecg") { $xsp = "sp_rpt_t_hasil_so_elmd"; $sql = "call {$xsp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "ecg" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$xsp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_elmd-treadmill") { $xsp = "sp_rpt_t_hasil_so_elmd"; $sql = "call {$xsp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "treadmill" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$xsp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_dummy_pajanan") { $arr_sub_url = [ "pribadi", "faktor_ergonomi", "faktor_biologi", "faktor_fisik", "faktor_kimia", "faktor_psikologi", ]; $resultEntryID = $this->get_so_result_entry_id( $headerID, "pajanan" ); $new_data = ["pajanan" => []]; if ($resultEntryID > 0) { foreach ($arr_sub_url as $s_url) { $new_data["pajanan"][$s_url] = $this->get_fisik_pajanan( $s_url, $resultEntryID, "k3" ); } } $arr_sub_url = [ "pribadi", "keluhan_saat_ini_new", "riwayat_phobia", "riwayat_obat", "riwayat_penyakit", "riwayat_hidup", "riwayat_keluarga", "tanda_vital", "status_gizi", "keadaan_umum", "mulut", "gigi", "visus", "kepala_wajah", "mata", "telinga", "thorax", "paru", "jantung", "integumen", "sistem", "anggota", "genitourinaria", "perut", "leher", "hidung", "persepsi_warna", ]; $new_data["fisik"] = []; $new_data["riwayat"] = []; if ($resultEntryID > 0) { foreach ($arr_sub_url as $s_url) { $new_data["fisik"][$s_url] = $this->get_fisik( $s_url, $resultEntryID, "fisik" ); $new_data["riwayat"][$s_url] = $this->get_fisik( $s_url, $resultEntryID, "riwayat" ); } } $resp = ["data" => $new_data, "status" => 0]; } elseif ($sp == "sp_rpt_t_hasil_so_layanan") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "layanan" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_manthoux") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "manthoux" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_manthoux_sampling") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "manthoux" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_usg") { $sql = "call {$sp}(?,2,'admin')"; $resultEntryID = $this->get_so_result_entry_id( $headerID, "usg" ); $resp = $this->get_sp($sql, [$resultEntryID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$resultEntryID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_rpt_t_hasil_so_xray") { $sql = "call {$sp}(?,2,'admin')"; $resp = $this->get_sp($sql, [$headerID]); $new_data = []; foreach ($resp["data"] as $d) { $d["M_LangID"] = 2; $new_data[] = $d; } $sql = "call {$sp}(?,1,'admin')"; $resp = $this->get_sp($sql, [$headerID]); foreach ($resp["data"] as $d) { $d["M_LangID"] = 1; $new_data[] = $d; } $resp["data"] = $new_data; } elseif ($sp == "sp_dummy_fisik") { $arr_sub_url = [ "pribadi", "keluhan_saat_ini_new", "riwayat_phobia", "riwayat_obat", "riwayat_penyakit", "riwayat_hidup", "riwayat_keluarga", "tanda_vital", "status_gizi", "keadaan_umum", "mulut", "gigi", "visus", "kepala_wajah", "mata", "telinga", "thorax", "paru", "jantung", "integumen", "sistem", "anggota", "genitourinaria", "perut", "leher", "hidung", "persepsi_warna", ]; $resultEntryID = $this->get_so_result_entry_id( $headerID, "fisik" ); $new_data = ["fisik" => [], "riwayat" => []]; if ($resultEntryID > 0) { foreach ($arr_sub_url as $s_url) { $new_data["fisik"][$s_url] = $this->get_fisik( $s_url, $resultEntryID, "fisik" ); $new_data["riwayat"][$s_url] = $this->get_fisik( $s_url, $resultEntryID, "riwayat" ); } } $resp = ["data" => $new_data, "status" => 0]; } else { $resp = $this->get_sp($sql, [$headerID]); } if ($resp["status"] == -1) { $this->error_reply_gz("Err $sp : " . $resp["message"]); exit(); } $result[$key] = $resp["data"]; if ($key == "dummy_pajanan") { $result["dummy_fisik"] = $resp["data"]; } } if ($debug != "") { echo json_encode(["status" => "OK", "result" => $result]); exit(); } // cek data $sql_cek_data = " select OneResultConfirmT_OrderHeaderID from one_result_confirm where OneResultConfirmStatus IN ('C','R','E') AND OneResultConfirmRetry <= 5 AND OneResultConfirmIsActive = 'Y' AND OneResultConfirmT_OrderHeaderID = ? "; $qry_cek_data = $this->db->query($sql_cek_data,[ $headerID ]); if(!$qry_cek_data){ $this->db->trans_rollback(); $this->sys_error_db("select cek data one_result_confirm by orderId", $this->db); exit; } $row_cek_data = $qry_cek_data->result_array(); if (count($row_cek_data) > 0) { // field t_orderheader by order id $fields_object = $this->get_field_by_order_id($headerID); // field t_orderheader all $t_orderheader_all = $this->get_field_t_order_header_by_order_id($headerID); // field patient and address $M_PatientID = $fields_object['M_PatientID']; $m_patient_all = $this->get_field_m_patient_by_m_patient_id($M_PatientID); // field m_company $M_CompanyID = $fields_object['M_CompanyID']; $m_company_all = $this->get_field_m_company_by_m_company_id($M_CompanyID); // field t_orderdetail $t_orderdetail_all = $this->get_field_t_orderdetail_by_order_id($headerID); // field m_doctor dan m_doctoraddress $m_doctor_all = $this->get_field_m_doctor_by_order_id($headerID); // field m_mou $T_OrderHeaderM_MouID = $fields_object['T_OrderHeaderM_MouID']; $m_mou_all = $this->get_field_m_mou_by_order_id($T_OrderHeaderM_MouID); // field so_resultentry $so_entry_all = $this->get_field_so_resultentry_by_order_id($headerID); echo json_encode( [ "status" => "OK", "message" => "Data Ditemukan", "OneResultConfirmT_OrderHeaderID" => $fields_object['OneResultConfirmT_OrderHeaderID'], "T_OrderHeaderID" => $fields_object['T_OrderHeaderID'], 'branch_id' => $fields_object['branch_id'], 'branch_code' => $fields_object['branch_code'], "NIK" => $fields_object['NIK'], "NO_REG" => $fields_object['NO_REG'], "PID" => $fields_object['PID'], "NO_HP" => $fields_object['NO_HP'], "T_OrderHeaderDate" => $fields_object['T_OrderHeaderDate'], "M_CompanyID" => $fields_object['M_CompanyID'], "T_OrderHeaderM_MouID" => $fields_object['T_OrderHeaderM_MouID'], "M_PatientID" => $fields_object['M_PatientID'], "t_orderheader_json" => ($t_orderheader_all), "patient" => ($m_patient_all), "m_company_json" => ($m_company_all), "t_orderdetail_json" => ($t_orderdetail_all), "doctor" => ($m_doctor_all), "m_mou_json" => ($m_mou_all), // "report" => $result, "so_resultentry" => $so_entry_all ] ); }else{ echo json_encode( [ "status"=>"ERR", "message"=>"Data Tidak Ditemukan order ID $headerID" ] ); } // echo $this->reply_gz( // json_encode( // [ // "status" => "OK", // "header" => $header_patient, // "result" => $result // ] // ) // ); } ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sindhu/belajar#13