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

APCDHIST.m

Go to the documentation of this file.
APCDHIST ; IHS/CMI/LAB - DISPLAY HIST. DATA ;
 ;;2.0;IHS PCC SUITE;**7,11**;MAY 14, 2009;Build 58
 ;
DATE S APCDTCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$E(Y,6,7)_""/""_(1700+$E(Y,1,3))" K Y
 Q
FMH ; ******************** FAMILY HISTORY * 9000014 *******
 D DATE
 S APCDTICF="S"
 ; <SETUP>
 I '$D(^AUPNFH("AC",APCDPAT)) W !!,"******************* NO FAMILY HISTORY ON FILE **********************" Q
 W !!,"****************** FAMILY HISTORY ******************",!!
 ; <DISPLAY>
 S APCDTDFN="" F APCDTQ=0:0 S APCDTDFN=$O(^AUPNFH("AC",APCDPAT,APCDTDFN)) Q:APCDTDFN=""  D FHDSP
 ; <CLEANUP>
FMHX K APCDTDFN,APCDTN,APCDTICD,APCDTDAT,APCDTNRQ,APCDTICL,APCDTNQ,APCDTICF,APCDTCVD,APCDTQ,Y
 Q
FHDSP S APCDTN=^AUPNFH(APCDTDFN,0)
 S APCDTICD=$P(APCDTN,U) D GETICDDX
 S Y=$P(APCDTN,U,3) X APCDTCVD S APCDTDAT=Y
 S APCDTNRQ=$$VAL^XBDIQ1(9000014,APCDTDFN,.04)
 D GETNARR
 W APCDTDAT S APCDTICL=12
 NEW X,R,S,A,P
 S (X,R,S,N,A,P)=""
 S R=$$VAL^XBDIQ1(9000014,APCDTDFN,.07)
 S N=$$VAL^XBDIQ1(9000014,APCDTDFN,.04)_" ("_$$VAL^XBDIQ1(9000014,APCDTDFN,.01)_")"
 S A=$P(^AUPNFH(APCDTDFN,0),U,5)
 S S=$$VAL^XBDIQ1(9000014,APCDTDFN,.06)
 S P=$$VAL^XBDIQ1(9000014,APCDTDFN,.08)
 S X=R
 I X]"" S X=X_"; "
 S X=X_N
 S X=X_$S(A]"":"; Age at Onset: "_A,1:"; Age at Onset: None")
 S X=X_$S(S]"":"; Status: "_S,1:"; Status: None")
 S X=X_$S(P]"":"; Documented By: "_P,1:"")
 S APCDTICL=12,APCDTNRQ=X,APCDTICD=""
 D PRTICD
 Q
 ;
PMH ; ******************** PERSONAL HISTORY * 9000013 *******
 ; <SETUP>
 D DATE
 S APCDTICF="S"
 ; <SETUP>
 I '$D(^AUPNPH("AC",APCDPAT)) W !!,"******************* NO PERSONAL HISTORY ON FILE **********************" Q
 ; <DISPLAY>
 W !!,"********************** PERSONAL HISTORY ********************",!!
 S APCDTDFN="" F APCDTQ=0:0 S APCDTDFN=$O(^AUPNPH("AC",APCDPAT,APCDTDFN)) Q:APCDTDFN=""  D PHDSP
 ; <CLEANUP>
PMHX K APCDTDFN,APCDTN,APCDTICD,APCDTICL,APCDTNRQ,APCDTDAT,APCDTDTH,APCDTICF,APCDTQ,APCDTCVD,Y
 Q
PHDSP S APCDTN=^AUPNPH(APCDTDFN,0)
 S APCDTICD=$P(APCDTN,U) D GETICDDX
 S Y=$P(APCDTN,U,3) X APCDTCVD S APCDTDAT=Y
 S APCDTDTH=$P(APCDTN,U,5) I APCDTDTH]"" S Y=APCDTDTH X APCDTCVD S APCDTDTH=Y
 S APCDTNRQ=$P(APCDTN,U,4)
 D GETNARR
 I APCDTDTH]"" S:APCDTNRQ]"" APCDTNRQ=APCDTNRQ_" " S APCDTNRQ=APCDTNRQ_"(onset "_APCDTDTH_")"
 W APCDTDAT,?12,$$VAL^XBDIQ1(9000013,APCDTDFN,.01) S APCDTICL=22 D PRTICD
 Q
 ;
GETICDDX ;
 S:APCDTICF="S" APCDTICD=$P($$ICDDX^ICDEX(APCDTICD,$P(APCDTN,U,3)),U,4)
 Q
GETICDOP ;
 S:APCDTICF="S" APCDTICD=$P($$ICDOP^ICDEX(APCDTICD,$P(APCDTN,U,3),,"I"),U,5)
 Q
 ;
PRTICD ;
 S:APCDTNRQ="" APCDTNRQ="<no narrative provided>" S APCDTICD=""
 S APCDTTXT=APCDTICD D PRTTXT
 Q
 ;
