This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(".cd-select").select2({ | |
placeholder: 'Click and type', | |
allowClear: true, | |
ajax: { | |
url: function (params) { | |
return '/citiesDistricts/searchDistricts.json?q=' + params.term; | |
}, | |
dataType: 'json', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
success: function (response) { | |
if (response) { | |
var eventData = response.events; | |
var arr = [], i; | |
for (i in eventData) arr.push([i, eventData[i]].join('$$')); | |
var reverseData = arr.reverse(); | |
var append_text = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function bmiGraphApi($patient_id) { | |
if(!empty($patient_id)) { | |
$query = $this->Encounters->find() | |
->join(['Patients']); | |
$time = $query->func()->date_format([ | |
'Encounters.visitdate' => 'identifier', | |
"'%m-%d-%y'" => 'literal' | |
]); | |
$data = $query->select([ 'visitdate' => $time, 'bmi' => 'Patients.bmi']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using on patientDashboard - from today | |
public function nextAppointment($patient_id) { | |
$start = Time::now()->toDateString(); // today | |
$event = $this->Events->findByPatientId($patient_id) | |
->contain(['Facilities', 'Providers' => ['Users']]) | |
->where(['Events.start >= :now']) | |
->bind(':now', $start, 'time')->first(); | |
$this->set(compact('event')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function is using on calendar slot -appointment - aditya | |
public function lastVisitDate($patient_id, $facility_id) { | |
$last_visit_date = " "; | |
$Prescriptions = TableRegistry::get('prescriptions'); | |
$prescription = $Prescriptions->find() | |
->where(['patient_id' => $patient_id]) | |
->andWhere(['facility_id' => $facility_id]); | |
if($prescription->last()) { | |
//debug("pres-hh"); | |
$last_visit_date = $prescription->last()->created; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$_data = [ | |
'users' => [], | |
'recipientLists' => [], | |
'template' => 'default', | |
'vars' => [], | |
'tracking_id' => $this->getTrackingId() | |
]; | |
foreach ($data['vars'] as $key => $value) { | |
if (($key != 'new_email') && ($key != 'hyperlink')) { | |
$data['vars'][$key] = substr($value, 0, 18); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function lastVisitDate($patient_id, $facility_id) { | |
$Events = TableRegistry::get('events'); | |
$start = Time::now()->toDateString(); // today | |
$events = $Events->find() | |
->where(['patient_id' => $patient_id]) | |
->andWhere(['facility_id' => $facility_id]) | |
->andWhere(['events.start < :now']) // returns the past appointments (not includes today) | |
->bind(':now', $start, 'time') | |
->contain(['Encounters' => ['Prescriptions']]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using for EventCalendar/provider_cal.ctp | |
public function getSlotsForProvider($provider_id=null) { | |
Log::debug("getSlotsForProvider".$provider_id); | |
$providerSlots = $this->ProviderSlots->find("all") | |
->where(['provider_id' => $provider_id]) | |
// ->where(['OR' => [['alldays' => 1], ['day' => 0]]]) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// primary caregiver | |
if($patient->dirty('primary_contact_email') || $patient->dirty('primary_contact_phone1')) { | |
if ($new_caregiver_id1) { | |
// Found Existing user | |
// send notification | |
// create mapper Entity | |
if($caregiver1) { | |
$caregiver1->caregiver_patient_id = $new_caregiver_id1; | |
$this->Patients->Caregivers->save($caregiver1); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$patient_uuid = !$event->patient->external_patient_id ? $event->patient->patient_uuid : $event->patient->external_patient_id; | |
// aditya changes - | |
$last_visit_date = $this->lastVisitDate($event->patient->id, $event->facility->id); | |
// For last_vist date , please check for null then appply below date function, whereever you call | |
$last_visit_date = ($last_visit_date != null) ? (new Date($last_visit_date))->timeAgoInWords() : null; | |
$age = !($event->patient->age == "Not Defined") ? (" | ". $event->patient->age . " years old ") : ""; | |
/* | |
* 'title' => $patient . " | " . $event->patient->sex . $age . $last_visit_date, |