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

PSBPARIV.m

Go to the documentation of this file.
PSBPARIV ;BIRMINGHAM/EFC-BCMA IV PARAMETERS FUNCTIONS ;Mar 2004
 ;;3.0;BAR CODE MED ADMIN;;Mar 2004
 ;
 ; Reference/IA
 ; ^DIC(42/1377
 ; ^DIC(42/2440
 ; $$SITE^VASITE/10112
 ; $$GET^XPAR/2263
 ; WIN^DGPMDDCF/1246
 ;
WLIST(RESULTS,PSBEDIV) ; get the ward list for the IV Parameters GUI
 K ^TMP("PSB",$J)
 S RESULTS=$NAME(^TMP("PSB",$J)),^TMP("PSB",$J,0)=1,^TMP("PSB",$J,1)="ALL^1^0^1^1^1^1^1"
 S PSBX="" F  S PSBX=$O(^DIC(42,"B",PSBX)) Q:PSBX=""  D
 .S D0=$O(^DIC(42,"B",PSBX,"")) D WIN^DGPMDDCF Q:X=1 
 .S PSBD=$$GET1^DIQ(42,D0_",",.015,"I") Q:PSBD=""
 .S PSBD=$P($$SITE^VASITE(DT,PSBD),U,1) Q:PSBD'=$G(PSBEDIV)
 .S PSBNODE=^TMP("PSB",$J,0)+1,^TMP("PSB",$J,0)=PSBNODE,^TMP("PSB",$J,PSBNODE)=PSBX_"^0"
 .I $D(^PSB(53.66,"B",D0)) S PSBIEN=$O(^PSB(53.66,"B",D0,"")),$P(^TMP("PSB",$J,PSBNODE),U,2)="1^"_PSBIEN_"^0^0^0^0^0" D
 ..S PSBY="" F  S PSBY=$O(^PSB(53.66,PSBIEN,1,"B",PSBY)) Q:PSBY=""  S $P(^TMP("PSB",$J,PSBNODE),U,$FIND("ACHPS",PSBY)+2)=1
 Q
 ;
GETPAR(RESULTS,PSBWARD,PSBIVPT,PSBDIV) ;get parameters for a specific ward and type
 K ^TMP("PSB",$J)
 I $G(PSBDIV)'="" S PSBEDIV=PSBDIV
 S RESULTS=$NAME(^TMP("PSB",$J)),^TMP("PSB",$J,0)="-1^Ward is not defined in BCMA IV PARAMETERS file 53.66"
 D CHKDIV
 S:PSBEDIV'["DIV.`" PSBEDIV="DIV.`"_PSBEDIV
 I PSBWARD=0 D  Q
 .S PSBPAR=PSBIVPT_U_$$GET^XPAR(PSBEDIV,"PSBIV ADDITIVE",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV STRENGTH",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV BOTTLE",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV SOLUTION",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV VOLUME",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV INFUSION RATE",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV MED ROUTE",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV SCHEDULE",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV ADMIN TIME",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV REMARKS",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV OTHER PRINT INFO",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV PROVIDER",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV START DATE/TIME",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV STOP DATE/TIME",PSBIVPT)
 .S PSBPAR=PSBPAR_U_$$GET^XPAR(PSBEDIV,"PSBIV PROVIDER COMMENTS",PSBIVPT)
 .S ^TMP("PSB",$J,0)=PSBPAR
 I '$D(^PSB(53.66,PSBWARD)) Q
 I '$D(^PSB(53.66,PSBWARD,1,"B",PSBIVPT)) D  Q
 .S PSBIVPTX=$P("^ADDMIXTURE^PIGGYBACK^HYPERAL^SYRINGE^CHEMO",U,$F("APHSC",PSBIVPT))
 .S ^TMP("PSB",$J,0)="-1^"_PSBIVPTX_" IV PARAMETERS NOT DEFINED FOR WARD"
 S PSBPAR=$TR(^PSB(53.66,PSBWARD,1,$O(^PSB(53.66,PSBWARD,1,"B",PSBIVPT,0)),0),"WNI",123)
 S ^TMP("PSB",$J,0)=PSBPAR
 Q
 ;
CHKDIV ;
 ;
 S:PSBEDIV'["DIV.`" PSBEDIV="DIV.`"_PSBEDIV
 I '$$GET^XPAR(PSBEDIV,"PSBIV ADDITIVE") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV ADDITIVE",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV ADMIN TIME") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV ADMIN TIME",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV BOTTLE") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV BOTTLE",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV INFUSION RATE") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV INFUSION RATE",I,1)
 I '$$GET^XPAR(PSBEDIV,"PSBIV MED ROUTE") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV MED ROUTE",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV OTHER PRINT INFO") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV OTHER PRINT INFO",I,1)
 I '$$GET^XPAR(PSBEDIV,"PSBIV PROVIDER") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV PROVIDER",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV PROVIDER COMMENTS") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV PROVIDER COMMENTS",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV REMARKS") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV REMARKS",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV SCHEDULE") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV SCHEDULE",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV SOLUTION") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV SOLUTION",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV START DATE/TIME") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV START DATE/TIME",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV STOP DATE/TIME") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV STOP DATE/TIME",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV STRENGTH")  F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV STRENGTH",I,3)
 I '$$GET^XPAR(PSBEDIV,"PSBIV VOLUME") F I=1:1:5  D EN^XPAR(PSBEDIV,"PSBIV VOLUME",I,3)
 Q
 ;
PUTPAR(RESULTS,PSBWARD,PSBPARS,PSBDIV) ;  set 53.66 (parameters file) with input iv parameters
 K ^TMP("PSB",$J)
 I $G(PSBDIV)'="" S PSBEDIV=PSBDIV
 N PSBDIEN S PSBDIEN=+($G(PSBEDIV))
 S:PSBEDIV'["DIV.`" PSBEDIV="DIV.`"_PSBEDIV
 N PSBFDA,PSBMSG,PSBWD,PSBIVPT,X,Z,PSBIVPR,I,K
 S RESULTS=$NAME(^TMP("PSB",$J))
 S PSBWARD=$G(PSBWARD)
 S PSBPARS=$G(PSBPARS)
 I $G(PSBDIEN)="" S ^TMP("PSB",$J,0)="-1^Division IEN required for ward"_$G(PSBWARD) Q
 S PSBWD=$P(PSBWARD,U,1),PSBIEN=$P(PSBWARD,U,2)
 S X="^ADDITIVE^STRENGTH^BOTTLE^SOLUTION^VOLUME^INFUSION RATE^MED ROUTE^SCHEDULE^ADMIN TIME"
 S X=X_"^REMARKS^OTHER PRINT INFO^PROVIDER^START DATE/TIME^STOP DATE/TIME^PROVIDER COMMENTS"
 S PSBIVPT=$P(PSBPARS,U,1)
 I PSBWD="ALL" D  Q
 .S K=2,PSBIVPT=$S(PSBIVPT="A":1,PSBIVPT="P":2,PSBIVPT="H":3,PSBIVPT="S":4,1:5)
 .F I=2:1 Q:$P(X,U,I)=""  S PSBIVPR(I)="PSBIV"_" "_$P(X,U,I)
 .F I=2:1:16 D EN^XPAR(PSBEDIV,$G(PSBIVPR(I)),PSBIVPT,$P(PSBPARS,U,K)) S K=K+1
 .S ^TMP("PSB",$J,0)="1^Parameters Saved"
 F I=2:1 Q:$P(PSBPARS,U,I)=""  S $P(PSBPARS,U,I)=$TR($P(PSBPARS,U,I),123,"WNI")
 I PSBWD'="ALL" D
 .S PSBWIEN=$O(^DIC(42,"B",PSBWD,""))
 .S PSBDIVPT=$$GET1^DIQ(42,PSBWIEN_",",.015,"I")
 .I $P($$SITE^VASITE(DT,PSBDIVPT),U,1)'=PSBDIEN S ^TMP("PSB",$J,0)="-1^Data NOT filed - invalid Division IEN" Q
 .I $P(PSBPARS,U,2)'="" D
 ..I $D(^PSB(53.66,"B",PSBWIEN)),$D(^PSB(53.66,PSBIEN,1,"B",PSBIVPT)) D MODIFY ;Modify an existing ward,ivtype
 ..I $D(^PSB(53.66,"B",PSBWIEN)),'$D(^PSB(53.66,PSBIEN,1,"B",PSBIVPT)) D ADD  ;ward exists but not type
 ..I '$D(^PSB(53.66,"B",PSBWIEN)) D NEW ;Create a new ward
 .I $P(PSBPARS,U,2)="" D RESET ;Delete an existing ward
 Q
NEW ;
 S PSBIEN="+1,"
 S PSBFDA(53.66,PSBIEN,.01)=$G(PSBWIEN)
 D FILEIT
 S PSBIEN="+1,"_PSBIEN(1)_","
 S PSBFDA(53.67,PSBIEN,.01)=PSBIVPT
 S PSBFDA(53.67,PSBIEN,1)=$P(PSBPARS,U,2)
 F I=5:5:70 S PSBFDA(53.67,PSBIEN,I)=""
 S K=3,I=1 F  S I=$O(PSBFDA(53.67,PSBIEN,I)) Q:I=""  S PSBFDA(53.67,PSBIEN,I)=$P(PSBPARS,U,K),K=K+1
 S PSBIEN(1)=""
 D FILEIT
 Q:$D(PSBMSG("DIERR"))
 S ^TMP("PSB",$J,0)="1^Data successfully filed^"_$G(PSBIEN(1))
 Q
MODIFY ;
 S PSBIEN=$O(^PSB(53.66,"B",PSBWIEN,""))
 S Z=$O(^PSB(53.66,PSBIEN,1,"B",PSBIVPT,""))
 S PSBIEN=Z_","_PSBIEN_","
 S PSBFDA(53.67,PSBIEN,.01)=PSBIVPT
 S PSBFDA(53.67,PSBIEN,1)=$P(PSBPARS,U,2)
 F I=5:5:70 S PSBFDA(53.67,PSBIEN,I)=""
 S K=3,I=1 F  S I=$O(PSBFDA(53.67,PSBIEN,I)) Q:I=""  S PSBFDA(53.67,PSBIEN,I)=$P(PSBPARS,U,K),K=K+1
 D FILEIT
 Q:$D(PSBMSG("DIERR"))
 S ^TMP("PSB",$J,0)="1^Data successfully filed^"
 Q
ADD ;
 S PSBIEN=$O(^PSB(53.66,"B",PSBWIEN,""))
 S PSBIEN="+1"_","_PSBIEN_","
 S PSBFDA(53.67,PSBIEN,.01)=PSBIVPT
 S PSBFDA(53.67,PSBIEN,1)=$P(PSBPARS,U,2)
 F I=5:5:70 S PSBFDA(53.67,PSBIEN,I)=""
 S K=3,I=1 F  S I=$O(PSBFDA(53.67,PSBIEN,I)) Q:I=""  S PSBFDA(53.67,PSBIEN,I)=$P(PSBPARS,U,K),K=K+1
 D FILEIT
 Q:$D(PSBMSG("DIERR"))
 S ^TMP("PSB",$J,0)="1^Data successfully filed^"
 Q
RESET ;
 N DIK,DA
 S DIK="^PSB(53.66,"
 S DA=PSBIEN
 D ^DIK
 S ^TMP("PSB",$J,0)="1^Data successfully deleted^"
 Q
FILEIT ;
 D CLEAN^DILF
 D UPDATE^DIE("","PSBFDA","PSBIEN","PSBMSG")
 I $D(PSBMSG("DIERR")) S ^TMP("PSB",$J,0)="-1^"_PSBMSG("DIERR",1)_": "_PSBMSG("DIERR",1,"TEXT",1) Q
 Q