"AND patient_tracker.lastseq = patient_tracker_element.seq " .
                            "WHERE patient_tracker.id =?",array($_GET['tracker_id']));
 
    $tkpid = $trow['pid'];
    $appttime = $trow['appttime'];
    $apptdate = $trow['apptdate']; 
    $pceid = $trow['eid'];
    $theroom = '';
	 
  if ($_POST['statustype'] !='') { 
    $status = $_POST['statustype'];
    if (strlen($_POST['roomnum']) != 0) {
       $theroom = $_POST['roomnum'];
    }
    # Gather information and send to manage tracker status.
    if ($GLOBALS['auto_create_new_encounters'] && $apptdate == date('Y-m-d') && (is_checkin($status) == '1') && !is_tracker_encounter_exist($apptdate,$appttime,$tkpid,$pceid))		 
	 {		
        # Gather information for encounter fields
        $genenc = sqlQuery("select pc_catid as category, pc_hometext as reason, pc_aid as provider, pc_facility as facility, pc_billing_location as billing_facility " .
                           "from openemr_postcalendar_events where pc_eid =? " , array($pceid));
        $encounter = todaysEncounterCheck($tkpid, $apptdate, $genenc['reason'], $genenc['facility'], $genenc['billing_facility'], $genenc['provider'], $genenc['category'],false);
        # Capture the appt status and room number for patient tracker. This will map the encounter to it also.
        if (!empty($pceid)) {
        manage_tracker_status($apptdate,$appttime,$pceid,$tkpid,$_SESSION["authUser"],$status,$theroom,$encounter);
	 }
     }
     else 
     {
        # Capture the appt status and room number for patient tracker.
        if (!empty($pceid)) {
          manage_tracker_status($apptdate,$appttime,$pceid,$tkpid,$_SESSION["authUser"],$status,$theroom);
示例#2
0
function DOBandEncounter()
{
    global $event_date, $info_msg;
    // Save new DOB if it's there.
    $patient_dob = trim($_POST['form_dob']);
    $tmph = $_POST['form_hour'] + 0;
    $tmpm = $_POST['form_minute'] + 0;
    if ($_POST['form_ampm'] == '2' && $tmph < 12) {
        $tmph += 12;
    }
    $appttime = "{$tmph}:{$tmpm}:00";
    if ($patient_dob && $_POST['form_pid']) {
        sqlStatement("UPDATE patient_data SET DOB = ? WHERE " . "pid = ?", array($patient_dob, $_POST['form_pid']));
    }
    // Manage tracker status.
    // And auto-create a new encounter if appropriate.
    if (!empty($_POST['form_pid'])) {
        if ($GLOBALS['auto_create_new_encounters'] && $event_date == date('Y-m-d') && is_checkin($_POST['form_apptstatus']) == '1' && !is_tracker_encounter_exist($event_date, $appttime, $_POST['form_pid'], $_GET['eid'])) {
            $encounter = todaysEncounterCheck($_POST['form_pid'], $event_date, $_POST['form_comments'], $_POST['facility'], $_POST['billing_facility'], $_POST['form_provider'], $_POST['form_category'], false);
            if ($encounter) {
                $info_msg .= xl("New encounter created with id");
                $info_msg .= " {$encounter}";
            }
            # Capture the appt status and room number for patient tracker. This will map the encounter to it also.
            if (isset($GLOBALS['temporary-eid-for-manage-tracker']) || !empty($_GET['eid'])) {
                // Note that the temporary-eid-for-manage-tracker is used to capture the eid for new appointments and when separate a recurring
                // appointment. It is set in the InsertEvent() function. Note that in the case of spearating a recurrent appointment, the get eid
                // parameter is actually erroneous(is eid of the recurrent appt and not the new separated appt), so need to use the
                // temporary-eid-for-manage-tracker global instead.
                $temp_eid = isset($GLOBALS['temporary-eid-for-manage-tracker']) ? $GLOBALS['temporary-eid-for-manage-tracker'] : $_GET['eid'];
                manage_tracker_status($event_date, $appttime, $temp_eid, $_POST['form_pid'], $_SESSION["authUser"], $_POST['form_apptstatus'], $_POST['form_room'], $encounter);
            }
        } else {
            # Capture the appt status and room number for patient tracker.
            if (!empty($_GET['eid'])) {
                manage_tracker_status($event_date, $appttime, $_GET['eid'], $_POST['form_pid'], $_SESSION["authUser"], $_POST['form_apptstatus'], $_POST['form_room']);
            }
        }
    }
}