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

BLRDIAG.m

Go to the documentation of this file.
BLRDIAG ;IHS/ITSC/TPF - MAIN 'SIGN OR SYMPTOM' LAB POV INPUT ROUTINE; 22-Oct-2013 09:22 ; MKK
 ;;5.2;IHS LABORATORY;**1015,1017,1018,1019,1021,1027,1031,1033,1034**;NOV 01, 1997;Build 88
 ;
 ;NOTE: LRPOVREQ  WAS USED AS A SITE PARAMETER DURING DEVELOPMENT.
 ;IT WAS THOUGHT THAT THIS REQUIREMENT WOULD BE DECIDED UPON BY EACH
 ;SITE. HOWEVER MED REC HAS DECIDED SINCE THIS IS REQUIRED BY LAW IT
 ;SHOULD NOT BE LEFT TO EACH SITE'S CHOICE TO REQUIRE THE FIELD OR
 ;NOT. THE VARIABLE HAS BEEN LEFT IN FOR ALPHA TESTING
 Q
UPPER(X) ; EP
 Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
 ;
 ;AFTER THE ENTIRE ORDER IS COMPLETE LETS DO THE 'SIGN OR SYMPTOM'
 ;ALSO IF NEED BE CHECK TO SEE IF WE NEED TO ACCESSION THEM AS WELL (FAST E.G.)
COMPORD(LRODT,LRORD) ;EP CALLED FROM LRORDST
 ;
 Q:$G(LRODT)=""!($G(LRORD)="")
 ;
 ;
 N TMPCWL,TMPSET
 D DIAG(LRODT,LRORD)  ;IHS/ITSC/TPF ALLOW ENTRY OF 'SIGN OR SYMPTOM' LAB POV **1015*
 ;
 I LRORDR="" D
 .S ORDIEN="" F  S ORDIEN=$O(^LRO(69,"C",LRORD,LRODT,ORDIEN)) Q:ORDIEN=""  D
 ..;S LRSN=ORDIEN S LRPHSET=0 D ^LRWLST K LRPHSET
 ..;KILL LRNCWL TO MAKE SURE THE PROMPT TO ALLOW USER TO ENTER AN
 ..;NUMBER IS NOT DISPLAYED AT WL2+1^LRWLST
 ..;KILL LRPHSET TO MAKE SURE THE ACCESSION IS DISPLAYED AT
 ..;STWLN+8^LRWLST1
 ..;KILL LRNCWL TO MAKE SURE PROMPT FOR ENTRY # IS NOT ASKED
 ..S LRSN=ORDIEN S:$D(LRNCWL) TMPCWL=$G(LRNCWL) S:$D(LRPHSET) TMPSET=LRPHSET K LRNCWL,LRPHSET D ^LRWLST S:$D(TMPCWL) LRNCWL=TMPCWL S:$D(TMPSET) LRPHSET=TMPSET
 ;
 Q
 ;
DIAG(LRODT,LRORD) ;EP CALLED FROM LROW2A,LRTSTSET
 D ENTRYAUD^BLRUTIL("DIAG^BLRDIAG 0.0")
 ;
 Q:$G(LRODT)=""!($G(LRORD)="")
 ;
 D ENTRYAUD^BLRUTIL("DIAG^BLRDIAG 1.0")
 ;
 ;DO WE HAVE MULTIPLE ENTRIES WE NEED TO ADD THE DIAG TO?
 S MULTIPL=0
 D MULTTST(LRORD,LRODT,.MULTIPL)
 ;
 ;----- BEGIN IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 G:$G(BLRGUI) RPT
 ;----- END IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 ;
 ;IHS/ITSC/TPF 'SIGN OR SYMPTOM' LABPOV **1015**
 D ENTRYAUD^BLRUTIL("DIAG^BLRDIAG 2.0")
 ;
 W !!
 S ASKALL=0  ;IHS/ITSC/TPF ASSUME USER WANTS SAME DIAG FOR ALL TESTS
 I MULTIPL D  Q:$D(DUOUT)!$D(DTOUT)
 .;----- BEGIN IHS/OIT/MKK MODIFICATION LR*5.2*1021 -- Yes or No ONLY
