UPDATE IGNORE #Request.prefix_db_agency#.pPatients SET Comments = '#form.comments#' WHERE Patient_ID = #form.Patients_ID# SELECT * FROM #Request.prefix_db_agency#.pPayer WHERE Status = '0'
Patients by Payer
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 JOIN #Request.prefix_db_agency#.pPtPayer ON pPatients.Patient_ID = pPtPayer.Patient_ID AND pPtPayer.status = 0 WHERE pPatients.Loc_ID = #session.AgencyID# AND pPtPayer.Payer_ID = #GetPayer.Pay_ID# AND pPatients.Status < 2 AND pPatients.Status = '0' AND pPatients.Status = '1' Order by pPtContacts.Emergency ASC,Pt_Last ASC

 #GetPayer.Pay_Name#

SELECT * FROM #Request.prefix_db_agency#.pProblem WHERE M0_No like 'M102%' AND Status = 0 AND Assmt_ID = (SELECT Assmt_ID FROM #Request.prefix_db_agency#.pAssessments WHERE pAssessments.Patient_ID = #GetPatient.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 ) LIMIT 0,6

(#Left(Priority,1)#)#GetPatient.Pt_Last#, #GetPatient.Pt_First# #GetPatient.Pt_Middle#

Physician :

#Phys_Last#, #Phys_First# - #Phys_Phone#

Diagnosis :

#Description# (Primary Diagnosis)

Emergency Contact :

* #GetPatient.Telephone1# #Last_Name# #First_Name# #Pt_Realtionship#

Comments : #Comment#

UPDATE IGNORE #Request.prefix_db_agency#.pPatients SET Comments = '#form.comment#' WHERE Patient_ID = #form.Patient_ID# 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 pPtContacts. Emergency = 1 Order by pPtContacts.Emergency ASC,Pt_Last ASC
Emergency Contacts for Active Patients

* primary contact

SELECT * FROM #Request.prefix_db_agency#.pProblem WHERE M0_No like 'M102%' 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 ) LIMIT 0,6

#Pt_Last#, #Pt_First# #Pt_Middle#

Diagnosis :

#Description# (Primary Diagnosis)

Emergency Contact :

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

Comments : #Comment#