Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VENPCCQD

VENPCCQD.m

Go to the documentation of this file.
VENPCCQD ; IHS/OIT/GIS - PRE INSTALL ; DATA ENTRY MNEMONIC
 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
APCDTWC2 ; GENERATED FROM 'APCD WCE (ADD)' INPUT TEMPLATE(#XXX), FILE 9000010
 ; EXAMS
 ; 
 ;
EXAM ; EP -  ENTER SPECIAL EXAMS AND SCREENING PROCEDURES
 N ARR,AGIEN,%,X,TOT,LOU,TIME,FTIME,GRP,WVCIEN,TYPE,DOM,TITLE,SS,TITLE,DIR
EQ W !!,"Select EXAM TYPE"
 S DIR(0)="S^1:General health screening;2:Age-specific physical exam;3:Special risk screening;4:Behavioral health screening;A:ALL OF ABOVE;Q:QUIT ENTERING EXAMS"
 S DIR("A")="Your choice" D ^DIR K DIR
 I Y="Q" D ^XBFMK Q  ; Q
 I Y S Y=$S(Y=1:8,Y=2:4,Y=3:3,1:7) D EX(Y) G EQ ; EDIT A SINGLE EXAM TYPE
 S DOM=7
 F TYPE=8,4,3,7 D EX(TYPE) ; EDIT ALL 4 EXAM TYPES
 G EQ
 ; 
EX(TYPE) ; EP - MANAGE SELECTIONS
 I '$G(TYPE) Q
 S TITLE=$S(TYPE=4:"age-specific physical exam",TYPE=7:"behavioral health screening exam",TYPE=3:"special risk screening exam",TYPE=8:"general health screening exam",1:"")
 I '$L(TITLE) Q
 S SS=$S(TYPE=4:6,TYPE=7:7,TYPE=3:4,TYPE=8:8,1:"") I 'SS Q
 S DOM=7
 D ARR^APCDTWC(AUPNPAT,TYPE,DOM,.ARR) ; BUILD THE PRE-SELECTION ARRAY
 I '$D(ARR) W !,"No ",TITLE," items are available for this visit" Q
 S VWCIEN=$O(^AUPNVWC("AD",APCDVSIT,999999999),-1)
 I VWCIEN D  ; CHECK FOR EXISTING SELECTIONS AND UPDATE THE ARRAY
 . S TOT=0 F  S TOT=$O(ARR(TOT)) Q:'TOT  D
 .. S X=ARR(TOT)
 .. S X=$P(X,". ",2)
 .. S X=$E(X,1,30)
 .. I $D(^AUPNVWC(VWCIEN,SS,"B",X)) S ARR(TOT,1)="" ; IF ITS ALREADY IN V WC, SET THE ARR NODE TO 'SELECTED'
 .. Q
 . Q
 I '$D(ARR) Q
 W !!,"Select ",TITLE,"(s)"
 D RANGE^APCDTWC(.ARR) I '$D(ARR) Q  ; GET FINAL SELECTION ARRAY
EFILE ; FILE EXAMS IN V WC AND V EXAM
 D EVWCFILE^APCDTWC1(SS) ; FILE RESULTS IN V WELL CHILD ; REQUIRES THE SELECTION ARRAY
 K ARR
 Q
 ; 
CLEANUP ; EP - CLEANUP
 S NAME="Measure",DIK="^VEN(7.12,"
 F  S NAME=$O(^VEN(7.12,"C",NAME)) Q:NAME'["Measure"  S DA=0 F  S DA=$O(^VEN(7.12,"C",NAME,DA)) Q:'DA  D ^DIK W !,DA
 Q
 ; 
ASQAGE(DFN,VDT) ; EP - GIVEN A DFN, RETURN THE ASQ AGE IN MONTHS
 ; PATCHED BY GIS 1/7/07
 N Y1,Y2,M1,M2,D1,D2,YD,MD,M,DOB
 I '$G(VDT) S VDT=$G(DT) I 'VDT Q ""
 S DOB=$$ASQDOB(DFN,VDT)
A1 S Y1=+$E(DOB,1,3),M1=+$E(DOB,4,5),D1=+$E(DOB,6,7)
 S Y2=+$E(VDT,1,3),M2=+$E(VDT,4,5),D2=+$E(VDT,6,7)
 I M1>M2 S Y2=Y2-1,M2=M2+12
 S YD=Y2-Y1,MD=M2-M1
 I D2<D1 S MD=MD-1
 S M=YD*12+MD
 Q M
 ; 
DOBAGE(DFN,VDT) ; EP - GIVEN A DFN, RETURN THE DOB AGE IN MONTHS
 ; PATCHED BY GIS 1/7/07
 N Y1,Y2,M1,M2,D1,D2,YD,MD,M,DOB
 I '$G(VDT) S VDT=$G(DT) I 'VDT Q ""
 S DOB=$P($G(^DPT(+$G(DFN),0)),U,3)
 I '$G(DOB) Q ""
 G A1
 ; 
ASQDOB(DFN,VDT) ; EP - GIVEN A DFN, RETURN THE ADJUSTED (ASQ) DOB
 ; PATCHED BY GIS 1/7/07
 N DOB,GA,%
 I '$G(VDT) S VDT=$G(DT) I 'VDT Q ""
 S DOB=$P($G(^DPT(+$G(DFN),0)),U,3)
 I '$G(DOB) Q ""
 I $$DOBAGE(DFN,VDT)>24 G A2 ; NO CORRECTIONS FOR PREMIES AFTER CHRONLOGICAL AGE OF 24 MOS!
 S GA=$P($G(^AUPNBMSR(DFN,0)),U,6)
 I GA,GA<40 S %=(40-GA)*7 I % S DOB=$$FMADD^XLFDT(DOB,-%)
A2 I VDT<DOB Q ""
 Q DOB
 ; 
ASQIEN(M) ; EP - GIVEN THE ASQ AGE IN MONTHS, RETURN THE CURRENT ASQ FORM IEN^IEN OF THE NEXT FORM
 N IEN,X,Y,IEN2
 I +$G(M)<3 Q ""
 I M>71 Q ""
 I M>60 S M=60
 S IEN2=""
 S IEN=$O(^VEN(7.14,"B",M,0))
 I IEN S Y=$O(^VEN(7.14,"B",M)) S:Y IEN2=$O(^VEN(7.14,"B",Y,0)) Q IEN_U_IEN2
 S X=M-1,IEN=$O(^VEN(7.14,"B",X,0))
 I IEN S Y=$O(^VEN(7.14,"B",X)) S:Y IEN2=$O(^VEN(7.14,"B",Y,0)) Q IEN_U_IEN2
 S X=M+1,IEN=$O(^VEN(7.14,"B",X,0))
 I IEN S Y=$O(^VEN(7.14,"B",X)) S:Y IEN2=$O(^VEN(7.14,"B",Y,0)) Q IEN_U_IEN2
 S X=$O(^VEN(7.14,"B",M),-1),IEN=$O(^VEN(7.14,"B",X,0))
 I IEN S Y=$O(^VEN(7.14,"B",M)) S:Y IEN2=$O(^VEN(7.14,"B",Y,0)) Q IEN_U_IEN2
 Q ""
 ;