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

AGFACE.m

Go to the documentation of this file.
AGFACE ; IHS/ASDS/EFG - FACE SHEET ; MAR 19, 2010    
 ;;7.1;PATIENT REGISTRATION;**1,2,4,5,7,9,11**;AUG 25, 2005;Build 1
 ;IHS/OIT/NKD AG*7.1*11 MU2 MULTIPLE RACES
 ;IHS/OIT/NKD AG*7.1*11 MU2 PREFERRED METHOD
 ;
NODFN ;EP - No Pre-Defined Patient Number.
 D PTLK^AG
 Q:'$D(DFN)
 G L1
DFN ;PEP - Pre-Defined Patient Number.
 Q:'$D(DFN)
 D CHKRHI^AG
 I $D(RHIFLAG)&(RHIFLAG="A") W !,$$S^AGVDF("RVN"),$$S^AGVDF("BLN"),"This patient has Restricted Health Information",$$S^AGVDF("BLF"),$$S^AGVDF("RVF")
L1 K AG Q:'$D(DFN)  D ^AGDATCK I AG("DTOT")>0 D ^AGBADATA
 I AGOPT(24)="Y" D PRINTVS
DEV ;
 ;S XBNS="AG;DFN",XBRP="START^AGFACE" D ^XBDBQUE
 ;IM22794 ERROR DURING ALPHA TESTING. NOT REPORTED BY SITE
 S %ZIS="QA"
 D ^%ZIS
 G:POP NODFN
 I $G(IO("Q")) D QUE D HOME^%ZIS Q
 U IO
 D START
 D ^%ZISC
 D HOME^%ZIS
 Q
START ;PEP - From TaskMan.
 Q:'$G(DFN)  ;IHS/SD/TPF AG*7.1*1 REPORTED BY FDIH CALL FROM CIA REMOTE
 ;PROCEDURE HAD DFN=0 IM18987
 Q:'$G(DUZ(2))
 D ^AGVAR,LINES^AG,NOW^AG S AG("LOC")=$P($G(^DIC(4,DUZ(2),0)),U)
 S AG("PAGE")=0 D HDR
 S DIC=9000001,DR=.02 D ^AGDICLK W "COMPUTER FILE EST: " W:$D(AG("LKPRINT")) AG("LKPRINT") S AG=$P($G(^AUPNPAT(DFN,0)),U,11) I AG,$D(^VA(200,AG,0)) W "(",$P(^(0),U,2),")"
 S DR=.03,AGLAST="LAST EDIT: " D ^AGDICLK
 S:$D(AG("LKPRINT")) AGLAST=AGLAST_AG("LKPRINT") S AG=$P($G(^AUPNPAT(DFN,0)),U,12) I AG,$D(^VA(200,AG,0)) S AGLAST=AGLAST_" ("_$P(^(0),U,2)_")"
 W ?78-$L(AGLAST),AGLAST,!,AG("-")
