<?php

defined('BASEPATH') or exit('No direct script access allowed');

class Data_menu extends CI_Model
{

    public function __construct()
    {
        $this->load->database();
    }

    // Login
    public function getBpjsAccess()
    {
        $query = $this->db->query("select * from BPJS_ID  ");
        return $query->result_array();
    }

    public function GetUserNameAndPasswordBpjs($username, $password)
    {
        $password = hash('sha256', $password);
        $query = $this->db->query("select xUsername,xPassword from BPJS_ID where xUsername = '$username' and xPassword = '$password'  ");
        return $query->result_array();
    }

    public function GetUserNameBpjs($username)
    {
        $query = $this->db->query("select xUsername,xPassword from BPJS_ID where xUsername = '$username' ");
        return $query->result_array();
    }

    public function GetStatusAntreanBpjs($kodePoli, $kodeDokter, $tanggalPeriksa, $jamPraktek)
    {
        $query = $this->db->query("exec WsBpjs_StatusAntrean '$kodePoli','$kodeDokter','$tanggalPeriksa','$jamPraktek' ");
        return $query->result_array();
    }

    public function GetAmbilAntreanBpjs($kodePoli, $kodeDokter, $tanggalPeriksa, $jamPraktek, $nomorKartu, $nik, $noHp, $noRm,  $jenisKunjungan, $nomorReferensi)
    {
        $query = $this->db->query("exec WsBpjs_AmbilAntrean '$kodePoli','$kodeDokter','$tanggalPeriksa','$jamPraktek', '$nomorKartu', '$nik', '$noHp', '$noRm',  '$jenisKunjungan', '$nomorReferensi' ");
        return $query->result_array();
    }

    public function GetSisaAntreanBpjs($kodeBooking)
    {
        $query = $this->db->query("exec WsBpjs_SisaAntrean '$kodeBooking' ");
        return $query->result_array();
    }

    public function GetBatalAntreanBpjs($kodeBooking, $keterangan)
    {
        $query = $this->db->query("exec WsBpjs_BatalAntrean '$kodeBooking' , '$keterangan'");
        return $query->result_array();
    }

    public function GetCheckInAntreanBpjs($kodeBooking, $keterangan)
    {
        $query = $this->db->query("exec WsBpjs_CheckInAntrean '$kodeBooking' , '$keterangan'");
        return $query->result_array();
    }

    public function GetInfoPasienBaruBpjs($nomorkartu, $nik, $nomorKk, $nama, $jenisKelamin, $tanggalLahir, $noHp, $alamat, $kodeProp, $namaProp, $kodeDati2, $namaDati2, $kodeKec, $namaKec, $kodeKel, $namaKel, $rw, $rt)
    {
        $query = $this->db->query("exec WsBpjs_InfoPasienBaru '$nomorkartu', '$nik', '$nomorKk', '$nama', '$jenisKelamin', '$tanggalLahir', '$noHp', '$alamat', '$kodeProp', '$namaProp', '$kodeDati2', '$namaDati2', '$kodeKec', '$namaKec', '$kodeKel', '$namaKel', '$rw', '$rt' ");
        return $query->result_array();
    }

    public function GetJadwalOperasiRs($tanggalAwal, $tanggalAkhir)
    {
        $query = $this->db->query("exec WsBpjs_JadwalOperasiRs '$tanggalAwal', '$tanggalAkhir' ");
        return $query->result_array();
    }

    public function GetJadwalOperasiPasien($noPeserta)
    {
        $query = $this->db->query("exec WsBpjs_JadwalOperasiPasien '$noPeserta' ");
        return $query->result_array();
    }
}