UPDATE IGNORE #Request.prefix_db_agency#.pPatients SET Comments = '#form.comment#' WHERE Patient_ID = #form.Patient_ID#
Patients by Priority

* primary contact

SELECT DISTINCT pPatients.Patient_ID, pPatients.Status, pPatients.Pt_Last, pPatients.Pt_First, pPatients.Pt_Middle,pPatients.Comments AS Comment, pPatients.Pt_Street,pPatients.Pt_City, pPatients.Pt_State,pPatients.Pt_Zip,pPatients.Pt_Phone, pPtContacts.Patient_ID, pPtContacts.Last_Name, pPtContacts.First_Name, pPtContacts.Pt_Realtionship, pPtContacts.Telephone1, pPtContacts.Emergency AS PrimaryContact,pa.Emerg_Priority AS Priority, pPhysicians.Phys_First,pPhysicians.Phys_Last,pPhysicians.Phys_Phone FROM #Request.prefix_db_agency#.pPatients JOIN #Request.prefix_db_agency#.pPtContacts ON pPatients.Patient_ID = pPtContacts.Patient_ID AND pPtContacts.status = 0 JOIN #Request.prefix_db_agency#.pAdmit pa ON pPatients.Patient_ID = pa.Patient_ID AND pa.status = 0 JOIN #Request.prefix_db_lookup#.pPhysicians ON pPhysicians.Phys_ID = pa.Render_Phys_ID AND pPhysicians.status = 0 WHERE pPatients.Loc_ID = #session.AgencyID# AND pPatients.Status < 2 AND pPatients.Status = '0' AND pPatients.Status = '1' Order by pPtContacts.Emergency ASC,Pt_Last ASC SELECT * FROM #Request.prefix_db_agency#.pProblem WHERE M0_No like 'M1021%' AND Status = 0 AND Assmt_ID = (SELECT Assmt_ID FROM #Request.prefix_db_agency#.pAssessments WHERE pAssessments.Patient_ID = #GetP.Patient_ID# AND pAssessments.Status = 0 AND (pAssessments.F26 like '%1 -%' OR pAssessments.F26 like '%3 -%' OR pAssessments.F26 like '%4 -%' ) ORDER BY pAssessments.F179 DESC LIMIT 1 )

(#LEFT(Priority,1)#) #Pt_Last#, #Pt_First# #Pt_Middle#

#Pt_Street#, #Pt_City# #Pt_Phone#

Physician :

#Phys_Last#, #Phys_First# - #Phys_Phone#

Primary Diagnosis :

#Description#

Emergency Contact :

* #Telephone1# #Last_Name# #First_Name# #Pt_Realtionship#

Comments : #Comment#