ALIAS ;OTHER NAMES
 I $O(^DPT(DFN,.01,0)) D
 .W !,"OTHER NAME(S):"
 .N I S I=0 F  S I=$O(^DPT(DFN,.01,I)) Q:'I  D
 ..W ?16,$P(^DPT(DFN,.01,I,0),"^",1),!
 E  W !
 S DR=.09,DIC=2 D ^AGDICLK
 ;I $D(AG("LKPRINT")) W "SSN: ",AG("LKPRINT") D
 ;I $$GET1^DIQ(2,DFN_",",1107.3)'="" W "SSN: ",$$GET1^DIQ(9000001,DFN_",",1107.3) D  ;IHS/SD/TPF AG*7.1*4
 I $$GET1^DIQ(9000001,DFN_",",1107.3)'="" W "SSN: ",$$GET1^DIQ(9000001,DFN_",",1107.3) D  ;IHS/SD/TPF AG*7.1*5
 .I $P(^AUPNPAT(DA,0),U,23) W ?40,"SSN STATUS: ",$P(^AUTTSSN($P(^(0),U,23),0),U,2)
 .E  W ?40,"SSN STATUS UNKNOWN"
 W !,"CLASS: " S DR=1111,DIC=9000001 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT")
 W ?62,"SEX: " S DR=.02,DIC=2 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT")
 W !,"COMMUNITY: " S DR=1118,DIC=9000001 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") I AGOPT(14)="Y",$D(^AUPNPAT(DFN,11)) W " (",$S($P(^(11),U,21)="Y":"Verified",1:"Unverified"),")"
 W ?57,"BIRTHDAY: " S DR=.03,DIC=2 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT")
 W !?3,"COUNTY: " S DIC=9000001.51,DR=.03,AG("DRENT")=0 D ^AGDICLK I '$D(AG("LKERR")),AG("LKDATA")]"",$D(^AUTTCOM(AG("LKDATA"),0)) S AG=$P(^(0),U,2) I AG,$D(^AUTTCTY(AG,0)) W $P(^(0),U)
 W ?62,"AGE: " S DR=1102.98,DIC=9000001 D ^AGDICLK I '$D(AG("LKERR")),$D(AG("LKPRINT")),+AG("LKPRINT") W AG("LKPRINT")
 ;W !,"HOME ADDRESS:" S DR=.111,DIC=2 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" W !?5,AG("LKPRINT")
 W !,"CURRENT ADDRESS:" S DR=.111,DIC=2 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" W !?5,AG("LKPRINT")  ;AG*7.1*4
 F DR=.112,.113 S DIC=2 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" W !?5,AG("LKPRINT")  ;AG*7.1*7
 ;W:$$GET1^DIQ(2,DFN_",",.112,"E")'="" !?5,$$GET1^DIQ(2,DFN_",",.112,"E")  ;IHS/SD/TPF FOR FOREST COUNTY H5297 NOT APPROVED BY TAG
 S AG="",DR=.114 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AG=AG_AG("LKPRINT")_","
 F DR=.115,.116 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AG=AG_" "_AG("LKPRINT")
 W:AG]"" !?5,AG
 W !,"PHONE NUMBERS ---"
 W !,"HOME: " S DR=.131 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") W ?27,"WORK: " S DR=.132 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") W !,"OTHER PHONE: " S DR=1801 W $$GET1^DIQ(9000001,DFN,DR)
 W !
 I $$GET1^DIQ(9009061,DUZ(2)_",",503,"I") D   ;AG*7.1*9 - Added conditional display of RACE
 .;IHS/OIT/NKD AG*7.1*11 MU2 - CHANGED DISPLAY TO USE MULTIPLE FIELD
 .;W $$GET1^DID(2,.06,"","LABEL"),": ",$E($$GET1^DIQ(2,DFN,.06),1,38) ;AG*7.1*7 - Truncated field length
 .N AGRACE S AGRACE=$$RACE^AGUTL(DFN)
 .W "RACE: "_$S(+AGRACE>1:"MULTIPLE RACES SPECIFIED",1:$E($P(AGRACE,"^",2),1,38))
 ;BEGIN NEW CODE AG*7.1*2 ETHNICITY
 I $$GET1^DIQ(9009061,DUZ(2)_",",501,"I") D
 .S ETHNIC=$O(^DPT(DFN,.06,0))
 .I ETHNIC S ETHNIC=$$GET1^DIQ(10.2,ETHNIC,.01)
 .W ?46,"ETHNICITY: ",$G(ETHNIC)
 ;END NEW CODE
 ;IHS/OIT/NKD AG*7.1*11 MU2 - RESTRICT PREFERRED LANGUAGE TO 25 CHARS AND SHIFT PREFERRED METHOD OVER
 ;W !,"PREFERRED LANGUAGE: ",$P($P($$CLANG^AGED10B(DFN),U,4),":",2),?52,"PREFERRED METHOD: ",$$GET1^DIQ(9000001,DFN,4002) ;AG*7.1*9 - Added Preferred Method
 W !,"PREFERRED LANGUAGE: ",$E($P($P($$CLANG^AGED10B(DFN),U,4),":",2),1,25),?47,"PREFERRED METHOD: ",$$GET1^DIQ(9000001,DFN,4002)
 ;NEW CODE FOR EMAIL ADDRESSES AG*7.1*4
 W:$$GET1^DIQ(9000001,DFN_",",1802)'="" !,"CURRENT EMAIL ADDRESS: ",$$GET1^DIQ(9000001,DFN_",",1802)
 ;END NEW CODE FOR EMAIL ADDRESS
 I AGOPT(23)="Y" W !,$$GET1^DID(9000001,.35,"","LABEL"),": ",$$GET1^DIQ(9000001,DFN,.35)
 I AGOPT(23)="Y" W ?30,$$GET1^DID(9000001,.36,"","LABEL"),": ",$$GET1^DIQ(9000001,DFN,.36)," /  ",$$GET1^DIQ(9000001,DFN_",",8701,"E")
 I '$D(^AUPNNPP("B",DFN)) W !,AG("-"),!,"*** NO NOTICE OF PRIVACY PRACTICES DATA ON THIS PATIENT ***"
 I $D(^AUPNNPP("B",DFN))  D
 .W !,AG("-"),!
 .W "NOTICE OF PRIVACY PRACTICES REC'D BY PATIENT :" W ?47,$$GET1^DIQ(9000038,DFN,.02)
 .W ?54,"DATE :",?61,$$GET1^DIQ(9000038,DFN,.03)
 .W !,"ACKNOWLEDGEMENT OF RECEIPT OF NPP SIGNED :"
 .W ?43,$$GET1^DIQ(9000038,DFN,.04)
 .I $$GET1^DIQ(9000038,DFN,.05)'=""  D
 ..W !,"REASON :"
 ..W ?11,$E($$GET1^DIQ(9000038,DFN,.05),1,60)
 ..I $L($$GET1^DIQ(9000038,DFN,.05))>60 W ! W ?11,$E($$GET1^DIQ(9000038,DFN,.05),61,80)
 W !,AG("-"),!,"TRIBE: " S DR=1108,DIC=9000001 D ^AGDICLK I $D(AG("LKPRINT")),AG("LKPRINT")]"" W AG("LKPRINT") I AGOPT(14)="Y",$D(^AUPNPAT(DFN,11)) W " (",$S($P(^(11),U,19)="Y":"Verified",1:"Unverified"),")"
 W ?50,"INDIAN QUANTUM: " S DR=1110 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT")
 K AGQUIT
 N I F I=1,4,5,6,7,9,11 D  Q:$D(AGQUIT)
 .I $D(AGQUIT) Q
 .I $Y+6>IOSL D HDR
 .I $D(AGQUIT) Q
 .D @("^AGFACE"_I)
 I $D(AGQUIT) K AGQUIT Q
 ;Write line of "-", Confidential Pat Info, If CPU do end of page
