Example #1
0
 public static function removeProvider($id)
 {
     $db =& DB::singleton();
     $res = 0;
     $delete_products = "delete from providers_products where providers_products.prov_id={$id}";
     $delete_provider = "delete providers from providers where providers.id={$id}";
     $res = $db->getAffectedRows($delete_products);
     $res = $db->getAffectedRows($delete_provider);
     self::$providers = null;
     return $res;
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Workers();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Workers'])) {
         $model->attributes = $_POST['Workers'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if (isset($_GET['providerid'])) {
         $model->providers_id = $_GET['providerid'];
     }
     $this->render('create', array('model' => $model, 'providers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Providers::model()->findAll("id in (select providers_id from workers where users_id=" . Yii::app()->user->id . ")"), "id", 'name')), 'users_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Users::model()->findAll('id in (select userid from AuthAssignment where ' . 'itemname="technician" and userid in ' . '(select users_id from workers where providers_id in ' . '(select providers_id from workers where users_id=' . Yii::app()->user->id . ')))'), "id", 'email'))));
 }
Example #3
0
 /**
  * Getting crowler
  * @param string $url
  * @return boolean|\Crowler
  */
 public static function getAnalyzer($url)
 {
     // Check is robots allowed
     if (!Robots::robots_allowed($url, Config::$agent_name)) {
         Providers::change_url_status($url, Providers::URLS_TYPE_ROBOTS_NOT_ALLOWED);
         _w('Robots not allowed');
         return false;
     }
     // Create object
     $obj = new ContentAnalyzer($url);
     if (!$obj->getCONTENT_DATA()) {
         Providers::change_url_status($url, Providers::URLS_TYPE_ERROR_NO_DATA);
         return false;
     }
     return $obj;
 }
