Example #1
0
 public function generate_feedback_export()
 {
     $patients_feed_service = new Patients_feeds_service();
     $question_type_service = new Question_types_service();
     $location_id = $this->session->userdata('USER_LOCATION');
     $month = $this->input->get('month', TRUE);
     $questionnaire = $this->input->get('questionnaire', TRUE);
     $date = date('n', strtotime($this->input->get('month', TRUE)));
     $data['questionnaire'] = $questionnaire;
     $data['date'] = $date;
     $data['get_month'] = $month;
     $data['feed_back_sheets'] = $patients_feed_service->get_feedbacks_for_location_by_month($location_id, $date, $questionnaire);
     $data['month'] = date('F Y', strtotime($month));
     if ($questionnaire != "") {
         $data['q_types'] = $question_type_service->get_published_question_types_for_questionnaire($location_id, $questionnaire);
     } else {
         $data['q_types'] = $question_type_service->get_published_question_types($location_id);
     }
     $data['location_id'] = $location_id;
     echo $this->load->view('reports_other/feedback_monthly_report_excel', $data, TRUE);
 }
$non_cat_questions = $questions_service->get_non_cat_questions($questionnaire_n);
foreach ($non_cat_questions as $non_cat_question) {
    ?>
                                    <th><?php 
    echo $non_cat_question->question_name;
    ?>
</th>
                                <?php 
}
?>
                            </tr>
                            </thead>
                            <tbody>
                            <?php 
$i = 0;
$feedback_service = new Patients_feeds_service();
foreach ($feed_back_sheets as $feed_back_sheet) {
    ?>
                                <tr>
                                    <td><?php 
    echo date('M - y', strtotime($get_month));
    ?>
</td>
                                    <td><?php 
    echo ++$i;
    ?>
</td>
                                    <?php 
    //questions with categories
    foreach ($q_types as $q_type) {
        if ($questionnaire != "") {
            <thead>
            <tr>
                <th>Description</th>
                <th>Excellent%</th>
                <th>Below Satisfactory%</th>
                <th>Excellent</th>
                <th>Good</th>
                <th>Satisfactory</th>
                <th>Poor</th>
            </tr>
            </thead>
        </table>

        <?php 
$questions_service = new Questions_service();
$feedback_service = new Patients_feeds_service();
foreach ($q_types as $q_type) {
    $cat_arr = array();
    $exce_arr = array();
    $satis_arr = array();
    if ($questionnaire != "") {
        $questions = $questions_service->get_questions_for_question_type_questionnaire($q_type->id, $questionnaire);
    } else {
        $questions = $questions_service->get_questions_for_question_type($q_type->id);
    }
    ?>
            <table class="display table table-bordered ">
                <tbody>
                <tr>
                    <td colspan="7">
                        <strong><?php 
Example #4
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);
         }
     }
 }