[623] | 1 | PXRMMH ; SLC/PKR - Handle mental health findings. ;04/05/2005
|
---|
| 2 | ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
|
---|
| 3 | ;
|
---|
| 4 | ;=======================================================
|
---|
| 5 | EVALFI(DFN,DEFARR,ENODE,FIEVAL) ;Evaluate mental health findings.
|
---|
| 6 | D EVALFI^PXRMINDX(DFN,.DEFARR,ENODE,.FIEVAL)
|
---|
| 7 | Q
|
---|
| 8 | ;
|
---|
| 9 | ;=======================================================
|
---|
| 10 | EVALPL(FINDPA,ENODE,TERMARR,PLIST) ;Evaluate mental health term findings
|
---|
| 11 | ;for patient lists.
|
---|
| 12 | D EVALPL^PXRMINDL(.FINDPA,ENODE,.TERMARR,PLIST)
|
---|
| 13 | Q
|
---|
| 14 | ;=======================================================
|
---|
| 15 | EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate mental
|
---|
| 16 | ;health instrument terms.
|
---|
| 17 | D EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
|
---|
| 18 | Q
|
---|
| 19 | ;
|
---|
| 20 | ;=======================================================
|
---|
| 21 | GETDATA(DAS,FIEVT) ;Return the data for a Psych Instrument Patient entry.
|
---|
| 22 | ;Some tests require the YSP key in order to get a score.
|
---|
| 23 | N DASP,IND,SCALE,YSDATA
|
---|
| 24 | ;DBIA #4442
|
---|
| 25 | S DASP=$P(DAS,"S",1)
|
---|
| 26 | S SCALE=$P(DAS,"S",2)
|
---|
| 27 | D ENDAS^YTAPI10(.YSDATA,DASP)
|
---|
| 28 | I $G(YSDATA(0))="[ERROR]" Q
|
---|
| 29 | S FIEVT("MH TEST")=$P(YSDATA(2),U,3)
|
---|
| 30 | I FIEVT("MH TEST")["GAF" S FIEVT("RATING")=$P(YSDATA(3),U,2) Q
|
---|
| 31 | ;If no scale is specified use the first set of results.
|
---|
| 32 | S IND=$S(SCALE="":6,1:SCALE+5)
|
---|
| 33 | S FIEVT("YSDATA")=$G(YSDATA(IND))
|
---|
| 34 | S FIEVT("SCALE NAME")=$P(FIEVT("YSDATA"),U,2)
|
---|
| 35 | S (FIEVT("RAW SCORE"),FIEVT("VALUE"))=$P(FIEVT("YSDATA"),U,3)
|
---|
| 36 | S FIEVT("TRANSFORMED SCORE")=$P(FIEVT("YSDATA"),U,4)
|
---|
| 37 | Q
|
---|
| 38 | ;
|
---|
| 39 | ;=======================================================
|
---|
| 40 | MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
|
---|
| 41 | N DATE,IND,JND,MHTEST,NAME,NOUT,RATING,RSCORE,SCORE,TEXTOUT,TSCORE
|
---|
| 42 | S MHTEST=IFIEVAL("MH TEST")
|
---|
| 43 | ;Remove the dashes surrounding the name.
|
---|
| 44 | S MHTEST=$TR(MHTEST,"-","")
|
---|
| 45 | S NAME="Mental Health Test: "_MHTEST_" = "
|
---|
| 46 | S IND=0
|
---|
| 47 | F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
|
---|
| 48 | . S DATE=IFIEVAL(IND,"DATE")
|
---|
| 49 | . S RSCORE=$G(IFIEVAL(IND,"RAW SCORE"))
|
---|
| 50 | . S TSCORE=$G(IFIEVAL(IND,"TRANSFORMED SCORE"))
|
---|
| 51 | . S RATING=$G(IFIEVAL(IND,"RATING"))
|
---|
| 52 | . S SCORE=$S(RATING'="":RATING,TSCORE'="":TSCORE,RSCORE'="":RSCORE,1:"")
|
---|
| 53 | . S TEMP=NAME_SCORE_" ("_$$EDATE^PXRMDATE(IFIEVAL(IND,"DATE"))_")"
|
---|
| 54 | . D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
|
---|
| 55 | . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
|
---|
| 56 | S NLINES=NLINES+1,TEXT(NLINES)=""
|
---|
| 57 | Q
|
---|
| 58 | ;
|
---|
| 59 | ;=======================================================
|
---|
| 60 | OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
|
---|
| 61 | ;maintenance output.
|
---|
| 62 | N DATE,IND,JND,MHTEST,NOUT,RATING,RSCORE,TEXTOUT,TSCORE
|
---|
| 63 | S MHTEST=IFIEVAL("MH TEST")
|
---|
| 64 | ;Remove the dashes surrounding the name.
|
---|
| 65 | S MHTEST=$TR(MHTEST,"-","")
|
---|
| 66 | S NLINES=NLINES+1
|
---|
| 67 | S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Mental Health Test: "_MHTEST
|
---|
| 68 | S IND=0
|
---|
| 69 | F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
|
---|
| 70 | . S DATE=IFIEVAL(IND,"DATE")
|
---|
| 71 | . S TEMP=$$EDATE^PXRMDATE(IFIEVAL(IND,"DATE"))
|
---|
| 72 | . S RSCORE=$G(IFIEVAL(IND,"RAW SCORE"))
|
---|
| 73 | . I RSCORE'="" S TEMP=TEMP_" raw score - "_RSCORE
|
---|
| 74 | . S TSCORE=$G(IFIEVAL(IND,"TRANSFORMED SCORE"))
|
---|
| 75 | . I TSCORE'="" S TEMP=TEMP_"; transformed score - "_TSCORE
|
---|
| 76 | . S RATING=$G(IFIEVAL(IND,"RATING"))
|
---|
| 77 | . I RATING'="" S TEMP=TEMP_" Rating: "_RATING
|
---|
| 78 | . D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
|
---|
| 79 | . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
|
---|
| 80 | S NLINES=NLINES+1,TEXT(NLINES)=""
|
---|
| 81 | Q
|
---|
| 82 | ;
|
---|
| 83 | ;=======================================================
|
---|
| 84 | SCHELP(MHIEN) ;Xecutable help for MH SCALE
|
---|
| 85 | N IND,JND,NUM,SCALE,TEMP,TEMP1
|
---|
| 86 | I MHIEN=0 D Q
|
---|
| 87 | . S SCALE(1)="This is not a valid Mental Health finding, selecting an MH scale does"
|
---|
| 88 | . S SCALE(2)="not make sense"
|
---|
| 89 | . D EN^DDIOL(.SCALE)
|
---|
| 90 | S SCALE(1)="SCALE NUMBER SCALE NAME"
|
---|
| 91 | S SCALE(2)="------------------------"
|
---|
| 92 | S IND=0
|
---|
| 93 | S JND=2
|
---|
| 94 | F S IND=$O(^YTT(601,MHIEN,"S",IND)) Q:+IND=0 D
|
---|
| 95 | . S TEMP=^YTT(601,MHIEN,"S",IND,0)
|
---|
| 96 | . S JND=JND+1
|
---|
| 97 | . S TEMP1=$P(TEMP,U,1)
|
---|
| 98 | . S NUM=6-$L(TEMP1)
|
---|
| 99 | . S SCALE(JND)=$$INSCHR^PXRMEXLC(NUM," ")_TEMP1_" "_$P(TEMP,U,2)
|
---|
| 100 | D EN^DDIOL(.SCALE)
|
---|
| 101 | Q
|
---|
| 102 | ;
|
---|
| 103 | ;=======================================================
|
---|
| 104 | SCHELPF ;Xecutable help for MH SCALE in 811.9 findings.
|
---|
| 105 | N FIND0,MHIEN
|
---|
| 106 | S FIND0=^PXD(811.9,DA(1),20,DA,0)
|
---|
| 107 | I FIND0["YTT(601" S MHIEN=$P(FIND0,";",1)
|
---|
| 108 | E S MHIEN=0
|
---|
| 109 | D SCHELP(MHIEN)
|
---|
| 110 | Q
|
---|
| 111 | ;
|
---|
| 112 | ;=======================================================
|
---|
| 113 | SCHELPT ;Xecutable help for MH SCALE in 811.5 findings.
|
---|
| 114 | N MHIEN,TFIND0
|
---|
| 115 | S TFIND0=^PXRMD(811.5,DA(1),20,DA,0)
|
---|
| 116 | I TFIND0["YTT(601" S MHIEN=$P(TFIND0,";",1)
|
---|
| 117 | E S MHIEN=0
|
---|
| 118 | D SCHELP(MHIEN)
|
---|
| 119 | Q
|
---|
| 120 | ;
|
---|
| 121 | ;=======================================================
|
---|
| 122 | SEVALFI(DFN,ITEM,NGET,SDIR,BDT,EDT,NFOUND,FLIST) ;
|
---|
| 123 | N FIEV,FINDING,IND,YS,YSDATA
|
---|
| 124 | S YS("CODE")=ITEM,YS("DFN")=DFN
|
---|
| 125 | S YS("BEGIN")=BDT,YS("END")=EDT
|
---|
| 126 | ;YTAPI10A does not understand "*" for a limit so use 99.
|
---|
| 127 | I NGET="*" S NGET=99
|
---|
| 128 | S YS("LIMIT")=$S(SDIR=-1:NGET,1:-NGET)
|
---|
| 129 | ;DBIA #4458
|
---|
| 130 | D PTTEST^YTAPI10A(.YSDATA,.YS)
|
---|
| 131 | S NFOUND=$P(YSDATA(1),U,2)
|
---|
| 132 | I NFOUND=0 Q
|
---|
| 133 | F IND=1:1:NFOUND S FLIST(IND)=YSDATA(IND+1)
|
---|
| 134 | Q
|
---|
| 135 | ;
|
---|
| 136 | ;=======================================================
|
---|
| 137 | SEVALPL(ITEM,NOCC,BDT,EDT,PLIST) ;Use MH API to get patient list. Called
|
---|
| 138 | ;from PXRMINDL.
|
---|
| 139 | N YS
|
---|
| 140 | ;YTAPI10A does not understand "*" for a limit so use 99.
|
---|
| 141 | I NOCC="*" S NOCC=99
|
---|
| 142 | S YS("CODE")=ITEM,YS("BEGIN")=BDT,YS("END")=EDT,YS("LIMIT")=NOCC
|
---|
| 143 | ;DBIA #4458
|
---|
| 144 | D OCCUR^YTAPI10A(PLIST,.YS)
|
---|
| 145 | Q
|
---|
| 146 | ;
|
---|
| 147 | ;=======================================================
|
---|
| 148 | VSCALE(X,FIND0) ;Make sure that the mental health scale is valid.
|
---|
| 149 | ;Either the scale number or the scale name can be used.
|
---|
| 150 | N MHIEN,MHTEST,SCALE,VALID
|
---|
| 151 | S MHTEST=$P(FIND0,U,1)
|
---|
| 152 | S MHIEN=$P(MHTEST,";",1)
|
---|
| 153 | I +X>0 D Q VALID
|
---|
| 154 | . S VALID=$S($D(^YTT(601,MHIEN,"S",X)):1,1:0)
|
---|
| 155 | E D
|
---|
| 156 | . S SCALE=$O(^YTT(601,MHIEN,"S","C",X,""))
|
---|
| 157 | . S VALID=$S(SCALE="":0,1:1)
|
---|
| 158 | Q VALID
|
---|
| 159 | ;
|
---|
| 160 | ;=======================================================
|
---|
| 161 | VSCALEF(X) ;Make sure that the mental health scale is valid for a finding.
|
---|
| 162 | I X="" Q 1
|
---|
| 163 | ;Do not execute as part of a verify fields.
|
---|
| 164 | I $G(DIUTIL)="VERIFY FIELDS" Q 1
|
---|
| 165 | ;Do not execute as part of exchange.
|
---|
| 166 | I $G(PXRMEXCH) Q 1
|
---|
| 167 | N FIND0
|
---|
| 168 | S FIND0=^PXD(811.9,DA(1),20,DA,0)
|
---|
| 169 | Q $$VSCALE(X,FIND0)
|
---|
| 170 | ;
|
---|
| 171 | ;=======================================================
|
---|
| 172 | VSCALET(X) ;Make sure that the mental health scale is valid for a
|
---|
| 173 | ;term finding.
|
---|
| 174 | I X="" Q 1
|
---|
| 175 | ;Do not execute as part of a verify fields.
|
---|
| 176 | I $G(DIUTIL)="VERIFY FIELDS" Q 1
|
---|
| 177 | ;Do not execute as part of exchange.
|
---|
| 178 | I $G(PXRMEXCH) Q 1
|
---|
| 179 | N TFIND0
|
---|
| 180 | S TFIND0=^PXRMD(811.5,DA(1),20,DA,0)
|
---|
| 181 | Q $$VSCALE(X,TFIND0)
|
---|
| 182 | ;
|
---|