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

APCHS1C.m

Go to the documentation of this file.
APCHS1C ; IHS/CMI/LAB - PART 1A OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS PCC SUITE;**2,5,11**;MAY 14, 2009;Build 58
 ;
 ;
BDEMOG ; ******************** BRIEF DEMOGRAPHICS - W/ADV DIRECTIVES ********************
 ; <SETUP>
 S APCHSN=^DPT(APCHSPAT,0)
 S APCHSNAM=$P(APCHSN,U,1)
 S Y=$P(APCHSN,U,3)
 I 'Y S APCHSDOB="<no date of birth recorded>"
 E  X ^DD("DD") S APCHSDOB=Y
 S APCHSADR=""
 I $D(^DPT(APCHSPAT,.11)) S APCHSN=^(.11) F APCHSI=1:1:6 S APCHSP=$P(APCHSN,U,APCHSI) I APCHSP]"" S:APCHSI=5 APCHSP=$P(^DIC(5,APCHSP,0),U,2) S APCHSADR=APCHSADR_","_APCHSP
 I $D(^DPT(APCHSPAT,.13)) S APCHHPH=$P($G(^DPT(APCHSPAT,.13)),U),APCHWPH=$P($G(^DPT(APCHSPAT,.13)),U,2)  ;IHS/CMI/GRL 
 S APCHSADR=$E(APCHSADR,2,255)
BDEMDSP ; <DISPLAY>
 X APCHSBRK
 I $$DOD^AUPNPAT(APCHSPAT)]""!($$VAL^XBDIQ1(9000001,APCHSPAT,1114)]"") D
 .W "*** DOD: ",$$VAL^XBDIQ1(2,APCHSPAT,.351),!
 .W "*** CAUSE OF DEATH: " I $$VAL^XBDIQ1(9000001,APCHSPAT,1114)]"" D  I 1
 ..W $$VAL^XBDIQ1(9000001,APCHSPAT,1114)
 ..K APCHSDSC
 ..S APCHSDSC=$$ICDD^ICDEX($$VAL^XBDIQ1(9000001,APCHSPAT,1114),"APCHSDSC",$$DOD^AUPNPAT(APCHSPAT)) I $P(APCHSDSC,U)=-1 S APCHSDSC(1)=$P($$ICDDX^ICDEX($P(^AUPNPAT(APCHSPAT,11),U,14),$$DOD^AUPNPAT(APCHSPAT)),U,4)
 ..K ^UTILITY($J,"W")
 ..S APCHSX=0
 ..S DIWL=0,DIWR=45 F  S APCHSX=$O(APCHSDSC(APCHSX)) Q:APCHSX'=+APCHSX!($D(APCHSQIT))  D
 ...S X=APCHSDSC(APCHSX)
 ...Q:X="CODE TEXT MAY BE INACCURATE"
 ...Q:X=" "
 ...D ^DIWP
 ..S APCHSZ=0 F  S APCHSZ=$O(^UTILITY($J,"W",DIWL,APCHSZ)) Q:APCHSZ'=+APCHSZ  D
 ...X APCHSCKP Q:$D(APCHSQIT)
 ...W ?28,^UTILITY($J,"W",DIWL,APCHSZ,0),!
 .E  W !
 K ^UTILITY($J,"W"),APCHSDSC,DIWL,APCHSX,APCHSZ,DIWL,DIWR
 Q:$D(APCHSQIT)
 W !,APCHSNAM,"  ",$$VAL^XBDIQ1(2,APCHSPAT,.02)," DOB: ",APCHSDOB," AGE: ",$$AGE^AUPNPAT(APCHSPAT,DT),"  SSN: ",$$SSN^APCHS1(APCHSPAT),!
 W "TRIBE: ",$$VAL^XBDIQ1(9000001,DFN,1108),"        ",$$VAL^XBDIQ1(9000001,DFN,1112),!
 I $D(DUZ(2)),DUZ(2),$D(^AUPNPAT(APCHSPAT,41,DUZ(2))) S APCHSFP=DUZ(2),APCHSFAC=$P(^AUPNPAT(APCHSPAT,41,APCHSFP,0),U,2) W $P(^DIC(4,APCHSFP,0),U,1)," HEALTH RECORD NUMBER: ",APCHSFAC,!
 W:APCHSADR]"" APCHSADR,!
 W "Home Phone: ",$S($G(APCHHPH)]"":APCHHPH,1:"None")_"     "_"Work Phone: ",$S($G(APCHWPH)]"":APCHWPH,1:"None"),! ;IHS/CMI/GRL
 S APCHPLNG=$$PREFLANG^APCLAPI7(APCHSPAT,DT,"E")
 I APCHPLNG]"" W "Preferred Language: ",APCHPLNG,!
 I $P($G(^AUPNPAT(APCHSPAT,40)),U,2)]"" W !,"Preferred Method of Receiving Reminders: ",$$VAL^XBDIQ1(9000001,APCHSPAT,4002),!
 ;ADVANCE DIRECTIVES
 I $D(^AUPNADVD(APCHSPAT,0)) D
 .X APCHSCKP Q:$D(APCHSQIT)
 .W "Advance Directives: "
 .S APCHSI=0 F  S APCHSI=$O(^AUPNADVD(APCHSPAT,11,"B",APCHSI)) Q:APCHSI=""  S APCHSN=0 F  S APCHSN=$O(^AUPNADVD(APCHSPAT,11,"B",APCHSI,APCHSN)) Q:APCHSN=""  S APCHSP=APCHSN
 .S APCHIEN=APCHSP_","_APCHSPAT_"," W ?20,$$GET1^DIQ(9000040.11,APCHIEN,.02),"   ",$$GET1^DIQ(9000040.11,APCHIEN,.03),"   Updated: ",$$GET1^DIQ(9000040.11,APCHIEN,.01),!
 I '$D(^AUPNADVD(APCHSPAT,0)) W "Advance Directives:  No information on file.",!
 X APCHSCKP Q:$D(APCHSQIT)
 W "Last Registration Update: ",$$VAL^XBDIQ1(9000001,APCHSPAT,.03),!
 ; <CLEANUP>
BDEMOGX K APCHSN,APCHSFP,APCHSFAC,APCHSNAM,APCHSDOB,APCHSADR,APCHSP,APCHSI,APCHIEN
 K APCHHPH,APCHWPH
 Q
 ;
HOMELOC ; ******************** LOCATION OF HOME ********************
 ; <SETUP>
 Q:'$O(^AUPNPAT(APCHSPAT,12,0))
 X APCHSBRK
 ; <DISPLAY>
 F APCHSI=0:0 S APCHSI=$O(^AUPNPAT(APCHSPAT,12,APCHSI)) Q:'APCHSI  X APCHSCKP Q:$D(APCHSQIT)  W ^AUPNPAT(APCHSPAT,12,APCHSI,0),!
 ; <CLEANUP>
HOMELOCX K APCHSI
 Q