Example #4
0
 protected function generate_ccda($hippa_id = '', $pid = '')
 {
     $ccda = file_get_contents(__DIR__ . '/../../public/ccda.xml');
     $practice_info = Practiceinfo::find(Session::get('practice_id'));
     $ccda = str_replace('?practice_name?', $practice_info->practice_name, $ccda);
     $date_format = "YmdHisO";
     $ccda = str_replace('?effectiveTime?', date($date_format), $ccda);
     $ccda_name = time() . '_ccda.xml';
     if ($pid == '') {
         $pid = Session::get('pid');
     }
     $ccda = str_replace('?pid?', $pid, $ccda);
     $demographics = Demographics::find($pid);
     $ccda = str_replace('?ss?', $demographics->ss, $ccda);
     $ccda = str_replace('?street_address1?', $demographics->address, $ccda);
     $ccda = str_replace('?city?', $demographics->city, $ccda);
     $ccda = str_replace('?state?', $demographics->state, $ccda);
     $ccda = str_replace('?zip?', $demographics->zip, $ccda);
     $ccda = str_replace('?phone_home?', $demographics->phone_home, $ccda);
     $ccda = str_replace('?firstname?', $demographics->firstname, $ccda);
     $ccda = str_replace('?lastname?', $demographics->lastname, $ccda);
     if ($demographics->sex == 'f') {
         $gender = 'F';
         $gender_full = 'Female';
     } elseif ($demographics->sex == 'm') {
         $gender = 'M';
         $gender_full = 'Male';
     } else {
         $gender = 'U';
         $gender_full = 'Undifferentiated Gender';
     }
     $ccda = str_replace('?gender?', $gender, $ccda);
     $ccda = str_replace('?gender_full?', $gender_full, $ccda);
     $ccda = str_replace('?dob?', date('Ymd', $this->human_to_unix($demographics->DOB)), $ccda);
     $marital_code = "U";
     if ($demographics->marital_status == 'Annulled') {
         $marital_code = "N";
     }
     if ($demographics->marital_status == 'Common law') {
         $marital_code = "C";
     }
     if ($demographics->marital_status == 'Divorced') {
         $marital_code = "D";
     }
     if ($demographics->marital_status == 'Domestic partner') {
         $marital_code = "P";
     }
     if ($demographics->marital_status == 'Interlocutory') {
         $marital_code = "I";
     }
     if ($demographics->marital_status == 'Legally Separated') {
         $marital_code = "E";
     }
     if ($demographics->marital_status == 'Living together') {
         $marital_code = "G";
     }
     if ($demographics->marital_status == 'Married') {
         $marital_code = "M";
     }
     if ($demographics->marital_status == 'Other') {
         $marital_code = "O";
     }
     if ($demographics->marital_status == 'Registered domestic partner') {
         $marital_code = "R";
     }
     if ($demographics->marital_status == 'Separated') {
         $marital_code = "A";
     }
     if ($demographics->marital_status == 'Single') {
         $marital_code = "S";
     }
     if ($demographics->marital_status == 'Unknown') {
         $marital_code = "U";
     }
     if ($demographics->marital_status == 'Unmarried') {
         $marital_code = "B";
     }
     if ($demographics->marital_status == 'Unreported') {
         $marital_code = "T";
     }
     if ($demographics->marital_status == 'Widowed') {
         $marital_code = "O";
     }
     $ccda = str_replace('?marital_status?', $demographics->marital_status, $ccda);
     $ccda = str_replace('?marital_code?', $marital_code, $ccda);
     $ccda = str_replace('?race?', $demographics->race, $ccda);
     $ccda = str_replace('?race_code?', $demographics->race_code, $ccda);
     $ccda = str_replace('?ethnicity?', $demographics->ethnicity, $ccda);
     $ccda = str_replace('?ethnicity_code?', $demographics->ethnicity_code, $ccda);
     $ccda = str_replace('?guardian_code?', $demographics->guardian_code, $ccda);
     $ccda = str_replace('?guardian_relationship?', $demographics->guardian_relationship, $ccda);
     $ccda = str_replace('?guardian_lastname?', $demographics->guardian_lastname, $ccda);
     $ccda = str_replace('?guardian_firstname?', $demographics->guardian_firstname, $ccda);
     $ccda = str_replace('?guardian_address?', $demographics->guardian_address, $ccda);
     $ccda = str_replace('?guardian_city?', $demographics->guardian_city, $ccda);
     $ccda = str_replace('?guardian_state?', $demographics->guardian_state, $ccda);
     $ccda = str_replace('?guardian_zip?', $demographics->guardian_zip, $ccda);
     $ccda = str_replace('?guardian_phone_home?', $demographics->guardian_phone_home, $ccda);
     if ($practice_info->street_address2 != '') {
         $practice_info->street_address1 .= ', ' . $practice_info->street_address2;
     }
     $ccda = str_replace('?practiceinfo_street_address?', $practice_info->street_address1, $ccda);
     $ccda = str_replace('?practiceinfo_city?', $practice_info->city, $ccda);
     $ccda = str_replace('?practiceinfo_state?', $practice_info->state, $ccda);
     $ccda = str_replace('?practiceinfo_zip?', $practice_info->zip, $ccda);
     $ccda = str_replace('?practiceinfo_phone?', $practice_info->phone, $ccda);
     $user_id = Session::get('user_id');
     $user = User::find($user_id);
     $ccda = str_replace('?user_id?', $user->id, $ccda);
     $ccda = str_replace('?user_lastname?', $user->lastname, $ccda);
     $ccda = str_replace('?user_firstname?', $user->firstname, $ccda);
     $ccda = str_replace('?user_title?', $user->title, $ccda);
     $date_format1 = "Ymd";
     $ccda = str_replace('?effectiveTimeShort?', date($date_format1), $ccda);
     $ccda = str_replace('?lang_code?', $demographics->lang_code, $ccda);
     if ($hippa_id != '') {
         $hippa_info = Hippa::find($hippa_id);
         $ccda = str_replace('?hippa_provider?', $hippa_info->hippa_provider, $ccda);
         $ccda = str_replace('?encounter_role?', $hippa_info->hippa_role, $ccda);
         if ($hippa_info->hippa_role == "Primary Care Provider") {
             $hippa_role_code = "PP";
         }
         if ($hippa_info->hippa_role == "Consulting Provider") {
             $hippa_role_code = "CP";
         }
         if ($hippa_info->hippa_role == "Referring Provider") {
             $hippa_role_code = "RP";
         }
     } else {
         $ccda = str_replace('?hippa_provider?', '', $ccda);
         $ccda = str_replace('?encounter_role?', '', $ccda);
         $hippa_role_code = "";
     }
     $ccda = str_replace('?encounter_role_code?', $hippa_role_code, $ccda);
     $recent_encounter_query = DB::table('encounters')->where('pid', '=', $pid)->where('addendum', '=', 'n')->where('practice_id', '=', Session::get('practice_id'))->where('encounter_signed', '=', 'Yes')->orderBy('encounter_DOS', 'desc')->take(1)->first();
     if ($recent_encounter_query) {
         $ccda = str_replace('?eid?', $recent_encounter_query->eid, $ccda);
         $encounter_info = Encounters::find($recent_encounter_query->eid);
         $provider_info = User::find($encounter_info->user_id);
         $provider_info1 = Providers::find($encounter_info->user_id);
         if ($provider_info1) {
             $npi = $provider_info1->npi;
         } else {
             $npi = '';
         }
         $ccda = str_replace('?npi?', $npi, $ccda);
         $ccda = str_replace('?provider_title?', $provider_info->title, $ccda);
         $ccda = str_replace('?provider_firstname?', $provider_info->firstname, $ccda);
         $ccda = str_replace('?provider_lastname?', $provider_info->lastname, $ccda);
         $ccda = str_replace('?encounter_dos?', date('Ymd', $this->human_to_unix($encounter_info->encounter_DOS)), $ccda);
         $assessment_info = Assessment::find($recent_encounter_query->eid);
         if ($assessment_info) {
             $recent_icd = $assessment_info->assessment_icd1;
             $assessment_info1 = DB::table('icd9')->where('icd9', '=', $recent_icd)->first();
             if ($assessment_info1) {
                 $recent_icd_description = $assessment_info1->icd9_description;
             } else {
                 $recent_icd_description = '';
             }
         } else {
             $recent_icd = '';
             $recent_icd_description = '';
         }
         $ccda = str_replace('?icd9?', $recent_icd, $ccda);
         $ccda = str_replace('?icd9_description?', $recent_icd_description, $ccda);
     } else {
         $ccda = str_replace('?eid?', '', $ccda);
         $ccda = str_replace('?npi?', '', $ccda);
         $ccda = str_replace('?provider_title?', '', $ccda);
         $ccda = str_replace('?provider_firstname?', '', $ccda);
         $ccda = str_replace('?provider_lastname?', '', $ccda);
         $ccda = str_replace('?encounter_dos?', '', $ccda);
         $ccda = str_replace('?icd9?', '', $ccda);
         $ccda = str_replace('?icd9_description?', '', $ccda);
     }
     $allergies_query = DB::table('allergies')->where('pid', '=', $pid)->get();
     $allergies_table = "";
     $allergies_file_final = "";
     if ($allergies_query) {
         $i = 1;
         foreach ($allergies_query as $allergies_row) {
             $allergies_table .= "<tr>";
             $allergies_table .= "<td>" . $allergies_row->allergies_med . "</td>";
             $allergies_table .= "<td><content ID='reaction" . $i . "'>" . $allergies_row->allergies_reaction . "</content></td>";
             $allergies_table .= "<td><content ID='severity" . $i . "'>" . $allergies_row->allergies_severity . "</content></td>";
             if ($allergies_row->allergies_date_inactive == '0000-00-00 00:00:00') {
                 $allergies_table .= "<td>Active</td>";
                 $allergies_status = "Active";
                 $allergies_file = file_get_contents(__DIR__ . '/../../public/allergies_active.xml');
                 $allergies_file = str_replace('?allergies_date_active?', date('Ymd', $this->human_to_unix($allergies_row->allergies_date_active)), $allergies_file);
             } else {
                 $allergies_table .= "<td>Inactive</td>";
                 $allergies_status = "Inactive";
                 $allergies_file = file_get_contents(__DIR__ . '/../../public/allergies_inactive.xml');
                 $allergies_file = str_replace('?allergies_date_active?', date('Ymd', $this->human_to_unix($allergies_row->allergies_date_active)), $allergies_file);
                 $allergies_file = str_replace('?allergies_date_inactive?', date('Ymd', $this->human_to_unix($allergies_row->allergies_date_inactive)), $allergies_file);
             }
             $allergies_table .= "</tr>";
             $reaction_number = "#reaction" . $i;
             $severity_number = "#severity" . $i;
             $allergies_file = str_replace('?reaction_number?', $reaction_number, $allergies_file);
             $allergies_file = str_replace('?severity_number?', $severity_number, $allergies_file);
             $allergies_file = str_replace('?allergies_med?', $allergies_row->allergies_med, $allergies_file);
             $allergies_file = str_replace('?allergies_status?', $allergies_status, $allergies_file);
             $allergies_file = str_replace('?allergies_reaction?', $allergies_row->allergies_reaction, $allergies_file);
             $allergies_file = str_replace('?allergies_code?', '', $allergies_file);
             // Need allergies severity field
             $allergies_file = str_replace('?allergies_severity?', '', $allergies_file);
             $allergy_random_id1 = $this->gen_uuid();
             $allergy_random_id2 = $this->gen_uuid();
             $allergy_random_id3 = $this->gen_uuid();
             $allergies_file = str_replace('?allergy_random_id1?', $allergy_random_id1, $allergies_file);
             $allergies_file = str_replace('?allergy_random_id2?', $allergy_random_id2, $allergies_file);
             $allergies_file = str_replace('?allergy_random_id3?', $allergy_random_id3, $allergies_file);
             $allergies_file_final .= $allergies_file;
             $i++;
         }
     }
     $ccda = str_replace('?allergies_table?', $allergies_table, $ccda);
     $ccda = str_replace('?allergies_file?', $allergies_file_final, $ccda);
     $encounters_query = DB::table('encounters')->where('pid', '=', $pid)->where('addendum', '=', 'n')->where('practice_id', '=', Session::get('practice_id'))->where('encounter_signed', '=', 'Yes')->orderBy('encounter_DOS', 'desc')->get();
     $e = 1;
     $encounters_table = "";
     $encounters_file_final = "";
     if ($encounters_query) {
         foreach ($encounters_query as $encounters_row) {
             $encounters_table .= "<tr>";
             $encounters_table .= "<td><content ID='Encounter" . $e . "'>" . $encounters_row->encounter_cc . "</content></td>";
             $encounters_table .= "<td>" . $encounters_row->encounter_provider . "</td>";
             $encounters_table .= "<td>" . $practice_info->practice_name . "</td>";
             $encounters_table .= "<td>" . date('m-d-Y', $this->human_to_unix($encounters_row->encounter_DOS)) . "</td>";
             $encounters_table .= "</tr>";
             $encounters_file = file_get_contents(__DIR__ . '/../../public/encounters.xml');
             $encounters_number = "#Encounter" . $e;
             $billing = DB::table('billing_core')->where('eid', '=', $encounters_row->eid)->where('billing_group', '=', '1')->where('cpt', 'NOT LIKE', "sp%")->orderBy('cpt_charge', 'desc')->take(1)->first();
             if ($billing) {
                 $cpt_query = DB::table('cpt_relate')->where('cpt', '=', $billing->cpt)->first();
                 if ($cpt_query) {
                     $cpt_result = DB::table('cpt_relate')->where('cpt', '=', $billing->cpt)->first();
                 } else {
                     $cpt_result = DB::table('cpt')->where('cpt', '=', $billing->cpt)->first();
                 }
                 $encounter_code = $billing->cpt;
                 if ($cpt_result) {
                     $cpt_description = $cpt_result->cpt_description;
                 } else {
                     $cpt_description = '';
                 }
             } else {
                 $encounter_code = '';
                 $cpt_description = '';
             }
             $provider_info2 = User::find($encounters_row->user_id);
             if ($provider_info2) {
                 $provider_firstname = $provider_info2->firstname;
                 $provider_lastname = $provider_info2->lastname;
                 $provider_title = $provider_info2->title;
             } else {
                 $provider_firstname = '';
                 $provider_lastname = '';
                 $provider_title = '';
             }
             $encounters_file = str_replace('?encounter_cc?', $encounters_row->encounter_cc, $encounters_file);
             $encounters_file = str_replace('?encounter_number?', $encounters_row->eid, $encounters_file);
             $encounters_file = str_replace('?encounter_code?', $encounter_code, $encounters_file);
             $encounters_file = str_replace('?encounter_code_desc?', $cpt_description, $encounters_file);
             $encounters_file = str_replace('?encounter_provider?', $encounters_row->encounter_provider, $encounters_file);
             $encounters_file = str_replace('?encounter_dos1?', date('m-d-Y', $this->human_to_unix($encounters_row->encounter_DOS)), $encounters_file);
             $encounters_file = str_replace('?provider_firstname?', $provider_firstname, $encounters_file);
             $encounters_file = str_replace('?provider_lastname?', $provider_lastname, $encounters_file);
             $encounters_file = str_replace('?provider_title?', $provider_title, $encounters_file);
             $encounters_file = str_replace('?encounter_dos?', date('Ymd', $this->human_to_unix($encounters_row->encounter_DOS)), $encounters_file);
             $encounters_file = str_replace('?practiceinfo_street_address?', $practice_info->street_address1, $encounters_file);
             $encounters_file = str_replace('?practiceinfo_city?', $practice_info->city, $encounters_file);
             $encounters_file = str_replace('?practiceinfo_state?', $practice_info->state, $encounters_file);
             $encounters_file = str_replace('?practiceinfo_zip?', $practice_info->zip, $encounters_file);
             $encounters_file = str_replace('?practiceinfo_phone?', $practice_info->phone, $encounters_file);
             $encounters_file = str_replace('?practice_name?', $practice_info->practice_name, $encounters_file);
             $encounter_random_id1 = $this->gen_uuid();
             $encounter_random_id2 = $this->gen_uuid();
             $encounter_random_id3 = $this->gen_uuid();
             $encounters_file = str_replace('?encounter_random_id1?', $encounter_random_id1, $encounters_file);
             $encounters_file = str_replace('?encounter_random_id2?', $encounter_random_id2, $encounters_file);
             $assessment_info1 = Assessment::find($encounters_row->eid);
             $encounter_diagnosis = '';
             if ($assessment_info1) {
                 $dx_array[] = $assessment_info1->assessment_icd1;
                 if ($assessment_info1->assessment_icd2 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd2;
                 }
                 if ($assessment_info1->assessment_icd3 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd3;
                 }
                 if ($assessment_info1->assessment_icd4 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd4;
                 }
                 if ($assessment_info1->assessment_icd5 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd5;
                 }
                 if ($assessment_info1->assessment_icd6 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd6;
                 }
                 if ($assessment_info1->assessment_icd7 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd7;
                 }
                 if ($assessment_info1->assessment_icd8 != "") {
                     $dx_array[] = $assessment_info1->assessment_icd8;
                 }
                 foreach ($dx_array as $dx_item) {
                     $dx_file = file_get_contents(__DIR__ . '/../../public/encounter_diagnosis.xml');
                     $dx_random_id1 = $this->gen_uuid();
                     $dx_random_id2 = $this->gen_uuid();
                     $dx_random_id3 = $this->gen_uuid();
                     $dx_file = str_replace('?dx_random_id1?', $dx_random_id1, $dx_file);
                     $dx_file = str_replace('?dx_random_id2?', $dx_random_id2, $dx_file);
                     $dx_file = str_replace('?dx_random_id3?', $dx_random_id3, $dx_file);
                     $dx_file = str_replace('?icd9?', $dx_item, $dx_file);
                     $dx_file = str_replace('?encounter_dos?', date('Ymd', $this->human_to_unix($encounter_info->encounter_DOS)), $dx_file);
                     $dx_info = DB::table('icd9')->where('icd9', '=', $dx_item)->first();
                     if ($dx_info) {
                         $icd_description = $dx_info->icd9_description;
                     } else {
                         $icd_description = '';
                     }
                     $dx_file = str_replace('?icd9_description?', $icd_description, $dx_file);
                     $encounter_diagnosis .= $dx_file;
                 }
             }
             $encounters_file = str_replace('?encounter_diagnosis?', $encounter_diagnosis, $encounters_file);
             $encounters_file_final .= $encounters_file;
             $e++;
         }
     }
     $ccda = str_replace('?encounters_table?', $encounters_table, $ccda);
     $ccda = str_replace('?encounters_file?', $encounters_file_final, $ccda);
     $imm_query = DB::table('immunizations')->where('pid', '=', $pid)->orderBy('imm_immunization', 'asc')->orderBy('imm_sequence', 'asc')->get();
     $imm_table = "";
     $imm_file_final = "";
     if ($imm_query) {
         $j = 1;
         foreach ($imm_query as $imm_row) {
             $imm_table .= "<tr>";
             $imm_table .= "<td><content ID='immun" . $j . "'>" . $imm_row->imm_immunization . "</content></td>";
             $imm_table .= "<td>" . date('m-d-Y', $this->human_to_unix($imm_row->imm_date)) . "</td>";
             $imm_table .= "<td>Completed</td>";
             $imm_table .= "</tr>";
             $imm_file = file_get_contents(__DIR__ . '/../../public/immunizations.xml');
             $immun_number = "#immun" . $j;
             $imm_file = str_replace('?immun_number?', $immun_number, $imm_file);
             $imm_file = str_replace('?imm_date?', date('Ymd', $this->human_to_unix($imm_row->imm_date)), $imm_file);
             $imm_code = '';
             $imm_code_description = '';
             if ($imm_row->imm_route == "intramuscularly") {
                 $imm_code = "C1556154";
                 $imm_code_description = "Intramuscular Route of Administration";
             }
             if ($imm_row->imm_route == "subcutaneously") {
                 $imm_code = "C1522438";
                 $imm_code_description = "Subcutaneous Route of Administration";
             }
             if ($imm_row->imm_route == "intravenously") {
                 $imm_code = "C2960476";
                 $imm_code_description = "Intravascular Route of Administration";
             }
             if ($imm_row->imm_route == "by mouth") {
                 $imm_code = "C1522409";
                 $imm_code_description = "Oropharyngeal Route of Administration";
             }
             $imm_file = str_replace('?imm_code?', $imm_code, $imm_file);
             $imm_file = str_replace('?imm_code_description?', $imm_code_description, $imm_file);
             $imm_file = str_replace('?imm_dosage?', $imm_row->imm_dosage, $imm_file);
             $imm_file = str_replace('?imm_dosage_unit?', $imm_row->imm_dosage_unit, $imm_file);
             $imm_file = str_replace('?imm_cvxcode?', $imm_row->imm_cvxcode, $imm_file);
             $imm_random_id1 = $this->gen_uuid();
             $imm_file = str_replace('?imm_random_id1?', $imm_random_id1, $imm_file);
             $cvx = DB::table('cvx')->where('cvx_code', '=', $imm_row->imm_cvxcode)->first();
             if ($cvx) {
                 $vaccine_name = $cvx->vaccine_name;
             } else {
                 $vaccine_name = '';
             }
             $imm_file = str_replace('?vaccine_name?', $vaccine_name, $imm_file);
             $imm_file = str_replace('?imm_manufacturer?', $imm_row->imm_manufacturer, $imm_file);
             $imm_file_final .= $imm_file;
             $j++;
         }
     }
     $ccda = str_replace('?imm_table?', $imm_table, $ccda);
     $ccda = str_replace('?imm_file?', $imm_file_final, $ccda);
     $med_query = DB::table('rx_list')->where('pid', '=', $pid)->where('rxl_date_inactive', '=', '0000-00-00 00:00:00')->where('rxl_date_old', '=', '0000-00-00 00:00:00')->get();
     $sup_query = DB::table('sup_list')->where('pid', '=', $pid)->where('sup_date_inactive', '=', '0000-00-00 00:00:00')->get();
     $med_table = "";
     $med_file_final = "";
     $k = 1;
     if ($med_query) {
         foreach ($med_query as $med_row) {
             $med_table .= "<tr>";
             $med_table .= "<td><content ID='med" . $k . "'>" . $med_row->rxl_medication . ' ' . $med_row->rxl_dosage . ' ' . $med_row->rxl_dosage_unit . "</content></td>";
             if ($med_row->rxl_sig == '') {
                 $instructions = $med_row->rxl_instructions;
                 $med_dosage = '';
                 $med_dosage_unit = '';
                 $med_code = '';
                 $med_code_description = '';
                 $med_period = '';
             } else {
                 $instructions = $med_row->rxl_sig . ' ' . $med_row->rxl_route . ' ' . $med_row->rxl_frequency;
                 $med_dosage_parts = explode(" ", $med_row->rxl_sig);
                 $med_dosage = $med_dosage_parts[0];
                 if (count($med_dosage_parts) > 1) {
                     $med_dosage_unit = $med_dosage_parts[1];
                 } else {
                     $med_dosage_unit = '';
                 }
                 $med_code = '';
                 $med_code_description = '';
                 if ($med_row->rxl_route == "by mouth") {
                     $med_code = "C1522409";
                     $med_code_description = "Oropharyngeal Route of Administration";
                 }
                 if ($med_row->rxl_route == "per rectum") {
                     $med_code = "C1527425";
                     $med_code_description = "Rectal Route of Administration";
                 }
                 if ($med_row->rxl_route == "transdermal") {
                     $med_code = "C0040652";
                     $med_code_description = "Transdermal Route of Administration";
                 }
                 if ($med_row->rxl_route == "subcutaneously") {
                     $med_code = "C1522438";
                     $med_code_description = "Subcutaneous Route of Administration";
                 }
                 if ($med_row->rxl_route == "intravenously") {
                     $med_code = "C2960476";
                     $med_code_description = "Intravascular Route of Administration";
                 }
                 if ($med_row->rxl_route == "intramuscularly") {
                     $med_code = "C1556154";
                     $med_code_description = "Intramuscular Route of Administration";
                 }
                 $med_period = '';
                 $med_freq_array_1 = array("once daily", "every 24 hours", "once a day", "1 time a day", "QD");
                 $med_freq_array_2 = array("twice daily", "every 12 hours", "two times a day", "2 times a day", "BID", "q12h", "Q12h");
                 $med_freq_array_3 = array("three times daily", "every 8 hours", "three times a day", "3 times daily", "3 times a day", "TID", "q8h", "Q8h");
                 $med_freq_array_4 = array("every six hours", "every 6 hours", "four times daily", "4 times a day", "four times a day", "4 times daily", "QID", "q6h", "Q6h");
                 $med_freq_array_5 = array("every four hours", "every 4 hours", "six times a day", "6 times a day", "six times daily", "6 times daily", "q4h", "Q4h");
                 $med_freq_array_6 = array("every three hours", "every 3 hours", "eight times a day", "8 times a day", "eight times daily", "8 times daily", "q3h", "Q3h");
                 $med_freq_array_7 = array("every two hours", "every 2 hours", "twelve times a day", "12 times a day", "twelve times daily", "12 times daily", "q2h", "Q2h");
                 $med_freq_array_8 = array("every hour", "every 1 hour", "every one hour", "q1h", "Q1h");
                 if (in_array($med_row->rxl_frequency, $med_freq_array_1)) {
                     $med_period = "24";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_2)) {
                     $med_period = "12";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_3)) {
                     $med_period = "8";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_4)) {
                     $med_period = "6";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_5)) {
                     $med_period = "4";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_6)) {
                     $med_period = "3";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_7)) {
                     $med_period = "2";
                 }
                 if (in_array($med_row->rxl_frequency, $med_freq_array_8)) {
                     $med_period = "1";
                 }
             }
             $med_table .= "<td>" . $instructions . "</td>";
             $med_table .= "<td>" . date('m-d-Y', $this->human_to_unix($med_row->rxl_date_active)) . "</td>";
             $med_table .= "<td>Active</td>";
             $med_table .= "<td>" . $med_row->rxl_reason . "</td>";
             $med_table .= "</tr>";
             $med_file = file_get_contents(__DIR__ . '/../../public/medications.xml');
             $med_number = "#med" . $k;
             $med_random_id1 = $this->gen_uuid();
             $med_random_id2 = $this->gen_uuid();
             $med_file = str_replace('?med_random_id1?', $med_random_id1, $med_file);
             $med_file = str_replace('?med_random_id2?', $med_random_id2, $med_file);
             $med_file = str_replace('?med_number?', $med_number, $med_file);
             $med_file = str_replace('?med_date_active?', date('Ymd', $this->human_to_unix($med_row->rxl_date_active)), $med_file);
             $med_file = str_replace('?med_code?', $med_code, $med_file);
             $med_file = str_replace('?med_code_description?', $med_code_description, $med_file);
             $med_file = str_replace('?med_period?', $med_period, $med_file);
             $med_file = str_replace('?med_dosage?', $med_dosage, $med_file);
             $med_file = str_replace('?med_dosage_unit?', $med_dosage_unit, $med_file);
             $rxnormapi = new RxNormApi();
             $rxnormapi->output_type = 'json';
             $rxnorm = json_decode($rxnormapi->findRxcuiById("NDC", $med_row->rxl_ndcid), true);
             if (isset($rxnorm['idGroup']['rxnormId'][0])) {
                 $rxnorm1 = json_decode($rxnormapi->getRxConceptProperties($rxnorm['idGroup']['rxnormId'][0]), true);
                 $med_rxnorm_code = $rxnorm['idGroup']['rxnormId'][0];
                 $med_name = $rxnorm1['properties']['name'];
             } else {
                 $med_rxnorm_code = '';
                 $med_name = $med_row->rxl_medication . ' ' . $med_row->rxl_dosage . ' ' . $med_row->rxl_dosage_unit;
             }
             $med_file = str_replace('?med_rxnorm_code?', $med_rxnorm_code, $med_file);
             $med_file = str_replace('?med_name?', $med_name, $med_file);
             $med_file_final .= $med_file;
             $k++;
         }
     }
     if ($sup_query) {
         foreach ($sup_query as $sup_row) {
             $med_table .= "<tr>";
             $med_table .= "<td><content ID='med" . $k . "'>" . $sup_row->sup_supplement . ' ' . $sup_row->sup_dosage . ' ' . $sup_row->sup_dosage_unit . "</content></td>";
             if ($sup_row->sup_sig == '') {
                 $instructions = $sup_row->sup_instructions;
                 $med_dosage = '';
                 $med_dosage_unit = '';
                 $med_code = '';
                 $med_code_description = '';
                 $med_period = '';
             } else {
                 $instructions = $sup_row->sup_sig . ' ' . $sup_row->sup_route . ' ' . $sup_row->sup_frequency;
                 $med_dosage_parts = explode(" ", $sup_row->sup_sig);
                 $med_dosage = $med_dosage_parts[0];
                 $med_dosage_unit = '';
                 if (isset($med_dosage_parts[1])) {
                     $med_dosage_unit = $med_dosage_parts[1];
                 }
                 $med_code = '';
                 $med_code_description = '';
                 if ($sup_row->sup_route == "by mouth") {
                     $med_code = "C1522409";
                     $med_code_description = "Oropharyngeal Route of Administration";
                 }
                 if ($sup_row->sup_route == "per rectum") {
                     $med_code = "C1527425";
                     $med_code_description = "Rectal Route of Administration";
                 }
                 if ($sup_row->sup_route == "transdermal") {
                     $med_code = "C0040652";
                     $med_code_description = "Transdermal Route of Administration";
                 }
                 if ($sup_row->sup_route == "subcutaneously") {
                     $med_code = "C1522438";
                     $med_code_description = "Subcutaneous Route of Administration";
                 }
                 if ($sup_row->sup_route == "intravenously") {
                     $med_code = "C2960476";
                     $med_code_description = "Intravascular Route of Administration";
                 }
                 if ($sup_row->sup_route == "intramuscularly") {
                     $med_code = "C1556154";
                     $med_code_description = "Intramuscular Route of Administration";
                 }
                 $med_period = '';
                 $med_freq_array_1 = array("once daily", "every 24 hours", "once a day", "1 time a day", "QD");
                 $med_freq_array_2 = array("twice daily", "every 12 hours", "two times a day", "2 times a day", "BID", "q12h", "Q12h");
                 $med_freq_array_3 = array("three times daily", "every 8 hours", "three times a day", "3 times daily", "3 times a day", "TID", "q8h", "Q8h");
                 $med_freq_array_4 = array("every six hours", "every 6 hours", "four times daily", "4 times a day", "four times a day", "4 times daily", "QID", "q6h", "Q6h");
                 $med_freq_array_5 = array("every four hours", "every 4 hours", "six times a day", "6 times a day", "six times daily", "6 times daily", "q4h", "Q4h");
                 $med_freq_array_6 = array("every three hours", "every 3 hours", "eight times a day", "8 times a day", "eight times daily", "8 times daily", "q3h", "Q3h");
                 $med_freq_array_7 = array("every two hours", "every 2 hours", "twelve times a day", "12 times a day", "twelve times daily", "12 times daily", "q2h", "Q2h");
                 $med_freq_array_8 = array("every hour", "every 1 hour", "every one hour", "q1h", "Q1h");
                 if (in_array($sup_row->sup_frequency, $med_freq_array_1)) {
                     $med_period = "24";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_2)) {
                     $med_period = "12";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_3)) {
                     $med_period = "8";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_4)) {
                     $med_period = "6";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_5)) {
                     $med_period = "4";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_6)) {
                     $med_period = "3";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_7)) {
                     $med_period = "2";
                 }
                 if (in_array($sup_row->sup_frequency, $med_freq_array_8)) {
                     $med_period = "1";
                 }
             }
             $med_table .= "<td>" . $instructions . "</td>";
             $med_table .= "<td>" . date('m-d-Y', $this->human_to_unix($sup_row->sup_date_active)) . "</td>";
             $med_table .= "<td>Active</td>";
             $med_table .= "<td>" . $sup_row->sup_reason . "</td>";
             $med_table .= "</tr>";
             $med_file = file_get_contents(__DIR__ . '/../../public/medications.xml');
             $med_number = "#med" . $k;
             $med_random_id1 = $this->gen_uuid();
             $med_random_id2 = $this->gen_uuid();
             $med_file = str_replace('?med_random_id1?', $med_random_id1, $med_file);
             $med_file = str_replace('?med_random_id2?', $med_random_id2, $med_file);
             $med_file = str_replace('?med_number?', $med_number, $med_file);
             $med_file = str_replace('?med_date_active?', date('Ymd', $this->human_to_unix($sup_row->sup_date_active)), $med_file);
             $med_file = str_replace('?med_code?', $med_code, $med_file);
             $med_file = str_replace('?med_code_description?', $med_code_description, $med_file);
             $med_file = str_replace('?med_period?', $med_period, $med_file);
             $med_file = str_replace('?med_dosage?', $med_dosage, $med_file);
             $med_file = str_replace('?med_dosage_unit?', $med_dosage_unit, $med_file);
             $med_rxnorm_code = '';
             $med_name = $sup_row->sup_supplement . ' ' . $sup_row->sup_dosage . ' ' . $sup_row->sup_dosage_unit;
             $med_file = str_replace('?med_rxnorm_code?', $med_rxnorm_code, $med_file);
             $med_file = str_replace('?med_name?', $med_name, $med_file);
             $med_file_final .= $med_file;
             $k++;
         }
     }
     $ccda = str_replace('?med_table?', $med_table, $ccda);
     $ccda = str_replace('?med_file?', $med_file_final, $ccda);
     $orders_table = "";
     $orders_file_final = "";
     if ($recent_encounter_query) {
         $orders_query = DB::table('orders')->where('eid', '=', $recent_encounter_query->eid)->get();
         if ($orders_query) {
             foreach ($orders_query as $orders_row) {
                 if ($orders_row->orders_labs != '') {
                     $orders_labs_array = explode("\n", $orders_row->orders_labs);
                     $n1 = 1;
                     foreach ($orders_labs_array as $orders_labs_row) {
                         $orders_table .= "<tr>";
                         $orders_table .= "<td><content ID='orders_labs_" . $n1 . "'>" . $orders_labs_row . "</td>";
                         $orders_table .= "<td>" . date('m-d-Y', $this->human_to_unix($orders_row->orders_date)) . "</td>";
                         $orders_table .= "</tr>";
                         $orders_file_final .= $this->get_snomed_code($orders_labs_row, $orders_row->orders_date, '#orders_lab_' . $n1);
                         $n1++;
                     }
                 }
                 if ($orders_row->orders_radiology != '') {
                     $orders_rad_array = explode("\n", $orders_row->orders_radiology);
                     $n2 = 1;
                     foreach ($orders_rad_array as $orders_rad_row) {
                         $orders_table .= "<tr>";
                         $orders_table .= "<td><content ID='orders_rad_" . $n2 . "'>" . $orders_rad_row . "</td>";
                         $orders_table .= "<td>" . date('m-d-Y', $this->human_to_unix($orders_row->orders_date)) . "</td>";
                         $orders_table .= "</tr>";
                         $orders_file_final .= $this->get_snomed_code($orders_rad_row, $orders_row->orders_date, '#orders_rad_' . $n2);
                         $n2++;
                     }
                 }
                 if ($orders_row->orders_cp != '') {
                     $orders_cp_array = explode("\n", $orders_row->orders_cp);
                     $n3 = 1;
                     foreach ($orders_cp_array as $orders_cp_row) {
                         $orders_table .= "<tr>";
                         $orders_table .= "<td><content ID='orders_cp_" . $n3 . "'>" . $orders_cp_row . "</td>";
                         $orders_table .= "<td>" . date('m-d-Y', $this->human_to_unix($orders_row->orders_date)) . "</td>";
                         $orders_table .= "</tr>";
                         $orders_file_final .= $this->get_snomed_code($orders_cp_row, $orders_row->orders_date, '#orders_cp_' . $n3);
                         $n3++;
                     }
                 }
                 if ($orders_row->orders_referrals != '') {
                     $referral_orders = explode("\nRequested action:\n", $orders_row->orders_referrals);
                     if (count($referral_orders) > 1) {
                         $orders_ref_array = explode("\n", $referral_orders[0]);
                         $n4 = 1;
                         foreach ($orders_ref_array as $orders_ref_row) {
                             $orders_table .= "<tr>";
                             $orders_table .= "<td><content ID='orders_ref_" . $n4 . "'>" . $orders_ref_row . "</td>";
                             $orders_table .= "<td>" . date('m-d-Y', $this->human_to_unix($orders_row->orders_date)) . "</td>";
                             $orders_table .= "</tr>";
                             $orders_file_final .= $this->get_snomed_code($orders_ref_row, $orders_row->orders_date, '#orders_ref_' . $n4);
                             $n4++;
                         }
                     }
                 }
             }
         }
     }
     $ccda = str_replace('?orders_table?', $orders_table, $ccda);
     $ccda = str_replace('?orders_file?', $orders_file_final, $ccda);
     $issues_query = DB::table('issues')->where('pid', '=', $pid)->get();
     $issues_table = "";
     $issues_file_final = "";
     if ($issues_query) {
         $l = 1;
         foreach ($issues_query as $issues_row) {
             $issues_table .= "<list listType='ordered'>";
             $issues_array = explode(' [', $issues_row->issue);
             $issue_code = str_replace("]", "", $issues_array[1]);
             $issue_code_description = $issues_array[0];
             if ($issues_row->issue_date_inactive != '0000-00-00 00:00:00') {
                 $issues_table .= "<item><content ID='problem" . $l . "'>" . $issues_row->issue . ": Status - Resolved</content></item>";
                 $issues_status = "Resolved";
                 $issues_code = "413322009";
                 $issues_file = file_get_contents(__DIR__ . '/../../public/issues_inactive.xml');
                 $issues_file = str_replace('?issue_date_inactive?', date('Ymd', $this->human_to_unix($issues_row->issue_date_inactive)), $issues_file);
             } else {
                 $issues_table .= "<item><content ID='problem" . $l . "'>" . $issues_row->issue . ": Status - Active</content></item>";
                 $issues_status = "Active";
                 $issues_code = "55561003";
                 $issues_file = file_get_contents(__DIR__ . '/../../public/issues_active.xml');
             }
             $issues_table .= "</list>";
             $issues_file = str_replace('?issue_date_active?', date('Ymd', $this->human_to_unix($issues_row->issue_date_active)), $issues_file);
             $issues_file = str_replace('?issue_code?', $issue_code, $issues_file);
             $issues_file = str_replace('?issue_code_description?', $issue_code_description, $issues_file);
             $issues_number = "#problem" . $l;
             $issues_random_id1 = $this->gen_uuid();
             $issues_file = str_replace('?issues_random_id1?', $issues_random_id1, $issues_file);
             $issues_file = str_replace('?issues_number?', $issues_number, $issues_file);
             $issues_file = str_replace('?issues_code?', $issues_code, $issues_file);
             $issues_file = str_replace('?issues_status?', $issues_status, $issues_file);
             $issues_file_final .= $issues_file;
             $l++;
         }
     }
     $ccda = str_replace('?issues_table?', $issues_table, $ccda);
     $ccda = str_replace('?issues_file?', $issues_file_final, $ccda);
     $proc_table = "";
     $proc_file_final = "";
     if ($recent_encounter_query) {
         $proc_query = DB::table('procedure')->where('eid', '=', $recent_encounter_query->eid)->get();
         if ($proc_query) {
             $m = 1;
             foreach ($proc_query as $proc_row) {
                 $proc_table .= "<tr>";
                 $proc_table .= "<td><content ID='proc" . $m . "'>" . $proc_row->proc_type . "</content></td>";
                 $proc_table .= "<td>" . date('m-d-Y', $this->human_to_unix($proc_row->proc_date)) . "</td>";
                 $proc_table .= "</tr>";
                 $proc_file = file_get_contents(__DIR__ . '/../../public/proc.xml');
                 $proc_file = str_replace('?proc_date?', date('Ymd', $this->human_to_unix($proc_row->proc_date)), $proc_file);
                 $proc_file = str_replace('?proc_type?', $proc_row->proc_type, $proc_file);
                 $proc_file = str_replace('?proc_cpt?', $proc_row->proc_cpt, $proc_file);
                 $proc_file = str_replace('?practiceinfo_street_address?', $practice_info->street_address1, $proc_file);
                 $proc_file = str_replace('?practiceinfo_city?', $practice_info->city, $proc_file);
                 $proc_file = str_replace('?practiceinfo_state?', $practice_info->state, $proc_file);
                 $proc_file = str_replace('?practiceinfo_zip?', $practice_info->zip, $proc_file);
                 $proc_file = str_replace('?practiceinfo_phone?', $practice_info->phone, $proc_file);
                 $proc_file = str_replace('?practice_name?', $practice_info->practice_name, $proc_file);
                 $proc_number = "#proc" . $m;
                 $proc_random_id1 = $this->gen_uuid();
                 $proc_file = str_replace('?proc_random_id1?', $proc_random_id1, $proc_file);
                 $proc_file_final .= $proc_file;
                 $m++;
             }
         }
     }
     $ccda = str_replace('?proc_table?', $proc_table, $ccda);
     $ccda = str_replace('?proc_file?', $proc_file_final, $ccda);
     $other_history_table = "";
     $other_history_file = "";
     if ($recent_encounter_query) {
         $other_history_row = DB::table('other_history')->where('eid', '=', $recent_encounter_query->eid)->first();
         if ($other_history_row) {
             if ($other_history_row->oh_tobacco != '') {
                 $other_history_table .= "<td>Smoking Status</td>";
                 $other_history_table .= "<td><content ID='other_history1'>" . $other_history_row->oh_tobacco . "</td>";
                 $other_history_table .= "<td>" . date('m-d-Y', $this->human_to_unix($other_history_row->oh_date)) . "</td>";
                 $other_history_table .= "</tr>";
                 $other_history_table .= "<tr>";
                 if ($demographics->tobacco == 'yes') {
                     $other_history_code = "77176002";
                     $other_history_description = "Smoker";
                 } else {
                     $other_history_code = "8392000";
                     $other_history_description = "Non-Smoker";
                 }
                 $other_history_file = file_get_contents(__DIR__ . '/../../public/social_history.xml');
                 $other_history_file = str_replace('?other_history_code?', $other_history_code, $other_history_file);
                 $other_history_file = str_replace('?other_history_description?', $other_history_description, $other_history_file);
                 $other_history_file = str_replace('?other_history_date?', date('Ymd', $this->human_to_unix($other_history_row->oh_date)), $other_history_file);
             }
         }
     }
     $ccda = str_replace('?other_history_table?', $other_history_table, $ccda);
     $ccda = str_replace('?other_history_file?', $other_history_file, $ccda);
     $vitals_table = "";
     $vitals_file_final = "";
     if ($recent_encounter_query) {
         $vitals_row = DB::table('vitals')->where('eid', '=', $recent_encounter_query->eid)->first();
         if ($vitals_row) {
             $vitals_table .= '<thead><tr><th align="right">Date / Time: </th><th>' . date('m-d-Y h:i A', $this->human_to_unix($vitals_row->vitals_date)) . '</th></tr></thead><tbody>';
             $vitals_file_final .= '               <entry typeCode="DRIV"><organizer classCode="CLUSTER" moodCode="EVN"><templateId root="2.16.840.1.113883.10.20.22.4.26"/><id root="';
             $vitals_file_final .= $this->gen_uuid() . '"/><code code="46680005" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT" displayName="Vital signs"/><statusCode code="completed"/><effectiveTime value="';
             $vitals_file_final .= date('Ymd', $this->human_to_unix($vitals_row->vitals_date)) . '"/>';
             if ($vitals_row->height != '') {
                 $vitals_table .= '<tr><th align="left">Height</th><td><content ID="vit_height">';
                 $vitals_table .= $vitals_row->height . ' ' . $practice_info->height_unit;
                 $vitals_table .= '</content></td></tr>';
                 $vitals_code1 = "8302-2";
                 $vitals_description1 = "Body height";
                 $vitals_file = file_get_contents(__DIR__ . '/../../public/vitals.xml');
                 $vitals_file = str_replace('?vitals_code?', $vitals_code1, $vitals_file);
                 $vitals_file = str_replace('?vitals_description?', $vitals_description1, $vitals_file);
                 $vitals_file = str_replace('?vitals_date?', date('Ymd', $this->human_to_unix($vitals_row->vitals_date)), $vitals_file);
                 $vitals_file = str_replace('?vitals_id?', '#vit_height', $vitals_file);
                 $vitals_file = str_replace('?vitals_value?', $vitals_row->height, $vitals_file);
                 $vitals_file = str_replace('?vitals_unit?', $practice_info->height_unit, $vitals_file);
                 $vitals_random_id1 = $this->gen_uuid();
                 $vitals_file = str_replace('?vitals_random_id1?', $vitals_random_id1, $vitals_file);
             }
             if ($vitals_row->weight != '') {
                 $vitals_table .= '<tr><th align="left">Weight</th><td><content ID="vit_weight">';
                 $vitals_table .= $vitals_row->weight . ' ' . $practice_info->weight_unit;
                 $vitals_table .= '</content></td></tr>';
                 $vitals_code2 = "3141-9";
                 $vitals_description2 = "Body weight Measured";
                 $vitals_file = file_get_contents(__DIR__ . '/../../public/vitals.xml');
                 $vitals_file = str_replace('?vitals_code?', $vitals_code2, $vitals_file);
                 $vitals_file = str_replace('?vitals_description?', $vitals_description2, $vitals_file);
                 $vitals_file = str_replace('?vitals_date?', date('Ymd', $this->human_to_unix($vitals_row->vitals_date)), $vitals_file);
                 $vitals_file = str_replace('?vitals_id?', '#vit_weight', $vitals_file);
                 $vitals_file = str_replace('?vitals_value?', $vitals_row->weight, $vitals_file);
                 $vitals_file = str_replace('?vitals_unit?', $practice_info->weight_unit, $vitals_file);
                 $vitals_random_id2 = $this->gen_uuid();
                 $vitals_file = str_replace('?vitals_random_id1?', $vitals_random_id2, $vitals_file);
             }
             if ($vitals_row->bp_systolic != '' && $vitals_row->bp_diastolic) {
                 $vitals_table .= '<tr><th align="left">Blood Pressure</th><td><content ID="vit_bp">';
                 $vitals_table .= $vitals_row->bp_systolic . '/' . $vitals_row->bp_diastolic . ' mmHg';
                 $vitals_table .= '</content></td></tr>';
                 $vitals_code3 = "8480-6";
                 $vitals_description3 = "Intravascular Systolic";
                 $vitals_file = file_get_contents(__DIR__ . '/../../public/vitals.xml');
                 $vitals_file = str_replace('?vitals_code?', $vitals_code3, $vitals_file);
                 $vitals_file = str_replace('?vitals_description?', $vitals_description3, $vitals_file);
                 $vitals_file = str_replace('?vitals_date?', date('Ymd', $this->human_to_unix($vitals_row->vitals_date)), $vitals_file);
                 $vitals_file = str_replace('?vitals_id?', '#vit_bp', $vitals_file);
                 $vitals_file = str_replace('?vitals_value?', $vitals_row->bp_systolic, $vitals_file);
                 $vitals_file = str_replace('?vitals_unit?', "mmHg", $vitals_file);
                 $vitals_random_id3 = $this->gen_uuid();
                 $vitals_file = str_replace('?vitals_random_id1?', $vitals_random_id3, $vitals_file);
             }
             $vitals_table .= '</tbody>';
             $vitals_file_final .= '                  </organizer>';
             $vitals_file_final .= '               </entry>';
         }
     }
     $ccda = str_replace('?vitals_table?', $vitals_table, $ccda);
     $ccda = str_replace('?vitals_file?', $vitals_file_final, $ccda);
     return $ccda;
 }
 public function postElectronicOrders()
 {
     $pid = Session::get('pid');
     $orders_id = Input::get('orders_id');
     $row = Orders::find($orders_id);
     $row1 = Addressbook::find($row->address_id);
     if ($row1->electronic_order == '') {
         echo "Laboratory provider is not configured for electronic order entry.  Please use an alternate method for delivery.";
         exit(0);
     } else {
         $row2 = Demographics::find($pid);
         $row3 = User::find($row->id);
         $row4 = Providers::find($row->id);
         if ($row1->electronic_order == 'PeaceHealth') {
             $date = date('YmdHi');
             $dob = date('Ymd', $this->human_to_unix($row2->DOB));
             $order_date = date('YmdHi', $this->human_to_unix($row->orders_pending_date));
             $middle = substr($row3->middle, 0, 1);
             $pname = substr($row3->lastname, 0, 5) . substr($row3->firstname, 0, 1) . substr($row3->middle, 0, 1);
             $hl7 = "MSH|^~\\&|QDX|" . strtoupper($pname) . "|||" . $date . "00||ORM^O01|R10063131003.1|P|2.3||^" . strtoupper($pname);
             $hl7 .= "\r";
             $hl7 .= "PID|1|" . $pid . "|||" . strtoupper($row2->lastname) . "^" . strtoupper($row2->firstname) . "||" . $dob . "|" . strtoupper($row2->sex) . "|||||||||||";
             $hl7 .= "\r";
             $hl7 .= "ORC|NW|" . $orders_id . "|||A||^^^" . $order_date . "00||" . $date . "00|||" . strtoupper($row4->peacehealth_id) . "^" . strtoupper($row3->lastname) . "^" . strtoupper($row3->firstname) . "^" . strtoupper($middle) . "^^^" . strtoupper($row3->title) . "||||^|" . strtoupper($row4->peacehealth_id) . "^" . strtoupper($row3->lastname) . "^" . strtoupper($row3->firstname) . "^" . strtoupper($middle) . "^^^" . strtoupper($row3->title) . "||||100^QA-Central Laboratory|QA-Central Laboratory|QA-Central Laboratory^123 International Way^Springfield^OR^97477|1-800-826-3616";
             $orders_array = explode("\n", $row->orders_labs);
             $j = 1;
             foreach ($orders_array as $orders_row) {
                 if ($orders_row != "") {
                     $orders_row_array = explode(";", $orders_row);
                     $testname = $orders_row_array[0];
                     $i = 0;
                     foreach ($orders_row_array as $orders_row1) {
                         if (strpos($orders_row1, " Code: ") !== FALSE) {
                             $testcode = str_replace(" Code: ", "", $orders_row1);
                             $i++;
                         }
                         if (strpos($orders_row1, " AOEAnswer: ") !== FALSE) {
                             $aoe_answer = str_replace(" AOEAnswer: ", "", $orders_row1);
                             if (strpos($aoe_answer, "|") !== FALSE) {
                                 $aoe_answer_array = explode("|", $aoe_answer);
                             } else {
                                 $aoe_answer_array[] = $aoe_answer;
                             }
                         }
                         if (strpos($orders_row1, " AOECode: ") !== FALSE) {
                             $aoe_code = str_replace(" AOECode: ", "", $orders_row1);
                             $aoe_code = str_replace("\r", "", $aoe_code);
                             if (strpos($aoe_code, "|") !== FALSE) {
                                 $aoe_code_array = explode("|", $aoe_code);
                             } else {
                                 $aoe_code_array[] = $aoe_code;
                             }
                         }
                     }
                     if ($i == 0) {
                         echo "Laboratory order code is missing for the electronic order entry.  Be sure you are choosing an order from an Electronic Order Entry list";
                         exit(0);
                     }
                     $hl7 .= "\r";
                     $orders_cc = '';
                     $hl7 .= "OBR|" . $j . "|" . $orders_id . "||" . strtoupper($testcode) . "^" . strtoupper($testname) . "^^|R|" . $order_date . "00|" . $date . "|||||||" . $date . "00|SST^BLD|96666|||||PHL^PeaceHealth Laboratories^123 International Way^Springfield^OR^97477|||||||" . $orders_cc . "|";
                     $j++;
                 }
             }
             if ($row->orders_insurance != 'Bill Client') {
                 $in1_array = explode("\n", $row->orders_insurance);
                 $k = 1;
                 foreach ($in1_array as $in1_row) {
                     $in1_array1 = explode(";", $in1_row);
                     $payor_id = str_replace(" Payor ID: ", "", $in1_array1[1]);
                     if ($payor_id == "Unknown") {
                         $payor_id = 'UNK.';
                     }
                     $plan_id = str_replace(" ID: ", "", $in1_array1[2]);
                     if (strpos($in1_array1[3], " Group: ") !== FALSE) {
                         $group_id = str_replace(" Group: ", "", $in1_array1[3]);
                         $name_array = explode(", ", $in1_array1[4]);
                     } else {
                         $group_id = "";
                         $name_array = explode(", ", $in1_array1[3]);
                     }
                     $hl7 .= "\r";
                     $hl7 .= "IN1|" . $k . "|UNK.|" . strtoupper($payor_id) . "|" . strtoupper($in1_array1[0]) . "||||" . strtoupper($group_id) . "||||||||" . strtoupper($name_array[0]) . "^" . strtoupper($name_array[1]) . "^^^||||||||||||||||||||" . strtoupper($plan_id) . "|||||||||";
                     $k++;
                 }
             }
             if (isset($aoe_answer_array)) {
                 for ($l = 0; $l < count($aoe_answer_array); $l++) {
                     $hl7 .= "\r";
                     $m = $l + 1;
                     $hl7 .= "OBX|" . $m . "||" . strtoupper($aoe_code_array[$l]) . "||" . strtoupper($aoe_answer_array[$l]) . "||||||P|||" . $date . "00|";
                 }
             }
             $file = "/srv/ftp/shared/export/PHLE_" . time();
             file_put_contents($file, $hl7);
             echo "Electronic order entry sent!";
             exit(0);
         }
     }
 }
