| 1 | GMRPNOR1 ;SLC/MKB/DJP Progress Note- OE/RR interface;; 2-14-97 ; 7-DEC-1999 12:10:24
 | 
|---|
| 2 |  ;;2.5;Progress Notes;**25,45,50**;Jan 08, 1993
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; this rtn is needed by TIU to support the one letter CWAD indicators
 | 
|---|
| 5 |  ; in OE/RR 2.5 screens- subroutine CWAD
 | 
|---|
| 6 |  ; DO NOT delete this rtn when the GMRP* rtns are deleted in the
 | 
|---|
| 7 |  ; TIU clean-up
 | 
|---|
| 8 |  ;
 | 
|---|
| 9 | SELPT ;select new patient using IN^OR to update ORVP, etc. GMRP*2.5*50
 | 
|---|
| 10 |  ; IN^OR doesn't exist, code no longer used
 | 
|---|
| 11 |  ;K DIC,Y,DIROUT S GMRPOLD=$G(ORVP)
 | 
|---|
| 12 |  ;D IN^OR I $D(DIROUT) S GMRPEND=1 Q
 | 
|---|
| 13 |  ;I (ORVP=GMRPOLD) S XQORM("B")="Redisplay Screen" K GMRPOLD Q
 | 
|---|
| 14 |  ;K GMRPOLD D PAT Q:$D(GMRPQT)  S:'$D(GMRPCTXT) GMRPCTXT=1
 | 
|---|
| 15 |  ;D @("BUILD"_GMRPCTXT_"^GMRPNOR"),SCREEN^GMRPNOR
 | 
|---|
| 16 |  ;Q
 | 
|---|
| 17 | PAT ;set up patient info for use - expects ORVP or DFN
 | 
|---|
| 18 |  S GMRPDFN=$S($D(ORVP):$P(ORVP,";"),$D(DFN):DFN,1:0)
 | 
|---|
| 19 |  I +GMRPDFN'>0 D  Q:$D(GMRPQT)
 | 
|---|
| 20 |  .S DIC="^DPT(",DIC(0)="AEQM" D ^DIC K DIC
 | 
|---|
| 21 |  .I +Y<1 S GMRPQT=1 Q
 | 
|---|
| 22 |  .S GMRPDFN=+Y
 | 
|---|
| 23 |  N DFN S DFN=+GMRPDFN D OERR^VADPT
 | 
|---|
| 24 |  S $P(GMRPDFN,U,2)=VADM(1),GMRPSSN=VA("PID")
 | 
|---|
| 25 |  S GMRPDOB=VADM(3),GMRPAGE=VADM(4),GMRPRB=VAIN(5),GMRPLOC=$P(VAIN(4),U)
 | 
|---|
| 26 |  S GMRPLOC=$P($G(^DIC(42,+GMRPLOC,44)),U)
 | 
|---|
| 27 |  S:GMRPLOC>0 $P(GMRPLOC,U,2)=$P(^SC(+GMRPLOC,0),U)
 | 
|---|
| 28 |  K VAIN,VADM,GMRPCWAD S GMRPCWAD=$$CWAD(GMRPDFN)
 | 
|---|
| 29 |  Q
 | 
|---|
| 30 | CWAD(GMRPDFN) ;;check if any clinical warnings exist for patient
 | 
|---|
| 31 |  ;Returns GMRPCWAD="CWAD" (for ones found), or "" if none
 | 
|---|
| 32 |  ;S DFN (below) needed for hidden action CWAD^TIULX 
 | 
|---|
| 33 |  ; N GMRPCWAD,GMRPCWA1,TIUST,GMRPALG,GMRPI
 | 
|---|
| 34 |  N GMRPCWA1,GMRPI
 | 
|---|
| 35 |  I '+GMRPDFN Q ""
 | 
|---|
| 36 |  S GMRPCWAD=""
 | 
|---|
| 37 |  S GMRPCWA1=""
 | 
|---|
| 38 |  F GMRPI=7,8 D
 | 
|---|
| 39 |  . I $D(^TIU(8925,"ADCPT",+GMRPDFN,30,GMRPI)) S GMRPCWA1=GMRPCWA1_"C"
 | 
