Initial import
This commit is contained in:
492
application/controllers/v1/report/Medis.php
Normal file
492
application/controllers/v1/report/Medis.php
Normal file
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
class Medis extends MY_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
//$this->db = $this->load->database("one", true);
|
||||
}
|
||||
function pribadi($id, $langid)
|
||||
{
|
||||
//$id = orderID
|
||||
$sql = "SELECT
|
||||
orderID,
|
||||
orderDate,
|
||||
orderAge,
|
||||
orderNumber ,
|
||||
one.fn_get_name(orderM_PatientID) as M_PatientName,
|
||||
orderKeluhan,
|
||||
orderDiagnosisAwal,
|
||||
orderDiagnosisAkhir,
|
||||
CONCAT(ifnull( M_DoctorPrefix,''),' ', M_DoctorName,' ',ifnull( M_DoctorSufix,''),' ',ifnull( M_DoctorSufix2,''),' ',ifnull( M_DoctorSufix3,'')) AS M_DoctorName,
|
||||
orderDoctorVitalSign ,
|
||||
orderDoctorReceipt,
|
||||
orderDoctorDiagnosePrimer ,
|
||||
orderDoctorDiagnoseSekunder ,
|
||||
orderDoctorSaran
|
||||
|
||||
FROM one_klinik.`order`
|
||||
left join m_doctor ON order.orderM_DoctorID = M_DoctorID
|
||||
left join one_klinik.order_doctor on orderDoctorOrderID = OrderID and orderDoctorIsActive = 'Y'
|
||||
|
||||
where
|
||||
orderID = ?
|
||||
and
|
||||
orderDoctorType = 'TEXT'
|
||||
|
||||
";
|
||||
$qry = $this->db->query($sql, array($id));
|
||||
//echo $this->db->last_query();
|
||||
if ($qry) {
|
||||
$rows = $qry->result_array();
|
||||
|
||||
// foreach($rows as $idx => $r ) {
|
||||
// $rows[$idx]["keluhan_saat_ini"] = $this->keluhan_saat_ini($id,$langid,$type);
|
||||
// $rows[$idx]["phobia"] = $this->phobia($id,$langid,$type);
|
||||
// $rows[$idx]["kesimpulan"] = $this->kesimpulanv4($id,$langid);
|
||||
// }
|
||||
|
||||
echo json_encode($rows);
|
||||
} else {
|
||||
echo json_encode(array());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function keluhan_saat_ini_new($id,$langid)
|
||||
{
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
|
||||
$qry = $this->db->query($sql, array($id,$langid));
|
||||
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
//print_r($rows[0]["orderAnamnesisKeluhanUtama"]);
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisKeluhanUtama"], true);
|
||||
|
||||
//keluhan saat ini
|
||||
$keluhan_saat_ini_new = array();
|
||||
foreach ($details[0]["details"] as $d) {
|
||||
if ($d["chx"] == 1) {
|
||||
$keluhan_saat_ini_new[] = array(
|
||||
"a1" => $d["label"],
|
||||
"a2" => $d["value"],
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($keluhan_saat_ini_new);
|
||||
}
|
||||
|
||||
|
||||
function riwayat_penyakit($id,$langid) {
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
|
||||
$qry = $this->db->query($sql,array($id,$langid));
|
||||
if (! $qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0 ) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisRiwayatPenyakitDanAlergiDahulu"],true);
|
||||
//keluhan saat ini
|
||||
$riwayat_penyakit = array();
|
||||
foreach ($details[0]["details"] as $d) {
|
||||
|
||||
|
||||
|
||||
foreach($d["details"] as $xd) {
|
||||
if ($xd["chx"] == 1 ) {
|
||||
$arr_result[] = array($xd["label"],$xd["value"],$xd["segment_name"],$xd["id"]) ;
|
||||
$riwayat_penyakit[] = array(
|
||||
"c1" => $xd["label"],
|
||||
"c2" => $xd["value"],
|
||||
"c3" => $xd["segment_name"],
|
||||
"c4" => $xd["id"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
echo json_encode($riwayat_penyakit);
|
||||
}
|
||||
|
||||
|
||||
function riwayat_penyakit_sekarang($id,$langid) {
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
|
||||
$qry = $this->db->query($sql,array($id,$langid));
|
||||
if (! $qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0 ) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisRiwayatPenyakitDanAlergiSekarang"],true);
|
||||
|
||||
$riwayat_penyakit_sekarang = array();
|
||||
foreach ($details[0]["details"] as $d) {
|
||||
|
||||
|
||||
|
||||
foreach($d["details"] as $xd) {
|
||||
if ($xd["chx"] == 1 ) {
|
||||
$arr_result[] = array($xd["label"],$xd["value"],$xd["segment_name"],$xd["id"]) ;
|
||||
$riwayat_penyakit_sekarang[] = array(
|
||||
"cc1" => $xd["label"],
|
||||
"cc2" => $xd["value"],
|
||||
"cc3" => $xd["segment_name"],
|
||||
"cc4" => $xd["id"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
echo json_encode($riwayat_penyakit_sekarang);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function riwayat_keluarga($id, $langid)
|
||||
{
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
|
||||
|
||||
$qry = $this->db->query($sql, array($id, $langid));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisRiwayatPenyakitKeluarga"], true);
|
||||
//keluhan saat ini
|
||||
$riwayat_keluarga = array();
|
||||
foreach ($details[0]["details"] as $d) {
|
||||
|
||||
// foreach ($d["details"] as $gp) {
|
||||
//echo print_r($d["details"]);
|
||||
if (true || $d["chx"] == 1) {
|
||||
$arr_result[] = array($d["label"], $d["value"], $d["id"]);
|
||||
foreach ($d["options"] as $gpd) {
|
||||
if ($gpd["selected"] == 1) {
|
||||
$riwayat_keluarga[] = array(
|
||||
"d1" => $d["label"],
|
||||
"d2" => $gpd["label"],
|
||||
"d3" => $d["id"],
|
||||
);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
echo json_encode($riwayat_keluarga);
|
||||
}
|
||||
|
||||
|
||||
function riwayat_obat($id, $langid)
|
||||
{
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
$qry = $this->db->query($sql, array($id, $langid));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisRiwayatPengobatan"], true);
|
||||
//keluhan saat ini
|
||||
$riwayat_obat = array();
|
||||
foreach ($details[0]["details"] as $gp) {
|
||||
|
||||
// echo print_r($d);
|
||||
|
||||
if ($gp["chx"] == 1) {
|
||||
$arr_result[] = array($gp["label"], $gp["value"]);
|
||||
$riwayat_obat[] = array(
|
||||
"f1" => $gp["label"],
|
||||
"f2" => $gp["value"],
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
echo json_encode($riwayat_obat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function riwayat_hidup($id, $langid )
|
||||
{
|
||||
$sql = "select * from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' ";
|
||||
$qry = $this->db->query($sql, array($id, $langid ));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderAnamnesisRiwayatSosial"], true);
|
||||
//keluhan saat ini
|
||||
$riwayat_hidup = array();
|
||||
foreach ($details[0]["details"] as $d) {
|
||||
|
||||
|
||||
|
||||
foreach ($d["details"] as $xd) {
|
||||
if ($xd["chx"] == 1) {
|
||||
$arr_result[] = array($xd["segment_name"], $xd["label"], $xd["value"]);
|
||||
$riwayat_hidup[] = array(
|
||||
"e1" => $xd["segment_name"],
|
||||
"e2" => $xd["label"] . ' ' . $xd["value"],
|
||||
"e3" => $xd["value"],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
echo json_encode($riwayat_hidup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function riwayat_imunisasi($id, $langid )
|
||||
{
|
||||
$sql = "select orderAnamnesisRiwayatImunisasi as details from one_klinik.order_anamnesis
|
||||
left join one_klinik.`order` on orderAnamnesisOrderID = OrderID
|
||||
where OrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderAnamnesisTypeForm = 'FORM' AND orderAnamnesisIsActive = 'Y' LIMIT 1";
|
||||
|
||||
$qry = $this->db->query($sql, array($id, $langid ));
|
||||
//echo $this->db->last_query(). "<br>";
|
||||
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->row_array();
|
||||
//print_r($rows['details']);
|
||||
$imunisasi = json_decode($rows["details"], true);
|
||||
//print_r($imunisasi );
|
||||
//keluhan saat ini
|
||||
$riwayat_imunisasi = array();
|
||||
// print_r($imunisasi['details']);
|
||||
|
||||
|
||||
foreach ($imunisasi[0]['details'] as $key => $d) {
|
||||
//print_r($d);
|
||||
foreach($d['details'] as $k => $xd){
|
||||
// echo $xd['id_code'];
|
||||
if ($xd["chx"] == 1) {
|
||||
$arr_result[] = array($xd["segment_name"], $xd["label"], $xd["value"]);
|
||||
//print_r($arr_result);
|
||||
$riwayat_imunisasi[] = array(
|
||||
"g1" => $xd["segment_name"],
|
||||
"g2" => $xd["label"] . ' ' . $xd["value"],
|
||||
"g3" => $xd["value"],
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($riwayat_imunisasi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//pemeriksaan Fisik
|
||||
function tanda_vital($id, $langid)
|
||||
{
|
||||
$sql = "select * from one_klinik.order_doctor
|
||||
left join one_klinik.`order` on orderDoctorOrderID = OrderID
|
||||
where orderDoctorOrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderDoctorType = 'FORM'
|
||||
";
|
||||
$qry = $this->db->query($sql, array($id, $langid));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderDoctorVitalSign"], true);
|
||||
//keluhan saat ini
|
||||
$tanda_vital = array();
|
||||
foreach ($details as $d) {
|
||||
if ($d["title"] == "TANDA VITAL") {
|
||||
|
||||
foreach ($d["details"] as $gp) {
|
||||
$value = $gp["value"] . ' ' . $gp["unit"];
|
||||
if ($gp["chx_x"] == "1") $value = $gp["label_x"];
|
||||
|
||||
if ($gp["chx_y"] == "1") $value = $gp["label_y"] . ' ' . $gp["value"] . ' ' . $gp["unit"];
|
||||
|
||||
|
||||
$tanda_vital[] = array(
|
||||
"aa1" => $gp["label"],
|
||||
"aa2" => $value,
|
||||
"aa3" => ucwords(strtolower($gp["value_x"])),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($tanda_vital);
|
||||
}
|
||||
|
||||
function status_gizi($id, $langid)
|
||||
{
|
||||
$sql = "select * from one_klinik.order_doctor
|
||||
left join one_klinik.`order` on orderDoctorOrderID = OrderID
|
||||
where orderDoctorOrderID = ?
|
||||
and orderM_LanguageID =?
|
||||
and orderDoctorType = 'FORM'
|
||||
";
|
||||
$qry = $this->db->query($sql, array($id, $langid));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["orderDoctorVitalSign"], true);
|
||||
//keluhan saat ini
|
||||
$status_gizi = array();
|
||||
foreach ($details as $d) {
|
||||
if ($d["title"] == "STATUS GIZI") {
|
||||
|
||||
foreach ($d["details"] as $gp) {
|
||||
$value = $gp["value"];
|
||||
if ($gp["chx_x"] == "1") $value = $gp["label_x"];
|
||||
if ($gp["chx_y"] == "1") $value = $gp["label_y"];
|
||||
|
||||
if ($gp["value"] == NaN) {
|
||||
$value = '-';
|
||||
}
|
||||
$status_gizi[] = array(
|
||||
"qq1" => $gp["label"],
|
||||
"qq2" => $value,
|
||||
"qq3" => $gp["unit"],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($status_gizi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//k3
|
||||
function kesimpulanx2($id, $langid, $type)
|
||||
{
|
||||
$sql = "select * from one_klinik.so_resultentry_fisik_umum
|
||||
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
|
||||
and So_ResultEntryFisikUmumM_LangID=?
|
||||
and So_ResultEntryFisikUmumType=?";
|
||||
$qry = $this->db->query($sql, array($id, $langid, $type));
|
||||
if (!$qry) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
return json_encode(array());
|
||||
}
|
||||
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"], true);
|
||||
//keluhan saat ini
|
||||
$kesimpulanx = array("asdasdasdasdasd");
|
||||
foreach ($details as $d) {
|
||||
|
||||
if ($d["title"] == "") {
|
||||
|
||||
foreach ($d["details"] as $gp) {
|
||||
if ($gp["chx"] == 1) {
|
||||
$arr_result[] = array($gp["label"], $gp["value"]);
|
||||
$kesimpulanx[] = array(
|
||||
"nn1" => $gp["label"],
|
||||
"nn2" => $gp["value"]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array("abc" => $kesimpulanx));
|
||||
}
|
||||
|
||||
|
||||
function list()
|
||||
{
|
||||
$sql = "select * from m_religion";
|
||||
$qry = $this->db->query($sql);
|
||||
if ($qry) {
|
||||
$rows = $qry->result_array();
|
||||
echo json_encode($rows);
|
||||
} else {
|
||||
echo json_encode(array());
|
||||
}
|
||||
}
|
||||
function get($id)
|
||||
{
|
||||
$sql = "select * from m_religion where M_ReligionID=?";
|
||||
$qry = $this->db->query($sql, $id);
|
||||
if ($qry) {
|
||||
$rows = $qry->result_array();
|
||||
echo json_encode($rows);
|
||||
} else {
|
||||
echo json_encode(array());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user