PSOERXOG ;ALB/BWF - eRx parsing Utilities ; 11/14/2019 3:46pm
;;7.0;OUTPATIENT PHARMACY;**581,746**;DEC 1997;Build 106
;
Q
; GBL - Global location for XML storage
; CNT - counter, passed by reference
; ERXIEN - ien of the ERx
; MTYP - medication type to build
; NOTEOVR - note override for rxchangerequest messages
MEDS(GBL,CNT,ERXIEN,MTYPE,NOTEOVR) ;
N MEDIEN,MEDDAT,F,TYPE,DRUGDESC,DCPCODE,DCPCQUAL,DCSTRVAL,DCSTRFRM,DCSTRUOM,DCDDBC,DCDQUAL,DCDEASCH,QVAL,QCLQUAL
N QUOM,DAYS,WDATE,SFDATE,SUBS,NUMREF,PRAUTH,PRAUTHST,NOTE,SNOMED,FMT,DONOTFIL,TZID,TZDIFF,OCAPMETH
N REA4SUBS,SPSCRIPT,RXFILL,DELREQ,DELLOC,DIABFREQ,DIABINDC,DIABDEP,DEAVDEV,DIABNOTE,DIABDEV
N INJREL,TREATIND,PROPHEPI,TREATCYC,NUMCYCLE,PRESREMS,RESMRISK,REMSAUTH,PHRITRTE,FLAVREQ,PHRMDOSE,NUMPACK
N NNLDATE,NNLREAS,PSOPROD,PROVAUTH,HTAG,TAG,DIAVDEV,IENS,LFDATE,PHTITRTE,REMSRISK,MESTYPE,RESVAL
Q:'$O(^PS(52.49,ERXIEN,311,"C",MTYPE,0))
S MESTYPE=$$GET1^DIQ(52.49,ERXIEN,.08,"I"),RESVAL=$$GET1^DIQ(52.49,ERXIEN,52.1,"I")
S HTAG=0
S MEDIEN=0 F S MEDIEN=$O(^PS(52.49,ERXIEN,311,"C",MTYPE,MEDIEN)) Q:'MEDIEN D
.K MEDDAT
.S IENS=MEDIEN_","_ERXIEN_","
.S F=52.49311
.D GETS^DIQ(F,IENS,"**","IE","MEDDAT")
.;populate 2017 vars
.S TYPE=$$GET1^DIQ(F,IENS,.02,"I")
.S TAG=$S((TYPE="P")!((MESTYPE="RE")):"MedicationPrescribed",TYPE="D":"MedicationDispensed",TYPE="R":"MedicationRequested",1:"")
.Q:TAG=""
.; if the header tag has not yet been built, build it. Otherwise bypass
.I 'HTAG D
..D C S @GBL@(CNT,0)="<"_TAG_">" S HTAG=1
.S DRUGDESC=$G(MEDDAT(F,IENS,.03,"E"))
.S DCPCODE=$G(MEDDAT(F,IENS,1.1,"E"))
.S DCPCQUAL=$G(MEDDAT(F,IENS,1.2,"E"))
.S DCSTRVAL=$G(MEDDAT(F,IENS,1.3,"E"))
.S DCSTRFRM=$G(MEDDAT(F,IENS,1.4,"E"))
.S DCSTRUOM=$G(MEDDAT(F,IENS,1.5,"E"))
.S DCDDBC=$G(MEDDAT(F,IENS,1.6,"E"))
.S DCDQUAL=$G(MEDDAT(F,IENS,1.7,"E"))
.S DCDEASCH=$G(MEDDAT(F,IENS,1.8,"E")) ; come back - failing to file, no result at $$presolv^psoerxa1
.S QVAL=$G(MEDDAT(F,IENS,2.1,"E"))
.S QCLQUAL=$G(MEDDAT(F,IENS,2.2,"E"))
.S QUOM=$G(MEDDAT(F,IENS,2.3,"E"))
.S DAYS=$G(MEDDAT(F,IENS,2.4,"E"))
.S WDATE=$G(MEDDAT(F,IENS,2.5,"I")) ; will convert in future with outbound date function, yet to be built
.S WDATE=$P(WDATE,"@",1)
.I $G(WDATE) S WDATE=$P($$EXTIME^PSOERXO1(WDATE),"T")
.S LFDATE=$G(MEDDAT(F,IENS,2.6,"I")) ; will convert in future with outbound date function, yet to be built
.I $G(LFDATE) S LFDATE=$P($$EXTIME^PSOERXO1(LFDATE),"T")
.S SUBS=$G(MEDDAT(F,IENS,2.7,"I"))
.S NUMREF=$G(MEDDAT(F,IENS,2.8,"E"))
.S PRAUTH=$G(MEDDAT(F,IENS,4.1,"E"))
.S PRAUTHST=$G(MEDDAT(F,IENS,4.2,"I"))
.S NOTE=$S($G(NOTEOVR)]"":$G(NOTEOVR),1:(MEDDAT(F,IENS,5,"E")))
.S SNOMED=$G(MEDDAT(F,IENS,9.1,"E"))
.S FMT=$G(MEDDAT(F,IENS,9.2,"E"))
.S DONOTFIL=$G(MEDDAT(F,IENS,16.1,"I"))
.S TZID=$G(MEDDAT(F,IENS,16.2,"I"))
.S TZDIFF=$G(MEDDAT(F,IENS,16.3,"E"))
.S OCAPMETH=$G(MEDDAT(F,IENS,16.4,"I"))
.S REA4SUBS=$G(MEDDAT(F,IENS,16.5,"I"))
.S SPSCRIPT=$G(MEDDAT(F,IENS,16.6,"I"))
.S RXFILL=$G(MEDDAT(F,IENS,16.7,"E"))
.S DELREQ=$G(MEDDAT(F,IENS,18.1,"I"))
.S DELLOC=$G(MEDDAT(F,IENS,18.2,"I"))
.S DIABFREQ=$G(MEDDAT(F,IENS,19.1,"E"))
.S DIABINDC=$G(MEDDAT(F,IENS,19.2,"I"))
.S DIABDEP=$G(MEDDAT(F,IENS,19.3,"I"))
.S DIABDEV=$G(MEDDAT(F,IENS,19.4,"I"))
.S DIABNOTE=$G(MEDDAT(F,IENS,19.5,"E"))
.S INJREL=$G(MEDDAT(F,IENS,20.1,"I"))
.S TREATIND=$G(MEDDAT(F,IENS,45.1,"I"))
.S PROPHEPI=$G(MEDDAT(F,IENS,45.2,"I"))
.S TREATCYC=$G(MEDDAT(F,IENS,45.3,"E"))
.S NUMCYCLE=$G(MEDDAT(F,IENS,45.4,"E"))
.S PRESREMS=$G(MEDDAT(F,IENS,47,"I"))
.S REMSRISK=$G(MEDDAT(F,IENS,48.1,"E"))
.S REMSAUTH=$G(MEDDAT(F,IENS,48.2,"E"))
.S PHTITRTE=$G(MEDDAT(F,IENS,49.1,"E"))
.S FLAVREQ=$G(MEDDAT(F,IENS,55.1,"I"))
.S PHRMDOSE=$G(MEDDAT(F,IENS,56.1,"E"))
.S NUMPACK=$G(MEDDAT(F,IENS,58.1,"E"))
.S NNLDATE=$G(MEDDAT(F,IENS,63.1,"E"))
.S NNLREAS=$G(MEDDAT(F,IENS,63.2,"E"))
.S PSOPROD=$G(MEDDAT(F,IENS,63.3,"E"))
.S PROVAUTH=$G(MEDDAT(F,IENS,63.4,"I"))
.;BEGIN 2017 OUTBOUND BUILDING
.D BL(GBL,.CNT,"DrugDescription",DRUGDESC)
.I $L(DCPCODE_DCPCQUAL_DCSTRVAL_DCSTRFRM_DCSTRUOM_DCDDBC_DCDQUAL_DCDEASCH) D
..D C S @GBL@(CNT,0)="<DrugCoded>"
..I $L(DCPCODE_DCPCQUAL) D
...D C S @GBL@(CNT,0)="<ProductCode>"
...D BL(GBL,.CNT,"Code",DCPCODE)
...D BL(GBL,.CNT,"Qualifier",DCPCQUAL)
...D C S @GBL@(CNT,0)="</ProductCode>"
..I $L(DCSTRVAL_DCSTRFRM_DCSTRUOM) D
...D C S @GBL@(CNT,0)="<Strength>"
...D BL(GBL,.CNT,"StrengthValue",DCSTRVAL)
...I $L(DCSTRFRM) D
....D C S @GBL@(CNT,0)="<StrengthForm>"
....D BL(GBL,.CNT,"Code",DCSTRFRM)
....D C S @GBL@(CNT,0)="</StrengthForm>"
...I $L(DCSTRUOM) D
....D C S @GBL@(CNT,0)="<StrengthUnitOfMeasure>"
....D BL(GBL,.CNT,"Code",DCSTRUOM)
....D C S @GBL@(CNT,0)="</StrengthUnitOfMeasure>"
...D C S @GBL@(CNT,0)="</Strength>"
..I $L(DCDDBC_DCDQUAL) D
...D C S @GBL@(CNT,0)="<DrugDBCode>"
...D BL(GBL,.CNT,"Code",DCDDBC)
...D BL(GBL,.CNT,"Qualifier",DCDQUAL)
...D C S @GBL@(CNT,0)="</DrugDBCode>"
..I $L(DCDEASCH) D
...D C S @GBL@(CNT,0)="<DEASchedule>"
...D BL(GBL,.CNT,"Code",DCDEASCH)
...D C S @GBL@(CNT,0)="</DEASchedule>"
..D C S @GBL@(CNT,0)="</DrugCoded>"
.D C S @GBL@(CNT,0)="<Quantity>"
.D BL(GBL,.CNT,"Value",QVAL)
.D BL(GBL,.CNT,"CodeListQualifier",QCLQUAL)
.I $L(QUOM) D
..D C S @GBL@(CNT,0)="<QuantityUnitOfMeasure>"
..D BL(GBL,.CNT,"Code",QUOM)
..D C S @GBL@(CNT,0)="</QuantityUnitOfMeasure>"
.D C S @GBL@(CNT,0)="</Quantity>"
.D BL(GBL,.CNT,"DaysSupply",DAYS)
.D C S @GBL@(CNT,0)="<WrittenDate>"
.D BL(GBL,.CNT,"Date",WDATE)
.D C S @GBL@(CNT,0)="</WrittenDate>"
.I $L(LFDATE) D
..D C S @GBL@(CNT,0)="<LastFillDate>"
..D BL(GBL,.CNT,"Date",LFDATE)
..D C S @GBL@(CNT,0)="</LastFillDate>"
.D BL(GBL,.CNT,"Substitutions",SUBS)
.D BL(GBL,.CNT,"NumberOfRefills",NUMREF)
.D ODIAG^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN) ; outbound diagnosis
.D BL(GBL,.CNT,"PriorAuthorization",PRAUTH)
.D BL(GBL,.CNT,"Note",NOTE)
.D ODUE^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN) ; outbound drug use evaluation
.D ODCS^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN) ; outbound drug coverage status
.D BL(GBL,.CNT,"PriorAuthorizationStatus",PRAUTHST)
.D SIG^PSOERXOI(GBL,.CNT,ERXIEN,MEDIEN)
.D BL(GBL,.CNT,"ReasonForSubstitutionCodeUsed",REA4SUBS)
.D OOPHAFF^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN) ;outbound office of pharmacy affairs segment ; COME BACK - FILING ISSUE
.I $L(DIABFREQ_DIABNOTE_DIABINDC_DIABDEP_DIABDEV) D
..D C S @GBL@(CNT,0)="<DiabeticSupply>"
..D BL(GBL,.CNT,"TestingFrequency",DIABFREQ)
..D BL(GBL,.CNT,"TestingFrequencyNotes",DIABNOTE)
..D BL(GBL,.CNT,"SupplyIndicator",DIABINDC)
..D BL(GBL,.CNT,"InsulinDependent",DIABDEP)
..D BL(GBL,.CNT,"HasAutomatedInsulinDevice",DIABDEV)
..D C S @GBL@(CNT,0)="</DiabeticSupply>"
.D BL(GBL,.CNT,"InjuryRelated",INJREL)
.D OAGENCY^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN) ;outbound agency segment
.D OIVA^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN) ; outbound IV segment ; *****
.D BL(GBL,.CNT,"TreatmentIndicator",TREATIND)
.D BL(GBL,.CNT,"ProphylacticOrEpisodic",PROPHEPI)
.D BL(GBL,.CNT,"CurrentTreatmentCycle",TREATCYC)
.D BL(GBL,.CNT,"NumberOfCyclesPlanned",NUMCYCLE)
.D OWOUND^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN) ;outbound wound segment
.D OTITDSMS^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN) ; titration
.D BL(GBL,.CNT,"FlavoringRequested",FLAVREQ)
.D OCOMPINF^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN) ; compound ingredients
.D BL(GBL,.CNT,"NumberOfPackagesToBeDispensed",NUMPACK)
.D OPTCODNT^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN) ; patient codified notes
.D OFACSPE^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN) ; facility spec admin timing
.D OOTHMEDT^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN) ; other medication date
.D BL(GBL,.CNT,"PlaceOfServiceNonSelfAdministeredProduct",PSOPROD)
.D BL(GBL,.CNT,"ProviderExplicitAuthorizationToAdminister",PROVAUTH)
D C S @GBL@(CNT,0)="</"_TAG_">"
Q
BL(GBL,CNT,TAG,VAR) ;
Q:VAR=""
D C S @GBL@(CNT,0)="<"_TAG_">"_$$SYMENC^MXMLUTL(VAR)_"</"_TAG_">"
Q
C ;
S CNT=$G(CNT)+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOERXOG 8035 printed Nov 22, 2024@17:38:51 Page 2
PSOERXOG ;ALB/BWF - eRx parsing Utilities ; 11/14/2019 3:46pm
+1 ;;7.0;OUTPATIENT PHARMACY;**581,746**;DEC 1997;Build 106
+2 ;
+3 QUIT
+4 ; GBL - Global location for XML storage
+5 ; CNT - counter, passed by reference
+6 ; ERXIEN - ien of the ERx
+7 ; MTYP - medication type to build
+8 ; NOTEOVR - note override for rxchangerequest messages
MEDS(GBL,CNT,ERXIEN,MTYPE,NOTEOVR) ;
+1 NEW MEDIEN,MEDDAT,F,TYPE,DRUGDESC,DCPCODE,DCPCQUAL,DCSTRVAL,DCSTRFRM,DCSTRUOM,DCDDBC,DCDQUAL,DCDEASCH,QVAL,QCLQUAL
+2 NEW QUOM,DAYS,WDATE,SFDATE,SUBS,NUMREF,PRAUTH,PRAUTHST,NOTE,SNOMED,FMT,DONOTFIL,TZID,TZDIFF,OCAPMETH
+3 NEW REA4SUBS,SPSCRIPT,RXFILL,DELREQ,DELLOC,DIABFREQ,DIABINDC,DIABDEP,DEAVDEV,DIABNOTE,DIABDEV
+4 NEW INJREL,TREATIND,PROPHEPI,TREATCYC,NUMCYCLE,PRESREMS,RESMRISK,REMSAUTH,PHRITRTE,FLAVREQ,PHRMDOSE,NUMPACK
+5 NEW NNLDATE,NNLREAS,PSOPROD,PROVAUTH,HTAG,TAG,DIAVDEV,IENS,LFDATE,PHTITRTE,REMSRISK,MESTYPE,RESVAL
+6 if '$ORDER(^PS(52.49,ERXIEN,311,"C",MTYPE,0))
QUIT
+7 SET MESTYPE=$$GET1^DIQ(52.49,ERXIEN,.08,"I")
SET RESVAL=$$GET1^DIQ(52.49,ERXIEN,52.1,"I")
+8 SET HTAG=0
+9 SET MEDIEN=0
FOR
SET MEDIEN=$ORDER(^PS(52.49,ERXIEN,311,"C",MTYPE,MEDIEN))
if 'MEDIEN
QUIT
Begin DoDot:1
+10 KILL MEDDAT
+11 SET IENS=MEDIEN_","_ERXIEN_","
+12 SET F=52.49311
+13 DO GETS^DIQ(F,IENS,"**","IE","MEDDAT")
+14 ;populate 2017 vars
+15 SET TYPE=$$GET1^DIQ(F,IENS,.02,"I")
+16 SET TAG=$SELECT((TYPE="P")!((MESTYPE="RE")):"MedicationPrescribed",TYPE="D":"MedicationDispensed",TYPE="R":"MedicationRequested",1:"")
+17 if TAG=""
QUIT
+18 ; if the header tag has not yet been built, build it. Otherwise bypass
+19 IF 'HTAG
Begin DoDot:2
+20 DO C
SET @GBL@(CNT,0)="<"_TAG_">"
SET HTAG=1
End DoDot:2
+21 SET DRUGDESC=$GET(MEDDAT(F,IENS,.03,"E"))
+22 SET DCPCODE=$GET(MEDDAT(F,IENS,1.1,"E"))
+23 SET DCPCQUAL=$GET(MEDDAT(F,IENS,1.2,"E"))
+24 SET DCSTRVAL=$GET(MEDDAT(F,IENS,1.3,"E"))
+25 SET DCSTRFRM=$GET(MEDDAT(F,IENS,1.4,"E"))
+26 SET DCSTRUOM=$GET(MEDDAT(F,IENS,1.5,"E"))
+27 SET DCDDBC=$GET(MEDDAT(F,IENS,1.6,"E"))
+28 SET DCDQUAL=$GET(MEDDAT(F,IENS,1.7,"E"))
+29 ; come back - failing to file, no result at $$presolv^psoerxa1
SET DCDEASCH=$GET(MEDDAT(F,IENS,1.8,"E"))
+30 SET QVAL=$GET(MEDDAT(F,IENS,2.1,"E"))
+31 SET QCLQUAL=$GET(MEDDAT(F,IENS,2.2,"E"))
+32 SET QUOM=$GET(MEDDAT(F,IENS,2.3,"E"))
+33 SET DAYS=$GET(MEDDAT(F,IENS,2.4,"E"))
+34 ; will convert in future with outbound date function, yet to be built
SET WDATE=$GET(MEDDAT(F,IENS,2.5,"I"))
+35 SET WDATE=$PIECE(WDATE,"@",1)
+36 IF $GET(WDATE)
SET WDATE=$PIECE($$EXTIME^PSOERXO1(WDATE),"T")
+37 ; will convert in future with outbound date function, yet to be built
SET LFDATE=$GET(MEDDAT(F,IENS,2.6,"I"))
+38 IF $GET(LFDATE)
SET LFDATE=$PIECE($$EXTIME^PSOERXO1(LFDATE),"T")
+39 SET SUBS=$GET(MEDDAT(F,IENS,2.7,"I"))
+40 SET NUMREF=$GET(MEDDAT(F,IENS,2.8,"E"))
+41 SET PRAUTH=$GET(MEDDAT(F,IENS,4.1,"E"))
+42 SET PRAUTHST=$GET(MEDDAT(F,IENS,4.2,"I"))
+43 SET NOTE=$SELECT($GET(NOTEOVR)]"":$GET(NOTEOVR),1:(MEDDAT(F,IENS,5,"E")))
+44 SET SNOMED=$GET(MEDDAT(F,IENS,9.1,"E"))
+45 SET FMT=$GET(MEDDAT(F,IENS,9.2,"E"))
+46 SET DONOTFIL=$GET(MEDDAT(F,IENS,16.1,"I"))
+47 SET TZID=$GET(MEDDAT(F,IENS,16.2,"I"))
+48 SET TZDIFF=$GET(MEDDAT(F,IENS,16.3,"E"))
+49 SET OCAPMETH=$GET(MEDDAT(F,IENS,16.4,"I"))
+50 SET REA4SUBS=$GET(MEDDAT(F,IENS,16.5,"I"))
+51 SET SPSCRIPT=$GET(MEDDAT(F,IENS,16.6,"I"))
+52 SET RXFILL=$GET(MEDDAT(F,IENS,16.7,"E"))
+53 SET DELREQ=$GET(MEDDAT(F,IENS,18.1,"I"))
+54 SET DELLOC=$GET(MEDDAT(F,IENS,18.2,"I"))
+55 SET DIABFREQ=$GET(MEDDAT(F,IENS,19.1,"E"))
+56 SET DIABINDC=$GET(MEDDAT(F,IENS,19.2,"I"))
+57 SET DIABDEP=$GET(MEDDAT(F,IENS,19.3,"I"))
+58 SET DIABDEV=$GET(MEDDAT(F,IENS,19.4,"I"))
+59 SET DIABNOTE=$GET(MEDDAT(F,IENS,19.5,"E"))
+60 SET INJREL=$GET(MEDDAT(F,IENS,20.1,"I"))
+61 SET TREATIND=$GET(MEDDAT(F,IENS,45.1,"I"))
+62 SET PROPHEPI=$GET(MEDDAT(F,IENS,45.2,"I"))
+63 SET TREATCYC=$GET(MEDDAT(F,IENS,45.3,"E"))
+64 SET NUMCYCLE=$GET(MEDDAT(F,IENS,45.4,"E"))
+65 SET PRESREMS=$GET(MEDDAT(F,IENS,47,"I"))
+66 SET REMSRISK=$GET(MEDDAT(F,IENS,48.1,"E"))
+67 SET REMSAUTH=$GET(MEDDAT(F,IENS,48.2,"E"))
+68 SET PHTITRTE=$GET(MEDDAT(F,IENS,49.1,"E"))
+69 SET FLAVREQ=$GET(MEDDAT(F,IENS,55.1,"I"))
+70 SET PHRMDOSE=$GET(MEDDAT(F,IENS,56.1,"E"))
+71 SET NUMPACK=$GET(MEDDAT(F,IENS,58.1,"E"))
+72 SET NNLDATE=$GET(MEDDAT(F,IENS,63.1,"E"))
+73 SET NNLREAS=$GET(MEDDAT(F,IENS,63.2,"E"))
+74 SET PSOPROD=$GET(MEDDAT(F,IENS,63.3,"E"))
+75 SET PROVAUTH=$GET(MEDDAT(F,IENS,63.4,"I"))
+76 ;BEGIN 2017 OUTBOUND BUILDING
+77 DO BL(GBL,.CNT,"DrugDescription",DRUGDESC)
+78 IF $LENGTH(DCPCODE_DCPCQUAL_DCSTRVAL_DCSTRFRM_DCSTRUOM_DCDDBC_DCDQUAL_DCDEASCH)
Begin DoDot:2
+79 DO C
SET @GBL@(CNT,0)="<DrugCoded>"
+80 IF $LENGTH(DCPCODE_DCPCQUAL)
Begin DoDot:3
+81 DO C
SET @GBL@(CNT,0)="<ProductCode>"
+82 DO BL(GBL,.CNT,"Code",DCPCODE)
+83 DO BL(GBL,.CNT,"Qualifier",DCPCQUAL)
+84 DO C
SET @GBL@(CNT,0)="</ProductCode>"
End DoDot:3
+85 IF $LENGTH(DCSTRVAL_DCSTRFRM_DCSTRUOM)
Begin DoDot:3
+86 DO C
SET @GBL@(CNT,0)="<Strength>"
+87 DO BL(GBL,.CNT,"StrengthValue",DCSTRVAL)
+88 IF $LENGTH(DCSTRFRM)
Begin DoDot:4
+89 DO C
SET @GBL@(CNT,0)="<StrengthForm>"
+90 DO BL(GBL,.CNT,"Code",DCSTRFRM)
+91 DO C
SET @GBL@(CNT,0)="</StrengthForm>"
End DoDot:4
+92 IF $LENGTH(DCSTRUOM)
Begin DoDot:4
+93 DO C
SET @GBL@(CNT,0)="<StrengthUnitOfMeasure>"
+94 DO BL(GBL,.CNT,"Code",DCSTRUOM)
+95 DO C
SET @GBL@(CNT,0)="</StrengthUnitOfMeasure>"
End DoDot:4
+96 DO C
SET @GBL@(CNT,0)="</Strength>"
End DoDot:3
+97 IF $LENGTH(DCDDBC_DCDQUAL)
Begin DoDot:3
+98 DO C
SET @GBL@(CNT,0)="<DrugDBCode>"
+99 DO BL(GBL,.CNT,"Code",DCDDBC)
+100 DO BL(GBL,.CNT,"Qualifier",DCDQUAL)
+101 DO C
SET @GBL@(CNT,0)="</DrugDBCode>"
End DoDot:3
+102 IF $LENGTH(DCDEASCH)
Begin DoDot:3
+103 DO C
SET @GBL@(CNT,0)="<DEASchedule>"
+104 DO BL(GBL,.CNT,"Code",DCDEASCH)
+105 DO C
SET @GBL@(CNT,0)="</DEASchedule>"
End DoDot:3
+106 DO C
SET @GBL@(CNT,0)="</DrugCoded>"
End DoDot:2
+107 DO C
SET @GBL@(CNT,0)="<Quantity>"
+108 DO BL(GBL,.CNT,"Value",QVAL)
+109 DO BL(GBL,.CNT,"CodeListQualifier",QCLQUAL)
+110 IF $LENGTH(QUOM)
Begin DoDot:2
+111 DO C
SET @GBL@(CNT,0)="<QuantityUnitOfMeasure>"
+112 DO BL(GBL,.CNT,"Code",QUOM)
+113 DO C
SET @GBL@(CNT,0)="</QuantityUnitOfMeasure>"
End DoDot:2
+114 DO C
SET @GBL@(CNT,0)="</Quantity>"
+115 DO BL(GBL,.CNT,"DaysSupply",DAYS)
+116 DO C
SET @GBL@(CNT,0)="<WrittenDate>"
+117 DO BL(GBL,.CNT,"Date",WDATE)
+118 DO C
SET @GBL@(CNT,0)="</WrittenDate>"
+119 IF $LENGTH(LFDATE)
Begin DoDot:2
+120 DO C
SET @GBL@(CNT,0)="<LastFillDate>"
+121 DO BL(GBL,.CNT,"Date",LFDATE)
+122 DO C
SET @GBL@(CNT,0)="</LastFillDate>"
End DoDot:2
+123 DO BL(GBL,.CNT,"Substitutions",SUBS)
+124 DO BL(GBL,.CNT,"NumberOfRefills",NUMREF)
+125 ; outbound diagnosis
DO ODIAG^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN)
+126 DO BL(GBL,.CNT,"PriorAuthorization",PRAUTH)
+127 DO BL(GBL,.CNT,"Note",NOTE)
+128 ; outbound drug use evaluation
DO ODUE^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN)
+129 ; outbound drug coverage status
DO ODCS^PSOERXOH(GBL,.CNT,ERXIEN,MEDIEN)
+130 DO BL(GBL,.CNT,"PriorAuthorizationStatus",PRAUTHST)
+131 DO SIG^PSOERXOI(GBL,.CNT,ERXIEN,MEDIEN)
+132 DO BL(GBL,.CNT,"ReasonForSubstitutionCodeUsed",REA4SUBS)
+133 ;outbound office of pharmacy affairs segment ; COME BACK - FILING ISSUE
DO OOPHAFF^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN)
+134 IF $LENGTH(DIABFREQ_DIABNOTE_DIABINDC_DIABDEP_DIABDEV)
Begin DoDot:2
+135 DO C
SET @GBL@(CNT,0)="<DiabeticSupply>"
+136 DO BL(GBL,.CNT,"TestingFrequency",DIABFREQ)
+137 DO BL(GBL,.CNT,"TestingFrequencyNotes",DIABNOTE)
+138 DO BL(GBL,.CNT,"SupplyIndicator",DIABINDC)
+139 DO BL(GBL,.CNT,"InsulinDependent",DIABDEP)
+140 DO BL(GBL,.CNT,"HasAutomatedInsulinDevice",DIABDEV)
+141 DO C
SET @GBL@(CNT,0)="</DiabeticSupply>"
End DoDot:2
+142 DO BL(GBL,.CNT,"InjuryRelated",INJREL)
+143 ;outbound agency segment
DO OAGENCY^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN)
+144 ; outbound IV segment ; *****
DO OIVA^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN)
+145 DO BL(GBL,.CNT,"TreatmentIndicator",TREATIND)
+146 DO BL(GBL,.CNT,"ProphylacticOrEpisodic",PROPHEPI)
+147 DO BL(GBL,.CNT,"CurrentTreatmentCycle",TREATCYC)
+148 DO BL(GBL,.CNT,"NumberOfCyclesPlanned",NUMCYCLE)
+149 ;outbound wound segment
DO OWOUND^PSOERXOL(GBL,.CNT,ERXIEN,MEDIEN)
+150 ; titration
DO OTITDSMS^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN)
+151 DO BL(GBL,.CNT,"FlavoringRequested",FLAVREQ)
+152 ; compound ingredients
DO OCOMPINF^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN)
+153 DO BL(GBL,.CNT,"NumberOfPackagesToBeDispensed",NUMPACK)
+154 ; patient codified notes
DO OPTCODNT^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN)
+155 ; facility spec admin timing
DO OFACSPE^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN)
+156 ; other medication date
DO OOTHMEDT^PSOERXOM(GBL,.CNT,ERXIEN,MEDIEN)
+157 DO BL(GBL,.CNT,"PlaceOfServiceNonSelfAdministeredProduct",PSOPROD)
+158 DO BL(GBL,.CNT,"ProviderExplicitAuthorizationToAdminister",PROVAUTH)
End DoDot:1
+159 DO C
SET @GBL@(CNT,0)="</"_TAG_">"
+160 QUIT
BL(GBL,CNT,TAG,VAR) ;
+1 if VAR=""
QUIT
+2 DO C
SET @GBL@(CNT,0)="<"_TAG_">"_$$SYMENC^MXMLUTL(VAR)_"</"_TAG_">"
+3 QUIT
C ;
+1 SET CNT=$GET(CNT)+1
+2 QUIT