PSOERXIF ;ALB/BWF - eRx Utilities/RPC's ; 8/3/2016 5:14pm
;;7.0;OUTPATIENT PHARMACY;**581,635**;DEC 1997;Build 19
;
Q
; ERXIEN - ERX IEN
; MIEN - MEDICATION IEN
SIG(ERXIEN,MIEN,MTYPE,MEDTYPE,I) ;
N MSF,INSF,GL,GLIFU,GLINS,CFT,SIGTEXT,FMT,SNOV,INS,INSCNT,MIM,INSI,MTM
N DDMC,DDMQ,DDMT,DDMMC,DDMMT,DDMMQ,DADDQ,DADUOMC,DADUOMQ,DADUOMT,DADDDRM,DADDQ2,DADUOMC2
N DADUOMQ2,DADUOMT2,DADCDBN,DADCDBRM,DADCDBN2,DADCDBC,DADCDBT,DADCDBQ,DADCBMQ,DADCBMV
N DADCCDN,DADCCDC,DADCCDT,DADCCDQ,DADCCF,DADDCC,DADDCT,DADDCQ,DADCFT,DADAC,DADAT,DADAQ,DAV,DAROAC
N DAROAQ,DAROAT,DAROACFT,DASOAC,DASOAQ,DASOAT,DASOACFT,INS2,INS2CNT,TADFFNV,TADFVFM,TADFFNV2,TADFFUC
N TADFFUQ,TADFFUT,TADIINV,TADIVIM,TADIINV2,TADIIUC,TADIIUQ,TADIIUT,TADATATN,TADATVAT,TADAATUC,TADAATUQ,TADAATUT
N TADAATMC,TADAATMQ,TADAATMT,TADAATEC,TADAATEQ,TADAATET,TADAATFT,TADROA,TADRUOMC,TADRUOMT,TADRUOMQ,TADTPBC
N TADTPBT,TADTPBQ,TADDNV,TADDTC,TADDTQ,TADDTT,TADDTTC,TADDTTQ,TADDTTT,TADDTFT,TADSCC,TADSCT,TADSQ,MDR,MDRCNT
N FDA,GLINSTAD,INS2IENS,SCNT,SIGARY,ICFT,TIMCFT,ADMINI,DAVVC,DAVVCFT,DAVVMVM,DAVVPC,DAVVPQ
N DAVVPT,DAVVQ,DAVVQ2,DAVVT,DAVVUOMC,DAVVUOMQ,DAVVUOMT,GLINSDA,IFUSF,INSFTAD,INSIENS,TADATAT2,TADSCQ
S MSF=52.49311
S INSF=52.4931112
S IFUSF=52.4931113
S INSFTAD=52.49311123
S GL=$NA(^TMP($J,"PSOERXO1","Message",0,"Body",0,MTYPE,0,MEDTYPE,I,"Sig",0))
S GLINS=$NA(^TMP($J,"PSOERXO1","Message",0,"Body",0,MTYPE,0,MEDTYPE,I,"Sig",0,"Instruction"))
S CFT=$G(@GL@("ClarifyingFreeText",0)),FDA(MSF,MIEN_","_ERXIEN_",",15)=CFT
S SIGTEXT=$G(@GL@("SigText",0))
D SIG^PSOERXII(ERXIEN,MIEN,SIGTEXT)
S SNOV=$G(@GL@("CodeSystem",0,"SNOMEDVersion",0)),FDA(MSF,MIEN_","_ERXIEN_",",9.1)=SNOV
S FMT=$G(@GL@("CodeSystem",0,"FMTVersion",0)),FDA(MSF,MIEN_","_ERXIEN_",",9.2)=FMT
D CFDA^PSOERXIU(.FDA)
D FILE^DIE(,"FDA") K FDA
D IFU^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE)
S INS=-1 F S INS=$O(@GLINS@(INS)) Q:INS="" D
.; The multiple instruction modifier will be at the INS-1 subscript, since the modifier comes _after_ the instruction and
.; is optional.
.S GLINSDA=$NA(^TMP($J,"PSOERXO1","Message",0,"Body",0,MTYPE,0,"MedicationPrescribed",I,"Sig",0,"Instruction",INS,"DoseAdministration",0))
.S INSCNT=$G(INSCNT)+1
.S INSIENS="+"_INSCNT_","_MIEN_","_ERXIEN_","
.S FDA(INSF,INSIENS,.01)=INSCNT
.S MIM=$G(@GL@("MultipleInstructionModifier",INS-1)),FDA(INSF,INSIENS,.03)=MIM
.; dose delivery method
.S INSI=$G(@GLINS@(INS,"InstructionIndicator",0)),FDA(INSF,INSIENS,.02)=INSI
.S ADMINI=$G(@GLINS@(INS,"AdministrationIndicator",0)),FDA(INSF,INSIENS,4.1)=ADMINI
.S DDMC=$G(@GLINSDA@("DoseDeliveryMethod",0,"Code",0)),FDA(INSF,INSIENS,7)=DDMC
.S DDMQ=$G(@GLINSDA@("DoseDeliveryMethod",0,"Qualifier",0)),FDA(INSF,INSIENS,8)=DDMQ
.S DDMT=$G(@GLINSDA@("DoseDeliveryMethod",0,"Text",0)),FDA(INSF,INSIENS,9)=DDMT
.S DDMMC=$G(@GLINSDA@("DoseDeliveryMethodModifier",0,"Code",0)),FDA(INSF,INSIENS,72)=DDMMC
.S DDMMQ=$G(@GLINSDA@("DoseDeliveryMethodModifier",0,"Qualifier",0)),FDA(INSF,INSIENS,73)=DDMMQ
.S DDMMT=$G(@GLINSDA@("DoseDeliveryMethodModifier",0,"Text",0)),FDA(INSF,INSIENS,74)=DDMMT
.; dosage
.S DADDQ=$G(@GLINSDA@("Dosage",0,"DoseQuantity",0)),FDA(INSF,INSIENS,10.1)=DADDQ
.S DADUOMC=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Code",0)),FDA(INSF,INSIENS,11)=DADUOMC
.S DADUOMQ=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Qualifier",0)),FDA(INSF,INSIENS,12)=DADUOMQ
.S DADUOMT=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Text",0)),FDA(INSF,INSIENS,13)=DADUOMT
.S DADDDRM=$G(@GLINSDA@("Dosage",0,"DoseRangeModifier",0)),FDA(INSF,INSIENS,14)=DADDDRM
.; 2 instances of these elements... check the global/xml structure - not sure where this increments or how it is stored
.S DADDQ2=$G(@GLINSDA@("Dosage",0,"DoseQuantity",1)),FDA(INSF,INSIENS,15.1)=DADDQ2
.S DADUOMC2=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Code",0)),FDA(INSF,INSIENS,16)=DADUOMC2
.S DADUOMQ2=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Qualifier",0)),FDA(INSF,INSIENS,17)=DADUOMQ2
.S DADUOMT2=$G(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Text",0)),FDA(INSF,INSIENS,18)=DADUOMT2
.; Dose calculation - 2 INSTANCES OF DOSINGBASISNUMERIC.. CHECK STRUCTURES
.S DADCDBN=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisNumeric",0)),FDA(INSF,INSIENS,21.1)=DADCDBN
.S DADCDBRM=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisRangeModifier",0)),FDA(INSF,INSIENS,21.2)=DADCDBRM
.S DADCDBN2=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisNumeric",1)),FDA(INSF,INSIENS,21.3)=DADCDBN2
.S DADCDBC=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Code",0)),FDA(INSF,INSIENS,22)=DADCDBC
.S DADCDBQ=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Qualifier",0)),FDA(INSF,INSIENS,23)=DADCDBQ
.S DADCDBT=$G(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Text",0)),FDA(INSF,INSIENS,24)=DADCDBT
.S DADCBMQ=$G(@GLINSDA@("DoseCalculation",0,"BodyMetricQualifier",0)),FDA(INSF,INSIENS,25.1)=DADCBMQ
.S DADCBMV=$G(@GLINSDA@("DoseCalculation",0,"BodyMetricValue",0)),FDA(INSF,INSIENS,25.2)=DADCBMV
.S DADCCDN=$G(@GLINSDA@("DoseCalculation",0,"CalculatedDoseNumeric",0)),FDA(INSF,INSIENS,26)=DADCCDN
.S DADCCDC=$G(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Code",0)),FDA(INSF,INSIENS,27)=DADCCDC
.S DADCCDQ=$G(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Qualifier",0)),FDA(INSF,INSIENS,28)=DADCCDQ
.S DADCCDT=$G(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Text",0)),FDA(INSF,INSIENS,29)=DADCCDT
.S DADCCF=$G(@GLINSDA@("DoseCalculation",0,"DoseCalculationClarifyingFreeText",0)),FDA(INSF,INSIENS,31)=DADCCF
.S DADDCC=$G(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Code",0)),FDA(INSF,INSIENS,32)=DADDCC
.S DADDCQ=$G(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Qualifier",0)),FDA(INSF,INSIENS,33)=DADDCQ
.S DADDCT=$G(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Text",0)),FDA(INSF,INSIENS,34)=DADDCT
.; dose amount
.S DADCFT=$G(@GLINSDA@("DoseClarifyingFreeText",0)),FDA(INSF,INSIENS,38)=DADCFT
.S DADAC=$G(@GLINSDA@("DoseAmount",0,"Code",0)),FDA(INSF,INSIENS,35)=DADAC
.S DADAQ=$G(@GLINSDA@("DoseAmount",0,"Qualifier",0)),FDA(INSF,INSIENS,36)=DADAQ
.S DADAT=$G(@GLINSDA@("DoseAmount",0,"Text",0)),FDA(INSF,INSIENS,37)=DADAT
.; Vehicle
.S DAVVPC=$G(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Code")),FDA(INSF,INSIENS,41)=DAVVPC
.S DAVVPQ=$G(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Qualifier")),FDA(INSF,INSIENS,42)=DAVVPQ
.S DAVVPT=$G(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Text")),FDA(INSF,INSIENS,43)=DAVVPT
.S DAVVQ=$G(@GLINSDA@("Vehicle",0,"VehicleQuantity",0)),FDA(INSF,INSIENS,44.1)=DAVVQ
.S DAVVMVM=$G(@GLINSDA@("Vehicle",0,"MultipleVehicleModifier",0)),FDA(INSF,INSIENS,44.2)=DAVVMVM
.S DAVVQ2=$G(@GLINSDA@("Vehicle",0,"VehicleQuantity",1)),FDA(INSF,INSIENS,44.3)=DAVVQ2
.S DAVVUOMC=$G(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Code")),FDA(INSF,INSIENS,45)=DAVVUOMC
.S DAVVUOMQ=$G(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Qualifier")),FDA(INSF,INSIENS,46)=DAVVUOMQ
.S DAVVUOMT=$G(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Text")),FDA(INSF,INSIENS,47)=DAVVUOMT
.S DAVVC=$G(@GLINSDA@("Vehicle",0,"Vehicle",0,"Code",0)),FDA(INSF,INSIENS,51)=DAVVC
.S DAVVQ=$G(@GLINSDA@("Vehicle",0,"Vehicle",0,"Qualifier",0)),FDA(INSF,INSIENS,52)=DAVVQ
.S DAVVT=$G(@GLINSDA@("Vehicle",0,"Vehicle",0,"Text",0)),FDA(INSF,INSIENS,53)=DAVVT
.S DAVVCFT=$G(@GLINSDA@("Vehicle",0,"VehicleClarifyingFreeText",0)),FDA(INSF,INSIENS,54)=DAVVCFT
.; route of administration
.S DAROAC=$G(@GLINSDA@("RouteOfAdministration",0,"Code",0)),FDA(INSF,INSIENS,55)=DAROAC
.S DAROAQ=$G(@GLINSDA@("RouteOfAdministration",0,"Qualifier",0)),FDA(INSF,INSIENS,56)=DAROAQ
.S DAROAT=$G(@GLINSDA@("RouteOfAdministration",0,"Text",0)),FDA(INSF,INSIENS,57)=DAROAT
.S DAROACFT=$G(@GLINS@("RouteOfAdministrationClarifyingFreeText",0)),FDA(INSF,INSIENS,58)=DAROACFT
.; site of administration
.S DASOAC=$G(@GLINSDA@("SiteOfAdministration",0,"Code",0)),FDA(INSF,INSIENS,61)=DASOAC
.S DASOAQ=$G(@GLINSDA@("SiteOfAdministration",0,"Qualifier",0)),FDA(INSF,INSIENS,62)=DASOAQ
.S DASOAT=$G(@GLINSDA@("SiteOfAdministration",0,"Text",0)),FDA(INSF,INSIENS,63)=DASOAT
.S DASOACFT=$G(@GLINSDA@("SiteOfAdministrationClarifyingFreeText",0)),FDA(INSF,INSIENS,64)=DASOACFT
.S ICFT=$G(@GLINS@(INS,"IndicationClarifyingFreeText",0)),FDA(INSF,INSIENS,70)=ICFT
.N NINSIEN,NEWIEN
.D CFDA^PSOERXIU(.FDA)
.D UPDATE^DIE(,"FDA","NEWIEN") K FDA S NEWIEN=$O(NEWIEN(0)),NINSIEN=$G(NEWIEN(NEWIEN))
.;PSO*7*635 - add handling of 'IndicationForUse' when it appears under the 'Instruction' segment
.D INSIFU^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE,INS,NINSIEN)
.;PSO*7*635 - end change
.S INS2=-1 F S INS2=$O(@GLINS@(INS,"TimingAndDuration",INS2)) Q:INS2="" D
..; frequency - note dual FrequencyNumericValue components. need to see how that gets stored. incrementor?
..S INS2CNT=$G(INS2CNT)+1
..S INS2IENS="+"_INS2CNT_","_NINSIEN_","_MIEN_","_ERXIEN_","
..S FDA(INSFTAD,INS2IENS,.01)=INS2CNT
..S MTM=$G(@GLINS@(INS,"MultipleTimingModifier",0)),FDA(INSFTAD,INS2IENS,.02)=MTM
..S GLINSTAD=$NA(^TMP($J,"PSOERXO1","Message",0,"Body",0,MTYPE,0,"MedicationPrescribed",0,"Sig",0,"Instruction",INS,"TimingAndDuration",INS2))
..S TADFFNV=$G(@GLINSTAD@("Frequency",0,"FrequencyNumericValue",0)),FDA(INSFTAD,INS2IENS,11.1)=TADFFNV
..S TADFVFM=$G(@GLINSTAD@("Frequency",0,"VariableFrequencyModifier",0)),FDA(INSFTAD,INS2IENS,11.2)=TADFVFM
..S TADFFNV2=$G(@GLINSTAD@("Frequency",0,"FrequencyNumericValue",1)),FDA(INSFTAD,INS2IENS,11.3)=TADFFNV2
..S TADFFUC=$G(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Code",0)),FDA(INSFTAD,INS2IENS,12)=TADFFUC
..S TADFFUQ=$G(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,13)=TADFFUQ
..S TADFFUT=$G(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Text",0)),FDA(INSFTAD,INS2IENS,14)=TADFFUT
..; interval - same issue as frequency
..S TADIINV=$G(@GLINSTAD@("Interval",0,"IntervalNumericValue",0)),FDA(INSFTAD,INS2IENS,15.1)=TADIINV
..S TADIVIM=$G(@GLINSTAD@("Interval",0,"VariableIntervalModifier",0)),FDA(INSFTAD,INS2IENS,15.2)=TADIVIM
..S TADIINV2=$G(@GLINSTAD@("Interval",0,"IntervalNumericValue",1)),FDA(INSFTAD,INS2IENS,15.3)=TADIINV2
..S TADIIUC=$G(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Code",0)),FDA(INSFTAD,INS2IENS,16)=TADIIUC
..S TADIIUQ=$G(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,17)=TADIIUQ
..S TADIIUT=$G(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Text",0)),FDA(INSFTAD,INS2IENS,18)=TADIIUT
..;admin timing
..S TADATATN=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingNumericValue",0)),FDA(INSFTAD,INS2IENS,.03)=TADATATN
..S TADATAT2=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingNumericValue",1)),FDA(INSFTAD,INS2IENS,.05)=TADATAT2
..S TADATVAT=$G(@GLINSTAD@("AdministrationTiming",0,"VariableAdministrationTimingModifier",0,"Code",0)),FDA(INSFTAD,INS2IENS,.04)=TADATVAT
..S TADAATUC=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Code",0)),FDA(INSFTAD,INS2IENS,1)=TADAATUC
..S TADAATUQ=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,2)=TADAATUQ
..S TADAATUT=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Text",0)),FDA(INSFTAD,INS2IENS,3)=TADAATUT
..S TADAATMC=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Code",0)),FDA(INSFTAD,INS2IENS,4)=TADAATMC
..S TADAATMQ=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,5)=TADAATMQ
..S TADAATMT=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Text",0)),FDA(INSFTAD,INS2IENS,6)=TADAATMT
..S TADAATEC=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Code",0)),FDA(INSFTAD,INS2IENS,7)=TADAATEC
..S TADAATEQ=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,8)=TADAATEQ
..S TADAATET=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Text",0)),FDA(INSFTAD,INS2IENS,9)=TADAATET
..S TADAATFT=$G(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingClarifyingFreeText",0)),FDA(INSFTAD,INS2IENS,10)=TADAATFT
..; rate of administration
..S TADROA=$G(@GLINSTAD@("RateOfAdministration",0,"RateOfAdministration",0)),FDA(INSFTAD,INS2IENS,21.1)=TADROA
..S TADRUOMC=$G(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Code")),FDA(INSFTAD,INS2IENS,22)=TADRUOMC
..S TADRUOMT=$G(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Text")),FDA(INSFTAD,INS2IENS,24)=TADRUOMT
..S TADRUOMQ=$G(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Qualifier")),FDA(INSFTAD,INS2IENS,23)=TADRUOMQ
..S TADTPBC=$G(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Code")),FDA(INSFTAD,INS2IENS,25)=TADTPBC
..S TADTPBT=$G(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Text")),FDA(INSFTAD,INS2IENS,27)=TADTPBT
..S TADTPBQ=$G(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Qualifier")),FDA(INSFTAD,INS2IENS,26)=TADTPBQ
..S TIMCFT=$G(@GLINSTAD@("TimeClarifyingFreeText",0)),FDA(INSFTAD,INS2IENS,28)=TIMCFT
..; duration
..S TADDNV=$G(@GLINSTAD@("Duration",0,"DurationNumericValue",0)),FDA(INSFTAD,INS2IENS,31)=TADDNV
..S TADDTC=$G(@GLINSTAD@("Duration",0,"DurationText",0,"Code",0)),FDA(INSFTAD,INS2IENS,32)=TADDTC
..S TADDTQ=$G(@GLINSTAD@("Duration",0,"DurationText",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,33)=TADDTQ
..S TADDTT=$G(@GLINSTAD@("Duration",0,"DurationText",0,"Text",0)),FDA(INSFTAD,INS2IENS,34)=TADDTT
..; duration trigger
..S TADDTTC=$G(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Code",0)),FDA(INSFTAD,INS2IENS,35)=TADDTTC
..S TADDTTQ=$G(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,36)=TADDTTQ
..S TADDTTT=$G(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Text",0)),FDA(INSFTAD,INS2IENS,37)=TADDTTT
..S TADDTFT=$G(@GLINSTAD@("DurationTrigger",0,"DurationClarifyingFreeText",0)),FDA(INSFTAD,INS2IENS,38)=TADDTFT
..; stop code
..S TADSCC=$G(@GLINSTAD@("StopCode",0,"Code",0)),FDA(INSFTAD,INS2IENS,41)=TADSCC
..S TADSCT=$G(@GLINSTAD@("StopCode",0,"Text",0)),FDA(INSFTAD,INS2IENS,43)=TADSCT
..S TADSCQ=$G(@GLINSTAD@("StopCode",0,"Qualifier",0)),FDA(INSFTAD,INS2IENS,42)=TADSCQ
..D CFDA^PSOERXIU(.FDA)
..D UPDATE^DIE(,"FDA") K FDA
..;D MDRSF^PSOERXII(GLINS,ERXIEN,MIEN,NINSIEN)
D MDR^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOERXIF 14601 printed Nov 22, 2024@17:38:40 Page 2
PSOERXIF ;ALB/BWF - eRx Utilities/RPC's ; 8/3/2016 5:14pm
+1 ;;7.0;OUTPATIENT PHARMACY;**581,635**;DEC 1997;Build 19
+2 ;
+3 QUIT
+4 ; ERXIEN - ERX IEN
+5 ; MIEN - MEDICATION IEN
SIG(ERXIEN,MIEN,MTYPE,MEDTYPE,I) ;
+1 NEW MSF,INSF,GL,GLIFU,GLINS,CFT,SIGTEXT,FMT,SNOV,INS,INSCNT,MIM,INSI,MTM
+2 NEW DDMC,DDMQ,DDMT,DDMMC,DDMMT,DDMMQ,DADDQ,DADUOMC,DADUOMQ,DADUOMT,DADDDRM,DADDQ2,DADUOMC2
+3 NEW DADUOMQ2,DADUOMT2,DADCDBN,DADCDBRM,DADCDBN2,DADCDBC,DADCDBT,DADCDBQ,DADCBMQ,DADCBMV
+4 NEW DADCCDN,DADCCDC,DADCCDT,DADCCDQ,DADCCF,DADDCC,DADDCT,DADDCQ,DADCFT,DADAC,DADAT,DADAQ,DAV,DAROAC
+5 NEW DAROAQ,DAROAT,DAROACFT,DASOAC,DASOAQ,DASOAT,DASOACFT,INS2,INS2CNT,TADFFNV,TADFVFM,TADFFNV2,TADFFUC
+6 NEW TADFFUQ,TADFFUT,TADIINV,TADIVIM,TADIINV2,TADIIUC,TADIIUQ,TADIIUT,TADATATN,TADATVAT,TADAATUC,TADAATUQ,TADAATUT
+7 NEW TADAATMC,TADAATMQ,TADAATMT,TADAATEC,TADAATEQ,TADAATET,TADAATFT,TADROA,TADRUOMC,TADRUOMT,TADRUOMQ,TADTPBC
+8 NEW TADTPBT,TADTPBQ,TADDNV,TADDTC,TADDTQ,TADDTT,TADDTTC,TADDTTQ,TADDTTT,TADDTFT,TADSCC,TADSCT,TADSQ,MDR,MDRCNT
+9 NEW FDA,GLINSTAD,INS2IENS,SCNT,SIGARY,ICFT,TIMCFT,ADMINI,DAVVC,DAVVCFT,DAVVMVM,DAVVPC,DAVVPQ
+10 NEW DAVVPT,DAVVQ,DAVVQ2,DAVVT,DAVVUOMC,DAVVUOMQ,DAVVUOMT,GLINSDA,IFUSF,INSFTAD,INSIENS,TADATAT2,TADSCQ
+11 SET MSF=52.49311
+12 SET INSF=52.4931112
+13 SET IFUSF=52.4931113
+14 SET INSFTAD=52.49311123
+15 SET GL=$NAME(^TMP($JOB,"PSOERXO1","Message",0,"Body",0,MTYPE,0,MEDTYPE,I,"Sig",0))
+16 SET GLINS=$NAME(^TMP($JOB,"PSOERXO1","Message",0,"Body",0,MTYPE,0,MEDTYPE,I,"Sig",0,"Instruction"))
+17 SET CFT=$GET(@GL@("ClarifyingFreeText",0))
SET FDA(MSF,MIEN_","_ERXIEN_",",15)=CFT
+18 SET SIGTEXT=$GET(@GL@("SigText",0))
+19 DO SIG^PSOERXII(ERXIEN,MIEN,SIGTEXT)
+20 SET SNOV=$GET(@GL@("CodeSystem",0,"SNOMEDVersion",0))
SET FDA(MSF,MIEN_","_ERXIEN_",",9.1)=SNOV
+21 SET FMT=$GET(@GL@("CodeSystem",0,"FMTVersion",0))
SET FDA(MSF,MIEN_","_ERXIEN_",",9.2)=FMT
+22 DO CFDA^PSOERXIU(.FDA)
+23 DO FILE^DIE(,"FDA")
KILL FDA
+24 DO IFU^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE)
+25 SET INS=-1
FOR
SET INS=$ORDER(@GLINS@(INS))
if INS=""
QUIT
Begin DoDot:1
+26 ; The multiple instruction modifier will be at the INS-1 subscript, since the modifier comes _after_ the instruction and
+27 ; is optional.
+28 SET GLINSDA=$NAME(^TMP($JOB,"PSOERXO1","Message",0,"Body",0,MTYPE,0,"MedicationPrescribed",I,"Sig",0,"Instruction",INS,"DoseAdministration",0))
+29 SET INSCNT=$GET(INSCNT)+1
+30 SET INSIENS="+"_INSCNT_","_MIEN_","_ERXIEN_","
+31 SET FDA(INSF,INSIENS,.01)=INSCNT
+32 SET MIM=$GET(@GL@("MultipleInstructionModifier",INS-1))
SET FDA(INSF,INSIENS,.03)=MIM
+33 ; dose delivery method
+34 SET INSI=$GET(@GLINS@(INS,"InstructionIndicator",0))
SET FDA(INSF,INSIENS,.02)=INSI
+35 SET ADMINI=$GET(@GLINS@(INS,"AdministrationIndicator",0))
SET FDA(INSF,INSIENS,4.1)=ADMINI
+36 SET DDMC=$GET(@GLINSDA@("DoseDeliveryMethod",0,"Code",0))
SET FDA(INSF,INSIENS,7)=DDMC
+37 SET DDMQ=$GET(@GLINSDA@("DoseDeliveryMethod",0,"Qualifier",0))
SET FDA(INSF,INSIENS,8)=DDMQ
+38 SET DDMT=$GET(@GLINSDA@("DoseDeliveryMethod",0,"Text",0))
SET FDA(INSF,INSIENS,9)=DDMT
+39 SET DDMMC=$GET(@GLINSDA@("DoseDeliveryMethodModifier",0,"Code",0))
SET FDA(INSF,INSIENS,72)=DDMMC
+40 SET DDMMQ=$GET(@GLINSDA@("DoseDeliveryMethodModifier",0,"Qualifier",0))
SET FDA(INSF,INSIENS,73)=DDMMQ
+41 SET DDMMT=$GET(@GLINSDA@("DoseDeliveryMethodModifier",0,"Text",0))
SET FDA(INSF,INSIENS,74)=DDMMT
+42 ; dosage
+43 SET DADDQ=$GET(@GLINSDA@("Dosage",0,"DoseQuantity",0))
SET FDA(INSF,INSIENS,10.1)=DADDQ
+44 SET DADUOMC=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Code",0))
SET FDA(INSF,INSIENS,11)=DADUOMC
+45 SET DADUOMQ=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Qualifier",0))
SET FDA(INSF,INSIENS,12)=DADUOMQ
+46 SET DADUOMT=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",0,"Text",0))
SET FDA(INSF,INSIENS,13)=DADUOMT
+47 SET DADDDRM=$GET(@GLINSDA@("Dosage",0,"DoseRangeModifier",0))
SET FDA(INSF,INSIENS,14)=DADDDRM
+48 ; 2 instances of these elements... check the global/xml structure - not sure where this increments or how it is stored
+49 SET DADDQ2=$GET(@GLINSDA@("Dosage",0,"DoseQuantity",1))
SET FDA(INSF,INSIENS,15.1)=DADDQ2
+50 SET DADUOMC2=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Code",0))
SET FDA(INSF,INSIENS,16)=DADUOMC2
+51 SET DADUOMQ2=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Qualifier",0))
SET FDA(INSF,INSIENS,17)=DADUOMQ2
+52 SET DADUOMT2=$GET(@GLINSDA@("Dosage",0,"DoseUnitOfMeasure",1,"Text",0))
SET FDA(INSF,INSIENS,18)=DADUOMT2
+53 ; Dose calculation - 2 INSTANCES OF DOSINGBASISNUMERIC.. CHECK STRUCTURES
+54 SET DADCDBN=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisNumeric",0))
SET FDA(INSF,INSIENS,21.1)=DADCDBN
+55 SET DADCDBRM=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisRangeModifier",0))
SET FDA(INSF,INSIENS,21.2)=DADCDBRM
+56 SET DADCDBN2=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisNumeric",1))
SET FDA(INSF,INSIENS,21.3)=DADCDBN2
+57 SET DADCDBC=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Code",0))
SET FDA(INSF,INSIENS,22)=DADCDBC
+58 SET DADCDBQ=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Qualifier",0))
SET FDA(INSF,INSIENS,23)=DADCDBQ
+59 SET DADCDBT=$GET(@GLINSDA@("DoseCalculation",0,"DosingBasisUnitOfMeasure",0,"Text",0))
SET FDA(INSF,INSIENS,24)=DADCDBT
+60 SET DADCBMQ=$GET(@GLINSDA@("DoseCalculation",0,"BodyMetricQualifier",0))
SET FDA(INSF,INSIENS,25.1)=DADCBMQ
+61 SET DADCBMV=$GET(@GLINSDA@("DoseCalculation",0,"BodyMetricValue",0))
SET FDA(INSF,INSIENS,25.2)=DADCBMV
+62 SET DADCCDN=$GET(@GLINSDA@("DoseCalculation",0,"CalculatedDoseNumeric",0))
SET FDA(INSF,INSIENS,26)=DADCCDN
+63 SET DADCCDC=$GET(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Code",0))
SET FDA(INSF,INSIENS,27)=DADCCDC
+64 SET DADCCDQ=$GET(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Qualifier",0))
SET FDA(INSF,INSIENS,28)=DADCCDQ
+65 SET DADCCDT=$GET(@GLINSDA@("DoseCalculation",0,"CalculatedDoseUnitOfMeasure",0,"Text",0))
SET FDA(INSF,INSIENS,29)=DADCCDT
+66 SET DADCCF=$GET(@GLINSDA@("DoseCalculation",0,"DoseCalculationClarifyingFreeText",0))
SET FDA(INSF,INSIENS,31)=DADCCF
+67 SET DADDCC=$GET(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Code",0))
SET FDA(INSF,INSIENS,32)=DADDCC
+68 SET DADDCQ=$GET(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Qualifier",0))
SET FDA(INSF,INSIENS,33)=DADDCQ
+69 SET DADDCT=$GET(@GLINSDA@("DoseCalculation",0,"DoseUnitOfMeasureCode",0,"Text",0))
SET FDA(INSF,INSIENS,34)=DADDCT
+70 ; dose amount
+71 SET DADCFT=$GET(@GLINSDA@("DoseClarifyingFreeText",0))
SET FDA(INSF,INSIENS,38)=DADCFT
+72 SET DADAC=$GET(@GLINSDA@("DoseAmount",0,"Code",0))
SET FDA(INSF,INSIENS,35)=DADAC
+73 SET DADAQ=$GET(@GLINSDA@("DoseAmount",0,"Qualifier",0))
SET FDA(INSF,INSIENS,36)=DADAQ
+74 SET DADAT=$GET(@GLINSDA@("DoseAmount",0,"Text",0))
SET FDA(INSF,INSIENS,37)=DADAT
+75 ; Vehicle
+76 SET DAVVPC=$GET(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Code"))
SET FDA(INSF,INSIENS,41)=DAVVPC
+77 SET DAVVPQ=$GET(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Qualifier"))
SET FDA(INSF,INSIENS,42)=DAVVPQ
+78 SET DAVVPT=$GET(@GLINSDA@("Vehicle",0,"VehiclePreposition",0,"Text"))
SET FDA(INSF,INSIENS,43)=DAVVPT
+79 SET DAVVQ=$GET(@GLINSDA@("Vehicle",0,"VehicleQuantity",0))
SET FDA(INSF,INSIENS,44.1)=DAVVQ
+80 SET DAVVMVM=$GET(@GLINSDA@("Vehicle",0,"MultipleVehicleModifier",0))
SET FDA(INSF,INSIENS,44.2)=DAVVMVM
+81 SET DAVVQ2=$GET(@GLINSDA@("Vehicle",0,"VehicleQuantity",1))
SET FDA(INSF,INSIENS,44.3)=DAVVQ2
+82 SET DAVVUOMC=$GET(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Code"))
SET FDA(INSF,INSIENS,45)=DAVVUOMC
+83 SET DAVVUOMQ=$GET(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Qualifier"))
SET FDA(INSF,INSIENS,46)=DAVVUOMQ
+84 SET DAVVUOMT=$GET(@GLINSDA@("Vehicle",0,"VehicleUnitOfMeasure",0,"Text"))
SET FDA(INSF,INSIENS,47)=DAVVUOMT
+85 SET DAVVC=$GET(@GLINSDA@("Vehicle",0,"Vehicle",0,"Code",0))
SET FDA(INSF,INSIENS,51)=DAVVC
+86 SET DAVVQ=$GET(@GLINSDA@("Vehicle",0,"Vehicle",0,"Qualifier",0))
SET FDA(INSF,INSIENS,52)=DAVVQ
+87 SET DAVVT=$GET(@GLINSDA@("Vehicle",0,"Vehicle",0,"Text",0))
SET FDA(INSF,INSIENS,53)=DAVVT
+88 SET DAVVCFT=$GET(@GLINSDA@("Vehicle",0,"VehicleClarifyingFreeText",0))
SET FDA(INSF,INSIENS,54)=DAVVCFT
+89 ; route of administration
+90 SET DAROAC=$GET(@GLINSDA@("RouteOfAdministration",0,"Code",0))
SET FDA(INSF,INSIENS,55)=DAROAC
+91 SET DAROAQ=$GET(@GLINSDA@("RouteOfAdministration",0,"Qualifier",0))
SET FDA(INSF,INSIENS,56)=DAROAQ
+92 SET DAROAT=$GET(@GLINSDA@("RouteOfAdministration",0,"Text",0))
SET FDA(INSF,INSIENS,57)=DAROAT
+93 SET DAROACFT=$GET(@GLINS@("RouteOfAdministrationClarifyingFreeText",0))
SET FDA(INSF,INSIENS,58)=DAROACFT
+94 ; site of administration
+95 SET DASOAC=$GET(@GLINSDA@("SiteOfAdministration",0,"Code",0))
SET FDA(INSF,INSIENS,61)=DASOAC
+96 SET DASOAQ=$GET(@GLINSDA@("SiteOfAdministration",0,"Qualifier",0))
SET FDA(INSF,INSIENS,62)=DASOAQ
+97 SET DASOAT=$GET(@GLINSDA@("SiteOfAdministration",0,"Text",0))
SET FDA(INSF,INSIENS,63)=DASOAT
+98 SET DASOACFT=$GET(@GLINSDA@("SiteOfAdministrationClarifyingFreeText",0))
SET FDA(INSF,INSIENS,64)=DASOACFT
+99 SET ICFT=$GET(@GLINS@(INS,"IndicationClarifyingFreeText",0))
SET FDA(INSF,INSIENS,70)=ICFT
+100 NEW NINSIEN,NEWIEN
+101 DO CFDA^PSOERXIU(.FDA)
+102 DO UPDATE^DIE(,"FDA","NEWIEN")
KILL FDA
SET NEWIEN=$ORDER(NEWIEN(0))
SET NINSIEN=$GET(NEWIEN(NEWIEN))
+103 ;PSO*7*635 - add handling of 'IndicationForUse' when it appears under the 'Instruction' segment
+104 DO INSIFU^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE,INS,NINSIEN)
+105 ;PSO*7*635 - end change
+106 SET INS2=-1
FOR
SET INS2=$ORDER(@GLINS@(INS,"TimingAndDuration",INS2))
if INS2=""
QUIT
Begin DoDot:2
+107 ; frequency - note dual FrequencyNumericValue components. need to see how that gets stored. incrementor?
+108 SET INS2CNT=$GET(INS2CNT)+1
+109 SET INS2IENS="+"_INS2CNT_","_NINSIEN_","_MIEN_","_ERXIEN_","
+110 SET FDA(INSFTAD,INS2IENS,.01)=INS2CNT
+111 SET MTM=$GET(@GLINS@(INS,"MultipleTimingModifier",0))
SET FDA(INSFTAD,INS2IENS,.02)=MTM
+112 SET GLINSTAD=$NAME(^TMP($JOB,"PSOERXO1","Message",0,"Body",0,MTYPE,0,"MedicationPrescribed",0,"Sig",0,"Instruction",INS,"TimingAndDuration",INS2))
+113 SET TADFFNV=$GET(@GLINSTAD@("Frequency",0,"FrequencyNumericValue",0))
SET FDA(INSFTAD,INS2IENS,11.1)=TADFFNV
+114 SET TADFVFM=$GET(@GLINSTAD@("Frequency",0,"VariableFrequencyModifier",0))
SET FDA(INSFTAD,INS2IENS,11.2)=TADFVFM
+115 SET TADFFNV2=$GET(@GLINSTAD@("Frequency",0,"FrequencyNumericValue",1))
SET FDA(INSFTAD,INS2IENS,11.3)=TADFFNV2
+116 SET TADFFUC=$GET(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,12)=TADFFUC
+117 SET TADFFUQ=$GET(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,13)=TADFFUQ
+118 SET TADFFUT=$GET(@GLINSTAD@("Frequency",0,"FrequencyUnits",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,14)=TADFFUT
+119 ; interval - same issue as frequency
+120 SET TADIINV=$GET(@GLINSTAD@("Interval",0,"IntervalNumericValue",0))
SET FDA(INSFTAD,INS2IENS,15.1)=TADIINV
+121 SET TADIVIM=$GET(@GLINSTAD@("Interval",0,"VariableIntervalModifier",0))
SET FDA(INSFTAD,INS2IENS,15.2)=TADIVIM
+122 SET TADIINV2=$GET(@GLINSTAD@("Interval",0,"IntervalNumericValue",1))
SET FDA(INSFTAD,INS2IENS,15.3)=TADIINV2
+123 SET TADIIUC=$GET(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,16)=TADIIUC
+124 SET TADIIUQ=$GET(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,17)=TADIIUQ
+125 SET TADIIUT=$GET(@GLINSTAD@("Interval",0,"IntervalUnits",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,18)=TADIIUT
+126 ;admin timing
+127 SET TADATATN=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingNumericValue",0))
SET FDA(INSFTAD,INS2IENS,.03)=TADATATN
+128 SET TADATAT2=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingNumericValue",1))
SET FDA(INSFTAD,INS2IENS,.05)=TADATAT2
+129 SET TADATVAT=$GET(@GLINSTAD@("AdministrationTiming",0,"VariableAdministrationTimingModifier",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,.04)=TADATVAT
+130 SET TADAATUC=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,1)=TADAATUC
+131 SET TADAATUQ=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,2)=TADAATUQ
+132 SET TADAATUT=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingUnits",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,3)=TADAATUT
+133 SET TADAATMC=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,4)=TADAATMC
+134 SET TADAATMQ=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,5)=TADAATMQ
+135 SET TADAATMT=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingModifier",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,6)=TADAATMT
+136 SET TADAATEC=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,7)=TADAATEC
+137 SET TADAATEQ=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,8)=TADAATEQ
+138 SET TADAATET=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingEvent",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,9)=TADAATET
+139 SET TADAATFT=$GET(@GLINSTAD@("AdministrationTiming",0,"AdministrationTimingClarifyingFreeText",0))
SET FDA(INSFTAD,INS2IENS,10)=TADAATFT
+140 ; rate of administration
+141 SET TADROA=$GET(@GLINSTAD@("RateOfAdministration",0,"RateOfAdministration",0))
SET FDA(INSFTAD,INS2IENS,21.1)=TADROA
+142 SET TADRUOMC=$GET(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Code"))
SET FDA(INSFTAD,INS2IENS,22)=TADRUOMC
+143 SET TADRUOMT=$GET(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Text"))
SET FDA(INSFTAD,INS2IENS,24)=TADRUOMT
+144 SET TADRUOMQ=$GET(@GLINSTAD@("RateOfAdministration",0,"RateUnitOfMeasure",0,"Qualifier"))
SET FDA(INSFTAD,INS2IENS,23)=TADRUOMQ
+145 SET TADTPBC=$GET(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Code"))
SET FDA(INSFTAD,INS2IENS,25)=TADTPBC
+146 SET TADTPBT=$GET(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Text"))
SET FDA(INSFTAD,INS2IENS,27)=TADTPBT
+147 SET TADTPBQ=$GET(@GLINSTAD@("RateOfAdministration",0,"TimePeriodBasis",0,"Qualifier"))
SET FDA(INSFTAD,INS2IENS,26)=TADTPBQ
+148 SET TIMCFT=$GET(@GLINSTAD@("TimeClarifyingFreeText",0))
SET FDA(INSFTAD,INS2IENS,28)=TIMCFT
+149 ; duration
+150 SET TADDNV=$GET(@GLINSTAD@("Duration",0,"DurationNumericValue",0))
SET FDA(INSFTAD,INS2IENS,31)=TADDNV
+151 SET TADDTC=$GET(@GLINSTAD@("Duration",0,"DurationText",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,32)=TADDTC
+152 SET TADDTQ=$GET(@GLINSTAD@("Duration",0,"DurationText",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,33)=TADDTQ
+153 SET TADDTT=$GET(@GLINSTAD@("Duration",0,"DurationText",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,34)=TADDTT
+154 ; duration trigger
+155 SET TADDTTC=$GET(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,35)=TADDTTC
+156 SET TADDTTQ=$GET(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,36)=TADDTTQ
+157 SET TADDTTT=$GET(@GLINSTAD@("DurationTrigger",0,"Trigger",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,37)=TADDTTT
+158 SET TADDTFT=$GET(@GLINSTAD@("DurationTrigger",0,"DurationClarifyingFreeText",0))
SET FDA(INSFTAD,INS2IENS,38)=TADDTFT
+159 ; stop code
+160 SET TADSCC=$GET(@GLINSTAD@("StopCode",0,"Code",0))
SET FDA(INSFTAD,INS2IENS,41)=TADSCC
+161 SET TADSCT=$GET(@GLINSTAD@("StopCode",0,"Text",0))
SET FDA(INSFTAD,INS2IENS,43)=TADSCT
+162 SET TADSCQ=$GET(@GLINSTAD@("StopCode",0,"Qualifier",0))
SET FDA(INSFTAD,INS2IENS,42)=TADSCQ
+163 DO CFDA^PSOERXIU(.FDA)
+164 DO UPDATE^DIE(,"FDA")
KILL FDA
+165 ;D MDRSF^PSOERXII(GLINS,ERXIEN,MIEN,NINSIEN)
End DoDot:2
End DoDot:1
+166 DO MDR^PSOERXII(ERXIEN,MIEN,MTYPE,MEDTYPE)
+167 QUIT