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

AMHPOST.m

Go to the documentation of this file.
AMHPOST ; IHS/CMI/LAB - POST INIT BH ;  
 ;;3.0;IHS BEHAVIORAL HEALTH;;JAN 27, 2003
 ;re-index all cross references on Designated provider fields
 ;
ENV ;EP 
 I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
 Q
 ;
PRE ;
 ;REMOVE IDENTIFIER NODES FOR FILEMAN 22
 K ^DD(9002011.01,0,"ID")
 K ^DD(9002011.02,0,"ID")
 K ^DD(9002011.03,0,"ID")
 K ^DD(9002011.04,0,"ID")
 K ^DD(9002011.05,0,"ID")
 S DIK="^DD(9002012.2,",DA=.04,DA(1)=9002012.2 D ^DIK
 D ^AMHPREI
 D ^AMHPREI1
 D ^AMHPREI2
 F DA=1:1:200 S DIK="^AMHSORT(" D ^DIK
 S DA=$O(^AMHTSET("B","TELE-MENTAL HEALTH",0))
 I DA S DIE="^AMHTSET(",DR=".02///15" D ^DIE K DA,DIE,DR
 S DA=$O(^AMHTSET("B","RESIDENTIAL/DAY PROGRAM",0))
 I DA S DIE="^AMHTSET(",DR=".01///RESIDENTIAL" D ^DIE
 S DA=$O(^AMHTSET("B","OUTPATIENT CLINIC",0))
 I DA S DIE="^AMHTSET(",DR=".01///OUTPATIENT" D ^DIE
 S DA=$O(^DIC(19,"B","AMH DE ACT RECORD LOG",0)) I DA S DIK="^DIC(19," D ^DIK
 S DA=$O(^DIC(19,"B","AMH E ADD CASE TRACKING",0)) I DA S DIK="^DIC(19," D ^DIK
 S DA=$O(^DIC(19,"B","AMH DE PATIENT RELATED",0)) I DA S DIK="^DIC(19," D ^DIK
 S DA=$O(^DIC(19,"B","AMH P TABLES TOC",0)) I DA S DIK="^DIC(19," D ^DIK
 S DA=$O(^DIC(19,"B","AMH ENTER DNKA",0)) I DA S DIK="^DIC(19," D ^DIK
 Q
POST ;EP
 S DIK="^AMHRCDST(",DIK(1)=".02^AC" D ENALL^DIK
 S DIK="^AMHPROB(",DIK(1)=".03^AC" D ENALL^DIK ;reindex problem ac index
 K ^DD(9002012.2,.05,9)
PROB ;add problems, fix problems
 G COM
P1 ;
 I $D(^AMHPROB("B","302.85")) W !,"Code 302.85 already exists." G P2
 S DIC="^AMHPROB(",X="302.85",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///GENDER IDENTITY DISORDER OF ADOLESCENT OR ADULT;.03///20;.05///302.85;.06///I" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"302.85 failed"
 D ^XBFMK K DIADD,DLAYGO
P2 ;
 I $D(^AMHPROB("B","50")) W !,"Code 50 already exists." G P3
 S DIC="^AMHPROB(",X="50",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///TRAUMATIC BEREAVEMENT;.03///50;.05///V62.82;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"50 failed"
 D ^XBFMK K DIADD,DLAYGO
P3 ;
 I $D(^AMHPROB("B","49.9")) W !,"Code 49.9 already exists." G P4
 S DIC="^AMHPROB(",X="49.9",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///EXPLOITATION;.03///49.9;.05///V61.29" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"49.9 failed"
 D ^XBFMK K DIADD,DLAYGO
P4 ;
 I $D(^AMHPROB("B","47.1")) W !,"Code 47.1 already exists." G P5
 S DIC="^AMHPROB(",X="47.1",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///CHILD NEGLECT (SUSPECTED), PHYSICAL;.03///47.1;.05///995.59;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"47.1 failed"
 D ^XBFMK K DIADD,DLAYGO
P5 ;
 I $D(^AMHPROB("B","47.2")) W !,"Code 47.2 already exists." G P6
 S DIC="^AMHPROB(",X="47.2",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///CHILD NEGLECT (SUSPECTED), MENTAL;.03///47.2;.05///995.51;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"47.2 failed"
 D ^XBFMK K DIADD,DLAYGO