YNONLY . ;
 .;----- END IHS/OIT/MKK MODIFICATION LR*5.2*1021
 .K STUFF
 .K DIR
 .; S DIR("A")="Do you want to enter a different Sign or Symptom for each test?"
 .S DIR("A")="Do you want to enter a different Clinical Indication for each test?"  ; IHS/MSC/MKK - LR*5.2*1034
 .S DIR("B")="N"
 .S DIR(0)="Y"
 .D ^DIR
 .;----- BEGIN IHS/OIT/MKK MODIFICATION LR*5.2*1021 -- Yes or No ONLY
 .I X'="Y"&(X'="N") G YNONLY      ; Only "Y" or "N" allowed
 .;----- END IHS/OIT/MKK MODIFICATION LR*5.2*1021
 .S ASKALL=Y
 ;
 I ASKALL S BLRRLASK=1  ;cmi/anch/maw 5/22/2008 for reference lab
 I ASKALL D ASK(LRORD,LRODT,1,.MULTIPL) W !! Q
 ;
 ;EXECUTION FALLS TO HERE IF A "BLANKET" DIAGNOSIS IS TO BE ENTERED
 ;FOR THE ENTIRE ORDER
RPT ;
 S LRPOVREQ=1
 K DIR,STUFF
 ;----- BEGIN IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 I $G(BLRGUI) Q:BPCCOM=""  D ASK(LRORD,LRODT,0,.MULTIPL,BPCCOM) Q
 ;----- END IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 ;
 ; S DIR("A",1)="Enter Sign or Symptom for LAB Order number "_LRORD
 ; S DIR("A")="(DO NOT USE 'RULE OUT', 'PROBABLE', 'QUESTIONABLE', etc.)"
 ; S DIR(0)="69.03,9999999.1^^"_$P(^DD(69.03,9999999.1,0),U,5)
 ; W !
 ; D ^DIR
 ; 
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
 ; D ASKLPOV("Enter Sign or Symptom for LAB Order number "_LRORD)
 ; ----- END IHS/MSC/MKK - LR*5.2*1031
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1033
 S ^TMP("BLRDIAG",$J,"ORDER")=LRORD
 S ^TMP("BLRDIAG",$J,"ORDER","ALLTESTS")="YES"
 S X=$$ALLTESTS^BLRSGNSY(DFN,LRORD,LRODT)
 D:X GETRID^BLRSGNSP(LRORD)
 Q
 ; ----- END IHS/MSC/MKK - LR*5.2*1033
 ;
 I Y[U S LRNOP=0 D CANORD(LRODT,LRORD) W !!,"ORDER CANCELED!!" Q  ;ADDED 12/30/02
 I $G(LRPOVREQ),($D(DUOUT)!$D(DTOUT)!(Y="")) W !,"This is a required response." G RPT
 ; I Y=""!(Y[U) W !!,"No Sign or Symptom entered for order number "_LRORD,!! Q
 I Y=""!(Y[U) W !!,"No Clinical Indication entered for order number "_LRORD,!! Q    ; IHS/MSC/MKK - LR*5.2*1034
 S STUFF=Y
 K DIR
 S DIR(0)="Y"
 S DIR("B")="YES"
 S DIR("A")="Is this correct"
 D ^DIR
 G:'Y RPT
 ;
 D ASK(LRORD,LRODT,0,.MULTIPL,STUFF)
 W !!
 Q
 ;
 ;DO WE HAVE MULTIPLE TESTS FOR THIS ORDER?
MULTTST(LRORD,LRODT,MULTIPL) ;
 S ^TMP("BLRDIAG",$J,"ORDER")=LRORD
 ;
 S ORDIEN="" F I=1:1 S ORDIEN=$O(^LRO(69,"C",LRORD,LRODT,ORDIEN)) Q:ORDIEN=""  D  Q:MULTIPL
 .I I>1 S MULTIPL=1 Q
 .S TST="" F J=1:1 S TST=$O(^LRO(69,LRODT,1,ORDIEN,2,"B",TST)) Q:TST=""  D  Q:MULTIPL
 ..I J>1 S MULTIPL=1 Q
 Q
 ;
 ;GO THROUGH ORDER D FOR EACH TEST AND PROMPT IF ASKING AND STUFF IF NOT
ASK(LRORD,LRODT,ASK,MULTIPL,STUFF) ; EP
 D ENTRYAUD^BLRUTIL("ASK^BLRDIAG 0.0")
 ;
 N I,J,ORDIEN,TST,SEQ,Y,DFNFLAG
 NEW BAILOUT  ; IHS/MSC/MKK - LR*5.2*1033
 ;
 I +$G(DFN)<1 D
 . S LRSP=$O(^LRO(69,"C",LRORD,LRODT,0))
 . S LRDFN=+$G(^LRO(69,LRODT,1,LRSP,0))
 . S DFN=+$P($G(^LR(LRDFN,0)),"^",3)
 . S DFNFLAG=1
 ;
 S ^TMP("BLRDIAG",$J,"ORDER")=LRORD    ; IHS/MSC/MKK - LR*5.2*1033
 S BAILOUT=0  ; IHS/MSC/MKK - LR*5.2*1033
 S STUFF=$$UPPER($G(STUFF))
 ; S ORDIEN="" F I=1:1 S ORDIEN=$O(^LRO(69,"C",LRORD,LRODT,ORDIEN)) Q:ORDIEN=""  D
 ; S ORDIEN=""  F  S ORDIEN=$O(^LRO(69,"C",LRORD,LRODT,ORDIEN)) Q:ORDIEN=""  D    ; IHS/OIT/MKK - LR*5.2*1031
 S ORDIEN=""  F  S ORDIEN=$O(^LRO(69,"C",LRORD,LRODT,ORDIEN)) Q:ORDIEN=""!(BAILOUT)  D    ; IHS/MSC/MKK - LR*5.2*1033
 .; S TST="" F J=1:1 S TST=$O(^LRO(69,LRODT,1,ORDIEN,2,"B",TST)) Q:TST=""  D
 .; S TST=""  F  S TST=$O(^LRO(69,LRODT,1,ORDIEN,2,"B",TST)) Q:TST=""  D          ; IHS/OIT/MKK - LR*5.2*1031
 .S TST=0  F  S TST=$O(^LRO(69,LRODT,1,ORDIEN,2,TST)) Q:TST<1!(BAILOUT)  D          ; IHS/MSC/MKK - LR*5.2*1033
 .. ;
 .. ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1033
 .. W !!,?4,"SIGN/SYMPTOM FOR TEST: ",$$GET1^DIQ(69.03,TST_","_ORDIEN_","_LRODT_",","TEST/PROCEDURE")
 .. S BAILOUT=$$GETSDIAG^BLRSGNSY(DFN,LRORD,LRODT,ORDIEN,TST)
 .. Q
 .. ; ----- END IHS/MSC/MKK - LR*5.2*1033
 .. ;
 ..S DA=$O(^LRO(69,LRODT,1,ORDIEN,2,"B",TST,""))
 ..S DIE="^LRO(69,"_LRODT_",1,"_ORDIEN_",2,"
 ..I ASK D  Q
 ...S DEF=$G(^LRO(69,LRODT,1,ORDIEN,2,DA,9999999))
 ...D ASK1(.STUFF,TST,DEF,ORDIEN,DA)
 ...Q:$G(Y)[U  ;IF TRUE TEST HAS BEEN CANCELLED
 ...S DR="9999999.1///^S X=STUFF"
 ...;----- BEGIN IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 ...; L +^LRO(69,LRODT,1,ORDIEN):1 I '$T W !,"ORDER IS CURRENTLY BEING EDITED!" Q
 ...L +^LRO(69,LRODT,1,ORDIEN):1 I '$T W:'$G(BLRGUI) !,"ORDER IS CURRENTLY BEING EDITED!" S:$G(BLRGUI) RESULT(1)=-1,RESULT(2)="ORDER IS CURRENTLY BEING EDITED!"  Q
 ...;----- END IHS MODIFICATIONS LR*5.2*1019 -- Patient Chart Mod
 ...D ^DIE L -^LRO(69,LRODT,1,ORDIEN)
 ..I 'ASK,($G(STUFF)'="") S DR="9999999.1///^S X=STUFF" D
 ...L +^LRO(69,LRODT,1,ORDIEN):1 I '$T W !,"ORDER IS CURRENTLY BEING EDITED!" Q
 ...D ^DIE L -^LRO(69,LRODT,1,ORDIEN)
 ;
 K:+$G(DFNFLAG) LRDFN,DFN,LRSP
 K I,J,ORDIEN,TST
 K ^TMP("BLRDIAG",$J,"ORDER")     ; IHS/MSC/MKK - LR*5.2*1033
 Q
 ;
 ;PROMPT FOR 'SIGN OR SYMPTOM'
ASK1(STUFF,TST,DEF,ORDIEN,DA) ;
 S LRPOVREQ=1
ASK1B K DIR
 S STUFF=$$UPPER($G(STUFF))
 ; S DIR("B")=$G(DEF)
 ; S DIR("A",1)="Enter Sign or Symptom for "_$P($G(^LAB(60,TST,0)),U)
 ; S DIR("A")="(DO NOT USE 'RULE OUT', 'PROBABLE', 'QUESTIONABLE', etc.)"
 ; S DIR(0)="69.03,9999999.1^^"_$P(^DD(69.03,9999999.1,0),U,5)
 ; W !
 ; D ^DIR
 ; 
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
 ; D ASKLPOV("Enter Sign or Symptom for "_$P($G(^LAB(60,TST,0)),U))
 D ASKLPOV("Enter Clinical Indication for "_$P($G(^LAB(60,TST,0)),U))     ; IHS/MSC/MKK - LR*5.2*1034
 ; ----- END IHS/MSC/MKK - LR*5.2*1031
 ;
 ;I Y[U S LRNOP=0 D CANTST(ORDIEN,$S($G(DA)'="":DA,1:LRTN)) W !!,"TEST CANCELED FROM ORDER!!" Q  ;ADDED 12/30/02
 I Y[U S LRNOP=0 D CANTST(ORDIEN,$S($G(DA)'="":DA,$D(LRSN):LRSN,1:LRTN)) W !!,"TEST CANCELED FROM ORDER!!" Q  ;IHS/ITSC/TPF 7/1/03 **1017** 
 I $G(LRPOVREQ),($D(DUOUT)!$D(DTOUT)!(Y="")) W !,"This is a required response." G ASK1B
 ; I Y=""!(Y[U) W !!,"No Sign or Symptom entered for "_$P($G(^LAB(60,TST,0)),U),!! Q
 I Y=""!(Y[U) W !!,"No Clinical Indication entered for "_$P($G(^LAB(60,TST,0)),U),!! Q   ; IHS/MSC/MKK - LR*5.2*1034
 S STUFF=Y
ASK2 K DIR
 S DIR(0)="Y"
 S DIR("B")="YES"
 S DIR("A")="Is this correct"
 D ^DIR
 G:'Y ASK1B
 Q
 ;
 ;ENTER DIAGNOSIS FOR JUST ONE TEST
ADDTST(LRODT,ORDIEN,TST) ;EP CALLED FROM LRTSTSET WHEN ADDING TEST TO ORDER
 Q:$G(LRODT)=""!($G(ORDIEN)="")!($G(TST)="")
 ;
 Q:$$CHKORDAC^BLRSGNSU(LRODT,ORDIEN,TST)    ; IHS/MSC/MKK - LR*5.2*1033
 ;
 NEW BAILOUT
 ;
 S DA=$O(^LRO(69,LRODT,1,ORDIEN,2,"B",TST,""))
 S DIE="^LRO(69,"_LRODT_",1,"_ORDIEN_",2,"
 ; D ASK1(.STUFF,TST,,ORDIEN,DA)
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1033
 S:+$G(LRORD)<1 LRORD=+$G(^LRO(69,LRODT,1,ORDIEN,.1))
 S ^TMP("BLRDIAG",$J,"ORDER")=LRORD
 S ^TMP("BLRDIAG",$J,"ORDER","ADDTST")=DA
 S X=$$GETSDIAG^BLRSGNSY(DFN,LRORD,LRODT,ORDIEN,DA,.BAILOUT)
 K ^TMP("BLRDIAG",$J,"ORDER")
 K:+$G(BAILOUT) LRFLG Q
 ; ----- END IHS/MSC/MKK - LR*5.2*1033
 ;
 Q:$G(Y)[U&($G(XQY0)["LRADD TO ORDER")  ;IF TRUE THEN ORDER CANCELED
 ;
 I $G(Y)[U,($G(XQY0)["LRADD TO ACC") D DELACC Q
 S DR="9999999.1///^S X=STUFF"
 L +^LRO(69,LRODT,1,ORDIEN):1 I '$T W !,"ORDER IS CURRENTLY BEING EDITED!" Q
 D ^DIE                              ; IHS/MSC/MKK - LR*5.2*1033 -- routine BLRSGNSY adds Diag to File 69
 L -^LRO(69,LRODT,1,ORDIEN)
 Q
 ;
 ;CANCEL ENTIRE ORDER
CANORD(LRODT,LRORD) ;EP
 S LRSNTMP="" F  S LRSNTMP=$O(^LRO(69,"C",LRORD,LRODT,LRSNTMP)) Q:LRSNTMP=""  D
 .S TT=0 F  S TT=$O(^LRO(69,LRODT,1,LRSNTMP,2,TT)) Q:TT<1  K TST S X=^(TT,0) I '$P(X,"^",11) I 'LRNOP D
 ..S X=^LRO(69,LRODT,1,LRSNTMP,2,TT,0) W !,?5,$P(^LAB(60,+X,0),"^")
 ..S $P(^LRO(69,LRODT,1,LRSNTMP,2,TT,0),"^",3,6)="^^^",$P(^(0),"^",9,11)="CA^L^"_DUZ
 ..; S DIE="^LRO(69,LRODT,1,LRSNTMP,2,",DA=TT,DA(1)=LRSN,DA(2)=LRODT,DR=99 D ^DIE    ;NO NEED TO ENTER COMMENTS?
 S LRNCWL=1  ;SET TO BYPASS PRINTING ORDER COPY
 ;S LRPHSET=1  ;
 K LRSNTMP
 Q
 ;
 ;CANCEL TEST
CANTST(LRSN,TT) ;EP
 S LRACC=0
 K TST
 S X=^LRO(69,LRODT,1,LRSN,2,TT,0)
 I '$P(X,"^",11) S TST(+X)="",LRAD=+$P(X,U,3),LRAA=+$P(X,U,4),LRAN=+$P(X,U,5),ORIFN=$P(X,U,7) I 'LRNOP D
 .S X=^LRO(69,LRODT,1,LRSN,2,TT,0) W !,?5,$P(^LAB(60,+X,0),"^")
 .S $P(^LRO(69,LRODT,1,LRSN,2,TT,0),"^",3,6)="^^^",$P(^(0),"^",9,11)="CA^L^"_DUZ
 .;S DIE="^LRO(69,LRODT,1,LRSN,2,",DA=TT,DA(1)=LRSN,DA(2)=LRODT,DR=99 D ^DIE    ;NO NEED TO ENTER COMMENTS?
 ;S LRNCWL=1  ;SET TO BYPASS PRINTING ORDER COPY
 ;S LRPHSET=1
 Q
 ;
 ;DELETE ACCESSION
 ;THIS IS CALLED WHEN THEN OPTION ADD A TEST TO AN ACCESSION IS USED
 ;AND THE USER USES THE "^" TO GET OUT OF THE 'SIGN OR SYMPTOM' PROMPT
 ;IF THIS IS NOT DONE THE USER CAN THEN RESULT THE TEST WITHOUT HAVING
 ;TO ENTER A POV
DELACC ;
 S LRTSTS=LRTS
 S LRTNM=$P($G(^LAB(60,LRTS,0)),U)
 ;S LRCCOM="UP ARROWED OUT OF 'SIGN OR SYMPTOM' PROMPT"
 S LRCCOM="CANCELLED NO POV ENTERED"
 I $D(^LRO(68,LRAA,1,LRAD,1,LRAN,3)) S LRIDT=$P(^(3),U,5)
 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LROWDT=$P(X,U,3),LRODT=$P(X,U,4),LRSN=$P(X,U,5) I LROWDT=LRAD S:$D(^LRO(68,LRAA,1,LRAD,1,LRAN,9)) LROWDT=^(9)
 D TESTDEL^BLRDIAG1
 ; W !!,"Press Return to continue..." R X:DTIME
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
 W !!
 D ^XBFMK
 S DIR(0)="FAO"
 S DIR("A")="Press Return to continue..."
 S DIR("T")=15
 D ^DIR
 ; ----- END IHS/MSC/MKK - LR*5.2*1031
 ;
 K LRFLG
 ;
 Q
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
ASKLPOV(PROMPT) ; EP - Ask Lab Purpose Of Visit. Must be answered.
 NEW ANSWER,BADINPUT,DA,DIE
 ;
 S BADINPUT=1
 F  Q:+$G(BADINPUT)<1  D
 . D ^XBFMK
 . K DIR
 . S DIR("A",1)=PROMPT
 . S DIR("A")="(DO NOT USE 'RULE OUT', 'PROBABLE', 'QUESTIONABLE', etc.)"
 . S DIR(0)="69.03,9999999.1^^"_$P(^DD(69.03,9999999.1,0),U,5)
 . W !
 . D ^DIR
 . S BADINPUT=0
 . S ANSWER=$$UP^XLFSTR($P(Y,"^"))
 . I +$G(DIRUT)>0!(ANSWER["RULE OUT")!(ANSWER["PROBABLE")!(ANSWER["QUESTIONABLE") D
 .. W !,?4,"Invalid/'^' input not allowed."
 .. D PRESSKEY^BLRGMENU(9)
 .. S BADINPUT=1
 Q
 ; ----- END IHS/MSC/MKK - LR*5.2*1031