예제 #1
0
 function save_theme()
 {
     $questionnaire_service = new Questionnaire_service();
     if ($this->input->post('active_user_detail', TRUE) == '') {
         $data = array('text_colour' => $this->input->post('text_colour', TRUE), 'banner_colour' => $this->input->post('banner_colour', TRUE), 'banner_txt_colour' => $this->input->post('banner_txt_colour', TRUE), 'btn_colour' => $this->input->post('btn_colour', TRUE), 'btn_type' => $this->input->post('btn_type', TRUE), 'text_box_colour' => $this->input->post('text_box_colour', TRUE), 'welcome_bg_colour' => $this->input->post('welcome_bg_colour', TRUE), 'btn_text_colour' => $this->input->post('btn_text_colour', TRUE), 'active_user_detail' => '0', 'patient_no_field' => '0', 'name_field' => '0', 'email_field' => '0', 'contact_field' => '0', 'admission_date_field' => '0', 'discharge_date_field' => '0', 'ward_no_field' => '0');
     } else {
         $data = array('text_colour' => $this->input->post('text_colour', TRUE), 'banner_colour' => $this->input->post('banner_colour', TRUE), 'banner_txt_colour' => $this->input->post('banner_txt_colour', TRUE), 'btn_colour' => $this->input->post('btn_colour', TRUE), 'btn_type' => $this->input->post('btn_type', TRUE), 'text_box_colour' => $this->input->post('text_box_colour', TRUE), 'welcome_bg_colour' => $this->input->post('welcome_bg_colour', TRUE), 'btn_text_colour' => $this->input->post('btn_text_colour', TRUE), 'active_user_detail' => '1', 'patient_no_field' => $this->input->post('patient_no_field', TRUE) != '' ? '1' : '0', 'name_field' => '1', 'email_field' => $this->input->post('email_field', TRUE) != '' ? '1' : '0', 'contact_field' => $this->input->post('contact_field', TRUE) != '' ? '1' : '0', 'admission_date_field' => $this->input->post('admission_date_field', TRUE) != '' ? '1' : '0', 'discharge_date_field' => $this->input->post('discharge_date_field', TRUE) != '' ? '1' : '0', 'ward_no_field' => $this->input->post('ward_no_field', TRUE) != '' ? '1' : '0');
     }
     $questionnaire_service->update_questionnaire($data, $this->input->post('questionnaire_id', TRUE));
     $data['questionnaire'] = $questionnaire_service->get_questionnaire_by_id($this->input->post('questionnaire_id', TRUE));
 }
예제 #2
0
 public function save_feedback()
 {
     $patients_service = new Patients_service();
     $patients_model = new Patients_model();
     $patients_feeds_service = new Patients_feeds_service();
     $questionnaire_service = new Questionnaire_service();
     $questionnaire = $questionnaire_service->get_questionnaire_by_id($this->input->post('questionnaire_id', TRUE));
     $data['questionnaire'] = $questionnaire;
     echo $this->load->view('content/thank_you', $data);
     //check is the user is exist or not
     /* $patient    = $patients_service->get_patient_by_number($this->input->post('patient_number', TRUE));
        $patient_id = ''; */
     //if user exist update the details  otherwise insert a new user
     /*
      if (!empty($patient)) {
      $patient_id = $patient->id;
     
      $patients_model->set_id($patient_id);
      $patients_model->set_patient_name($this->input->post('patient_name', TRUE));
      $patients_model->set_patient_email($this->input->post('patient_email', TRUE));
      $patients_model->set_patient_contact_no($this->input->post('patient_contact_no', TRUE));
      $patients_model->set_patient_admission_date($this->input->post('patient_admission_date', TRUE));
      $patients_model->set_patient_discharge_date($this->input->post('patient_discharge_date', TRUE));
      $patients_model->set_updated_date(date("Y-m-d H:i:s"));
     
      $patients_service->update_patient_details($patients_model);
      } else {
     */
     if ($questionnaire->active_user_detail == '0') {
         if ($questionnaire->loc_type == 'hospital') {
             $patients_model->set_patient_number($this->input->post('patient_number', TRUE));
         } else {
             $patients_model->set_patient_name($this->input->post('patient_number', TRUE));
         }
     } else {
         $patients_model->set_patient_name($this->input->post('patient_name', TRUE));
         if ($questionnaire->loc_type == 'hospital') {
             $patients_model->set_patient_number($this->input->post('patient_number', TRUE));
         }
         if ($questionnaire->email_field == '1') {
             $patients_model->set_patient_email($this->input->post('patient_email', TRUE));
         }
         if ($questionnaire->contact_field == '1') {
             $patients_model->set_patient_contact_no($this->input->post('patient_contact_no', TRUE));
         }
         if ($questionnaire->admission_date_field == '1') {
             $patients_model->set_patient_admission_date($this->input->post('patient_admission_date', TRUE));
         }
         if ($questionnaire->discharge_date_field == '1') {
             $patients_model->set_patient_discharge_date($this->input->post('patient_discharge_date', TRUE));
         }
         if ($questionnaire->ward_no_field == '1') {
             $patients_model->set_ward_no($this->input->post('ward_no', TRUE));
         }
     }
     $patients_model->set_is_deleted('0');
     $patients_model->set_added_date(date("Y-m-d H:i:s"));
     $patient_id = $patients_service->save_patient_details($patients_model);
     /* } */
     $questions = $this->input->post('questions', TRUE);
     $answers = $this->input->post('answer', TRUE);
     if (!empty($questions)) {
         foreach ($questions as $question) {
             $patients_feeds_model = new Patients_feeds_model();
             $patients_feeds_model->set_questionnaire_id($this->input->post('questionnaire_id', TRUE));
             $patients_feeds_model->set_feed($answers[$question]);
             $patients_feeds_model->set_patient_id($patient_id);
             $patients_feeds_model->set_question_id($question);
             $patients_feeds_model->set_is_deleted('0');
             $patients_feeds_model->set_added_date(date("Y-m-d"));
             $patients_feeds_service->save_patient_feed($patients_feeds_model);
         }
     }
 }