P6 ;
 I $D(^AMHPROB("B","48.1")) W !,"Code 48.1 already exists." G P7
 S DIC="^AMHPROB(",X="48.1",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///ADULT NEGLECT (SUSPECTED), PHYSICAL;.03///48.1;.05///995.81;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"48.1 failed"
 D ^XBFMK K DIADD,DLAYGO
P7 ;
 I $D(^AMHPROB("B","48.2")) W !,"Code 48.2 already exists." G P8
 S DIC="^AMHPROB(",X="48.2",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///ADULT NEGLECT (SUSPECTED), MENTAL;.03///48.2;.05///995.82;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"48.2 failed"
 D ^XBFMK K DIADD,DLAYGO
P8 ;
 I $D(^AMHPROB("B","49.1")) W !,"Code 49.1 already exists." G P9
 S DIC="^AMHPROB(",X="49.1",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///PARTNER NEGLECT (SUSPECTED), PHYSICAL;.03///49.1;.05///995.81;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"49.1 failed"
 D ^XBFMK K DIADD,DLAYGO
P9 ;
 I $D(^AMHPROB("B","49.2")) W !,"Code 49.2 already exists." G P10
 S DIC="^AMHPROB(",X="49.2",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///PARTNER NEGLECT (SUSPECTED), MENTAL;.03///49.2;.05///995.82;.08///1" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"49.2 failed"
 D ^XBFMK K DIADD,DLAYGO
P10 ;
 I $D(^AMHPROB("B","312.39")) W !,"Code 312.39 already exists." G P11
 S DIC="^AMHPROB(",X="312.39",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///IMPULSE CONTROL DIS NED;.03///26;.05///312.39;.06///I" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"312.39 failed"
 D ^XBFMK K DIADD,DLAYGO
P11 ;
 I $D(^AMHPROB("B","8.3")) W !,"Code 8.3 already exists." G FICD
 S DIC="^AMHPROB(",X="8.3",DIC(0)="L",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".02///DID NOT WAIT TO BE SEEN;.03///8.3;.05///V15.81" K DD,DO,D0 D FILE^DICN
 I Y=-1 W !,"312.39 failed"
 D ^XBFMK K DIADD,DLAYGO
FICD ;
 S $P(^AMHPROB(492,0),U,5)=312.81
 S $P(^AMHPROB(476,0),U,5)=312.82
 S $P(^AMHPROB(477,0),U,5)=312.89
 F AMHX=1:1 S AMHY=$T(ICDC+AMHX) Q:$P(AMHY,";;",2)=""  D
 .S D=$P(AMHY,";;",2),I=$P(AMHY,";;",3)
 .S DA=$O(^AMHPROB("B",D,0))
 .I 'DA W !!,"Updating ICD code for ",D," failed." Q
 .S P=$O(^ICD9("AB",I,0)) I 'P W !,"Couldn't find ICD pointer value. ",D," ",I Q
 .S DIE="^AMHPROB(",DR=".05///"_I D ^DIE
 .W AMHY,!
 .I $D(Y) W !,"Updating ICD code for ",D," failed die." Q
 .K DIE,DA,DR
 .Q
COM ;
 NEW AMHX S AMHX=0 F  S AMHX=$O(^AMHPATR(AMHX)) Q:AMHX'=+AMHX  K ^AMHPATR(AMHX,31) W "."
 S DIK="^AMHPATR(" D IXALL^DIK  ;re index desg prov cross references
 ;move comment
 S X=0 F  S X=$O(^AMHREC(X)) Q:X'=+X  D
 .Q:'$D(^AMHREC(X,0))
 .I $P(^AMHREC(X,0),U,17)=0 S $P(^AMHREC(X,0),U,17)=10
 .Q:'$D(^AMHREC(X,12))
 .S Y=^AMHREC(X,12)
 .Q:Y=""
 .Q:$D(^AMHREC(X,81,0))
 .S ^AMHREC(X,81,0)="^^1^1^"_$P($P(^AMHREC(X,0),U),".")_"^"
 .S ^AMHREC(X,81,1,0)=Y
 .K ^AMHREC(X,12)
 .Q
