Commit 653707f8 by Jansa Jose

medical record change

parent f227a43b
......@@ -5658,6 +5658,15 @@ print_r(date('H:i',$ms));exit();*/
}
public function encrypt_data(){
$data = '{"booking_id":"56","main_problem":"Hand fracture","description":"Description of the problem","kidney_problems":["4"],"joint_problems":["5"],"heart_problems":["1","11"],"respiratory_problems":["6"],"gastric_problems":["7"],"allergies":["8"],"medicines":["paracetamol","Dolo","new","syndopn"],"has_hepatitis":false,"is_pregnant":false,"has_diabetes":false,"has_healing_problems":false}';
$new = encrypt_data($data);
$neww = decrypt_data('rsv1ArvYKAD6sQmygtLhMFYm0o9FAab49lXkrNyMoNWGnCse1Fz/nTf8Vd6uC8XWOhb4Jzk8sahLObHNc99suwh1KEAbw5uK2p1V/EjvA8yoo3mQXCJMrtLcbKWllepQLdBfh115Z6fgXEN0sx3o1/6zmlNHHpHsKZIsRdJVigKrqFCHbSyY6YLZj8XRbHLLwNzcYOWWRAZCWloiGF7XM8VXPH4jnLCB6vDvHLInbjwr24wCgNZYkmYCx13PPJpziUGenbxxo4vVXCTJm0kEcGQgIQ2zFZywiIdX+FMXGLU=');
print_r($new);echo"<br>";
print_r($neww);
exit();
}
public function set_prescriptions(){
header('Content-type: application/json');
$headers = apache_request_headers();
......
......@@ -2666,7 +2666,7 @@ class Webservice_model extends CI_Model {
$this->db->where('id',$data['medical_record_id']);
$res = $this->db->get('tbl_medical_records')->row();
//echo "<pre>";print_r($res);echo"</pre>";
//echo "<pre>";print_r($res);echo"</pre>";exit();
if($res){
$diff = (date('Y') - date('Y',$result->dob));
$result->patient_age = $diff;
......@@ -2691,8 +2691,8 @@ class Webservice_model extends CI_Model {
unset($result->amount);
$anamnese = array();
$anamse_details = decrypt_data(json_decode($res->diseases));
echo"<pre>";print_r($anamse_details->anamnese);echo"</pre><br>";
$anamse_details = json_decode(decrypt_data($res->diseases));
//echo"<pre>";print_r($anamse_details);echo"</pre><br>";exit();
foreach ($anamse_details->anamnese as $key => $value) {
$ke = strtolower($key);
$new[$ke] = $value;
......@@ -2701,75 +2701,97 @@ class Webservice_model extends CI_Model {
$anamse_details->anamnese = (object)$new;
$anamse_details->anamnese->principal_problem = decrypt_data($res->main_complaint);
$anamse_details->anamnese->description = decrypt_data(strip_tags($res->description));
if(in_array('hepatitis',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_hepatitis= true;
}else{
$anamse_details->anamnese->has_hepatitis= false;
}
if(in_array('pregnancy',$anamse_details->anamnese->others)){
$anamse_details->anamnese->is_pregnant= true;
}else{
$anamse_details->anamnese->is_pregnant= false;
}
if(in_array('diabetis',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_diabetes= true;
}else{
$anamse_details->anamnese->has_diabetes= false;
if(isset($anamse_details->anamnese->others)){
if(in_array('hepatitis',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_hepatitis= true;
}else{
$anamse_details->anamnese->has_hepatitis= false;
}
if(in_array('pregnancy',$anamse_details->anamnese->others)){
$anamse_details->anamnese->is_pregnant= true;
}else{
$anamse_details->anamnese->is_pregnant= false;
}
if(in_array('diabetis',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_diabetes= true;
}else{
$anamse_details->anamnese->has_diabetes= false;
}
if(in_array('healing_problems',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_healing_problems= true;
}else{
$anamse_details->anamnese->has_healing_problems= false;
}
unset($anamse_details->anamnese->others);
}
if(in_array('healing_problems',$anamse_details->anamnese->others)){
$anamse_details->anamnese->has_healing_problems= true;
}else{
$anamse_details->anamnese->has_healing_problems= false;
}
unset($anamse_details->anamnese->others);
$result->anamnese = $anamse_details->anamnese;
$prescrib = decrypt_data(json_decode($res->prescribtions));
$prescrib = json_decode(decrypt_data($res->prescribtions));
$med = array();
foreach ($prescrib as $key => $value) {
$med_data = $this->db->get_where('tbl_medicine',array('medicine_name'=>$value->name,'medicine_dosage'=>$value->quantity))->row();
$med[$key]['id'] = $med_data->id;
$med[$key]['medicine_name'] = $value->name;
$med[$key]['dosage'] = $value->procedure;
$med[$key]['quantity'] = $value->quantity;
}
$result->prescriptions = $med;
$exams = decrypt_data(json_decode($res->exams));
if(isset($prescrib)){
foreach ($prescrib as $key => $value) {
$med_data = $this->db->get_where('tbl_medicine',array('medicine_name'=>$value->name,'medicine_dosage'=>$value->quantity))->row();
$med[$key]['id'] = $med_data->id;
$med[$key]['medicine_name'] = $value->name;
$med[$key]['dosage'] = $value->procedure;
$med[$key]['quantity'] = $value->quantity;
}
$result->prescriptions = $med;
}else{
$result->prescriptions = [];
}
$exams = json_decode(decrypt_data($res->exams));
$exam = array();
foreach ($exams as $key => $value) {
$exam[$key]['exam'] = $value->procedure;
$exam[$key]['observation'] = $value->observation;
}
$result->exams = $exam;
$budgett = decrypt_data(json_decode($res->budget));
if(isset($exams)){
foreach ($exams as $key => $value) {
$exam[$key]['exam'] = $value->procedure;
$exam[$key]['observation'] = $value->observation;
}
$result->exams = $exam;
}else{
$result->exams = [];
}
$budgett = json_decode(decrypt_data($res->budget));
$budgt = array();
$budget=array();
$sum = 0;
foreach ($budgett as $key => $value) {
$budgt[$key]['item'] = $value->procedure;
$budgt[$key]['quantity'] = $value->quantity;
$budgt[$key]['amount'] = $value->amount;
$sum = $sum + $value->amount;
}
$budget['total'] = $sum;
$budget['bill_items'] = $budgt;
$result->budget = $budget;
if(isset($budgett)){
$sum = 0;
foreach ($budgett as $key => $value) {
$budgt[$key]['item'] = $value->procedure;
$budgt[$key]['quantity'] = $value->quantity;
$budgt[$key]['amount'] = $value->amount;
$sum = $sum + $value->amount;
}
$budget['total'] = $sum;
$budget['bill_items'] = $budgt;
$result->budget = $budget;
}else{
$result->budget = [];
}
$medical = array();
$medi = decrypt_data(json_decode($res->letters));
$medical[0]['title'] = '';
$medical[0]['certificate'] = strip_tags($medi->certificate);
$result->medical_certificates = $medical;
$medi = json_decode(decrypt_data($res->letters));
if(isset($medi)){
$medical[0]['title'] = '';
$medical[0]['certificate'] = strip_tags($medi->certificate);
$result->medical_certificates = $medical;
}else{
$result->medical_certificates = [];
}
$photos = json_decode($res->images);
$result->attached_images = $photos;
$result->other_observations = decrypt_data(strip_tags($res->other_observations));
if(isset($photos)){
$result->attached_images = $photos;
}else{
$result->attached_images = [];
}
$result->other_observations = strip_tags(decrypt_data($res->other_observations));
//echo "<pre>";print_r($result);echo"</pre>";exit();
$return_array = array('status'=>'success','data'=>$result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment