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

BDMFS.m

Go to the documentation of this file.
BDMFS ; IHS/CMI/LAB - DMS FLOW SHEET MANAGEMENT UTILITY ;
 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
 ;UTILITY PROGRAM TO MANAGE FLOW SHEET CREATION AND EDITING
FS ;EP;FLOW SHEET MANAGEMENT
 S IOP="HOME"
 D ^%ZIS
 D FS1 Q:$D(BDMQUIT)!$D(BDMOUT)
FSEXIT K BDMQUIT,BDMOUT,BDMJ,BDMX,BDMY,BDMSDA,BDMSNAM,BDMCINK,BDMCNK0,BDMCDA,BDMWHCH,BDMADA,BDMANAM,BDMSF,BDMCANN,BDMGO
 K ^TMP("BDMVR",$J)
 Q
FS1 D FSEXIT
 D FSDISP
 Q
FSDISP ;DISPLAY FLOW SHEET
 D VALM("BDM FLOW SHEET LIST")
 Q
FSHEAD ;PRINT HEADER FOR FLOW SHEET MANAGEMENT
 W @IOF
FSHEAD1 N X
 F X="DIABETES MANAGEMENT SYSTEM","FLOW SHEET MANAGEMENT" D
 .W !?(80-$L(X))\2,X
 Q
DXHEAD ;PRINT HEADER FOR FLOW SHEET MANAGEMENT
 W @IOF
 D FSHEAD1
 N X
 F X="Diagnosti/Medication Flow Sheets"
 W !?(80-$L(X))\2,X
 Q
FSDH ;DISPLAY HEADER FOR FLOW SHEET SYSTEM
 Q
FSADD ;EP;ENTER A NEW FLOW SHEET
 S DIR(0)="FO^3:30"
 S DIR("A")="Flow Sheet Name"
 W !
 D DIR^BDMDIC
 I Y="" S BDMQUIT="" D TABACK Q
 I X="^" S BDMQUIT="" D TABACK Q
 S (X,BDMSNAM)=Y
 S DIC="^APCHSFLC("
 S DIC(0)="L"
 D FILE^BDMDIC
 S BDMSDA=+Y
 I 'BDMSDA D TABACK Q
 D FSCEDIT
 D FSCLIST
TABACK S BDMGO="FS"
 D BACK
 Q
FSEDIT ;EP;EDIT AN EXISTING FLOW SHEET
 D SELECT
 I $D(BDMQUIT) K BDMQUIT D TEBACK Q
 D FSCLIST
TEBACK S BDMGO="FS"
 D BACK
 Q
SELECT ;SELECT AN EXISTING FLOW SHEET
 S DIR(0)="NO^1:"_BDMJ
 S DIR("A")="Which Flow Sheet"
 W !
 D DIR^BDMDIC
 I Y<1 S BDMQUIT="" Q
 Q:'$D(BDMJ(Y))
 S BDMSDA=+BDMJ(Y)
 S BDMSNAM=$P(BDMJ(Y),U,2)
 D FSCLIST
 Q
FSCEDIT ;EP;EDIT A FLOW SHEET COMPONENT
 S DA=BDMSDA
 S DIE="^APCHSFLC("
 S DR="[BDM FLOW SHEET COMPONENT]"
 D DDS^BDMDIC
 S BDMGO="FSC"
 D BACK
 Q
FSINIT ;EP;INITIALIZE ARRAY FOR FLOW SHEET DISPLAY
 K ^TMP("BDMVR",$J),BDMJ
 S VALMCNT=0
 S X="     NO. Flow sheet"
 D Z(X)
 S X="     --- ------------------------------"
 D Z(X)
 N I,J,X,Y,Z
 S I=0
 S X=""
 F  S X=$O(^APCHSFLC("B",X)) Q:X=""  D
 .S Y=0
 .F  S Y=$O(^APCHSFLC("B",X,Y)) Q:'Y  D
 ..S I=I+1
 ..S A="    "_I
 ..S:$L(A)=5 A=" "_A
 ..S A=A_"   "_X
 ..D Z(A)
 ..S BDMJ(I)=Y_U_X
 I '$D(^TMP("BDMVR",$J)) D
 .S VALMCNT=2
 .S X="NO FLOW SHEET ON FILE FOR "_BDMX
 .D Z(X)
 S BDMJ=I
 Q
VALM(BDMX) ;VALM INTERFACE
 S VALMCC=1 ;1=screen mode, 0=scrolling mode
 D TERM^VALM0
 D EN^VALM(BDMX)
 D CLEAR^VALM1
 Q
FSCLIST ;EP;TO DISPLAY ITEMS ON FLOW SHEET LIST
 D VALM("BDM FLOW SHEET COMPONENT LIST")
 Q
FSCINIT ;EP;TO LIST ITEMS ON FLOW SHEET
 N A,B,J,X,Y,Z,BDMTYPE,BDMABEL
 K ^TMP("BDMVR",$J),BDMJ,BDMCS
 S VALMCNT=0
 S X="     "_BDMSNAM
 D Z(X)
 S X="   "
 D Z(X)
 S X="     Flowsheet Components"
 D Z(X)
 S X="     NO.  ORDER  TYPE                 LABEL                 WIDTH"
 D Z(X)
 S X="     ---  -----  -------------------  --------------------  -----"
 D Z(X)
 S (J,BDMX)=0
 F  S BDMX=$O(^APCHSFLC(BDMSDA,1,"B",BDMX)) Q:'BDMX  D
 .S BDMCDA=0
 .F  S BDMCDA=$O(^APCHSFLC(BDMSDA,1,"B",BDMX,BDMCDA)) Q:'BDMCDA  D
 ..S X=$G(^APCHSFLC(BDMSDA,1,BDMCDA,0))
 ..Q:X=""
 ..S J=J+1
 ..S A="     "_J
 ..S:$L(A)=6 A=A_" "
 ..S A=A_"    "
 ..S A=A_$P(X,U)
 ..S:$L($P(X,U))=1 A=A_" "
 ..S A=A_"    "
 ..S BDMTYPE=$P($G(^APCHSFLI(+$P(X,U,2),0)),U)
 ..S BDMTYPE=BDMTYPE_$E("                    ",1,20-$L(BDMTYPE))
 ..S A=A_BDMTYPE
 ..S A=A_" "
 ..S BDMABEL=$P(X,U,3)
 ..S BDMABEL=BDMABEL_$E("                    ",1,20-$L(BDMABEL))
 ..S A=A_BDMABEL
 ..S A=A_"   "
 ..S BDMWDTH=$P(X,U,4)
 ..S A=A_BDMWDTH
 ..S X=A
 ..D Z(X)
 ..S BDMJ(BDMSDA,J)=BDMCDA_U_A
 ..D MEMLIST
 S BDMJ=J
 Q
FSCADD ;EP;TO ADD ITEM TO FLOW SHEET
 K BDM
 N X,Y
 I BDMANAM="DIAGNOSIS"!(BDMSNAM="PROBLEM LIST DIAGNOSIS") D  I 1
 .S X=0
 .F  S X=$O(^APCHSFLC(BDMSDA,1,X)) Q:'X  D
 ..S Y=$G(^APCHSFLC(BDMSDA,1,X,0))
 ..S:$P(Y,U)]"" BDM(X)=$P(Y,U)_U_$S($P(Y,U,2)]"":$P(Y,U,2),1:$P(Y,U))
 .D ^BDMFS1
 .Q:$D(BDMQUIT)
 .S X=$P(BDM("LOW"),U)
 E  D
 .D CLEAR^VALM1
 .W !?5,"Select an item to ADD to the"
 .W !!?5,BDMSNAM," Flow Sheet"
 .S DIC=BDMSF
 .S DIC(0)="AEMQZ"
 .S DIC("A")="Which "_BDMANAM_": "
 .W !
 .D DIC^BDMDIC
 .I +Y<1 S BDMQUIT="" Q
 .S BDM("LOW")=+Y
 .D X
 .S BDM("HIGH")=""
 I $D(BDMQUIT) D FSCBACK Q
 S DA(1)=BDMSDA
 S DIC="^APCHSFLC("_BDMSDA_",1,"
 S DIC(0)="L"
 S DIC("DR")=".02////"_BDM("HIGH")
 D FILE^BDMDIC:'$D(^APCHSFLC(BDMSDA,1,"B",X))
FSCBACK ;EP;S BDMGO="FSC"
 D BACK
 Q
X ;EVALUATE X FOR PROPER INTERNAL VALUE
 I BDMANAM="ADA CODE" S X=Y(0,0)
 I BDMANAM="RX" S X=+Y
 I BDMANAM="PROCEDURE (MEDICAL)" S X=Y(0,0)
 I BDMANAM="PATIENT ED TOPIC" S X=+Y
 I BDMANAM="HEALTH FACTORS" S X=+Y
 I BDMANAM="PROBLEM LIST DIAGNOSIS" S X=Y(0,0)
 Q
FSCDEL ;EP;TO DELETE ITEM FROM FLOW SHEET
 D FSCSEL
 I $D(BDMQUIT) K BDMQUIT D FSCBACK Q
 N BDMI,BDMX
 F BDMI=1:1 S BDMX=$P(BDMY,",",BDMI) Q:BDMX=""  D
 .Q:'$D(BDMJ(BDMSDA,BDMX))
 .S BDMCDA=+BDMJ(BDMSDA,BDMX)
 .S DA(1)=BDMSDA
 .S DA=BDMCDA
 .S DIK="^APCHSFLC("_DA(1)_",1,"
 .D DIK^BDMDIC
 S BDMGO="FSC"
 D BACK
 Q
FSCSEL ;EP;SELECT EXISTING ITEM FROM A FLOW SHEET
 S DIR(0)="LO^1:"_BDMJ
 S DIR("A")="Whick Flow Sheet Component(s)"
 W !
 D DIR^BDMDIC
 I Y<1 S BDMQUIT="" Q
 S BDMY=Y
 Q
BACK ;EP;SETUP FOR RETURN TO LISTMAN
 S VALMBCK="R"
 D FSINIT:BDMGO="FS"
 D FSCINIT:BDMGO="FSC"
 D MEMINIT:BDMGO="FSM"
 D TERM^VALM0
 Q
MEMBERS ;EP;TO SPECIFY THE MEMBERS FOR A FLOW SHEET COMPONENT
 D FSCSEL
 I $D(BDMQUIT) K BDMQUIT D FSCBACK Q
 F BDMI=1:1 S BDMX=$P(BDMY,",",BDMI) Q:BDMX=""!$D(BDMQUIT)  D
 .Q:'$D(BDMJ(BDMSDA,BDMX))
 .S BDMCDA=+BDMJ(BDMSDA,BDMX)
 .Q:'BDMCDA
 .S BDMTYPE=$G(^APCHSFLI(+$P($G(^APCHSFLC(+BDMSDA,1,+BDMCDA,0)),U,2),0))
 .D MEMDISP
 Q
MEMSEL ;SELECT THE MEMBER OF THE COMPONENT TO EDIT OR DELETE
 S DIR(0)="LO^1:"_BDMJ
 S DIR("A")="Whick Component Members(s)"
 W !
 D DIR^BDMDIC
 I Y<1 S BDMQUIT="" Q
 S BDMY=Y
 Q
MEMADD ;EP;TO ADD MEMBERS TO A FLOW SHEET COMPONENT
 S BDMTYPE=$G(^APCHSFLI(+$P($G(^APCHSFLC(+BDMSDA,1,+BDMCDA,0)),U,2),0))
 F  D MADD1 Q:$D(BDMQUIT)
 K BDMQUIT
 D MBACK
 Q
MADD1 W @IOF
 W !?5,"Select"
 W !?5,$P(BDMTYPE,U),?25,"to add to the"
 W !?5,$P(BDMTYPE,U),?25,"component of the "
 W !?5,BDMSNAM,?25,"Flow Sheet"
 S DIC=+$P(BDMTYPE,U,2)
 I 'DIC S BDMQUIT="" Q
 S DIC=^DIC(DIC,0,"GL")
 I DIC="" S BDMQUIT="" Q
 S BDMDIC=DIC
 S DIC(0)="AEMQZ"
 S DIC("A")="Which "_$P(BDMTYPE,U)_": "
 W !
 D DIC^BDMDIC
 I +Y<1 S BDMQUIT="" Q
 S X=+Y_";"_$E(BDMDIC,2,99)
 S $P(^APCHSFLC(BDMSDA,1,BDMCDA,2,0),U,2)="9001020.15AV"
 S DA(2)=BDMSDA
 S DA(1)=BDMCDA
 S DIC="^APCHSFLC("_BDMSDA_",1,"_BDMCDA_",2,"
 S DIC(0)="L"
 D FILE^BDMDIC
 Q
MEMDEL ;EP;TO DELETE MEMBERS FROM A FLOW SHEET COMPONENT
 N BDMY
 D MEMSEL
 I $D(BDMQUIT) K BDMQUIT D MBACK Q
 F BDMI=1:1 S BDMX=$P(BDMY,",",BDMI) Q:BDMX=""  D
 .Q:'$D(BDMJ(BDMSDA,BDMCDA,BDMX))
 .S DA=+BDMJ(BDMSDA,BDMCDA,BDMX)
 .S DA(2)=BDMSDA
 .S DA(1)=BDMCDA
 .S DIK="^APCHSFLC("_DA(2)_",1,"_DA(1)_",2,"
 .D DIK^BDMDIC
MBACK S BDMGO="FSM"
 D BACK
 Q
DELETE ;EP;TO DELETE FLOW SHEET COMPONENT
 Q
MEMDISP ;DISPLAY MEMBERS OF A COMPONENT
 D VALM("BDM FLOW SHEET MEMBERS")
 Q
MEMINIT ;EP;TO LIST ITEMS ON FLOW SHEET
 K ^TMP("BDMVR",$J),BDMJ
 S VALMCNT=0
 S X="     "_$P(BDMTYPE,U)
 D Z(X)
 S X="     ---------------------------"
 D Z(X)
 N A,B,X,Y
 S BDMMDA=0
 F  S BDMMDA=$O(^APCHSFLC(BDMSDA,1,BDMCDA,2,BDMMDA)) Q:'BDMMDA  D
 .S X=$G(^APCHSFLC(BDMSDA,1,BDMCDA,2,BDMMDA,0))
 .Q:X=""
 .S BDMGL=U_$P(X,";",2)
 .S:$E(BDMGL,$L(BDMGL))="(" BDMGL=$E(BDMGL,1,$L(BDMGL)-1)
 .S:$E(BDMGL,$L(BDMGL))="," BDMGL=$E(BDMGL,1,$L(BDMGL)-1)_")"
 .S BDMDA=+X
 .S X=$P($G(@BDMGL@(+X,0)),U,$S(BDMGL'["AUTTMSR":1,1:2))
 .S A="     "_(VALMCNT-1)
 .S:$L(A)=6 A=A_" "
 .S A=A_"    "
 .S A=A_X
 .S X=A
 .D Z(X)
 .S BDMJ(BDMSDA,BDMCDA,VALMCNT-2)=BDMMDA_U_A
 S BDMJ=VALMCNT-2
 Q
MEMLIST ;LIST MEMBERS OF EACH COMPONENT FOR DISPLAY WITH COMPONENTS
 N J,X,Y,BDMX,BDMMDA
 S (J,BDMMDA)=0
 F  S BDMMDA=$O(^APCHSFLC(BDMSDA,1,BDMCDA,2,BDMMDA)) Q:'BDMMDA  D
 .S X=$G(^APCHSFLC(BDMSDA,1,BDMCDA,2,BDMMDA,0))
 .Q:X=""
 .S J=J+1
 .S BDMGL=U_$P(X,";",2)
 .S:$E(BDMGL,$L(BDMGL))="(" BDMGL=$E(BDMGL,1,$L(BDMGL)-1)
 .S:$E(BDMGL,$L(BDMGL))="," BDMGL=$E(BDMGL,1,$L(BDMGL)-1)_")"
 .S X=$P($G(@BDMGL@(+X,0)),U,$S(BDMGL'["AUTTMSR":1,1:2))
 .S A="                 "_X
 .S X=A
 .D Z(X)
 Q
 S VALMSG="- Prev Screen  QU Quit  ?? More Actions"
 Q
Z(X) ;SET TMP GLOBAL
 S VALMCNT=VALMCNT+1
 S ^TMP("BDMVR",$J,VALMCNT,0)=X
 Q