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

AMHRLP3.m

Go to the documentation of this file.
AMHRLP3 ; IHS/CMI/LAB - PROCESS RECORD ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
FLAT ;EP -called from AMHRLP
RECORD ;EP
 S AMHTX=""
RECTYPE S X="A" D TX
DATE S X=$P($P(AMHREC,U),".") I X="" S X="       "
 D TX
DUZ2 S X=$P(^AUTTLOC(DUZ(2),0),U,10) I X=""!($L(X)'=6) S X="      "
 D TX S AMHDUZ2=X
PROG S X=$P(AMHREC,U,2) I X="" S X="X"
 D TX
LOENC S X=$P(AMHREC,U,4) I X="" Q
 S X=$P(^AUTTLOC(X,0),U,10) I X=""!($L(X)'=6) S X="      "
 D TX S AMHLOC=X
COMM S AMHCOM=$P(AMHREC,U,5) I AMHCOM="" S AMHCOM="       " G COMMTX
 S X=$P(^AUTTCOM(AMHCOM,0),U,8) I X="" S X="       "
 I $L(X)'=7 S X="       "
COMMTX D TX
 K AMHTMP,^UTILITY("DIQ1",$J) S DIC="^AUTTCOM(",DR=".11991;.11992",DA=AMHCOM,DIQ="AMHTMP(",DIQ(0)="E" D EN^DIQ1 K DIC,DR,DIQ,^UTILITY("DIQ1",$J)
 S X=$G(AMHTMP(9999999.05,AMHCOM,.11992,"E"))_$G(AMHTMP(9999999.05,AMHCOM,.11991,"E"))_$P(^AUTTCOM(AMHCOM,0),U,7)
 I $L(X)'=7 S X="       "
 D TX
ACT S X=$P(AMHREC,U,6) I X="" Q
 I '$D(^AMHTACT(X)) Q
 S X=$P(^AMHTACT(X,0),U) I X="" Q
 D TX
CONT S X=$P(AMHREC,U,7) I X="" Q
 I '$D(^AMHTSET(X)) Q
 S X=$P(^AMHTSET(X,0),U,2) I X="" Q
 D TX
NS S X=$P(AMHREC,U,9) I 'X S X=0
 S X=$$LZERO(X,3)
 D TX
MIN S X=$P(AMHREC,U,12) I 'X S X=0
 S X=$$LZERO(X,5)
 D TX
DISP ;inpatient disposition
 S X=$P(AMHREC,U,17) S:X X=$P(^AMHTPLT(X,0),U,3) S:X=10 X=0 S:X>9 X="" S X=$$LBLK(X,1) ;GONE TO 2 DIGITS!!  OLD VALUES SENT FOR NOW
 D TX
APWI ;
 S X=$P(AMHREC,U,11) S X=$$LBLK(X,1)
 D TX
INT ;
 S X=$P(AMHREC,U,15) S X=$$LBLK(X,1)
 D TX
PROV ;get providers (1-4) addiii
 I '$D(^AMHRPROV("AD",AMHR)) S X="",X=$$LBLK(X,24) D TX G POVS
 S AMHAFF=$$PPAFFL^AMHUTIL(AMHR,"I")
 S AMHDISC=$$PPCLSC^AMHUTIL(AMHR) I AMHDISC=""!(AMHDISC["?") S AMHDISC="??"
 S AMHINI=$$PPINI^AMHUTIL(AMHR)
 S AMHINI=$$LBLK(AMHINI,3)
PROV1 S X=AMHAFF_AMHDISC_AMHINI D TX
 S AMHRIEN=0,AMHC=1 F  S AMHRIEN=$O(^AMHRPROV("AD",AMHR,AMHRIEN)) Q:AMHRIEN'=+AMHRIEN  I $P(^AMHRPROV(AMHRIEN,0),U,4)'="P" S AMHX=$P(^AMHRPROV(AMHRIEN,0),U) D
 .S AMHAFF=$$PROVAFFL^XBFUNC1(AMHX,"I") I AMHAFF=""!(AMHAFF["?") S AMHAFF=" "
 .S AMHDISC=$$PROVCLSC^XBFUNC1(AMHX) I AMHDISC=""!(AMHDISC["?") S AMHDISC="  "
 .S AMHINI=$$PROVINI^XBFUNC1(AMHX)
 .S AMHINI=$$LBLK(AMHINI,3)
 .S X=AMHAFF_AMHDISC_AMHINI D TX
 .S AMHC=AMHC+1
 .Q
 F I=(AMHC+1):1:4 S X="",X=$$LBLK(X,6) D TX
POVS ;get problems first 4
 I '$D(^AMHRPRO("AD",AMHR)) S X="",X=$$LBLK(X,24) D TX G PATIENT
 S (AMHRIEN,AMHC)=0 F  S AMHRIEN=$O(^AMHRPRO("AD",AMHR,AMHRIEN)) Q:AMHRIEN'=+AMHRIEN  S P=$P(^AMHRPRO(AMHRIEN,0),U),X=$P(^AMHPROB(P,0),U),X=$$LBLK(X,6),AMHC=AMHC+1 D TX
 F I=(AMHC+1):1:4 S X="",X=$$LBLK(X,6) D TX
 K AMHRIEN,P,X
PATIENT ;
 I $P(AMHREC,U,8)="" S X="",X=$$LBLK(X,63) D TX Q
 S AMHPAT=$P(AMHREC,U,8)
 S Y=AMHPAT D ^AUPNPAT
 S AMHNAME=$P(^DPT(AMHPAT,0),U)
CHART ;
 S X=$$ENC^AMHRLU2(AMHPAT)
 D TX
SEX ;
 I AUPNSEX="" S AUPNSEX=" "
 S X=AUPNSEX D TX
DOB ;
 I AUPNDOB="" S AUPNDOB="       "
 S X=AUPNDOB D TX
 I '$D(^AUPNPAT(AMHPAT,11)) S X="          " D TX G MCARE
COMRES ;
 S Y=0,AMHCOM="" F  S Y=$O(^AUPNPAT(AMHPAT,51,Y)) Q:Y'=+Y  S AMHCOM=Y
 I AMHCOM="" S X="       " D TX G TRIBE
 S AMHCOM=$P(^AUPNPAT(AMHPAT,51,AMHCOM,0),U,3) I AMHCOM="" S X="       " D TX G TRIBE
 I '$D(^AUTTCOM(AMHCOM,0)) S X="       " D TX G TRIBE
 I AMHCOM]"" S X=$P(^AUTTCOM(AMHCOM,0),U,8) I X="" S X="       " D TX G TRIBE
 D TX
 ;GET ASUCOMM CODE HERE AND D TX
 K AMHTMP,^UTILITY("DIQ1",$J) S DIC="^AUTTCOM(",DR=".11991;.11992",DA=AMHCOM,DIQ="AMHTMP(",DIQ(0)="E" D EN^DIQ1 K DIC,DR,DIQ,^UTILITY("DIQ1",$J)
 S X=$G(AMHTMP(9999999.05,AMHCOM,.11992,"E"))_$G(AMHTMP(9999999.05,AMHCOM,.11991,"E"))_$P(^AUTTCOM(AMHCOM,0),U,7)
 I $L(X)'=7 S X="       "
 D TX
TRIBE ;
 S X=$P(^AUPNPAT(AMHPAT,11),U,8) I X="" S X="   " D TX G MCARE
 I $P(^AUTTTRI(X,0),U,4)="Y" S X="   " D TX G MCARE
 S X=$P(^AUTTTRI(X,0),U,2) I X="" S X="   " G MCARE
 D TX
MCARE ;
 S X=$$MCR^AMHRLU(AMHPAT,$P($P(AMHREC,U),"."))
 S X=$S(X:"Y",1:"N")
 D TX
MCAID ;
 S X=$$MCD^AMHRLU(AMHPAT,$P($P(AMHREC,U),"."))
 S X=$S(X:"Y",1:"N")
 D TX
PI ;
 S X=$$PI^AMHRLU(AMHPAT,$P($P(AMHREC,U),"."))
 S X=$S(X:"Y",1:"N")
 D TX
 Q
 ;
TX ;
 S AMHTX=AMHTX_X
 Q
 ;
LZERO(V,L) ;left zero fill
 NEW %,I
 S %=$L(V),Z=L-% F I=1:1:Z S V="0"_V
 Q V
LBLK(V,L) ;left blank fill
 NEW %,I
 S %=$L(V),Z=L-% F I=1:1:Z S V=" "_V
 Q V