Index: qrda/C0Q/trunk/p/C0QPRML.m
===================================================================
--- qrda/C0Q/trunk/p/C0QPRML.m	(revision 1232)
+++ qrda/C0Q/trunk/p/C0QPRML.m	(revision 1335)
@@ -1,4 +1,4 @@
 C0QPRML	;JJOH/ZAG/GPL - Patient Reminder List ;7/5/11 8:50pm
-	;;1.0;MU PACKAGE;;;Build 19
+	;;1.0;MU PACKAGE;;;Build 23
 	;
 	;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
@@ -43,4 +43,5 @@
 	. D FILE ; FILE THE PATIENT LISTS
 	. D UPDATE^C0QUPDT(.G,8) ; UPDATE THE MU MEASUREMENT SET
+	. D UPDATE^C0QUPDT(.G,9) ; UPDATE THE MU MEASUREMENT SET
 	Q
 	;
@@ -58,7 +59,11 @@
 	. . . D PROBLEM
 	. . . D ALLERGY
-	. . . D MEDS
+	. . . D MEDS4
+	       . . . D RECON2
+	       . . . D ADVDIR
 	. . . D SMOKING
 	. . . D VITALS
+	       . . . D VTE1
+	       . . . D EDTIME
 	. . . I C0QPR D PRINT
 	. . . I C0QSS D SS
@@ -67,4 +72,6 @@
 	;
 DEMO	; patient demographics
+	K PTDOB
+	N PTNAME,PTSEX,PTHRN,PTRLANG,PTLANG,RACE,RACEDSC,ETHN,ETHNDSC,RB
 	S PTNAME=$P(^DPT(DFN,0),U) ;patient name
 	S PTDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) ;date of birth
@@ -85,4 +92,13 @@
 	. S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
 	S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
+	N DEMOYN S DEMOYN=1
+	I $G(PTSEX)="" S DEMOYN=0
+	I $G(PTDOB)="" S DEMOYN=0
+	I $G(PTHRN)="" S DEMOYN=0
+	I $G(PTLANG)="" S DEMOYN=0
+	I $G(RACEDSC)="" S DEMOYN=0
+	I $G(ETHNDSC)="" S DEMOYN=0
+	I DEMOYN S C0QLIST("HasDemographics",DFN)=""
+	E  S C0QLIST("FailedDemographics",DFN)=""
 	Q
 	;
@@ -128,9 +144,259 @@
 	Q
 	;