|---|
| 40 |  . I $D(^TIU(8925,"ADCPT",+GMRPDFN,31,GMRPI)) S GMRPCWA1=GMRPCWA1_"W"
 | 
|---|
| 41 |  . I $D(^TIU(8925,"ADCPT",+GMRPDFN,27,GMRPI)) S GMRPCWA1=GMRPCWA1_"D"
 | 
|---|
| 42 |  . Q
 | 
|---|
| 43 |  S DFN=GMRPDFN D ALLERGY^GMRPNCW I $D(GMRPALG) S GMRPCWA1=GMRPCWA1_"A"
 | 
|---|
| 44 |  F GMRPI="C","W","D","A" D
 | 
|---|
| 45 |  . I GMRPCWA1[GMRPI S GMRPCWAD=GMRPCWAD_GMRPI
 | 
|---|
| 46 |  K CWA,TIUST,GMRPALG
 | 
|---|
| 47 |  Q GMRPCWAD
 | 
|---|
| 48 |  ;
 | 
|---|
| 49 | QUIT ;quits out of review screen
 | 
|---|
| 50 |  S GMRPEND=1
 | 
|---|
| 51 |  Q
 | 
|---|
| 52 | SEL ;selects single note from screen -- assumes GMRPN(GMRPNN) array
 | 
|---|
| 53 |  S DIR(0)="NAO^1:"_GMRPNN,DIR("A")="Select a note: "
 | 
|---|
| 54 |  S DIR("?")="Enter the display number of the note you wish to amend."
 | 
|---|
| 55 |  S DIR("??")="^D HELPASK1^GMRPND" D ^DIR K DIR
 | 
|---|
| 56 |  I $D(DTOUT)!($D(DIRUT))!($D(DIROUT)) S GMRPQT=1 Q
 | 
|---|
| 57 |  S GMRPIFN=GMRPN(+Y)
 | 
|---|
| 58 |  I $D(GMRPADDM),$P($G(^GMR(121,GMRPIFN,5)),U)=1 D  Q
 | 
|---|
| 59 |  .W !!,"This note requires a cosignature before it may be amended!"
 | 
|---|
| 60 |  .W $C(7) S GMRPQT=1 K GMRPIFN
 | 
|---|
| 61 |  D DISPL^GMRPN2 K:'$D(DIROUT)&('$D(DTOUT)) GMRPQT,DUOUT
 | 
|---|
| 62 |  Q
 | 
|---|
| 63 | CURR ;Redisplay current screen -- needs GMRPPG & calls SCREEN
 | 
|---|
| 64 |  I $S('$D(GMRPPG):1,GMRPPG'>0:1,1:0) S GMRPPG=1
 | 
|---|
| 65 |  D SCREEN^GMRPNOR
 | 
|---|
| 66 |  Q
 | 
|---|
| 67 | NEXT ;Display next screen -- needs GMRPPG & calls SCREEN
 | 
|---|
| 68 |  I $S('$D(GMRPPG):1,GMRPPG'>0:1,1:0) S GMRPPG=1
 | 
|---|
| 69 |  I GMRPPG<GMRPN("PG") S GMRPPG=GMRPPG+1
 | 
|---|
| 70 |  D SCREEN^GMRPNOR
 | 
|---|
| 71 |  Q
 | 
|---|
| 72 | PREV ;Display previous screen -- needs GMRPPG & calls SCREEN
 | 
|---|
| 73 |  I $S('$D(GMRPPG):1,GMRPPG'>0:1,1:0) S GMRPPG=1
 | 
|---|
| 74 |  I GMRPPG>1 S GMRPPG=GMRPPG-1
 | 
|---|
| 75 |  D SCREEN^GMRPNOR
 | 
|---|
| 76 |  Q
 | 
|---|
| 77 | CTXT ;Select new context for viewing/acting on notes
 | 
|---|
| 78 |  ;Requires/Returns GMRPCTXT
 | 
|---|
| 79 |  S DIR(0)="SAO^1:SIGNED;2:UNSIGNED;3:UNCOSIGNED;4:AUTHOR;5:DATES"
 | 
|---|
| 80 |  S DIR("A")="Select context: ",DIR("A",1)="Valid selections are:"
 | 
