GMPL1 ; SLC/MKB/AJB/TC -- Problem List actions ; 04/22/03 [5/24/12 9:35am]
;;2.0;Problem List;**3,20,28,43**;Aug 25, 1994;Build 4
; 10 MAR 2000 - MA - Added to the routine another user prompt
; to backup and refine Lexicon search if ICD code 799.9
ADD ;add new entry to list - Requires GMPDFN
N GMPROB,GMPTERM,GMPICD,Y,DUP W !
S GMPROB=$$TEXT^GMPLEDT4("") I GMPROB="^" S GMPQUIT=1 Q
I 'GMPARAM("CLU")!('$D(GMPLUSER)&('$D(^XUSEC("GMPL ICD CODE",DUZ)))) S GMPTERM="",GMPICD="799.9" G ADD1
F D Q:$D(GMPQUIT)!(+$G(Y))
. D SEARCH^GMPLX(.GMPROB,.Y,"PROBLEM: ","1")
. I +Y'>0 S GMPQUIT=1 Q
. S DUP=$$DUPL^GMPLX(+GMPDFN,+Y,GMPROB)
. I DUP,'$$DUPLOK^GMPLX(DUP) S (Y,GMPROB)=""
. I +Y=1 D ICDMSG
Q:$D(GMPQUIT)
S GMPTERM=$S(+$G(Y)>1:Y,1:""),GMPICD=$G(Y(1))
S:'$L(GMPICD) GMPICD="799.9"
ADD1 ; set up default values
; -- May enter here with GMPROB=text,GMPICD=code,GMPTERM=#^term
; added for Code Set Versioning (CSV)
I '+$$STATCHK^ICDAPIU(GMPICD,DT) W !,GMPROB,!,"has an inactive code. Please edit before adding." H 3 Q
N OK,GMPI,GMPFLD K GMPLJUMP
S GMPFLD(1.01)=GMPTERM,GMPFLD(.05)=U_GMPROB
;S GMPFLD(.01)=$O(^ICD9("AB",GMPICD_" ",0))_U_GMPICD
S GMPFLD(.01)=$P($$CODEN^ICDCODE(GMPICD,80),"~")_U_GMPICD ; Replacing direct global read to ^ICD9
S:'GMPFLD(.01)!($P(GMPFLD(.01),U)<0) GMPFLD(.01)=$$NOS^GMPLX ; cannot resolve code
S (GMPFLD(1.04),GMPFLD(1.05))=$G(GMPROV),GMPFLD(1.03)=DUZ
S GMPFLD(1.06)=$$SERVICE^GMPLX1(+GMPFLD(1.04)),GMPFLD(1.08)=$G(GMPCLIN)
S (GMPFLD(.08),GMPFLD(1.09))=DT_U_$$EXTDT^GMPLX(DT)
S GMPFLD(.12)="A^ACTIVE",GMPFLD(1.14)="",GMPFLD(10,0)=0
S GMPFLD(1.02)=$S('$G(GMPARAM("VER")):"P",$D(GMPLUSER):"P",1:"T")
S (GMPFLD(.13),GMPFLD(1.07))="" ; initialize dates
S GMPFLD(1.1)=$S('GMPSC:"0^NO",1:""),GMPFLD(1.11)=$S('GMPAGTOR:"0^NO",1:"")
S GMPFLD(1.12)=$S('GMPION:"0^NO",1:""),GMPFLD(1.13)=$S('GMPGULF:"0^NO",1:"")
ADD2 ; prompt for values
D FLDS^GMPLEDT3 ; set GMPFLD("FLD") of editable fields
F GMPI=2:1:7 D @(GMPFLD("FLD",GMPI)_"^GMPLEDT1") Q:$D(GMPQUIT) K GMPLJUMP ; cannot ^-jump here
Q:$D(GMPQUIT)
ADD3 ; Ok to save?
S OK=$$ACCEPT^GMPLDIS1(.GMPFLD),GMPLJUMP=0 ; ok to save values?
I OK="^" W !!?10,"< Nothing Saved !! >",! S GMPQUIT=1 H 1 Q
I OK D Q ; ck DA for error?
. N I W !!,"Saving ..." D NEW^GMPLSAVE
. S I=$S(GMPLIST(0)'>0:1,GMPARAM("REV"):$O(GMPLIST(0))-.01,1:GMPLIST(0)+1)
. S GMPLIST(I)=DA,GMPLIST("B",DA)=I,GMPLIST(0)=$G(GMPLIST(0))+1
. W " done."
; Not ok -- edit values, ask again
F GMPI=1:1:GMPFLD("FLD",0) D @(GMPFLD("FLD",GMPI)_"^GMPLEDT1") Q:$D(GMPQUIT)!($D(GMPSAVED)) I $G(GMPLJUMP) S GMPI=GMPLJUMP-1 S GMPLJUMP=0 ; reset GMPI to desired fld
Q:$D(DTOUT) K GMPQUIT,DUOUT G ADD3
Q
;
; *********************************************************************
; * GMPIFN expected for the following calls:
;
STATUS ; -- inactivate problem
N DIE,DA,DR,X,Y,CHNGE,GMPFLD,PROMPT,DEFAULT
S GMPFLD(.13)=$P($G(^AUPNPROB(GMPIFN,0)),U,13) ; Onset
W !!,$$PROBTEXT^GMPLX(GMPIFN) D RESOLVED^GMPLEDT4 Q:$D(GMPQUIT)
S PROMPT="COMMENT (<60 char): ",DEFAULT="" D EDNOTE^GMPLEDT4 Q:$D(GMPQUIT)
W ! I Y'="" S GMPFLD(10,"NEW",1)=Y D NEWNOTE^GMPLSAVE W "."
S DIE="^AUPNPROB(",DR=".12///I;1.07////"_$P($G(GMPFLD(1.07)),U)
S DA=GMPIFN D ^DIE W "."
S CHNGE=GMPIFN_"^.12^"_$$HTFM^XLFDT($H)_U_DUZ_"^A^I^^"_+$G(GMPROV)
D AUDIT^GMPLX(CHNGE,"") W "." ; audit trail
D DTMOD^GMPLX(GMPIFN) W "." ; update Dt Last Mod
W "... inactivated!",!
H 1 S GMPSAVED=1
Q
;
NEWNOTE ; -- add a new comment
N GMPFLD
W !!,$$PROBTEXT^GMPLX(GMPIFN)
I '$$CODESTS^GMPLX(GMPIFN,DT) W !,"is inactive. Edit the problem before adding comments.",! H 2 Q
D NOTE^GMPLEDT1 Q:$D(GMPQUIT)!($D(GMPFLD(10,"NEW"))'>9)
D NEWNOTE^GMPLSAVE,DTMOD^GMPLX(GMPIFN)
S GMPSAVED=1
Q
;
DELETE ; -- delete a problem
N PROMPT,DEFAULT,X,Y,CHNGE,GMPFLD
W !!,$$PROBTEXT^GMPLX(GMPIFN)
S PROMPT="REASON FOR REMOVAL: ",DEFAULT=""
D EDNOTE^GMPLEDT4 Q:$D(GMPQUIT) W !
I Y'="" S GMPFLD(10,"NEW",1)=Y D NEWNOTE^GMPLSAVE W "."
S CHNGE=GMPIFN_"^1.02^"_$$HTFM^XLFDT($H)_U_DUZ_"^P^H^Deleted^"_+$G(GMPROV)
S $P(^AUPNPROB(GMPIFN,1),U,2)="H",GMPSAVED=1 W "."
D AUDIT^GMPLX(CHNGE,""),DTMOD^GMPLX(GMPIFN) W "."
W "... removed!",! H 1
Q
;
VERIFY ; -- verify a transcribed problem, if parameter on
N NOW,CHNGE S NOW=$$HTFM^XLFDT($H)
W !!,$$PROBTEXT^GMPLX(GMPIFN),!
I '$$CODESTS^GMPLX(GMPIFN,DT) W "has an inactive ICD9 code. Edit the problem before verification.",! H 2 Q
I $P($G(^AUPNPROB(GMPIFN,1)),U,2)'="T" W "does not require verification.",! H 2 Q
L +^AUPNPROB(GMPIFN,0):1 I '$T W $C(7),$$LOCKED^GMPLX,! H 2 Q
S $P(^AUPNPROB(GMPIFN,1),U,2)="P",GMPSAVED=1 W "."
S CHNGE=GMPIFN_"^1.02^"_NOW_U_DUZ_"^T^P^Verified^"_DUZ W "."
D AUDIT^GMPLX(CHNGE,""),DTMOD^GMPLX(GMPIFN) W "."
L -^AUPNPROB(GMPIFN,0) W " verified.",!
Q
ICDMSG ; If Lexicon returns ICD code 799.9
N DIR,DTOUT,DUOUT
S DIR(0)="YAO"
S DIR("A",1)="<< If you PROCEED WITH THIS NON SPECIFIC TERM, an ICD CODE OF 799.9 >>"
S DIR("A",2)="<< OTHER UNKNOWN AND UNSPECIFIED CAUSE OF MORBIDITY OR MORTALITY >>"
S DIR("A",3)="<< will be assigned. Adding more specificity to your diagnosis may >>"
S DIR("A",4)="<< allow a more accurate ICD code. >>"
S DIR("A",5)=""
S DIR("A")="Continue (YES/NO) ",DIR("B")="NO"
S DIR("T")=DTIME
D ^DIR
I $D(DTOUT)!$D(DUOUT) S Y=0
I +Y=0 S (GMPLY,GMPROB)=""
Q
GMPL1 ; SLC/MKB/AJB/TC -- Problem List actions ; 04/22/03 [5/24/12 9:35am]
+1 ;;2.0;Problem List;**3,20,28,43**;Aug 25, 1994;Build 4
+2 ; 10 MAR 2000 - MA - Added to the routine another user prompt
+3 ; to backup and refine Lexicon search if ICD code 799.9
ADD ;add new entry to list - Requires GMPDFN
+1 NEW GMPROB,GMPTERM,GMPICD,Y,DUP
WRITE !
+2 SET GMPROB=$$TEXT^GMPLEDT4("")
IF GMPROB="^"
SET GMPQUIT=1
QUIT
+3 IF 'GMPARAM("CLU")!('$DATA(GMPLUSER)&('$DATA(^XUSEC("GMPL ICD CODE",DUZ))))
SET GMPTERM=""
SET GMPICD="799.9"
GOTO ADD1
+4 FOR
Begin DoDot:1
+5 DO SEARCH^GMPLX(.GMPROB,.Y,"PROBLEM: ","1")
+6 IF +Y'>0
SET GMPQUIT=1
QUIT
+7 SET DUP=$$DUPL^GMPLX(+GMPDFN,+Y,GMPROB)
+8 IF DUP
IF '$$DUPLOK^GMPLX(DUP)
SET (Y,GMPROB)=""
+9 IF +Y=1
DO ICDMSG
End DoDot:1
IF $DATA(GMPQUIT)!(+$GET(Y))
QUIT
+10 IF $DATA(GMPQUIT)
QUIT
+11 SET GMPTERM=$SELECT(+$GET(Y)>1:Y,1:"")
SET GMPICD=$GET(Y(1))
+12 IF '$LENGTH(GMPICD)
SET GMPICD="799.9"
ADD1 ; set up default values
+1 ; -- May enter here with GMPROB=text,GMPICD=code,GMPTERM=#^term
+2 ; added for Code Set Versioning (CSV)
+3 IF '+$$STATCHK^ICDAPIU(GMPICD,DT)
WRITE !,GMPROB,!,"has an inactive code. Please edit before adding."
HANG 3
QUIT
+4 NEW OK,GMPI,GMPFLD
KILL GMPLJUMP
+5 SET GMPFLD(1.01)=GMPTERM
SET GMPFLD(.05)=U_GMPROB
+6 ;S GMPFLD(.01)=$O(^ICD9("AB",GMPICD_" ",0))_U_GMPICD
+7 ; Replacing direct global read to ^ICD9
SET GMPFLD(.01)=$PIECE($$CODEN^ICDCODE(GMPICD,80),"~")_U_GMPICD
+8 ; cannot resolve code
IF 'GMPFLD(.01)!($PIECE(GMPFLD(.01),U)<0)
SET GMPFLD(.01)=$$NOS^GMPLX
+9 SET (GMPFLD(1.04),GMPFLD(1.05))=$GET(GMPROV)
SET GMPFLD(1.03)=DUZ
+10 SET GMPFLD(1.06)=$$SERVICE^GMPLX1(+GMPFLD(1.04))
SET GMPFLD(1.08)=$GET(GMPCLIN)
+11 SET (GMPFLD(.08),GMPFLD(1.09))=DT_U_$$EXTDT^GMPLX(DT)
+12 SET GMPFLD(.12)="A^ACTIVE"
SET GMPFLD(1.14)=""
SET GMPFLD(10,0)=0
+13 SET GMPFLD(1.02)=$SELECT('$GET(GMPARAM("VER")):"P",$DATA(GMPLUSER):"P",1:"T")
+14 ; initialize dates
SET (GMPFLD(.13),GMPFLD(1.07))=""
+15 SET GMPFLD(1.1)=$SELECT('GMPSC:"0^NO",1:"")
SET GMPFLD(1.11)=$SELECT('GMPAGTOR:"0^NO",1:"")
+16 SET GMPFLD(1.12)=$SELECT('GMPION:"0^NO",1:"")
SET GMPFLD(1.13)=$SELECT('GMPGULF:"0^NO",1:"")
ADD2 ; prompt for values
+1 ; set GMPFLD("FLD") of editable fields
DO FLDS^GMPLEDT3
+2 ; cannot ^-jump here
FOR GMPI=2:1:7
DO @(GMPFLD("FLD",GMPI)_"^GMPLEDT1")
IF $DATA(GMPQUIT)
QUIT
KILL GMPLJUMP
+3 IF $DATA(GMPQUIT)
QUIT
ADD3 ; Ok to save?
+1 ; ok to save values?
SET OK=$$ACCEPT^GMPLDIS1(.GMPFLD)
SET GMPLJUMP=0
+2 IF OK="^"
WRITE !!?10,"< Nothing Saved !! >",!
SET GMPQUIT=1
HANG 1
QUIT
+3 ; ck DA for error?
IF OK
Begin DoDot:1
+4 NEW I
WRITE !!,"Saving ..."
DO NEW^GMPLSAVE
+5 SET I=$SELECT(GMPLIST(0)'>0:1,GMPARAM("REV"):$ORDER(GMPLIST(0))-.01,1:GMPLIST(0)+1)
+6 SET GMPLIST(I)=DA
SET GMPLIST("B",DA)=I
SET GMPLIST(0)=$GET(GMPLIST(0))+1
+7 WRITE " done."
End DoDot:1
QUIT
+8 ; Not ok -- edit values, ask again
+9 ; reset GMPI to desired fld
FOR GMPI=1:1:GMPFLD("FLD",0)
DO @(GMPFLD("FLD",GMPI)_"^GMPLEDT1")
IF $DATA(GMPQUIT)!($DATA(GMPSAVED))
QUIT
IF $GET(GMPLJUMP)
SET GMPI=GMPLJUMP-1
SET GMPLJUMP=0
+10 IF $DATA(DTOUT)
QUIT
KILL GMPQUIT,DUOUT
GOTO ADD3
+11 QUIT
+12 ;
+13 ; *********************************************************************
+14 ; * GMPIFN expected for the following calls:
+15 ;
STATUS ; -- inactivate problem
+1 NEW DIE,DA,DR,X,Y,CHNGE,GMPFLD,PROMPT,DEFAULT
+2 ; Onset
SET GMPFLD(.13)=$PIECE($GET(^AUPNPROB(GMPIFN,0)),U,13)
+3 WRITE !!,$$PROBTEXT^GMPLX(GMPIFN)
DO RESOLVED^GMPLEDT4
IF $DATA(GMPQUIT)
QUIT
+4 SET PROMPT="COMMENT (<60 char): "
SET DEFAULT=""
DO EDNOTE^GMPLEDT4
IF $DATA(GMPQUIT)
QUIT
+5 WRITE !
IF Y'=""
SET GMPFLD(10,"NEW",1)=Y
DO NEWNOTE^GMPLSAVE
WRITE "."
+6 SET DIE="^AUPNPROB("
SET DR=".12///I;1.07////"_$PIECE($GET(GMPFLD(1.07)),U)
+7 SET DA=GMPIFN
DO ^DIE
WRITE "."
+8 SET CHNGE=GMPIFN_"^.12^"_$$HTFM^XLFDT($HOROLOG)_U_DUZ_"^A^I^^"_+$GET(GMPROV)
+9 ; audit trail
DO AUDIT^GMPLX(CHNGE,"")
WRITE "."
+10 ; update Dt Last Mod
DO DTMOD^GMPLX(GMPIFN)
WRITE "."
+11 WRITE "... inactivated!",!
+12 HANG 1
SET GMPSAVED=1
+13 QUIT
+14 ;
NEWNOTE ; -- add a new comment
+1 NEW GMPFLD
+2 WRITE !!,$$PROBTEXT^GMPLX(GMPIFN)
+3 IF '$$CODESTS^GMPLX(GMPIFN,DT)
WRITE !,"is inactive. Edit the problem before adding comments.",!
HANG 2
QUIT
+4 DO NOTE^GMPLEDT1
IF $DATA(GMPQUIT)!($DATA(GMPFLD(10,"NEW"))'>9)
QUIT
+5 DO NEWNOTE^GMPLSAVE
DO DTMOD^GMPLX(GMPIFN)
+6 SET GMPSAVED=1
+7 QUIT
+8 ;
DELETE ; -- delete a problem
+1 NEW PROMPT,DEFAULT,X,Y,CHNGE,GMPFLD
+2 WRITE !!,$$PROBTEXT^GMPLX(GMPIFN)
+3 SET PROMPT="REASON FOR REMOVAL: "
SET DEFAULT=""
+4 DO EDNOTE^GMPLEDT4
IF $DATA(GMPQUIT)
QUIT
WRITE !
+5 IF Y'=""
SET GMPFLD(10,"NEW",1)=Y
DO NEWNOTE^GMPLSAVE
WRITE "."
+6 SET CHNGE=GMPIFN_"^1.02^"_$$HTFM^XLFDT($HOROLOG)_U_DUZ_"^P^H^Deleted^"_+$GET(GMPROV)
+7 SET $PIECE(^AUPNPROB(GMPIFN,1),U,2)="H"
SET GMPSAVED=1
WRITE "."
+8 DO AUDIT^GMPLX(CHNGE,"")
DO DTMOD^GMPLX(GMPIFN)
WRITE "."
+9 WRITE "... removed!",!
HANG 1
+10 QUIT
+11 ;
VERIFY ; -- verify a transcribed problem, if parameter on
+1 NEW NOW,CHNGE
SET NOW=$$HTFM^XLFDT($HOROLOG)
+2 WRITE !!,$$PROBTEXT^GMPLX(GMPIFN),!
+3 IF '$$CODESTS^GMPLX(GMPIFN,DT)
WRITE "has an inactive ICD9 code. Edit the problem before verification.",!
HANG 2
QUIT
+4 IF $PIECE($GET(^AUPNPROB(GMPIFN,1)),U,2)'="T"
WRITE "does not require verification.",!
HANG 2
QUIT
+5 LOCK +^AUPNPROB(GMPIFN,0):1
IF '$TEST
WRITE $CHAR(7),$$LOCKED^GMPLX,!
HANG 2
QUIT
+6 SET $PIECE(^AUPNPROB(GMPIFN,1),U,2)="P"
SET GMPSAVED=1
WRITE "."
+7 SET CHNGE=GMPIFN_"^1.02^"_NOW_U_DUZ_"^T^P^Verified^"_DUZ
WRITE "."
+8 DO AUDIT^GMPLX(CHNGE,"")
DO DTMOD^GMPLX(GMPIFN)
WRITE "."
+9 LOCK -^AUPNPROB(GMPIFN,0)
WRITE " verified.",!
+10 QUIT
ICDMSG ; If Lexicon returns ICD code 799.9
+1 NEW DIR,DTOUT,DUOUT
+2 SET DIR(0)="YAO"
+3 SET DIR("A",1)="<< If you PROCEED WITH THIS NON SPECIFIC TERM, an ICD CODE OF 799.9 >>"
+4 SET DIR("A",2)="<< OTHER UNKNOWN AND UNSPECIFIED CAUSE OF MORBIDITY OR MORTALITY >>"
+5 SET DIR("A",3)="<< will be assigned. Adding more specificity to your diagnosis may >>"
+6 SET DIR("A",4)="<< allow a more accurate ICD code. >>"
+7 SET DIR("A",5)=""
+8 SET DIR("A")="Continue (YES/NO) "
SET DIR("B")="NO"
+9 SET DIR("T")=DTIME
+10 DO ^DIR
+11 IF $DATA(DTOUT)!$DATA(DUOUT)
SET Y=0
+12 IF +Y=0
SET (GMPLY,GMPROB)=""
+13 QUIT