-SMOKING	; 
-	N C0QSMOKE
+MEDS2	; MEDICATIONS
+	;
+	K MEDSL,MDDESC,MDITEM
+	D COVER^ORWPS(.MEDSL,DFN) ; CPRS MED LIST
+	I '$D(MEDSL) D  ;
+	. S C0QLIST("NoMedOrders",DFN)=""
+	. I $$HFYN^C0QHF(DFN,"MEDS HAVE BEEN REVIEWED") D  ;
+	. . S C0QLIST("HasMed",DFN)=""
+	. E  S C0QLIST("NoMed",DFN)=""
+	S MDCNT="" S HASINP=0
+	F  S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT=""  D  ;
+	. ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE"  ;active medications only
+	. ;S C0QLIST("HasMedOrders",DFN)=""
+	. S C0QLIST("HasMed",DFN)=""
+	. S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
+	. S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
+	. I $P($P(MEDSL(MDCNT),"^",1),";",2)="I" S HASINP=1
+	I HASINP D  ; THE PATIENT HAS AN INPATIENT MED
+	. S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
+	E  S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
+	K MEDSL
+	Q
+	;
+MEDS3	; USE THE REMINDER INDEX ^PXRMINDX TO CHECK FOR MEDS
+	;
+	S C0QPXRM=$NA(^PXRMINDX(55,"PI")) ; REMINDER INDEX FOR DRUGS
+	I $D(@C0QPXRM@(DFN)) D  ; HAS MEDS
+	. S C0QLIST("HasMed",DFN)=""
+	. S C0QLIST("HasMedOrders",DFN)=""
+	E  D  ; NO MEDS
+	. S C0QLIST("NoMed",DFN)=""
+	. S C0QLIST("NoMedOrders",DFN)=""
+	Q
+	;
+MEDS4	; USE OCL^PSOORRL TO GET ALL MEDS
+	N BEG,END
+	S BEG=$$DT^C0PCUR("JULY 3,2011")
+	S END=$$DT^C0PCUR("NOW")
+	D OCL^PSOORRL(DFN,BEG,END)  ;DBIA #2400
+	N C0QMEDS
+	M C0QMEDS=^TMP("PS",$J) ; MEDS RETURNED FROM CALL
+	N FOUND
+	N ZI
+	I '$D(C0QMEDS(1)) D  Q  ; QUIT IF NO MEDS
+	. S C0QLIST("NoMed",DFN)=""
+	E  D  ; HAS MEDS
+	. S C0QLIST("HasMed",DFN)=""  
+	S ZI="" S FOUND=0
+	F  S ZI=$O(C0QMEDS(ZI)) Q:ZI=""  D  ; FOR EACH MED
+	. N ZM
+	. S ZM=$G(C0QMEDS(ZI,0)) ;THE MEDICATION
+	. I $P($P(ZM,"^",1),";",2)="I" D  ; IE 1U;I FOR AN INPATIENT UNIT DOSE
+	. . S FOUND=1
+	I FOUND S C0QLIST("HasMedOrders",DFN)="" ; MET CPOE MEASURE
+	E  S C0QLIST("NoMedOrders",DFN)=""
+	Q
+	;
+RECON	; MEDICATIONS RECONCILIATION
+	; 
+	I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D  ;
+	. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
+	N HASRECON S HASRECON=0
+	N GT,G
+	S GT(4,"HasMedRecon","MEDICATION RECONCILIATION COMPLET")=""
+	S GT(5,"HasMedRecon","Medication Reconcilation Complete")=""
+	I $$TXTALL^C0QNOTES(.G,.GT,DFN) D  ; SEARCH ALL NOTES FOR MED RECON
+	. S HASRECON=1
+	;N ZT
+	;S ZT="MEDICATION RECONCILIATION COMPLET"
+	;I $$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN) D  ;
+	;. S HASRECON=1
+	;E  D  ;
+	;. S ZT="Medication Reconcilation Complete"
+	;. I $$NTTXT^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",ZT,DFN) D  ;
+	;. . S HASRECON=1
+	;I $$HFYN^C0QHF("MEDS HAVE BEEN REVIEWED",DFN) S HASRECON=1
+	I HASRECON D  ;
+	. S C0QLIST("HasMedRecon",DFN)=""
+	E  S C0QLIST("NoMedRecon",DFN)=""
+	Q
+	;
+RECON2	; USE HEALTH FACTORS FOR MEDICATION RECONCILIATION
+	I $$HASNTYN^C0QNOTES("MED/SURG NURSING ADMISSION ASSESSMENT",DFN) D  ;
+	. S C0QLIST("XferOfCare",DFN)="" ; transfer of care patient
+	I $$HFYN^C0QHF(DFN,"Medication Reconciliation Completed: Yes") D  ;
+	. S C0QLIST("HasMedRecon",DFN)=""
+	E  S C0QLIST("NoMedRecon",DFN)=""
+	Q
+	;
+ADVDIR	; ADVANCE DIRECTIVE
+	;
+	I $$AGE^C0QUTIL(DFN)>64 D  ; ONLY FOR PATIENTS 65 AND OLDER
+	. S C0QLIST("Over65",DFN)=""
+	. I $$HASNTYN^C0QNOTES("ADVANCE DIRECTIVE",DFN) D  ;
+	. . S C0QLIST("HasAdvanceDirective",DFN)=""
+	. E  D  ;
+	. . S C0QLIST("NoAdvanceDirective",DFN)=""
+	Q
+	;
+SMOKING	;
+	I $$INLIST("HasSmokingStatus",DFN) D  Q  ; ALREADY HAS SMOKING STATUS CHECK
+	. S C0QLIST("HasSmokingStatus",DFN)=""
+	. S C0QLIST("Over12",DFN)=""
+	I $$INLIST("NoSmokingStatus",DFN) D  Q  ; ALREADY HAS SMOKING STATUS CHECK
+	. S C0QLIST("NoSmokingStatus",DFN)=""
+	. S C0QLIST("Over12",DFN)=""
+	N C0QSMOKE,C0QSYN
+	S C0QSYN=0
+	I $$AGE^C0QUTIL(DFN)<13 Q  ; DON'T CHECK UNDER AGE 13
 	D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
 	; PATIENT IN THE CATEGORY OF TOBACCO
