예제 #1
0
 //$observationStatus = $resultReport->ObservationStatus; // => procedure_report.report_status
 $observationStatus = $resultReport->OrderResultStatus;
 // => procedure_report.report_status
 $controlId = $resultReport->ForeignAccId;
 // This is the CONTROL ID that is sent back
 $orderingProviderId = $resultReport->OrderingProviderId;
 // =>procedure_order.provider_id  But the ID here is NOT the same ID as OpenEMR. You have to match it correctly
 $orderingProviderLastName = $resultReport->OrderingProviderLastName;
 // Use this to match the provider ID
 $orderingProviderFirstName = $resultReport->OrderingProviderFirstName;
 // Use this to match the provider ID
 // Do something with the report, ie put in DB
 // echo $observationCode .":".$observationText.":".$observationStatus. "\n";
 // Match provider
 $user_id = '';
 $user_id = lab_exchange_match_provider($orderingProviderLastName, $orderingProviderFirstName);
 $date = '';
 $date = substr($observationDate, 0, 8);
 $check_type = sqlQuery("SELECT COUNT(*) AS count FROM procedure_type WHERE procedure_type_id = '" . add_escape_custom($observationCode) . "'");
 if ($check_type['count'] <= 0) {
     $sql_type_data = "procedure_type_id = '" . add_escape_custom($observationCode) . "', " . "name = '" . add_escape_custom($observationText) . "', " . "procedure_type = 'res'";
     $type_id = sqlInsert("INSERT INTO procedure_type SET {$sql_type_data}");
 }
 $check_order = sqlQuery("SELECT COUNT(*) AS count, procedure_order_id, provider_id, patient_id FROM procedure_order WHERE control_id = '" . add_escape_custom($controlId) . "' AND procedure_type_id = '" . add_escape_custom($observationCode) . "'");
 if ($check_order['count'] <= 0) {
     $sql_order_data = "procedure_type_id = '" . add_escape_custom($observationCode) . "', " . "provider_id = '" . add_escape_custom($user_id) . "', " . "patient_id = '" . add_escape_custom($patient_id) . "', " . "date_collected = DATE_FORMAT('" . add_escape_custom($observationDate . '00') . "', '%Y%m%d%H%i%s'), " . "date_ordered = DATE_FORMAT('" . add_escape_custom($date) . "', '%Y%m%d'), " . "order_priority = 'normal', " . "order_status = 'complete', " . "control_id = '" . add_escape_custom($controlId) . "'";
     $order_id = sqlInsert("INSERT INTO procedure_order SET {$sql_order_data}");
 } else {
     $sql_order_data = "provider_id = '" . add_escape_custom($user_id) . "', " . "date_collected = DATE_FORMAT('" . add_escape_custom($observationDate . '00') . "', '%Y%m%d%H%i%s'), " . "order_priority = 'normal', " . "order_status = 'complete'";
     if ($check_order['patient_id'] == "") {
         $sql_order_data .= ", patient_id = '" . add_escape_custom($patient_id) . "'";
예제 #2
0
 // => This text should be the same as procedure_type.name
 $observationDate = $resultReport->ObservationDateTime;
 // => procedure_report.date_collected
 //$observationStatus = $resultReport->ObservationStatus; // => procedure_report.report_status
 $observationStatus = $resultReport->OrderResultStatus;
 // => procedure_report.report_status
 $controlId = $resultReport->ForeignAccId;
 // This is the CONTROL ID that is sent back
 $orderingProviderId = $resultReport->OrderingProviderId;
 // =>procedure_order.provider_id  But the ID here is NOT the same ID as OpenEMR. You have to match it correctly
 $orderingProviderLastName = $resultReport->OrderingProviderLastName;
 // Use this to match the provider ID
 $orderingProviderFirstName = $resultReport->OrderingProviderFirstName;
 // Use this to match the provider ID
 // Match provider
 $user_id = lab_exchange_match_provider($orderingProviderId);
 if (!$user_id) {
     $lab_provider_errors[] = $resultReport;
 }
 $date = '';
 $date = substr($observationDate, 0, 8);
 $check_type = sqlQuery("SELECT COUNT(*) AS count FROM procedure_type WHERE procedure_type_id = '" . add_escape_custom($observationCode) . "'");
 if ($check_type['count'] <= 0) {
     $sql_type_data = "procedure_type_id = '" . add_escape_custom($observationCode) . "', " . "name = '" . add_escape_custom($observationText) . "', " . "procedure_type = 'res'";
     $type_id = sqlInsert("INSERT INTO procedure_type SET {$sql_type_data}");
 }
 $check_order = sqlQuery("SELECT COUNT(*) AS count, procedure_order_id, provider_id, patient_id FROM procedure_order WHERE control_id = '" . add_escape_custom($controlId) . "' AND procedure_type_id = '" . add_escape_custom($observationCode) . "'");
 if ($check_order['count'] <= 0) {
     $sql_order_data = "procedure_type_id = '" . add_escape_custom($observationCode) . "', " . "provider_id = '" . add_escape_custom($user_id) . "', " . "patient_id = '" . add_escape_custom($patient_id) . "', " . "date_collected = DATE_FORMAT('" . add_escape_custom($observationDate . '00') . "', '%Y%m%d%H%i%s'), " . "date_ordered = DATE_FORMAT('" . add_escape_custom($date) . "', '%Y%m%d'), " . "order_priority = 'normal', " . "order_status = 'complete', " . "control_id = '" . add_escape_custom($controlId) . "'";
     $order_id = sqlInsert("INSERT INTO procedure_order SET {$sql_order_data}");
 } else {