コード例 #1
0
function updateAppointmentStatus($pid, $encdate, $newstatus)
{
    if (empty($GLOBALS['gbl_auto_update_appt_status'])) {
        return;
    }
    $query = "SELECT pc_eid, pc_aid, pc_catid, pc_apptstatus, pc_eventDate, pc_startTime, " . "pc_hometext, pc_facility, pc_billing_location, pc_room " . "FROM openemr_postcalendar_events WHERE " . "pc_pid = ? AND pc_recurrtype = 0 AND pc_eventDate = ? " . "ORDER BY pc_startTime DESC, pc_eid DESC LIMIT 1";
    $tmp = sqlQuery($query, array($pid, $encdate));
    if (!empty($tmp['pc_eid'])) {
        $appt_eid = $tmp['pc_eid'];
        $appt_status = $tmp['pc_apptstatus'];
        // Some tests for illogical changes.
        if ($appt_status == '$') {
            return;
        }
        if ($newstatus == '<' && $appt_status == '>') {
            return;
        }
        $encounter = todaysEncounterCheck($pid, $tmp['pc_eventDate'], $tmp['pc_hometext'], $tmp['pc_facility'], $tmp['pc_billing_location'], $tmp['pc_aid'], $tmp['pc_catid'], false);
        manage_tracker_status($tmp['pc_eventDate'], $tmp['pc_startTime'], $appt_eid, $pid, $_SESSION["authUser"], $newstatus, $tmp['pc_room'], $encounter);
    }
}
コード例 #2
0
    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);
        }
     }
    
     echo "<html>\n<body>\n<script language='JavaScript'>\n";	
     echo " window.opener.pattrk.submit();\n";
     echo " window.close();\n";    
     echo "</script></body></html>\n";
     exit();
  }
     #get the patient name for display
     $row = sqlQuery("select fname, lname " .
     "from patient_data where pid =? limit 1" , array($tkpid));

?>
 </head>
コード例 #3
0
ファイル: add_edit_event.php プロジェクト: minggLu/openemr
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']);
            }
        }
    }
}
コード例 #4
0
function InsertEvent($args,$from = 'general') {
  $pc_recurrtype = '0';
  if ($args['form_repeat']) {
    $pc_recurrtype = $args['recurrspec']['event_repeat_on_freq'] ? '2' : '1';
  }
  $form_pid = empty($args['form_pid']) ? '' : $args['form_pid'];
  $form_room = empty($args['form_room']) ? '' : $args['form_room'];

	if($from == 'general'){
    $pc_eid = sqlInsert("INSERT INTO openemr_postcalendar_events ( " .
			"pc_catid, pc_multiple, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, " .
			"pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, " .
			"pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, " .
			"pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing, pc_facility,pc_billing_location,pc_room " .
			") VALUES (?,?,?,?,?,NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,1,1,?,?,?)",
			array($args['form_category'],(isset($args['new_multiple_value']) ? $args['new_multiple_value'] : ''),$args['form_provider'],$form_pid,
			$args['form_title'],$args['form_comments'],$_SESSION['authUserID'],$args['event_date'],
			fixDate($args['form_enddate']),$args['duration'],$pc_recurrtype,serialize($args['recurrspec']),
			$args['starttime'],$args['endtime'],$args['form_allday'],$args['form_apptstatus'],$args['form_prefcat'],
			$args['locationspec'],(int)$args['facility'],(int)$args['billing_facility'],$form_room)
		);

            manage_tracker_status($args['event_date'],$args['starttime'],$pc_eid,$form_pid,$_SESSION['authUser'],$args['form_apptstatus'],$args['form_room']);
            $GLOBALS['temporary-eid-for-manage-tracker'] = $pc_eid; //used by manage tracker module to set correct encounter in tracker when check in

            return $pc_eid;

	}elseif($from == 'payment'){
		sqlStatement("INSERT INTO openemr_postcalendar_events ( " .
			"pc_catid, pc_multiple, pc_aid, pc_pid, pc_title, pc_time, " .
			"pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, " .
			"pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, " .
			"pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing, pc_facility,pc_billing_location " .
			") VALUES (?,?,?,?,?,NOW(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
			array($args['form_category'],$args['new_multiple_value'],$args['form_provider'],$form_pid,$args['form_title'],
				$args['event_date'],$args['form_enddate'],$args['duration'],$pc_recurrtype,serialize($args['recurrspec']),
				$args['starttime'],$args['endtime'],$args['form_allday'],$args['form_apptstatus'],$args['form_prefcat'], $args['locationspec'],
				1,1,(int)$args['facility'],(int)$args['billing_facility']));
	}
}