<?php
	class Ranap_model extends CI_Model {
		
		function __construct()
		{
			// Call the Model constructor
			parent::__construct();
			
			$this->dbhost=$this->load->database('khanza', TRUE);
					
			date_default_timezone_set('Asia/Jakarta');
		}
		
		function getDataVisiteDokter()
		{
			
		}
		
		//dummy
		public function getDataKamar()
		{
			$stat = array('1','2','3','4','5','6');
			//$this->db->where_in('NurseStation', $stat);
			//$q=$this->db->get('kamar');
			
			$q=$this->db
				->select('b.`NurseStation` AS nama_ns, a.*')
				->from('`kamar` AS a')
				->join('nursestation AS b','a.`NurseStation`=b.`ID`','left')
				->where_in('a.NurseStation', $stat)
				//->order_by('a.`id_poli`')
				->get();
				
			return $q->result();
		}
		
		//Json
		function getKamar($idkamar)
		{
			//$this->db->select('ID,NamaKamar,Kapasitas,terisi');
			$q=$this->db->get_where('kamar', array('ID' => $idkamar));
			
			if($q->num_rows() > 0)
			{
				return $q->result();
			}
		}
				
		function saveUpdateKamar($update, $idk)
		{
			$this->db->where('ID', $idk);
			
			return $this->db->update('kamar', $update);
		}
		
	}
