<?php
class Data_layanan_blu extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('user_model');
        $this->load->model('dashboard_model');
        $this->load->helper('content');

        if ($this->user_model->is_logged_in() == FALSE)
            redirect(base_url(), 'refresh');
    }

    public function index() {
        $view['content'] = 'chart/data_layanan_blu';
        $view['data'] = $this->dashboard_model->list_data_layanan_blu()->result();
        $this->load->view('admin/index', $view);
    }

    function bor() {
        /*
        $view['content'] = 'chart/data_layanan_blu';
        $view['data'] = $this->dashboard_model->list_data_layanan_blu()->result();
        $this->load->view('admin/index', $view);
        */
        
        $data = $this->dashboard_model->BOR();
        echo $data;
    }

    function input() {
        $KunjunganPasienRAJAL = $this->dashboard_model->KunjunganPasienRAJAL();
        $KunjunganPasienIGD = $this->dashboard_model->KunjunganPasienIGD();
        $KunjunganPasienRANAP = $this->dashboard_model->KunjunganPasienRANAP();
        $KunjunganPasienUMUM = $this->dashboard_model->KunjunganPasienUMUM();
        $KunjunganPasienJAMINAN = $this->dashboard_model->KunjunganPasienJAMINAN();
        $KunjunganPasienTOTAL = $this->dashboard_model->KunjunganPasienTOTAL();
        //$BOR = $this->dashboard_model->BOR();
        $AVLOS = $this->dashboard_model->AVLOS();
        $BTO = $this->dashboard_model->BTO();
        $NDR = $this->dashboard_model->NDR();
        $jmlBED = $this->dashboard_model->jmlBED();
        $JumlahOrangRAJAL = $this->dashboard_model->JumlahOrangRAJAL();
        $JumlahOrangIGD = $this->dashboard_model->JumlahOrangIGD();
        $JumlahOrangUMUM = $this->dashboard_model->JumlahOrangUMUM();
        $JumlahOrangJAMINAN = $this->dashboard_model->JumlahOrangJAMINAN();
        $JumlahOrangTOTAL = $this->dashboard_model->JumlahOrangTOTAL();
        $TarifKelas1 = $this->dashboard_model->TarifKelas1();
        $TarifKelas2 = $this->dashboard_model->TarifKelas2();
        $TarifKelas3 = $this->dashboard_model->TarifKelas3();
            
            $this->db->set('keterangan', 'Pasien Rawat Jalan (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienRAJAL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Gawat Darurat (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienIGD);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Rawat Inap (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienRANAP);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Umum (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienUMUM);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Jaminan (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienJAMINAN);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Total (Jumlah kunjungan)');
            $this->db->set('jumlah', $KunjunganPasienTOTAL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'BOR (%)');
            $this->db->set('jumlah', NULL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'ALOS (hari)');
            $this->db->set('jumlah', $AVLOS);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'BTO (frekuensi)');
            $this->db->set('jumlah', $BTO);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'NDR (%)');
            $this->db->set('jumlah', $NDR);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Kapasitas Tempat Tidur (Unit)');
            $this->db->set('jumlah', $jmlBED);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Rawat Jalan (jumlah orang)');
            $this->db->set('jumlah', $JumlahOrangRAJAL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Gawat Darurat (jumlah orang)');
            $this->db->set('jumlah', $JumlahOrangIGD);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Umum (jumlah orang)');
            $this->db->set('jumlah', NULL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Jaminan (jumlah orang)');
            $this->db->set('jumlah', $JumlahOrangJAMINAN);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Pasien Total (jumlah orang)');
            $this->db->set('jumlah', $JumlahOrangTOTAL);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Tarif Kelas I (Rp.)');
            $this->db->set('jumlah', $TarifKelas1);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Tarif Kelas II (Rp.)');
            $this->db->set('jumlah', $TarifKelas2);
            $this->db->insert('data_layanan_blu');

            $this->db->set('keterangan', 'Tarif Kelas III (Rp.)');
            $this->db->set('jumlah', $TarifKelas3);
            $this->db->insert('data_layanan_blu');
    }
}