PRTTXT ; GENERALIZED TEXT PRINTER
 S APCDTDLT=1,APCDTILN=80-APCDTICL-1
 F APCDTQ=0:0 S:APCDTNRQ]""&(($L(APCDTNRQ)+$L(APCDTTXT)+2)<255) APCDTTXT=$S(APCDTTXT]"":APCDTTXT_"; ",1:"")_APCDTNRQ,APCDTNRQ="" Q:APCDTTXT=""  D PRTTXT2
 K APCDTILN,APCDTDLT,APCDTF,APCDTC,APCDTTXT
 Q
PRTTXT2 D GETFRAG W ?APCDTICL W APCDTF,! S APCDTICL=APCDTICL+APCDTDLT,APCDTILN=APCDTILN-APCDTDLT,APCDTDLT=0
 Q
GETFRAG I $L(APCDTTXT)<APCDTILN S APCDTF=APCDTTXT,APCDTTXT="" Q
 F APCDTC=APCDTILN:-1:1 Q:$E(APCDTTXT,APCDTC)=" "
 S APCDTF=$E(APCDTTXT,1,APCDTC-1),APCDTTXT=$E(APCDTTXT,APCDTC+1,255)
 Q
 ;
GETNARR ;
 ;I APCDTNRQ]"" S APCDTNRQ=$S($D(^AUTNPOV(APCDTNRQ)):$P(^AUTNPOV(APCDTNRQ,0),U),1:"***** "_APCDTNRQ_" *****")
 ;E  S APCDTNRQ=""
 Q
 ;
GETSITEV ;
 S %=^AUPNVSIT(APCDTVDF,0),APCDTVSC=$P(%,U,7),APCDTITE=$P(%,U,6)
GETSITE ;
 S:APCDTITE="" APCDTITE="null"
 S %=$G(^AUTTLOC(APCDTITE,0))
 S APCDTNFL=$P(%,U),APCDTNFL=$S($D(^DIC(4,APCDTITE,0)):$P(^(0),U),1:"<"_APCDTITE_">")
 S APCDTNSH=$P(%,U,2) I APCDTNSH="" S APCDTNSH="<"_APCDTITE_">"
 S APCDTNAB=$J($P(%,U,7),4) I APCDTNAB="" S APCDTNAB="<"_APCDTITE_">"
 Q
REF ;EP - called from [APCD REF] template to 
 ;display currently documented refusals
 Q:'$D(^AUPNPREF("AC",APCDPAT))
 K APCDREF
 NEW APCDX,A,B,C,D S APCDX=0 F  S APCDX=$O(^AUPNPREF("AC",APCDPAT,APCDX)) Q:APCDX'=+APCDX  D
 .S A=$P(^AUPNPREF(APCDX,0),U),B=$P(^AUPNPREF(APCDX,0),U,4),D=$P(^AUPNPREF(APCDX,0),U,3)
 .Q:B=""
 .Q:A=""
 .Q:D=""
 .S D=9999999-D,APCDREF(A,B,9999999-D)=APCDX
 .Q
 W !!,"Last of each service type documented in PCC for "_$P(^DPT(APCDPAT,0),U)_":",!
 S A="" F  S A=$O(APCDREF(A)) Q:A'=+A  S B="" F  S B=$O(APCDREF(A,B)) Q:B=""  D
 .S D=$O(APCDREF(A,B,0))
 .S APCDX=APCDREF(A,B,D)
 .W !?2,$E($$VAL^XBDIQ1(9000022,APCDX,.01),1,15),?19,$$VAL^XBDIQ1(9000022,APCDX,.04),?62,$$VAL^XBDIQ1(9000022,APCDX,.03)
 .W !?5,"Service Type:  ",$$VAL^XBDIQ1(9000022,APCDX,.07)
 .Q
 W !
 Q
IMMCPT ;EP - called from APCD CPT templates
 NEW X
 ; S X=$P(^ICPT(APCDCPTP,0),U)
 S X=$P($$CPT^ICPTCOD(APCDCPTP),U,2)
 I +X<90471 Q
 I +X>90749 Q
 W !!,"REMINDER:  You have entered a CPT code for an immunization.  Please check the",!,"immunizations listed below and make sure the immunization has been entered using",!,"the IM mnemonic as well as with the CPT mnemonic."
 I '$O(^AUPNVIMM("AD",APCDVSIT,0)) W !,"There are no immunizations entered via the IM mnemonic.",! Q
 NEW Y S X=0 F  S X=$O(^AUPNVIMM("AD",APCDVSIT,X)) Q:X'=+X  D
 .W !?5,$P(^AUTTIMM($P(^AUPNVIMM(X,0),U),0),U),?40,"code: ",$P(^AUTTIMM($P(^AUPNVIMM(X,0),U),0),U,3)
 .Q
 W !
 Q