|---|
| 81 |  S DIR("A",2)="  1 - signed notes (all)   2 - unsigned notes       3 - uncosigned notes"
 | 
|---|
| 82 |  S DIR("A",3)="  4 - signed notes/author  5 - signed notes/dates",DIR("A",4)="   "
 | 
|---|
| 83 |  S DIR("?",1)="To change which notes are displayed, select the number"
 | 
|---|
| 84 |  S DIR("?")="of the context you wish to work within.",DIR("B")="1"
 | 
|---|
| 85 |  W ! D ^DIR K DIR S:$D(DIROUT) GMRPEND=1
 | 
|---|
| 86 |  Q:$D(DUOUT)!($D(DTOUT))!($D(DIROUT))
 | 
|---|
| 87 |  S GMRPSAV=Y D AUTHOR:Y=4,DATES^GMRPNP:Y=5 Q:$D(GMRPQT)
 | 
|---|
| 88 |  S GMRPCTXT=GMRPSAV K GMRPBLD,GMRPSAV
 | 
|---|
| 89 |  Q
 | 
|---|
| 90 | AUTHOR ;selects author - Returns GMRPDUZ=#^NAME or GMRPQT
 | 
|---|
| 91 |  S DIC="^VA(200,",DIC(0)="AEQM",DIC("A")="Select AUTHOR: "
 | 
|---|
| 92 |  S DIC("B")=$P(^VA(200,DUZ,0),U) D ^DIC K DIC
 | 
|---|
| 93 |  I '$T!(+Y<1) S GMRPQT=1 S:$D(DIROUT) GMRPEND=1 Q
 | 
|---|
| 94 |  S GMRPDUZ=Y K GMRPQT
 | 
|---|
| 95 |  Q
 | 
|---|
| 96 | SETERM ;sets up GMRPTRML variable to hi-lite <CWAD> flag on review screen
 | 
|---|
| 97 |  ;node 5 = inverse display, node 7 = highlighted display
 | 
|---|
| 98 |  S GMRPTRML="" Q:'$D(IOST)  Q:'$L(IOST)
 | 
|---|
| 99 |  S X=$O(^%ZIS(2,"B",IOST,0))
 | 
|---|
| 100 |  ;I X,$D(^%ZIS(2,X)) S GMRPTRML=$S($D(^(X,5)):$P(^(5),U,4,5),1:"")
 | 
|---|
| 101 |  I X,$D(^%ZIS(2,X)) S GMRPTRML=$S($D(^(X,7)):$P(^(7),U,1,3),1:"")
 | 
|---|
| 102 |  I  S:'$L($P(GMRPTRML,U,3)) $P(GMRPTRML,U,3)=$P(GMRPTRML,U,2)
 | 
|---|
| 103 |  F GMRPI=1,3 I '$L($P(GMRPTRML,U,GMRPI)) S GMRPTRML="" Q
 | 
|---|
| 104 |  K GMRPI Q
 | 
|---|
| 105 | INV() I '$L(X) Q ""
 | 
|---|
| 106 |  N DX,DY S DX=$X,DY=$Y W @X X ^%ZOSF("XY")
 | 
|---|
| 107 |  Q ""
 | 
|---|
| 108 | UNSIGN ;entry point for follow-up action on unsigned pn's
 | 
|---|
| 109 |  N ORVP S XQAKILL=0
 | 
|---|
| 110 |  S GMRPCTXT=2,ORVP=$P($G(XQAID),",",2)_";DPT("
 | 
|---|
| 111 |  S X=$O(^ORD(101,"B","GMRP REVIEW SCREEN",0))_";ORD(101," D EN^XQOR  ;WPB/CAM REMOVE B START OF LINE
 | 
|---|
| 112 |  Q
 | 
|---|
| 113 | COSIGN ;entry point for follow-up action on uncosigned pn's
 | 
|---|
| 114 |  N ORVP S XQAKILL=0
 | 
|---|
| 115 |  S GMRPCTXT=3,ORVP=$P($G(XQAID),",",2)_";DPT("
 | 
|---|
| 116 |  S X=$O(^ORD(101,"B","GMRP REVIEW SCREEN",0))_";ORD(101," D EN^XQOR
 | 
|---|
| 117 |  Q
 | 
|---|