Example #6
0
<?php

require_once 'providerRepository.php';
Providers::init();
?>

Database is ready!
Example #7
0
<?php

include 'libs/general.php';
$urlArray = array('http://jobberman.com/' => "Jobberman", 'https://ngcareers.com/' => "Nigeria Carrers", 'http://www.careers24.com.ng/' => "Carreer24");
Providers::insert_url_list($urlArray);
 public function update180()
 {
     $orderslist1_array = array();
     $orderslist1_array[] = array('orders_code' => '11550', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '12500', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '24080', 'aoe_code' => 'MIC1^SOURCE:', 'aoe_field' => 'aoe_source_code');
     $orderslist1_array[] = array('orders_code' => '30000', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '30740', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '30820', 'aoe_code' => 'GLUFAST^HOURS FASTING:', 'aoe_field' => 'aoe_fasting_hours_code');
     $orderslist1_array[] = array('orders_code' => '31300', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '33320', 'aoe_code' => 'TDM1^LAST DOSE DATE:;TDM2^LAST DOSE TIME:', 'aoe_field' => 'aoe_dose_date_code;aoe_dose_time_code');
     $orderslist1_array[] = array('orders_code' => '43540', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '43542', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '43546', 'aoe_code' => 'CHM1^FASTING STATE:', 'aoe_field' => 'aoe_fasting_code');
     $orderslist1_array[] = array('orders_code' => '60109', 'aoe_code' => 'BFL1^SOURCE:', 'aoe_field' => 'aoe_source1_code');
     $orderslist1_array[] = array('orders_code' => '61500', 'aoe_code' => 'MIC1^SOURCE:;MIC2^ADD. INFORMATION:', 'aoe_field' => 'aoe_source_code;aoe_additional_code');
     $orderslist1_array[] = array('orders_code' => '68329', 'aoe_code' => 'MIC1^SOURCE:', 'aoe_field' => 'aoe_source_code');
     foreach ($orderslist1_array as $row1) {
         $orders_query = DB::table('orderslist1')->where('orders_code', '=', $row1['orders_code'])->get();
         foreach ($orders_query as $row2) {
             $orders_data = array('aoe_code' => $row1['aoe_code'], 'aoe_field' => $row1['aoe_field']);
             DB::table('orderslist1')->where('orderslist1_id', '=', $row2->orderslist1_id)->update($orders_data);
         }
     }
     // Update referral templates
     $template_query = DB::table('templates')->where('category', '=', 'referral')->first();
     if (!$template_query) {
         $template_array = array();
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Referral - Please provide primary physician with summaries of subsequent visits.","id":"ref_referral_hidden"},{"type":"checkbox","id":"ref_referral_1","class":"ref_other ref_intro","value":"Assume management for this particular problem and return patient after conclusion of care.","name":"ref_referral_1","caption":"Return patient after managing particular problem"},{"type":"br"},{"type":"checkbox","id":"ref_referral_2","class":"ref_other ref_intro","value":"Assume future management of patient within your area of expertise.","name":"ref_referral_2","caption":"Future ongoing management"},{"type":"br"},{"type":"checkbox","id":"ref_referral_3","class":"ref_other ref_after","value":"Please call me when you have seen the patient.","name":"ref_referral_3","caption":"Call back"},{"type":"br"},{"type":"checkbox","id":"ref_referral_4","class":"ref_other ref_after","value":"I would like to receive periodic status reports on this patient.","name":"ref_referral_4","caption":"Receive periodic status reports"},{"type":"br"},{"type":"checkbox","id":"ref_referral_5","class":"ref_other ref_after","value":"Please send a thorough written report when the consultation is complete.","name":"ref_referral_5","caption":"Receive thorough written report"}]}', 'group' => 'referral', 'sex' => 'm');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Referral - Please provide primary physician with summaries of subsequent visits.","id":"ref_referral_hidden"},{"type":"checkbox","id":"ref_referral_1","class":"ref_other ref_intro","value":"Assume management for this particular problem and return patient after conclusion of care.","name":"ref_referral_1","caption":"Return patient after managing particular problem"},{"type":"br"},{"type":"checkbox","id":"ref_referral_2","class":"ref_other ref_intro","value":"Assume future management of patient within your area of expertise.","name":"ref_referral_2","caption":"Future ongoing management"},{"type":"br"},{"type":"checkbox","id":"ref_referral_3","class":"ref_other ref_after","value":"Please call me when you have seen the patient.","name":"ref_referral_3","caption":"Call back"},{"type":"br"},{"type":"checkbox","id":"ref_referral_4","class":"ref_other ref_after","value":"I would like to receive periodic status reports on this patient.","name":"ref_referral_4","caption":"Receive periodic status reports"},{"type":"br"},{"type":"checkbox","id":"ref_referral_5","class":"ref_other ref_after","value":"Please send a thorough written report when the consultation is complete.","name":"ref_referral_5","caption":"Receive thorough written report"}]}', 'group' => 'referral', 'sex' => 'f');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Consultation - Please send the patient back for follow-up and treatment.","id":"ref_consultation_hidden"},{"type":"checkbox","id":"ref_consultation_1","class":"ref_other ref_intro","value":"Confirm the diagnosis.","name":"ref_consultation_1","caption":"Confirm the diagnosis"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_2","class":"ref_other ref_intro","value":"Advise as to the diagnosis.","name":"ref_consultation_2","caption":"Advise as to the diagnosis"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_3","class":"ref_other ref_intro","value":"Suggest medication or treatment for the diagnosis.","name":"ref_consultation_3","caption":"Suggest medication or treatment"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_4","class":"ref_other ref_after","value":"Please call me when you have seen the patient.","name":"ref_consultation_4","caption":"Call back"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_5","class":"ref_other ref_after","value":"I would like to receive periodic status reports on this patient.","name":"ref_consultation_5","caption":"Receive periodic status reports"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_6","class":"ref_other ref_after","value":"Please send a thorough written report when the consultation is complete.","name":"ref_consultation_6","caption":"Receive thorough written report"}]}', 'group' => 'consultation', 'sex' => 'm');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Consultation - Please send the patient back for follow-up and treatment.","id":"ref_consultation_hidden"},{"type":"checkbox","id":"ref_consultation_1","class":"ref_other ref_intro","value":"Confirm the diagnosis.","name":"ref_consultation_1","caption":"Confirm the diagnosis"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_2","class":"ref_other ref_intro","value":"Advise as to the diagnosis.","name":"ref_consultation_2","caption":"Advise as to the diagnosis"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_3","class":"ref_other ref_intro","value":"Suggest medication or treatment for the diagnosis.","name":"ref_consultation_3","caption":"Suggest medication or treatment"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_4","class":"ref_other ref_after","value":"Please call me when you have seen the patient.","name":"ref_consultation_4","caption":"Call back"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_5","class":"ref_other ref_after","value":"I would like to receive periodic status reports on this patient.","name":"ref_consultation_5","caption":"Receive periodic status reports"},{"type":"br"},{"type":"checkbox","id":"ref_consultation_6","class":"ref_other ref_after","value":"Please send a thorough written report when the consultation is complete.","name":"ref_consultation_6","caption":"Receive thorough written report"}]}', 'group' => 'consultation', 'sex' => 'f');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Physical therapy referral details:","id":"ref_pt_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_pt_1_div","html":[{"type":"span","html":"Objectives:"},{"type":"br"},{"type":"checkbox","id":"ref_pt_1a","class":"ref_other ref_intro","value":"Decrease pain.","name":"ref_pt_1","caption":"Decrease pain"},{"type":"checkbox","id":"ref_pt_1b","class":"ref_other ref_intro","value":"Increase strength.","name":"ref_pt_1","caption":"Increase strength"},{"type":"checkbox","id":"ref_pt_1c","class":"ref_other ref_intro","value":"Increase mobility.","name":"ref_pt_1","caption":"Increase mobility"}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_pt_2_div","html":[{"type":"span","html":"Modalities:"},{"type":"br"},{"type":"select","multiple":"multiple","id":"ref_pt_2","class":"ref_select ref_intro","css":{"width":"200px"},"name":"ref_pt_2","caption":"","options":{"Hot or cold packs. ":"Hot or cold packs.","TENS unit. ":"TENS unit.","Back program. ":"Back program.","Joint mobilization. ":"Joint mobilization.","Home program. ":"Home program.","Pool therapy. ":"Pool therapy.","Feldenkrais method. ":"Feldenkrais method.","Therapeutic exercise. ":"Therapeutic exercise.","Myofascial release. ":"Myofascial release.","Patient education. ":"Patient education.","Work hardening. ":"Work hardening."}}]},{"type":"br"},{"type":"text","id":"ref_pt_3","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_3","placeholder":"Precautions"},{"type":"br"},{"type":"text","id":"ref_pt_4","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_4","placeholder":"Frequency"},{"type":"br"},{"type":"text","id":"ref_pt_5","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_5","placeholder":"Duration"}]}', 'group' => 'pt', 'sex' => 'm');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Physical therapy referral details:","id":"ref_pt_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_pt_1_div","html":[{"type":"span","html":"Objectives:"},{"type":"br"},{"type":"checkbox","id":"ref_pt_1a","class":"ref_other ref_intro","value":"Decrease pain.","name":"ref_pt_1","caption":"Decrease pain"},{"type":"checkbox","id":"ref_pt_1b","class":"ref_other ref_intro","value":"Increase strength.","name":"ref_pt_1","caption":"Increase strength"},{"type":"checkbox","id":"ref_pt_1c","class":"ref_other ref_intro","value":"Increase mobility.","name":"ref_pt_1","caption":"Increase mobility"}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_pt_2_div","html":[{"type":"span","html":"Modalities:"},{"type":"br"},{"type":"select","multiple":"multiple","id":"ref_pt_2","class":"ref_select ref_intro","css":{"width":"200px"},"name":"ref_pt_2","caption":"","options":{"Hot or cold packs. ":"Hot or cold packs.","TENS unit. ":"TENS unit.","Back program. ":"Back program.","Joint mobilization. ":"Joint mobilization.","Home program. ":"Home program.","Pool therapy. ":"Pool therapy.","Feldenkrais method. ":"Feldenkrais method.","Therapeutic exercise. ":"Therapeutic exercise.","Myofascial release. ":"Myofascial release.","Patient education. ":"Patient education.","Work hardening. ":"Work hardening."}}]},{"type":"br"},{"type":"text","id":"ref_pt_3","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_3","placeholder":"Precautions"},{"type":"br"},{"type":"text","id":"ref_pt_4","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_4","placeholder":"Frequency"},{"type":"br"},{"type":"text","id":"ref_pt_5","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_pt_5","placeholder":"Duration"}]}', 'group' => 'pt', 'sex' => 'f');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Massage therapy referral details:","id":"ref_massage_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_massage_1_div","html":[{"type":"span","html":"Objectives:"},{"type":"br"},{"type":"checkbox","id":"ref_massage_1a","class":"ref_other ref_intro","value":"Decrease pain.","name":"ref_massage_1","caption":"Decrease pain"},{"type":"checkbox","id":"ref_massage_1b","class":"ref_other ref_intro","value":"Increase mobility.","name":"ref_massage_1","caption":"Increase mobility"}]},{"type":"br"},{"type":"text","id":"ref_massage_2","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_2","placeholder":"Precautions"},{"type":"br"},{"type":"text","id":"ref_massage_3","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_3","placeholder":"Frequency"},{"type":"br"},{"type":"text","id":"ref_massage_4","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_4","placeholder":"Duration"}]}', 'group' => 'massage', 'sex' => 'm');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Massage therapy referral details:","id":"ref_massage_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_massage_1_div","html":[{"type":"span","html":"Objectives:"},{"type":"br"},{"type":"checkbox","id":"ref_massage_1a","class":"ref_other ref_intro","value":"Decrease pain.","name":"ref_massage_1","caption":"Decrease pain"},{"type":"checkbox","id":"ref_massage_1b","class":"ref_other ref_intro","value":"Increase mobility.","name":"ref_massage_1","caption":"Increase mobility"}]},{"type":"br"},{"type":"text","id":"ref_massage_2","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_2","placeholder":"Precautions"},{"type":"br"},{"type":"text","id":"ref_massage_3","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_3","placeholder":"Frequency"},{"type":"br"},{"type":"text","id":"ref_massage_4","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_massage_4","placeholder":"Duration"}]}', 'group' => 'massage', 'sex' => 'f');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Sleep study referral details:","id":"ref_sleep_study_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_1_div","html":[{"type":"span","html":"Type:"},{"type":"br"},{"type":"select","multiple":"multiple","id":"ref_sleep_study_1","class":"ref_select ref_other ref_intro","css":{"width":"200px"},"name":"ref_sleep_study_1","caption":"","options":{"Diagnostic Sleep Study Only.\\n":"Diagnostic Sleep Study Only.","Diagnostic testing with Continuous Positive Airway Pressure.\\n":"Diagnostic testing with Continuous Positive Airway Pressure.","Diagnostic testing with BiLevel Positive Airway Pressure.\\n":"Diagnostic testing with BiLevel Positive Airway Pressure.","Diagnostic testing with BiLevel Positive Airway Pressure.\\n":"Diagnostic testing with BiLevel Positive Airway Pressure.","Diagnostic testing with Oxygen.\\n":"Diagnostic testing with Oxygen.","Diagnostic testing with Oral Device.\\n":"Diagnostic testing with Oral Device.","MSLT (Multiple Sleep Latency Test).\\n":"MSLT (Multiple Sleep Latency Test).","MWT (Maintenance of Wakefulness Test).\\n":"MWT (Maintenance of Wakefulness Test).","Titrate BiPAP settings.\\n":"Titrate BiPAP settings.","Patient education. ":"Patient education.","Work hardening. ":"Work hardening."}}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_2_div","html":[{"type":"span","html":"BiPAP pressures:"},{"type":"br"},{"type":"text","id":"ref_sleep_study_2a","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_2a","placeholder":"Inspiratory Pressure (IPAP), cm H20"},{"type":"br"},{"type":"text","id":"ref_sleep_study_2b","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_2b","placeholder":"Expiratory Pressure (EPAP), cm H20"}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_3_div","html":[{"type":"span","html":"BiPAP Mode:"},{"type":"br"},{"type":"checkbox","id":"ref_sleep_study_3a","class":"ref_other ref_intro","value":"Spontaneous mode.","name":"ref_sleep_study_3","caption":"Spontaneous"},{"type":"checkbox","id":"ref_sleep_study_3b","class":"ref_other ref_intro","value":"Spontaneous/Timed mode","name":"ref_sleep_study_3","caption":"Spontaneous/Timed"},{"type":"br"},{"type":"text","id":"ref_sleep_study_3c","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_3","placeholder":"Breaths per minute"}]}]}', 'group' => 'sleep_study', 'sex' => 'm');
         $template_array[] = array('category' => 'referral', 'json' => '{"html":[{"type":"hidden","class":"ref_hidden","value":"Sleep study referral details:","id":"ref_sleep_study_hidden"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_1_div","html":[{"type":"span","html":"Type:"},{"type":"br"},{"type":"select","multiple":"multiple","id":"ref_sleep_study_1","class":"ref_select ref_other ref_intro","css":{"width":"200px"},"name":"ref_sleep_study_1","caption":"","options":{"Diagnostic Sleep Study Only.\\n":"Diagnostic Sleep Study Only.","Diagnostic testing with Continuous Positive Airway Pressure.\\n":"Diagnostic testing with Continuous Positive Airway Pressure.","Diagnostic testing with BiLevel Positive Airway Pressure.\\n":"Diagnostic testing with BiLevel Positive Airway Pressure.","Diagnostic testing with BiLevel Positive Airway Pressure.\\n":"Diagnostic testing with BiLevel Positive Airway Pressure.","Diagnostic testing with Oxygen.\\n":"Diagnostic testing with Oxygen.","Diagnostic testing with Oral Device.\\n":"Diagnostic testing with Oral Device.","MSLT (Multiple Sleep Latency Test).\\n":"MSLT (Multiple Sleep Latency Test).","MWT (Maintenance of Wakefulness Test).\\n":"MWT (Maintenance of Wakefulness Test).","Titrate BiPAP settings.\\n":"Titrate BiPAP settings.","Patient education. ":"Patient education.","Work hardening. ":"Work hardening."}}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_2_div","html":[{"type":"span","html":"BiPAP pressures:"},{"type":"br"},{"type":"text","id":"ref_sleep_study_2a","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_2a","placeholder":"Inspiratory Pressure (IPAP), cm H20"},{"type":"br"},{"type":"text","id":"ref_sleep_study_2b","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_2b","placeholder":"Expiratory Pressure (EPAP), cm H20"}]},{"type":"br"},{"type":"div","class":"ref_buttonset","id":"ref_sleep_study_3_div","html":[{"type":"span","html":"BiPAP Mode:"},{"type":"br"},{"type":"checkbox","id":"ref_sleep_study_3a","class":"ref_other ref_intro","value":"Spontaneous mode.","name":"ref_sleep_study_3","caption":"Spontaneous"},{"type":"checkbox","id":"ref_sleep_study_3b","class":"ref_other ref_intro","value":"Spontaneous/Timed mode","name":"ref_sleep_study_3","caption":"Spontaneous/Timed"},{"type":"br"},{"type":"text","id":"ref_sleep_study_3c","css":{"width":"200px"},"class":"ref_other ref_detail_text ref_intro","name":"ref_sleep_study_3","placeholder":"Breaths per minute"}]}]}', 'group' => 'sleep_study', 'sex' => 'f');
         foreach ($template_array as $template_ind) {
             $template_array = serialize(json_decode($template_ind['json']));
             $template_data = array('user_id' => '0', 'template_name' => 'Global Default', 'default' => 'default', 'category' => $template_ind['category'], 'sex' => $template_ind['sex'], 'group' => $template_ind['group'], 'array' => $template_array);
             DB::table('templates')->insert($template_data);
         }
     }
     // Update image links and create scans and received faxes directories if needed
     $practices = Practiceinfo::all();
     foreach ($practices as $practice) {
         $practice->practice_logo = str_replace("/var/www/nosh/", "", $practice->practice_logo);
         $practice->save();
         $scans_dir = $practice->documents_dir . 'scans/' . $practice->practice_id;
         if (!file_exists($scans_dir)) {
             mkdir($scans_dir, 0777);
         }
         $received_dir = $practice->documents_dir . 'received/' . $practice->practice_id;
         if (!file_exists($received_dir)) {
             mkdir($received_dir, 0777);
         }
     }
     $providers = Providers::all();
     foreach ($providers as $provider) {
         $provider->signature = str_replace("/var/www/nosh/", "", $provider->signature);
         $provider->save();
     }
     // Assign standard encounter templates
     DB::table('encounters')->update(array('encounter_template' => 'standardmedical'));
     // Move scans and received faxes
     $scans = DB::table('scans')->get();
     if ($scans) {
         foreach ($scans as $scan) {
             $practice1 = Practiceinfo::find($scan->practice_id);
             $new_scans_dir = $practice1->documents_dir . 'scans/' . $scan->practice_id;
             $scans_data['filePath'] = str_replace('/var/www/nosh/scans', $new_scans_dir, $scan->filePath);
             rename($scan->filePath, $scans_data['filePath']);
             DB::table('scans')->where('scans_id', '=', $scan->scans_id)->update($scans_data);
         }
     }
     $received = DB::table('received')->get();
     if ($received) {
         foreach ($received as $fax) {
             $fax_practice_id = '1';
             if ($fax->practice_id != '' && $fax->practice_id != '0') {
                 $fax_practice_id = $fax->practice_id;
             }
             $practice2 = Practiceinfo::find($fax_practice_id);
             $new_received_dir = $practice2->documents_dir . 'received/' . $fax_practice_id;
             $received_data['filePath'] = str_replace('/var/www/nosh/received', $new_received_dir, $fax->filePath);
             if (file_exists($fax->filePath)) {
                 rename($fax->filePath, $received_data['filePath']);
             }
             DB::table('received')->where('received_id', '=', $fax->received_id)->update($received_data);
         }
     }
     // Migrate bill_complex field to encounters
     $encounters = DB::table('encounters')->get();
     if ($encounters) {
         foreach ($encounters as $encounter) {
             $billing = DB::table('billing')->where('eid', '=', $encounter->eid)->where(function ($query_array1) {
                 $query_array1->where('bill_complex', '!=', "")->orWhereNotNull('bill_complex');
             })->first();
             $data['bill_complex'] = '';
             if ($billing) {
                 $data['bill_complex'] = $billing->bill_complex;
             }
             DB::table('encounters')->where('eid', '=', $encounter->eid)->update($data);
         }
     }
     $db_name = $_ENV['mysql_database'];
     $db_username = $_ENV['mysql_username'];
     $db_password = $_ENV['mysql_password'];
     DB::table('meds_full')->truncate();
     $meds_sql_file = __DIR__ . "/../../import/meds_full.sql";
     $meds_command = "mysql -u " . $db_username . " -p" . $db_password . " " . $db_name . " < " . $meds_sql_file;
     system($meds_command);
     DB::table('meds_full_package')->truncate();
     $meds1_sql_file = __DIR__ . "/../../import/meds_full_package.sql";
     $meds1_command = "mysql -u " . $db_username . " -p" . $db_password . " " . $db_name . " < " . $meds1_sql_file;
     system($meds1_command);
     DB::table('supplements_list')->truncate();
     $supplements_file = __DIR__ . "/../../import/supplements_list.sql";
     $supplements_command = "mysql -u " . $db_username . " -p" . $db_password . " " . $db_name . " < " . $supplements_file;
     system($supplements_command);
     DB::table('icd9')->truncate();
     $icd_file = __DIR__ . "/../../import/icd9.sql";
     $icd_command = "mysql -u " . $db_username . " -p" . $db_password . " " . $db_name . " < " . $icd_file;
     system($icd_command);
     $alpha_array = array('1' => 'A', '2' => 'B', '3' => 'C', '4' => 'D', '5' => 'E', '6' => 'F', '7' => 'G', '8' => 'H');
     // Update ICD pointers to reflect new HCFA-1500
     $billing_core = DB::table('billing_core')->whereNotNull('icd_pointer')->get();
     if ($billing_core) {
         foreach ($billing_core as $billing_core_row) {
             if ($billing_core_row->icd_pointer != '') {
                 $icd_pointer = $billing_core_row->icd_pointer;
                 foreach ($alpha_array as $key => $value) {
                     $icd_pointer = str_replace($key, $value, $icd_pointer);
                 }
                 $billing_core_data['icd_pointer'] = $icd_pointer;
                 DB::table('billing_core')->where('billing_core_id', '=', $billing_core_row->billing_core_id)->update($billing_core_data);
             }
         }
     }
     // Update calendar
     $calendar['provider_id'] = '0';
     DB::table('calendar')->update($calendar);
     // Update version
     DB::table('practiceinfo')->update(array('version' => '1.8.0'));
 }
