PXRMDOUT ; SLC/PKR - Handle outpatient med findings. ;17-Jun-2015 06:50;du
;;2.0;CLINICAL REMINDERS;**4,1001,12,17,1005**;Feb 04, 2005;Build 23
;DBIA #5187 for PSSCLINR
;IHS/MSC/MGH Patch 1001 and 1005
;===============================================
GETDATA(DAS,FIEVT) ;Return data for an outpatient drug finding.
;DBIA #3793
N ERX,END
S ERX=0
D PSRX^PSOPXRM1(DAS,.FIEVT)
;IHS/MSC/MGH Patch 1001 make changes for e-prescribing
I $P($G(^PSRX($P(DAS,";",1),999999921)),U,3)=1 S ERX=1
I +ERX S END=FIEVT("DAYS SUPPLY")*(FIEVT("REFILLS")+1)
;DBIA #5188
S (FIEVT("STATUS"),FIEVT("VALUE"))=$$STAT^PSO52CLR(FIEVT("STATUS"))
;S FIEVT("START DATE")=FIEVT("RELEASED DATE/TIME")
;S FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),FIEVT("DAYS SUPPLY"))
I ERX=0 D
.S FIEVT("START DATE")=FIEVT("RELEASED DATE/TIME")
.I $G(FIEVT("RELEASED DATE/TIME"))="" S FIEVT("START DATE")=FIEVT("FILL DATE")
I ERX=1 S FIEVT("START DATE")=FIEVT("FILL DATE")
I ERX=0 S FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),FIEVT("DAYS SUPPLY"))
I ERX=1 S FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),END)
S FIEVT("DURATION")=$$DURATION^PXRMDATE(FIEVT("START DATE"),FIEVT("STOP DATE"))
Q
;
;===============================================
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate terms.
D EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
Q
;
;===============================================
MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
N DRUG,JND,NOUT,TEMP,TEXTOUT
S DRUG=IFIEVAL("DISPENSE DRUG")
;DBIA #5187
S DRUG=$S(+DRUG=0:DRUG,1:$$DRUG^PSSCLINR(DRUG))
S TEMP="Outpatient Drug: "_DRUG_" = "
S TEMP=TEMP_"("_$$EDATE^PXRMDATE(IFIEVAL("START DATE"))
S TEMP=TEMP_" - "_$$EDATE^PXRMDATE(IFIEVAL("STOP DATE"))_")"
D FORMATS^PXRMTEXT(INDENT+1,PXRMRM,TEMP,.NOUT,.TEXTOUT)
F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
Q
;
;===============================================
OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
;maintenance output.
N DRUG,JND,NOUT,TEMP,TEXTOUT
S DRUG=IFIEVAL("DISPENSE DRUG")
S DRUG=$S(+DRUG=0:DRUG,1:$$DRUG^PSSCLINR(DRUG))
S NLINES=NLINES+1
S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Outpatient Medication: "_DRUG
S TEMP=$$EDATE^PXRMDATE(IFIEVAL("DATE"))_" Status: "_IFIEVAL("STATUS")_"\\"
S TEMP=TEMP_"Start date: "_$$EDATE^PXRMDATE(IFIEVAL("START DATE"))
S TEMP=TEMP_" Stop date: "_$$EDATE^PXRMDATE(IFIEVAL("STOP DATE"))
I $D(IFIEVAL("DURATION")) S TEMP=TEMP_" Duration: "_IFIEVAL("DURATION")_" D"_"\\"
S TEMP=TEMP_"Last release date: "_$$EDATE^PXRMDATE(IFIEVAL("RELEASED DATE/TIME"))
S TEMP=TEMP_" Days supply: "_IFIEVAL("DAYS SUPPLY")
D FORMATS^PXRMTEXT(INDENT+1,PXRMRM,TEMP,.NOUT,.TEXTOUT)
F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
S NLINES=NLINES+1,TEXT(NLINES)=""
Q
;
PXRMDOUT ; SLC/PKR - Handle outpatient med findings. ;17-Jun-2015 06:50;du
+1 ;;2.0;CLINICAL REMINDERS;**4,1001,12,17,1005**;Feb 04, 2005;Build 23
+2 ;DBIA #5187 for PSSCLINR
+3 ;IHS/MSC/MGH Patch 1001 and 1005
+4 ;===============================================
GETDATA(DAS,FIEVT) ;Return data for an outpatient drug finding.
+1 ;DBIA #3793
+2 NEW ERX,END
+3 SET ERX=0
+4 DO PSRX^PSOPXRM1(DAS,.FIEVT)
+5 ;IHS/MSC/MGH Patch 1001 make changes for e-prescribing
+6 IF $PIECE($GET(^PSRX($PIECE(DAS,";",1),999999921)),U,3)=1
SET ERX=1
+7 IF +ERX
SET END=FIEVT("DAYS SUPPLY")*(FIEVT("REFILLS")+1)
+8 ;DBIA #5188
+9 SET (FIEVT("STATUS"),FIEVT("VALUE"))=$$STAT^PSO52CLR(FIEVT("STATUS"))
+10 ;S FIEVT("START DATE")=FIEVT("RELEASED DATE/TIME")
+11 ;S FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),FIEVT("DAYS SUPPLY"))
+12 IF ERX=0
Begin DoDot:1
+13 SET FIEVT("START DATE")=FIEVT("RELEASED DATE/TIME")
+14 IF $GET(FIEVT("RELEASED DATE/TIME"))=""
SET FIEVT("START DATE")=FIEVT("FILL DATE")
End DoDot:1
+15 IF ERX=1
SET FIEVT("START DATE")=FIEVT("FILL DATE")
+16 IF ERX=0
SET FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),FIEVT("DAYS SUPPLY"))
+17 IF ERX=1
SET FIEVT("STOP DATE")=$$FMADD^XLFDT(FIEVT("START DATE"),END)
+18 SET FIEVT("DURATION")=$$DURATION^PXRMDATE(FIEVT("START DATE"),FIEVT("STOP DATE"))
+19 QUIT
+20 ;
+21 ;===============================================
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate terms.
+1 DO EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
+2 QUIT
+3 ;
+4 ;===============================================
MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
+1 NEW DRUG,JND,NOUT,TEMP,TEXTOUT
+2 SET DRUG=IFIEVAL("DISPENSE DRUG")
+3 ;DBIA #5187
+4 SET DRUG=$SELECT(+DRUG=0:DRUG,1:$$DRUG^PSSCLINR(DRUG))
+5 SET TEMP="Outpatient Drug: "_DRUG_" = "
+6 SET TEMP=TEMP_"("_$$EDATE^PXRMDATE(IFIEVAL("START DATE"))
+7 SET TEMP=TEMP_" - "_$$EDATE^PXRMDATE(IFIEVAL("STOP DATE"))_")"
+8 DO FORMATS^PXRMTEXT(INDENT+1,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+9 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
+10 QUIT
+11 ;
+12 ;===============================================
OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
+1 ;maintenance output.
+2 NEW DRUG,JND,NOUT,TEMP,TEXTOUT
+3 SET DRUG=IFIEVAL("DISPENSE DRUG")
+4 SET DRUG=$SELECT(+DRUG=0:DRUG,1:$$DRUG^PSSCLINR(DRUG))
+5 SET NLINES=NLINES+1
+6 SET TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Outpatient Medication: "_DRUG
+7 SET TEMP=$$EDATE^PXRMDATE(IFIEVAL("DATE"))_" Status: "_IFIEVAL("STATUS")_"\\"
+8 SET TEMP=TEMP_"Start date: "_$$EDATE^PXRMDATE(IFIEVAL("START DATE"))
+9 SET TEMP=TEMP_" Stop date: "_$$EDATE^PXRMDATE(IFIEVAL("STOP DATE"))
+10 IF $DATA(IFIEVAL("DURATION"))
SET TEMP=TEMP_" Duration: "_IFIEVAL("DURATION")_" D"_"\\"
+11 SET TEMP=TEMP_"Last release date: "_$$EDATE^PXRMDATE(IFIEVAL("RELEASED DATE/TIME"))
+12 SET TEMP=TEMP_" Days supply: "_IFIEVAL("DAYS SUPPLY")
+13 DO FORMATS^PXRMTEXT(INDENT+1,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+14 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
+15 SET NLINES=NLINES+1
SET TEXT(NLINES)=""
+16 QUIT
+17 ;