-	I $D(C0QSMOKE) S C0QLIST("HasSmokingStatus",DFN)=""
+	I $D(C0QSMOKE) S C0QSYN=1
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco <1 Yr Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco > 20 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 1-5 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 10-20 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smokeless Tobacco: 5-10 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking < 1 Yr Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking > 20 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 1-5 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 10-20 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Quit Smoking: 5-10 Yrs Ago")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 1-5 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 10-20 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: 5-10 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: < 1 YR AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS: > 20 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 10-20 YRS")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER 20+ YRS")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER < 1 YR AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER > 20 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 1-5 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 10-20 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKER: 5-10 YRS AGO")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"PREVIOUS SMOKELESS TOBACCO USER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking Cessation (OPH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"LIFETIME NON-SMOKER")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Former Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoke Exposure/2nd Hand Exposure")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoked For > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Tobacco User")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 1-5 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 10-20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for 5-10 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for < 1 Yr")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smokeless Used for > 20 Yrs")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoker (HPI)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (FMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Smoking (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Smoker (PMH)")
+	S:'C0QSYN C0QSYN=$$HFYN^C0QHF(DFN,"Non-Tobacco User")
+	S C0QLIST("Over12",DFN)=""
+	N GT
+	S GT(1,"HasSmokingStatus","SMOK")=""
+	S GT(2,"HasSmokingStatus","Smok")=""
+	S GT(3,"HasSmokingStatus","smok")=""
+	;N ZT
+	;S ZT="Smok"
+	;S:'C0QSYN C0QSYN=$$NTTXT^C0QNOTES("ER NURSE NOTE",ZT,DFN)  ;
+	I 'C0QSYN D  ;
+	. N G
+	. S OK=$$TXTALL^C0QNOTES(.G,.GT,DFN)
+	. I $D(G) S C0QSYN=1
+	I C0QSYN S C0QLIST("HasSmokingStatus",DFN)=""
 	E  S C0QLIST("NoSmokingStatus",DFN)=""
 	Q
@@ -146,4 +412,30 @@
 	. E  S C0QLIST("HasVitalSigns",DFN)=""
 	Q
+	;
+VTE1	; VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL
+	;
+	I $$HFYN^C0QHF(DFN,"VTE PROPHYLAXIS WITHIN 24HRS OF ARRIVAL") D  ;
+	. S C0QLIST("HasVTE24",DFN)=""
+	E  S C0QLIST("NoVTE24",DFN)="" 
+	Q
+	;
+EDTIME	; CHECK FOR EMERGENCY DEPT TIME FACTORS
+	N FOUND
+	S FOUND=0
+	I $$HFYN^C0QHF(DFN,"ED ARRIVAL TIME") S FOUND=1
+	I '$$HFYN^C0QHF(DFN,"ED DEPARTURE TIME") S FOUND=0
+	I '$$HFYN^C0QHF(DFN,"TIME DECISION TO ADMIT MADE") S FOUND=0
+	I FOUND D  ; 
+	. S C0QLIST("HasEDtime",DFN)=""
+	E  S C0QLIST("NoEDtime",DFN)=""
+	Q
+	;
+INLIST(ZLIST,DFN)	; EXTRINSIC FOR IS PATIENT ALREADY IN LIST ZLIST
+	N ZL,ZR
+	S ZL=$O(^C0Q(301,"CATTR",ZLIST,"")) ; IEN OF LIST IN C0Q PATIENT LIST FILE
+	I ZL="" Q 0 ; LIST DOES NOT EXIST
+	S ZR=0 ; ASSUME NOT IN LIST
+	I $D(^C0Q(301,ZL,1,"B",DFN)) S ZR=1 ; PATIENT IS IN LIST
+	Q ZR
 	;
 PRINT	; PRINT TO SCREEN
@@ -203,6 +495,6 @@
 	I $G(RACEDSC)="" S DEMOYN=0
 	I $G(ETHNDSC)="" S DEMOYN=0
-	I DEMOYN S C0QLIST("HasDemographics",DFN)=""
-	E  S C0QLIST("FailedDemographics",DFN)=""
+	;I DEMOYN S C0QLIST("HasDemographics",DFN)=""
+	;E  S C0QLIST("FailedDemographics",DFN)=""
 	;S G1("Gender")=PTSEX
 	;S G1("DateOfBirth")=PTDOB
@@ -217,7 +509,7 @@
 	I ALDESC["No Allergy" S C0QLIST("NoAllergy",DFN)=""
 	E  S C0QLIST("HasAllergy",DFN)=""
-	I $D(MDITEM) D  ;
-	. S C0QLIST("HasMed",DFN)=""
-	E  S G1("NoMed",DFN)=""
+	;I $D(MDITEM) D  ;
+	       ;. S C0QLIST("HasMed",DFN)=""
+	;E  S G1("NoMed",DFN)=""
 	;S G1("MedDescription")=$G(MDDESC)
 	Q
@@ -237,5 +529,5 @@
 	. S DTE=$O(^DGPM("B",DTE))
 	. Q:'DTE
-	. Q:DTE<3110703
+	. Q:$P(DTE,".")<3110703
 	. S EXDTE=$$FMTE^XLFDT(DTE)
 	. N PTFM S PTFM=""
@@ -244,10 +536,15 @@
 	. . Q:'PTFM
 	. . S DFN=$P(^DGPM(PTFM,0),U,3)
+	       . . S C0QLIST("Patient",DFN)=""
 	. . D DEMO
 	. . D PROBLEM
 	. . D ALLERGY
-	. . D MEDS
+	. . D MEDS4
+	       . . D RECON2
+	       . . D ADVDIR
 	. . D SMOKING
 	. . D VITALS
+	       . . D VTE1
+	       . . D EDTIME
 	. . I C0QPR D PRINT
 	. . I C0QSS D SS