Example #9
0
<?php

require_once '../classes/providerRepository.php';
header('Content-type: application/json');
echo ")]}'\n";
//if(isset($_GET['cloud_id'])) {
//echo "yes";
$services = Providers::getService();
//echo $services;
echo json_encode($services);
//}
 public function dashboard()
 {
     $user_id = Session::get('user_id');
     $practice_id = Session::get('practice_id');
     $data['practiceinfo'] = Practiceinfo::find($practice_id);
     $result = User::find($user_id);
     $data['displayname'] = $result->displayname;
     $displayname = $result->displayname;
     $fax_query = Received::where('practice_id', '=', $practice_id)->count();
     $from = $displayname . ' (' . $user_id . ')';
     if (Session::get('group_id') == '2') {
         $data['number_messages'] = Messaging::where('mailbox', '=', $user_id)->count();
         $data['number_documents'] = Scans::where('practice_id', '=', $practice_id)->count() + $fax_query;
         $data['number_appts'] = $this->getNumberAppts($user_id);
         $query1 = DB::table('t_messages')->join('demographics', 't_messages.pid', '=', 'demographics.pid')->where('t_messages.t_messages_from', '=', $from)->where('t_messages.t_messages_signed', '=', 'No')->count();
         $query2 = DB::table('encounters')->join('demographics', 'encounters.pid', '=', 'demographics.pid')->where('encounters.encounter_provider', '=', $displayname)->where('encounters.encounter_signed', '=', 'No')->count();
         $data['number_drafts'] = $query1 + $query2;
         $data['number_reminders'] = DB::table('alerts')->join('demographics', 'alerts.pid', '=', 'demographics.pid')->where('alerts.alert_provider', '=', $user_id)->where('alerts.alert_date_complete', '=', '0000-00-00 00:00:00')->where('alerts.alert_reason_not_complete', '=', '')->where(function ($query_array) {
             $query_array->where('alerts.alert', '=', 'Laboratory results pending')->orWhere('alerts.alert', '=', 'Radiology results pending')->orWhere('alerts.alert', '=', 'Cardiopulmonary results pending')->orWhere('alerts.alert', '=', 'Referral pending')->orWhere('alerts.alert', '=', 'Reminder')->orWhere('alerts.alert', '=', 'REMINDER');
         })->count();
         $data['number_bills'] = Encounters::where('bill_submitted', '=', 'No')->where('user_id', '=', $user_id)->count();
         $data['number_tests'] = Tests::whereNull('pid')->where('practice_id', '=', $practice_id)->count();
         if ($data['practiceinfo']->mtm_extension == 'y') {
             $mtm_users_array = explode(",", $data['practiceinfo']->mtm_alert_users);
             if (in_array($user_id, $mtm_users_array)) {
                 $data['mtm_alerts'] = Alerts::where('alert_date_complete', '=', '0000-00-00 00:00:00')->where('alert_reason_not_complete', '=', '')->where('alert', '=', 'Medication Therapy Management')->where('practice_id', '=', $practice_id)->count();
                 $data['mtm_alerts_status'] = "y";
             } else {
                 $data['mtm_alerts_status'] = "n";
             }
         } else {
             $data['mtm_alerts_status'] = "n";
         }
         $data['vaccine_supplement_alert'] = $this->vaccine_supplement_alert($practice_id);
     }
     if (Session::get('group_id') == '3') {
         $data['number_messages'] = Messaging::where('mailbox', '=', $user_id)->count();
         $data['number_documents'] = Scans::where('practice_id', '=', $practice_id)->count() + $fax_query;
         $data['number_drafts'] = DB::table('t_messages')->join('demographics', 't_messages.pid', '=', 'demographics.pid')->where('t_messages.t_messages_from', '=', $from)->where('t_messages.t_messages_signed', '=', 'No')->count();
         $data['number_reminders'] = DB::table('alerts')->join('demographics', 'alerts.pid', '=', 'demographics.pid')->where('alerts.alert_provider', '=', $user_id)->where('alerts.alert_date_complete', '=', '0000-00-00 00:00:00')->where('alerts.alert_reason_not_complete', '=', '')->where(function ($query_array) {
             $query_array->where('alerts.alert', '=', 'Laboratory results pending')->orWhere('alerts.alert', '=', 'Radiology results pending')->orWhere('alerts.alert', '=', 'Cardiopulmonary results pending')->orWhere('alerts.alert', '=', 'Referral pending')->orWhere('alerts.alert', '=', 'Reminder')->orWhere('alerts.alert', '=', 'REMINDER');
         })->count();
         $data['number_bills'] = Encounters::where('bill_submitted', '=', 'No')->where('practice_id', '=', $practice_id)->count();
         $data['number_tests'] = Tests::whereNull('pid')->where('practice_id', '=', $practice_id)->count();
         $data['vaccine_supplement_alert'] = $this->vaccine_supplement_alert($practice_id);
     }
     if (Session::get('group_id') == '4') {
         $data['number_messages'] = Messaging::where('mailbox', '=', $user_id)->count();
         $data['number_bills'] = Encounters::where('bill_submitted', '=', 'No')->where('practice_id', '=', $practice_id)->count();
         $data['number_documents'] = Scans::where('practice_id', '=', $practice_id)->count() + $fax_query;
     }
     if (Session::get('group_id') == '100') {
         $row = Demographics_relate::where('id', '=', $user_id)->first();
         Session::put('pid', $row->pid);
     }
     if (Session::get('group_id') == '1') {
         if ($practice_id == '1') {
             $data['saas_admin'] = 'y';
         } else {
             $data['saas_admin'] = 'n';
         }
         if (Session::get('patient_centric') != 'y') {
             $users = DB::table('users')->where('group_id', '=', '2')->where('practice_id', '=', Session::get('practice_id'))->first();
             if ($users) {
                 $data['users_needed'] = 'n';
             } else {
                 $data['users_needed'] = 'y';
             }
         } else {
             $data['users_needed'] = 'n';
         }
         if (Session::get('patient_centric') != 'y') {
             $schedule = DB::table('practiceinfo')->where('practice_id', '=', Session::get('practice_id'))->whereNull('minTime')->first();
             if ($schedule) {
                 $data['schedule_needed'] = 'y';
             } else {
                 $data['schedule_needed'] = 'n';
             }
         } else {
             $data['schedule_needed'] = 'n';
         }
     }
     if ($data['practiceinfo']->weekends == '1') {
         $data['weekends'] = 'true';
     } else {
         $data['weekends'] = 'false';
     }
     $data['minTime'] = ltrim($data['practiceinfo']->minTime, "0");
     $data['maxTime'] = ltrim($data['practiceinfo']->maxTime, "0");
     if (Session::get('group_id') == '2') {
         $provider = Providers::find(Session::get('user_id'));
         $data['schedule_increment'] = $provider->schedule_increment;
     } else {
         $data['schedule_increment'] = '15';
     }
     if (!Session::get('encounter_active')) {
         Session::put('encounter_active', 'n');
     }
     if ($data['practiceinfo']->fax_type != "") {
         $data1['fax'] = true;
     } else {
         $data1['fax'] = false;
     }
     $this->layout->style = $this->css_assets();
     $this->layout->script = $this->js_assets('home');
     $this->layout->content = '';
     if (Session::get('group_id') == '1') {
         $this->layout->content .= View::make('search', $this->getSearchData())->render();
         $this->layout->content .= View::make('dashboard', $data)->render();
         $this->layout->content .= View::make('setup')->render();
         $this->layout->content .= View::make('users')->render();
         $this->layout->content .= View::make('extensions', $data)->render();
         $this->layout->content .= View::make('schedule_admin')->render();
         $this->layout->content .= View::make('update')->render();
         $this->layout->content .= View::make('logs')->render();
         $this->layout->content .= View::make('schedule')->render();
     }
     if (Session::get('group_id') == '2' || Session::get('group_id') == '3' || Session::get('group_id') == '4') {
         $this->layout->content .= View::make('search', $this->getSearchData())->render();
         $this->layout->content .= View::make('dashboard', $data)->render();
         $this->layout->content .= View::make('demographics')->render();
         $this->layout->content .= View::make('options')->render();
         $this->layout->content .= View::make('messaging', $data1)->render();
         $this->layout->content .= View::make('schedule')->render();
         $this->layout->content .= View::make('billing')->render();
         $this->layout->content .= View::make('financial')->render();
         $this->layout->content .= View::make('office')->render();
         if (Session::get('patient_centric') == 'yp' && Session::get('group_id') == '2') {
             $this->layout->content .= View::make('setup')->render();
         }
     }
     if (Session::get('group_id') == '100') {
         $this->layout->content .= View::make('dashboard', $data)->render();
         $this->layout->content .= View::make('demographics')->render();
         $this->layout->content .= View::make('messaging', $data1)->render();
         $this->layout->content .= View::make('schedule')->render();
         $this->layout->content .= View::make('issues')->render();
         $this->layout->content .= View::make('encounters')->render();
         $this->layout->content .= View::make('t_messages')->render();
         $this->layout->content .= View::make('medications')->render();
         $this->layout->content .= View::make('supplements')->render();
         $this->layout->content .= View::make('allergies')->render();
         $this->layout->content .= View::make('immunizations')->render();
         $this->layout->content .= View::make('documents')->render();
         $this->layout->content .= View::make('forms')->render();
         $this->layout->content .= View::make('graph')->render();
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Providers the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Providers::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #12
0
<?php

require_once '../classes/providerRepository.php';
header('Content-type: application/json');
echo ")]}'\n";
if (isset($_GET['cloud_id'])) {
    $provider = Providers::getProvider($_GET['cloud_id']);
    echo json_encode($provider);
}
 public function postCropSignature()
 {
     $signature = Providers::find(Session::get('user_id'));
     $targ_w = 198;
     $targ_h = 55;
     $img_r = $this->getImageFile($signature->signature);
     $dst_r = ImageCreateTrueColor($targ_w, $targ_h);
     $x = Input::get('x');
     $y = Input::get('y');
     $w = Input::get('w');
     $h = Input::get('h');
     imagecopyresampled($dst_r, $img_r, 0, 0, $x, $y, $targ_w, $targ_h, $w, $h);
     $this->saveImage($dst_r, $signature->signature);
     $result['link'] = HTML::image($signature->signature, 'Provider Signature', array('border' => '0', 'id' => 'image_target'));
     $result['growl'] = "Signature cropped and saved!";
     $img = $this->getImageFile($signature->signature);
     $result['button'] = "";
     if (imagesx($img) > 198) {
         $result['message'] = "Image width is too large (less than 198px is recommended).  Use the cropping tool to get to the correct width.";
         $result['button'] = "<br><button id='image_crop'>Crop Image</button>";
     } else {
         $result['message'] = "Image width is correct.";
     }
     if (imagesy($img) > 55) {
         $result['message'] .= "  Image height is too large (less than 55px is recommended).  Use the cropping tool to get to the correct height.";
         $result['button'] = "<br><button id='image_crop'>Crop Image</button>";
     } else {
         $result['message'] .= "  Image height is correct.";
     }
     echo json_encode($result);
 }
Example #14
0
 public static function importRelations($file_path)
 {
     $tmp_file_name = '';
     if (is_array($file_path)) {
         if ($file_path['type'] == 'text/csv') {
             $file_path = $file_path['tmp_name'];
         } else {
             if ($file_path['type'] == 'application/vnd.ms-excel') {
                 if (filesize($file_path['tmp_name'])) {
                     $tmp_file_name = tempnam('/tmp', 'xls2csv_relations_');
                     $res = shell_exec("export LANG=en_US.UTF-8 && xls2csv -dUTF-8 -q3 -c, -x " . $file_path['tmp_name'] . ' > ' . $tmp_file_name);
                     $file_path = $tmp_file_name;
                 } else {
                     throw new Exception("Empty file.");
                 }
             } else {
                 throw new Exception("Incorrect file.");
             }
         }
     }
     if (filesize($file_path)) {
         $fp = fopen($file_path, "r");
         if ($fp) {
             $provs_ids = array();
             $provs =& Providers::getProvidersIdsByNamesArray();
             $data = fgetcsv($fp, 0, ',', '"');
             for ($i = 1; $i < count($data); $i++) {
                 if (isset($provs[$data[$i]])) {
                     $provs_ids[$i] = $provs[$data[$i]];
                 }
             }
             while (($data = fgetcsv($fp, 0, ',', '"')) !== false) {
                 for ($i = 1; $i < count($data); $i++) {
                     if (isset($provs_ids[$i]) && strlen($data[$i])) {
                         self::setRelationByName($data[0], $provs_ids[$i], $data[$i]);
                     }
                 }
             }
             fclose($fp);
         } else {
             throw new Exception("Can't get access to " . $file_path);
         }
     } else {
         throw new Exception("Empty file.");
     }
     if (strlen($tmp_file_name)) {
         unlink($tmp_file_name);
     }
     return true;
 }
Example #15
0
      <li><a href="Update://" onclick="updateMinPrices();return false;">Обновить минимальные цены</a></li>
      <li><a href="import_relations.php">Импорт соответствий</a></li>
      <li><a href="convert_for_import.php">Конвертировать для импорта</a></li>
	</ul>

<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

<li><a href="providers.php">Поставщики<!--[if IE 7]><!--></a><!--<![endif]-->

<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>
	<li><a href="convert.php">Импорт прайса</a></li>
	<li><a class="drop" href="providers.php">Поставщики
<?php 
$providers =& Providers::getProviders();
if (count($providers)) {
    echo '<div class="arrow">&raquo;</div><!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
		<ul>';
    foreach ($providers as $id => $provider) {
        echo '<li><a href="provider.php?id=' . $id . '">' . $provider['name'] . '</a></li>';
    }
    echo '</ul>

<!--[if lte IE 6]></td></tr></table></a><![endif]-->';
}
?>
	</li>
	<li><a href="prov_prods.php">Товары поставщиков</a></li>
      <li><a href="provider.php">Добавить поставщика</a></li>
Example #16
0
 /**
  * 
  * @param array $urls
  */
 public static function insert_url_list($urls)
 {
     foreach ($urls as $url => $desc) {
         // Actualy i dont care about "$desc" :)
         if (self::get_url_by_url($url)) {
             continue;
         }
         if (Providers::isUrlAllowed($url)) {
             self::get_or_create_url_by_url($url);
         }
     }
 }
Example #17
0
        // If content ignored
        if (!$ca) {
            _w('ignored');
            // Skip
            continue;
        }
        //		_w($ca->getOgDescription());
        //		die;
        _w('Createing general CA data');
        _w('populating search table');
        if (Providers::create_search_item($ca)) {
            _w("search data inserted");
        } else {
            _w("unable to insert search data");
        }
        _w('setting status to indexed');
        if (Providers::change_url_status($url_w, Providers::URLS_TYPE_INDEXED)) {
            _w('status changed to INDEXED');
        } else {
            _w('unable to change status');
        }
        //		_w($ca->getLinks());
        //		die;
        _w('inserting all other urls');
        Providers::insert_url_list($ca->getLinks());
    }
} catch (Exception $ex) {
    _w('WAS ERROR !!! ' . $ex->getMessage());
}
_w('Done for now');
unset($urls);
Example #18
0
<?php