INTAKE ;convert intake documents
 S AMHX=0 F  S AMHX=$O(^AMHPINTK(AMHX)) Q:AMHX'=+AMHX  D
 .Q:$D(^AMHPINTK(AMHX,41))  ;already has open field
 .S AMHC=0
 .F AMHF=1100:100:2800 I $D(^DD(9002011.07,AMHF)),$O(^AMHPINTK(AMHX,$E(AMHF,1,2),0)) S AMHFN=$P(^DD(9002011.07,AMHF,0),U) D
 ..S AMHC=AMHC+1,^AMHPINTK(AMHX,41,AMHC,0)=AMHFN,AMHC=AMHC+1,^AMHPINTK(AMHX,41,AMHC,0)=""
 ..S AMHV=0 F  S AMHV=$O(^AMHPINTK(AMHX,$E(AMHF,1,2),AMHV)) Q:AMHV'=+AMHV  D
 ...S AMHC=AMHC+1,^AMHPINTK(AMHX,41,AMHC,0)=^AMHPINTK(AMHX,$E(AMHF,1,2),AMHV,0)
 ...Q
 ..S AMHC=AMHC+1,^AMHPINTK(AMHX,41,AMHC,0)=""
 ..Q
 .S ^AMHPINTK(AMHX,41,0)="^^"_AMHC_"^"_AMHC_"^"_DT_"^^"
 .Q
TP ;
 S AMHTP=0 F  S AMHTP=$O(^AMHPTXP(AMHTP)) Q:AMHTP'=+AMHTP  D
 .S AMHNEW=0
 .I $O(^AMHPTXP(AMHTP,18,0)) S $P(^AMHPTXP(AMHTP,0),U,18)=1,$P(^AMHPTXP(AMHTP,0),U,19)=1
 .Q:$P(^AMHPTXP(AMHTP,0),U,18)
 .W ":",AMHTP
 .;move axis I to wp
 .S X=$G(^AMHPTXP(AMHTP,12))
 .I X]"" S ^AMHPTXP(AMHTP,6,1,0)=X,^AMHPTXP(AMHTP,6,0)="^^1^1^"_DT
 .S X=$G(^AMHPTXP(AMHTP,14))
 .I X]"" S ^AMHPTXP(AMHTP,7,1,0)=X,^AMHPTXP(AMHTP,7,0)="^^1^1^"_DT
 .S $P(^AMHPTXP(AMHTP,0),U,18)=1
 .;move axis ii to wp
 .S X=$G(^AMHPTXP(AMHTP,13))
 .I X]"" S ^AMHPTXP(AMHTP,8,1,0)=X,^AMHPTXP(AMHTP,8,0)="^^1^1^"_DT
 .;move nodes 3,4,5 to node 18
 .S C=0 I $O(^AMHPTXP(AMHTP,3,0)) D
 ..;S C=C+1,^AMHPTXP(AMHTP,18,C,0)="PROBLEM DESCRIPTION"
 ..S X=0 F  S X=$O(^AMHPTXP(AMHTP,3,X)) Q:X'=+X  D
 ...S C=C+1,^AMHPTXP(AMHTP,18,C,0)=^AMHPTXP(AMHTP,3,X,0)
 .I $O(^AMHPTXP(AMHTP,4,0)) D
 ..S C=C+2,^AMHPTXP(AMHTP,18,C,0)="GOALS"
 ..S X=0 F  S X=$O(^AMHPTXP(AMHTP,4,X)) Q:X'=+X  D
 ...S C=C+1,^AMHPTXP(AMHTP,18,C,0)=^AMHPTXP(AMHTP,4,X,0)
 .I $O(^AMHPTXP(AMHTP,5,0)) D
 ..S C=C+2,^AMHPTXP(AMHTP,18,C,0)="OBJECTIVES"
 ..S X=0 F  S X=$O(^AMHPTXP(AMHTP,3,X)) Q:X'=+X  D
 ...S C=C+1,^AMHPTXP(AMHTP,18,C,0)=^AMHPTXP(AMHTP,3,X,0)
 .K ^TMP($J,"AMHPOST1")
 .D GUIR^XBLM("METHOD^AMHPOST1","^TMP($J,""AMHPOST1"",")
 .S X=0 F  S X=$O(^TMP($J,"AMHPOST1",X)) Q:X'=+X  D
 ..S C=C+1
 ..S ^AMHPTXP(AMHTP,18,C,0)=^TMP($J,"AMHPOST1",X)
 .S ^AMHPTXP(AMHTP,18,0)="^^"_C_"^"_C_"^"_DT_"^^"
 .Q