END ;
 I $G(AG("VS"))=1 W !,AG("-"),!! F I=0:0 S I=$O(^AGFAC(DUZ(2),4,I)) Q:'I  W ^(I,0),!
 D CPI^AG G END2:$D(AGVQQFS) D RTRN^AG W $$S^AGVDF("IOF")
END1 D ^%ZISC
END2 ;
 K AG,AGIO,AGTIME,G,AGL,AGLAST,AG("LKERR"),AG("LKDATA"),AG("LKPRINT"),AGPCC,X,Y,Z
 D:$D(ZTQUEUED) KILL^%ZTLOAD
 Q
HDR ;EP - FACE SHEET HEADER
 ;S AG("PAGE")=AG("PAGE")+1
 S AG("PAGE")=$G(AG("PAGE"))+1  ;IHS/SD/TPF 12/15/2005 AG*7.1*1
 I AG("PAGE")>1 Q:$D(AGVQQFS)  D RTRN^AG I 'Y S AGQUIT="" D END1 Q
 W:AG("PAGE")>1 $$S^AGVDF("IOF")
 D CPI^AG
 W !?40-($L(AG("LOC"))\2),AG("LOC"),!?26,"AMBULATORY CARE RECORD BRIEF",!?25,"------------------------------",!,AGTIME,?70,"Page: ",AG("PAGE"),!,AG("="),!
 I '$D(RHIFLAG) W "PATIENT: " S DIC=2,DA=DFN,DR=.01 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") I $D(^DPT(DFN,"VET")),^("VET")="Y" W " (VETERAN)"
 I $D(RHIFLAG)  D
 . I RHIFLAG="A" W "PATIENT: " S DIC=2,DA=DFN,DR=.01 D ^AGDICLK W:$D(AG("LKPRINT")) $$S^AGVDF("RVN"),AG("LKPRINT"),$$S^AGVDF("BLN")," (RHI)",$$S^AGVDF("BLF"),$$S^AGVDF("RVF")
 . E  W "PATIENT: " S DIC=2,DA=DFN,DR=.01 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") I $D(^DPT(DFN,"VET")),^("VET")="Y" W " (VETERAN)"
 W ?59,"CHART #: " W:$D(^AUPNPAT(DFN,41,DUZ(2),0)) $P(^(0),U,2) W !,AG("="),!
 Q
QUE ;QUE TO TASKMAN
 K IO("Q")
 S ZTRTN="START^AGFACE",ZTDESC="FACE SHEET for "_$P(^DPT(DFN,0),U)_"."
 S ZTSAVE("DFN")=""
 K ZTSK D ^%ZTLOAD
 I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
 E  W !!?5,"Task # ",ZTSK," queued.",!
 H 3
 Q
PRINTVS ;PRINT VALIDATION STATEMENT
 K DIR,AG("VS")
 S DIR(0)="Y"
 S DIR("A")="Print VALIDATION STATEMENT on form ?"
 S DIR("B")="NO"
 D ^DIR S AG("VS")=Y
 K DIR
 Q