//making a RestFul API service
require '../classes/providerRepository.php';
header('Content-type: application/json');
echo ")]}'\n";
$provider = Providers::getProviders();
echo json_encode($provider);
Example #19
0
		Товары
	</th>
	<th>
		Использовать в поиске минимальной цены
	</th>
<tr>
<?php 
require_once dirname(__FILE__) . "/lib/Providers.php";
if (isset($_REQUEST['action'])) {
    switch ($_REQUEST['action']) {
        case 'delete':
            Providers::removeProvider((int) $_REQUEST['id']);
            break;
    }
}
$providers = Providers::getProvidersAndCounters();
foreach ($providers as $id => $provider) {
    echo '<tr>
		<td>
			<a href="provider.php?id=' . $provider['id'] . '">' . $provider['name'] . '
		</td>
		<td>
			' . $provider['last_update'] . '
		</td>
		<td>
			<a href="providers.php?action=delete&id=' . $provider['id'] . '" onclick="return confirm(\'Вы уверены?\');" style="color:red">Удалить</a>
		</td>
		<td>
			' . ((int) $provider['prods_count'] > 0 ? '<a href="prov_prods.php?id=' . $provider['id'] . '">Просмотреть(' . (int) $provider['prods_count'] . ')' : 'Нет товаров') . '</a>
		</td>
		<td>
Example #20
0
 function updateStatusAction()
 {
     $status_code = $this->request->getPost('status_code');
     if ($this->session->has('user')) {
         $uid = $this->session->get('user')->id;
         $user = Users::findFirst("id = '{$uid}'");
         $user->online = $status_code;
         $user->save();
     } else {
         $pid = $this->session->get('provider')->id;
         $provider = Providers::findFirst("id = '{$pid}'");
         $provider->online = $status_code;
         $provider->save();
     }
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreatetechnician()
 {
     $this->pagename = "Register Technician " . $this->pagename;
     $model = new Users();
     $modelprovider = new Providers();
     $transaction = $model->getDbConnection()->beginTransaction();
     if (isset($_POST['Users'])) {
         $model->attributes = $_POST['Users'];
         $temp = $_POST['Providers'];
         try {
             if ($model->save()) {
                 $authmodel = new AuthAssignment();
                 //$transactionauth=$authmodel->getDbConnection()->beginTransaction();
                 $authmodel->itemname = 'technician';
                 $authmodel->userid = $model->id;
                 if ($authmodel->save()) {
                     $worker = new Workers();
                     //$transactionWorker=$worker->getDbConnection()->beginTransaction();
                     $worker->users_id = $model->id;
                     $worker->providers_id = $temp['id'];
                     if ($worker->save()) {
                         $transaction->commit();
                         //$transactionauth->commit();
                         //$transactionWorker->commit();
                         $this->redirect(array('view', 'id' => $model->id));
                     } else {
                         //$transaction->rollback();
                         //$transactionauth->rollback();
                         //$transactionWorker->rollback();
                     }
                 } else {
                     $transaction->rollback();
                 }
             }
         } catch (Exception $e) {
             $transaction->rollback();
         }
     }
     $this->render('createTechnician', array('model' => $model, 'modelprovider' => $modelprovider, 'providers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Providers::model()->findAll("id in (select providers_id from workers where users_id=" . Yii::app()->user->id . ")"), "id", 'name'))));
 }
 public function main()
 {
     $row = Practiceinfo::find(Session::get('practice_id'));
     if (isset($row->default_pos_id)) {
         $data['default_pos'] = $row->default_pos_id;
     } else {
         $data['default_pos'] = '';
     }
     $data['encounter_template'] = $row->encounter_template;
     if ($row->weekends == '1') {
         $data['weekends'] = 'true';
     } else {
         $data['weekends'] = 'false';
     }
     $data['minTime'] = ltrim($row->minTime, "0");
     $data['maxTime'] = ltrim($row->maxTime, "0");
     if (!Session::get('encounter_active')) {
         Session::put('encounter_active', 'n');
     }
     if (Session::get('group_id') == '2') {
         $provider = Providers::find(Session::get('user_id'));
         $data['schedule_increment'] = $provider->schedule_increment;
     } else {
         $data['schedule_increment'] = '15';
     }
     if ($row->fax_type != "") {
         $data1['fax'] = true;
     } else {
         $data1['fax'] = false;
     }
     $patient = DB::table('demographics_relate')->where('pid', '=', Session::get('pid'))->where('practice_id', '=', Session::get('practice_id'))->whereNotNull('id')->first();
     if ($patient) {
         $data2['portal_active'] = true;
     } else {
         $data2['portal_active'] = false;
     }
     $patient1 = DB::table('demographics_relate')->where('pid', '=', Session::get('pid'))->where('practice_id', '=', Session::get('practice_id'))->whereNotNull('url')->first();
     if ($patient1) {
         $data['url'] = 'Connected';
     } else {
         $data['url'] = 'Not Connected';
     }
     $this->layout->style = $this->css_assets();
     $this->layout->script = $this->js_assets('chart');
     $this->layout->search = View::make('search', $this->getSearchData())->render();
     $this->layout->menu = View::make('menu', $this->getMenuData())->render();
     $this->layout->content = View::make('chart', $data)->render();
     $this->layout->modules = View::make('demographics')->render();
     $this->layout->modules .= View::make('options')->render();
     $this->layout->modules .= View::make('issues')->render();
     $this->layout->modules .= View::make('medications')->render();
     $this->layout->modules .= View::make('allergies')->render();
     $this->layout->modules .= View::make('supplements')->render();
     $this->layout->modules .= View::make('immunizations')->render();
     $this->layout->modules .= View::make('print')->render();
     $this->layout->modules .= View::make('billing')->render();
     $this->layout->modules .= View::make('documents')->render();
     $this->layout->modules .= View::make('t_messages')->render();
     $this->layout->modules .= View::make('encounters')->render();
     $this->layout->modules .= View::make('alerts', $data2)->render();
     $this->layout->modules .= View::make('lab')->render();
     $this->layout->modules .= View::make('rad')->render();
     $this->layout->modules .= View::make('cp')->render();
     $this->layout->modules .= View::make('ref')->render();
     $this->layout->modules .= View::make('messaging', $data1)->render();
     $this->layout->modules .= View::make('schedule')->render();
     $this->layout->modules .= View::make('financial')->render();
     $this->layout->modules .= View::make('office')->render();
     $this->layout->modules .= View::make('graph')->render();
     $this->layout->modules .= View::make('image')->render();
     if ($row->mtm_extension == 'y') {
         $this->layout->content .= View::make('mtm')->render();
         $this->layout->script .= HTML::script('/js/mtm.js');
     }
 }