TP2 ;convert again
 S AMHC=0
 S AMHXX=0 F  S AMHXX=$O(^AMHPTXP(AMHXX)) Q:AMHXX'=+AMHXX  D
 .Q:$P(^AMHPTXP(AMHXX,0),U,19)  ;converted 2nd time
 .Q:$O(^AMHPTXP(AMHXX,18,1))
 .K ^TMP($J,"AMHPOST1")
 .D GUIR^XBLM("GATHER^AMHPOST1","^TMP($J,""AMHPOST1"",")
 .S X=0,C=0 F  S X=$O(^TMP($J,"AMHPOST1",X)) Q:X'=+X  D
 ..S C=C+1
 ..S ^AMHPTXP(AMHXX,18,C,0)=^TMP($J,"AMHPOST1",X)
 .S ^AMHPTXP(AMHXX,18,0)="^^"_C_"^"_C_"^"_DT_"^^"
 .S AMHA=0 F  S AMHA=$O(^AMHPTPP("AD",AMHXX,AMHA)) Q:AMHA'=+AMHA  D
 ..S ^AMHPTXP(AMHXX,11)=$G(^AMHPTXP(AMHXX,11))_$P(^AMHPTPP(AMHA,0),U)_"   "
 ..Q
 .S $P(^AMHPTXP(AMHXX,0),U,19)=1  ;conversion 2
EDU ;fix education
 S AMHXX=0 F  S AMHXX=$O(^AMHREDU(AMHXX)) Q:AMHXX'=+AMHXX  D
 .S AMHV=$P(^AMHREDU(AMHXX,0),U,3)
 .Q:'AMHV
 .Q:$P(^AMHREDU(AMHXX,0),U,2)
 .Q:'$D(^AMHREC(AMHV,0))
 .S AMHP=$P(^AMHREC(AMHV,0),U,8)
 .Q:'AMHP
 .S DITC="",DIE="^AMHREDU(",DA=AMHXX,DR=".02////"_AMHP D ^DIE D ^XBFMK K DITC
FIXPROC ;
 S AMHXX=0 F  S AMHXX=$O(^AMHRPROC(AMHXX)) Q:AMHXX'=+AMHXX  D
 .S AMHV=$P(^AMHRPROC(AMHXX,0),U,3)
 .Q:'AMHV
 .Q:$P(^AMHRPROC(AMHXX,0),U,2)
 .Q:'$D(^AMHREC(AMHV,0))
 .S AMHP=$P(^AMHREC(AMHV,0),U,8)
 .Q:'AMHP
 .S DITC="",DIE="^AMHRPROC(",DA=AMHXX,DR=".02////"_AMHP D ^DIE D ^XBFMK K DITC
 Q
ICDC ;;
 ;;2;;V62.4
 ;;294.1;;294.10
 ;;42;;V71.81
 ;;43;;V71.81
 ;;44;;V71.81
 ;;45;;V71.89
 ;;47;;V71.81
 ;;48;;V71.81
 ;;49;;V71.81
 ;;62;;V61.8
 ;;65;;V25.09
 ;;84;;V62.1
 ;;90;;V62.3
 ;;98;;V62.0
 ;;99;;V68.89
 ;;42.1;;V71.81
 ;;42.2;;V71.81
 ;;42.3;;V71.81
 ;;43.1;;V71.81
 ;;43.2;;V71.81
 ;;43.3;;V71.81
 ;;44.1;;V71.81
 ;;44.2;;V71.81
 ;;44.3;;V71.81
 ;;45.1;;V71.89
 ;;45.2;;V71.89
 ;;45.3;;V71.89
 ;;14;;296.20
 ;;16;;297.9
 ;;25;;312.89
 ;;46.1;;V62.83
 ;;995.5;;995.50
 ;;995.81;;995.80
 ;;46.2;;V15.41
 ;;294.8;;294.0
 ;;21.1;;292.9
 ;;290.3;;331.0
 ;;291.5;;291.89
 ;;312.82;;312.82
 ;;312.89;;312.9
 ;;314.9;;314.01
 ;;333.92;;333.92
 ;;54.1;;798.2
 ;;54.2;;V66.7
 ;;46.3;;V71.81
 ;;47.1;;V71.81
 ;;47.2;;V71.81
 ;;48.1;;V71.81
 ;;48.2;;V71.81
 ;;49.1;;V71.81
 ;;49.2;;V71.81
 ;;
 ;
 ;;
 ;