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

require_once 'vendor/autoload.php';

class Wsbpjsreferensi extends CI_Controller
{	
   
		public function __construct()
		{
			parent::__construct();
			$this->load->model('data_menu');	
            $this->load->library('LibHttpRequest');					
		}
		

        public function diagnosa()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$namaAtauKodeDiagnosa = $this->GetJsonObject($obj->{'namaAtauKodeDiagnosa'}) ;
			$url = 'referensi/diagnosa/'.$namaAtauKodeDiagnosa;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function poli()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$namaAtauKodePoli = $this->GetJsonObject($obj->{'namaAtauKodePoli'}) ;
			$url = 'referensi/poli/'.$namaAtauKodePoli;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function fasilitasKesehatan()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$kodeFaskes = $this->GetJsonObject($obj->{'kodeFaskes'}) ;
            $jenisFaskes = $this->GetJsonObject($obj->{'jenisFaskes'}) ;
			$url = 'referensi/faskes/'.$kodeFaskes.'/'.$jenisFaskes;
			echo $this->HttpRequest("GET",$url) ;		
		}

		public function dokterDpjp()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$jenisPelayanan = $this->GetJsonObject($obj->{'jenisPelayanan'}) ;
			$tanggalPelayanan= $this->GetJsonObject($obj->{'tanggalPelayanan'}) ;	
			$kodeSpesialis= $this->GetJsonObject($obj->{'kodeSpesialis'}) ;	
			$url = 'referensi/dokter/pelayanan/'.$jenisPelayanan.'/tglPelayanan/'.$tanggalPelayanan.'/Spesialis/'.$kodeSpesialis;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function propinsi()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/propinsi';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function kabupaten()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);
            $kodePropinsi = $this->GetJsonObject($obj->{'kodePropinsi'}) ;
			$url = 'referensi/kabupaten/propinsi/'.$kodePropinsi;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function kecamatan()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);
            $kodeKabupaten = $this->GetJsonObject($obj->{'kodeKabupaten'}) ;
			$url = 'referensi/kecamatan/kabupaten/'.$kodeKabupaten;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function diagnosaProgramPrb()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/diagnosaprb';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function obatGenerikProgramPrb()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

            $namaObatGenerik = $this->GetJsonObject($obj->{'namaObatGenerik'}) ;
			$url = 'referensi/obatprb/'.$namaObatGenerik;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function procedure()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

            $namaAtauKodeProcedure = $this->GetJsonObject($obj->{'namaAtauKodeProcedure'}) ;
			$url = 'referensi/procedure/'.$namaAtauKodeProcedure;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function kelasRawat()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/kelasrawat';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function dokter()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

            $namaDokterAtauDpjp = $this->GetJsonObject($obj->{'namaDokterAtauDpjp'}) ;

			$url = 'referensi/dokter/'.$namaDokterAtauDpjp;
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function spesialistik()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);


			$url = 'referensi/spesialistik';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function ruangRawat()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/ruangrawat';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function caraKeluar()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/carakeluar';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function pascaPulang()
		{	
			$json = file_get_contents('php://input');
			$obj = json_decode($json);

			$url = 'referensi/pascapulang';
			echo $this->HttpRequest("GET",$url) ;		
		}

        public function HttpRequest($method,$endPoint,$params="",$contentType="application/x-www-form-urlencoded")
		{			
			echo $this->libhttprequest->vclaim($method,$endPoint,$params,$contentType);
			exit();			
		}
	
		function GetJsonObject($obj){
			return isset($obj) ? $obj : ""; 
		}
		
	

}