- PSSHREQ ;WOIFO/AV,TS - Creates PSSXML to send to PEPS using input global ;09/20/07
- ;;1.0;PHARMACY DATA MANAGEMENT;**136,163**;9/30/97;Build 8
- ;
- ; @authors - Alex Vazquez, Tim Sabat, Steve Gordon
- ; @date - September 19, 2007
- ; @version - 1.0
- ;
- QUIT
- ;;
- BLDPREQ(PSSBASE) ;
- ; @DRIVER
- ;
- ; @DESC Builds the PEPSRequest PSSXML element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An xml string representing an entire order check.
- ;
- NEW PSS,PSSXML
- ;
- SET PSS("PSSXMLHeader")=$$XMLHDR^MXMLUTL
- SET PSS("xmlns")=$$ATRIBUTE^PSSHRCOM("xmlns","gov/va/med/pharmacy/peps/external/common/preencapsulation/vo/drug/check/request")
- SET PSS("xsi")=$$ATRIBUTE^PSSHRCOM("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")
- ;
- SET PSSXML=PSS("PSSXMLHeader")
- SET PSSXML=PSSXML_"<PEPSRequest"
- SET PSSXML=PSSXML_" "_PSS("xmlns")
- SET PSSXML=PSSXML_" "_PSS("xsi")
- SET PSSXML=PSSXML_" >"
- SET PSSXML=PSSXML_$$HEADER(PSSBASE)
- I '$D(^TMP($JOB,PSSBASE,"IN","PING")) SET PSSXML=PSSXML_$$BODY(PSSBASE)
- SET PSSXML=PSSXML_"</PEPSRequest>"
- ;
- QUIT PSSXML
- ;;
- ; @DESC Builds the Header PSSXML element. A header is the section of the PSSXML
- ; that includes time, server, and user. This item holds no business logic, it
- ; only records debugging information.
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS A the PSSXML string representing the header element.
- ;
- NEW PSSXML,PSS
- ;
- ; pingOnly is OPTIONAL. If data in global, set pingOnly to true
- IF $DATA(^TMP($JOB,PSSBASE,"IN","PING")) DO
- . SET PSS("pingOnly")=$$ATRIBUTE^PSSHRCOM("pingOnly","true")
- . QUIT
- ;
- SET PSSXML="<Header "_$GET(PSS("pingOnly"))_">"
- SET PSSXML=PSSXML_$$HDRTIME
- SET PSSXML=PSSXML_$$HDRSERVR
- SET PSSXML=PSSXML_$$HDRMUSER
- SET PSSXML=PSSXML_"</Header>"
- ;
- ; Return composed header
- QUIT PSSXML
- ;;
- HDRTIME() ;
- ; @DESC Builds the Time PSSXML element which resides in the header
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An xml string containing the time element.
- ;
- NEW PSS,PSSXML
- ;
- SET PSS("value")=$$ATRIBUTE^PSSHRCOM("value",$GET(DT))
- ;
- SET PSSXML="<Time"
- SET PSSXML=PSSXML_" "_PSS("value")
- SET PSSXML=PSSXML_" />"
- ;
- QUIT PSSXML
- ;;
- HDRSERVR() ;
- ; @DESC Builds the MServer PSSXML element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the server element.
- ;
- NEW PSS,PSSXML,PSSNTDS1,PSSNTDS2,PSSNTDS3,PSSNTDS4,PSSNTDS5
- ;
- SET PSS("IP")=$$ATRIBUTE^PSSHRCOM("ip",$GET(IO("IP")))
- ;
- ; Namespace will remain empty because the method call used to get it
- ; is considered non-standard mumps.
- SET PSS("nameSpace")=$$ATRIBUTE^PSSHRCOM("namespace","")
- ;
- SET PSS("serverName")=$$ATRIBUTE^PSSHRCOM("serverName",$PIECE($GET(XMV("NETNAME")),"@",2))
- ;
- ;SET PSS("stationNumberOnly")=$$IEN^XUAF4($PIECE($$SITE^VASITE(),"^",1))
- ;IF PSS("stationNumberOnly")="" SET PSS("stationNumberOnly")=1
- S PSSNTDS1=$P($$SITE^VASITE(),"^",3)
- I PSSNTDS1'?1N.N S PSSNTDS2=$L(PSSNTDS1) S PSSNTDS5="" D:PSSNTDS2>0 S PSSNTDS1=PSSNTDS5 I PSSNTDS1'?1N.N S PSSNTDS1=0
- .F PSSNTDS3=1:1:PSSNTDS2 S PSSNTDS4=$E(PSSNTDS1,PSSNTDS3) Q:PSSNTDS4'?1N S PSSNTDS5=PSSNTDS5_PSSNTDS4
- SET PSS("stationNumber")=$$ATRIBUTE^PSSHRCOM("stationNumber",PSSNTDS1)
- ;
- ; Namespace will remain empty because the method call used to get it
- ; is considered non-standard mumps.
- SET PSS("UCI")=$$ATRIBUTE^PSSHRCOM("uci","")
- ;
- SET PSSXML="<MServer"
- SET PSSXML=PSSXML_" "_PSS("IP")
- SET PSSXML=PSSXML_" "_PSS("nameSpace")
- SET PSSXML=PSSXML_" "_PSS("serverName")
- SET PSSXML=PSSXML_" "_PSS("stationNumber")
- SET PSSXML=PSSXML_" "_PSS("UCI")
- SET PSSXML=PSSXML_" />"
- ;
- QUIT PSSXML
- ;;
- HDRMUSER() ;
- ; @DESC Builds the user element of the PSSXML
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the M user.
- ;
- NEW PSS,PSSXML,PSSNTDZ,PSSNTDJB
- ;
- S PSSNTDZ=$G(DUZ) I PSSNTDZ'?1N.N S PSSNTDZ=0
- ;
- SET PSS("DUZ")=$$ATRIBUTE^PSSHRCOM("duz",PSSNTDZ)
- ;
- S PSSNTDJB=$J S:PSSNTDJB'?1N.N PSSNTDJB=0 SET PSS("jobNumber")=$$ATRIBUTE^PSSHRCOM("jobNumber",PSSNTDJB)
- ;
- ; FIXME need to get username
- SET PSS("userName")=$$ATRIBUTE^PSSHRCOM("userName",$$GET1^DIQ(200,DUZ_",",.01))
- ;
- SET PSSXML="<MUser"
- SET PSSXML=PSSXML_" "_PSS("DUZ")
- SET PSSXML=PSSXML_" "_PSS("jobNumber")
- SET PSSXML=PSSXML_" "_PSS("userName")
- SET PSSXML=PSSXML_" />"
- ;
- QUIT PSSXML
- ;;
- BODY(PSSBASE) ;
- ; @DESC Builds the Body PSSXML element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the body element.
- ;
- NEW PSSXML
- ;
- SET PSSXML="<Body>"
- SET PSSXML=PSSXML_$$DRGCHEK(PSSBASE)
- SET PSSXML=PSSXML_"</Body>"
- ;
- QUIT PSSXML
- ;;
- DRGCHEK(PSSBASE) ;
- ; @DESC Builds the DrugCheck PSSXML element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS an PSSXML string representing the drugCheck element
- ;
- NEW PSSXML
- ;
- SET PSSXML="<drugCheck>"
- SET PSSXML=PSSXML_$$CHECKS(PSSBASE)
- SET PSSXML=PSSXML_$$DRUGPROS(PSSBASE)
- SET PSSXML=PSSXML_$$MEDPROF(PSSBASE)
- SET PSSXML=PSSXML_"</drugCheck>"
- ;
- ; Return the full drugCheck element
- QUIT PSSXML
- ;;
- CHECKS(PSSBASE) ;
- ; @DESC Builds the checks PSSXML element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the checks element.
- ;
- NEW PSS,PSSXML
- ;
- ; If data in global, set prospective only to false
- IF $DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE")) DO
- . SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","false")
- . QUIT
- ;
- ; If no data in global, set prospective only to true
- IF '$DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE")) DO
- . SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","true")
- . QUIT
- ;
- ; OPTIONAL. TBA Right now set to false, will be used in future
- SET PSS("useCustomTables")=$$ATRIBUTE^PSSHRCOM("useCustomTables","true")
- ;
- SET PSSXML="<checks"
- SET PSSXML=PSSXML_" "_$GET(PSS("prospectiveOnly"))
- SET PSSXML=PSSXML_" "_$GET(PSS("useCustomTables"))
- SET PSSXML=PSSXML_" >"
- SET PSSXML=PSSXML_$$CHEKDOSE(PSSBASE)
- SET PSSXML=PSSXML_$$CHEKDRUG(PSSBASE)
- SET PSSXML=PSSXML_$$CHEKTHER(PSSBASE)
- SET PSSXML=PSSXML_"</checks>"
- ;
- ; Return the full drugCheck element
- QUIT PSSXML
- ;;
- CHEKDOSE(PSSBASE) ;
- ; @DESC Sets the drugDoseCheck element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the doseCheck element
- ;
- NEW PSSXML
- ;
- SET PSSXML=""
- ;
- IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE")) DO
- . SET PSSXML="<drugDoseCheck>"
- . ; Get the demographics PSSXML section
- . SET PSSXML=PSSXML_$$DEMOGRAF(PSSBASE)
- . SET PSSXML=PSSXML_"</drugDoseCheck>"
- . QUIT
- ;
- QUIT PSSXML
- ;;
- DEMOGRAF(PSSBASE) ;
- ; @DESC Builds the demographic element
- ;
- ; @PSSBASE Input global base
- ;
- ; @RETURNS An PSSXML string representation of the demographics element
- ;
- NEW PSSXML,PSS
- ;
- SET PSS("bsa")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","BSA"))
- SET PSS("bodySurfaceAreaInSqM")=$$ATRIBUTE^PSSHRCOM("bodySurfaceAreaInSqM",PSS("bsa"))
- ;
- SET PSS("wt")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","WT"))
- SET PSS("weightInKG")=$$ATRIBUTE^PSSHRCOM("weightInKG",PSS("wt"))
- ;
- SET PSS("age")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","AGE"))
- SET PSS("ageInDays")=$$ATRIBUTE^PSSHRCOM("ageInDays",PSS("age"))
- ;
- SET PSSXML="<demographics "_PSS("bodySurfaceAreaInSqM")_" "_PSS("weightInKG")_" "_PSS("ageInDays")_"/>"
- QUIT PSSXML
- ;;
- CHEKDRUG(PSSBASE) ;
- ; @DESC Sets the drugDrugCheck element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML String representing drugDoseCheck element
- ;
- NEW PSSXML
- ;
- SET PSSXML=""
- ; If drug drug global set, add drug drug check
- IF $DATA(^TMP($JOB,PSSBASE,"IN","DRUGDRUG"))=1 DO
- . SET PSSXML="<drugDrugCheck />"
- . QUIT
- ;
- QUIT PSSXML
- ;;
- CHEKTHER(PSSBASE) ;
- ; @DESC Sets the drugTherapyCheck element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing the drugTherapyCheck element
- ;
- NEW PSSXML
- SET PSSXML=""
- ; If drug therapy set, add therapy check
- IF $DATA(^TMP($JOB,PSSBASE,"IN","THERAPY"))=1 DO
- . SET PSSXML="<drugTherapyCheck />"
- . QUIT
- ;
- QUIT PSSXML
- ;;
- MEDPROF(PSSBASE) ;
- ; @DESC Builds a medicationProfile element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS PSSXML string element of the medicationProfile
- ;
- NEW PSS,PSSXML
- ;
- SET PSSXML="<medicationProfile>"
- SET PSSXML=PSSXML_$$DRUGPROF(PSSBASE)
- SET PSSXML=PSSXML_"</medicationProfile>"
- ;
- QUIT PSSXML
- ;;
- DRUGPROS(PSSBASE) ;
- ; @DESC Builds prospectiveDrugs element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing prospectiveDrugs
- ;
- NEW PSSXML,PSSDRUGS
- ;
- ; Read drug info from input global, store in PSSDRUGS hash
- DO READRUGS(PSSBASE,"PROSPECTIVE",.PSSDRUGS)
- D
- .I '$D(PSSDRUGS("DRUG")) S PSSXML="" Q ;if no prospective drug just return null
- .; Write the drugs as PSSXML
- .SET PSSXML="<prospectiveDrugs>"_$$RITEDRGS(.PSSDRUGS)_"</prospectiveDrugs>"
- ;
- QUIT PSSXML
- ;;
- DRUGPROF(PSSBASE) ;
- ; @DESC Builds a prospective drug element
- ;
- ; @PSSBASE Base of input global
- ;
- ; @RETURNS An PSSXML string representing profile drugs
- ;
- NEW PSSXML,PSSDRUGS
- ;
- ; Read from the input global and put in PSSDRUGS hash
- DO READRUGS(PSSBASE,"PROFILE",.PSSDRUGS)
- ; Write the profile drugs as PSSXML
- SET PSSXML=$$RITEDRGS(.PSSDRUGS)
- ;
- QUIT PSSXML
- ;;
- READRUGS(PSSBASE,DRUGTYPE,PSSDRUGS) ;
- ; @DESC Builds either a prospective or a profile drug element.
- ; Note the "DRUGTYPE" parameter. This param allows for re-use, so either
- ; a profile or a prospective drug can be created.
- ;
- ; @PSSBASE Base of input global
- ; @DRUGTYPE A drug type, either Prospective or Profile
- ; @PSSDRUGS ByRef, variable to store drug attributes in
- ;
- ; @RETURNS Nothing, values stored in drugs variable
- ;
- NEW PSS
- ;
- SET PSS("ien")=""
- SET PSS("count")=0
- ;
- ; Loop through the unique order numbers
- SET PSS("orderNumber")=""
- FOR SET PSS("orderNumber")=$ORDER(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber"))) QUIT:PSS("orderNumber")="" DO
- . SET PSS("count")=PSS("count")+1
- . SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber")))
- . ; Set the drug order number
- . SET PSSDRUGS("DRUG",PSS("count"),"orderNumber")=PSS("orderNumber")
- . ; Set the drug gcn sequence number
- . SET PSSDRUGS("DRUG",PSS("count"),"gcn")=+$PIECE(PSS("value"),"^",1)
- . ; Set the drug vuid
- . SET PSSDRUGS("DRUG",PSS("count"),"vuid")=+$PIECE(PSS("value"),"^",2)
- . ; Set the drug ien
- . SET PSSDRUGS("DRUG",PSS("count"),"ien")=+$PIECE(PSS("value"),"^",3)
- . ; Set the drug name
- . SET PSSDRUGS("DRUG",PSS("count"),"drugName")=$PIECE(PSS("value"),"^",4)
- . ; Set the cprs order number
- . SET PSSDRUGS("DRUG",PSS("count"),"cprsOrderNumber")=$PIECE(PSS("value"),"^",5)
- . ; Set the package
- . SET PSSDRUGS("DRUG",PSS("count"),"package")=$PIECE(PSS("value"),"^",6)
- . ;
- . ; Get the possible dose information for the drug
- . DO READDOSE(PSSBASE,.PSSDRUGS,PSS("count"),PSS("orderNumber"))
- . QUIT
- ;
- QUIT
- ;;
- RITEDRGS(PSSDRUGS) ;
- ; @DESC Loop through the drugs and return PSSXML
- ;
- ; @PSSDRUGS Array containing the list of drugs
- ;
- ; @RETURNS PSSXML representing the drugs in array
- ;
- NEW PSSCOUNT,PSSXML
- ;
- SET PSSXML=""
- SET PSSCOUNT=""
- FOR SET PSSCOUNT=$ORDER(PSSDRUGS("DRUG",PSSCOUNT)) QUIT:PSSCOUNT="" DO
- . ; loop through drugs and append to PSSXML
- . SET PSSXML=PSSXML_$$RITEDRUG(.PSSDRUGS,PSSCOUNT)
- . QUIT
- ;
- QUIT PSSXML
- ;;
- RITEDRUG(PSSDRUGS,PSSCOUNT) ;
- ; @DESC Builds a single drug xml element
- ;
- ; @PSSDRUGS A handle to the drug object
- ; @PSSCOUNT The counter where the information should be taken from
- ;
- ; @RETURNS An PSSXML string representing a single drug
- ;
- NEW PSS,PSSXML,PSSORDR
- ;
- IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"drugName")) DO
- . SET PSS("drugName")=$$ATRIBUTE^PSSHRCOM("drugName",PSSDRUGS("DRUG",PSSCOUNT,"drugName"))
- ;
- SET PSS("gcnSeqNo")=$$ATRIBUTE^PSSHRCOM("gcnSeqNo",PSSDRUGS("DRUG",PSSCOUNT,"gcn"))
- ;
- SET PSS("ien")=$$ATRIBUTE^PSSHRCOM("ien",PSSDRUGS("DRUG",PSSCOUNT,"ien"))
- ;
- ; Concatenate the orderNumber, cprs order number, and package
- ; ex. orderNumber|cprsOrderNumber|package
- SET PSSORDR=PSSDRUGS("DRUG",PSSCOUNT,"orderNumber")_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"cprsOrderNumber"))_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"package"))
- ;
- SET PSS("orderNumber")=$$ATRIBUTE^PSSHRCOM("orderNumber",PSSORDR)
- ;
- ; vuid is optional
- IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"vuid")) DO
- . SET PSS("vuid")=$$ATRIBUTE^PSSHRCOM("vuid",PSSDRUGS("DRUG",PSSCOUNT,"vuid"))
- ;
- SET PSSXML="<drug "_PSS("drugName")_" "_PSS("gcnSeqNo")_" "_PSS("ien")_" "_PSS("orderNumber")_" "_PSS("vuid")_" >"
- SET PSSXML=PSSXML_$$RITEDOSE(.PSSDRUGS,PSSCOUNT)
- SET PSSXML=PSSXML_"</drug>"
- ;
- QUIT PSSXML
- ;;
- READDOSE(PSSBASE,PSSHASH,PSSCOUNT,ORDRNM) ;
- ; @DESC Sets the individual drugDose elements, including all dosing amounts,
- ; frequency, etc for an individual drug.
- ;
- ; @DOSE A handle to the drug dose you want to turn into PSSXML
- ;
- ; @RETURNS Nothing, values stored in hash
- ;
- NEW PSS
- ;
- ; If no drug dose information exist for the drug quit
- IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0 SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=0
- IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0 QUIT
- IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))>0 SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=1
- ;
- SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))
- ; If specific get values (doseAmount,doseUnit,doseRate,frequency,
- ; duration,durationRate,medicalRoute,doseType)
- SET PSSHASH("DRUG",PSSCOUNT,"doseAmount")=$PIECE(PSS("value"),"^",5)
- SET PSSHASH("DRUG",PSSCOUNT,"doseUnit")=$PIECE(PSS("value"),"^",6)
- SET PSSHASH("DRUG",PSSCOUNT,"doseRate")=$PIECE(PSS("value"),"^",7)
- SET PSSHASH("DRUG",PSSCOUNT,"frequency")=$PIECE(PSS("value"),"^",8)
- SET PSSHASH("DRUG",PSSCOUNT,"duration")=$PIECE(PSS("value"),"^",9)
- SET PSSHASH("DRUG",PSSCOUNT,"durationRate")=$PIECE(PSS("value"),"^",10)
- SET PSSHASH("DRUG",PSSCOUNT,"route")=$PIECE(PSS("value"),"^",11)
- SET PSSHASH("DRUG",PSSCOUNT,"doseType")=$PIECE(PSS("value"),"^",12)
- QUIT
- ;;
- RITEDOSE(PSSHASH,I) ;
- ; @DESC Writes the doseInformation PSSXML element
- ;
- ; @PSSHASH Hash value with variables used to create element
- ;
- ; @RETURNS A valid drugDose XML element
- ;
- NEW PSSXML
- ;
- SET PSSXML=""
- IF +$GET(PSSHASH("DRUG",I,"hasDose"))=0 QUIT PSSXML
- ;
- ; Create dose information
- SET PSSXML="<doseInformation>"
- SET PSSXML=PSSXML_"<doseType>"_PSSHASH("DRUG",I,"doseType")_"</doseType>"
- SET PSSXML=PSSXML_"<doseAmount>"_PSSHASH("DRUG",I,"doseAmount")_"</doseAmount>"
- SET PSSXML=PSSXML_"<doseUnit>"_PSSHASH("DRUG",I,"doseUnit")_"</doseUnit>"
- SET PSSXML=PSSXML_"<doseRate>"_PSSHASH("DRUG",I,"doseRate")_"</doseRate>"
- I $L(PSSHASH("DRUG",I,"frequency")) SET PSSXML=PSSXML_"<frequency>"_PSSHASH("DRUG",I,"frequency")_"</frequency>"
- I $L(PSSHASH("DRUG",I,"duration")) SET PSSXML=PSSXML_"<duration>"_PSSHASH("DRUG",I,"duration")_"</duration>"
- I $L(PSSHASH("DRUG",I,"durationRate")) SET PSSXML=PSSXML_"<durationRate>"_PSSHASH("DRUG",I,"durationRate")_"</durationRate>"
- SET PSSXML=PSSXML_"<route>"_PSSHASH("DRUG",I,"route")_"</route>"
- ;
- ; Close off dose information
- SET PSSXML=PSSXML_"</doseInformation>"
- ;
- QUIT PSSXML
- ;;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSSHREQ 15435 printed Feb 18, 2025@23:57:52 Page 2
- PSSHREQ ;WOIFO/AV,TS - Creates PSSXML to send to PEPS using input global ;09/20/07
- +1 ;;1.0;PHARMACY DATA MANAGEMENT;**136,163**;9/30/97;Build 8
- +2 ;
- +3 ; @authors - Alex Vazquez, Tim Sabat, Steve Gordon
- +4 ; @date - September 19, 2007
- +5 ; @version - 1.0
- +6 ;
- +7 QUIT
- +8 ;;
- BLDPREQ(PSSBASE) ;
- +1 ; @DRIVER
- +2 ;
- +3 ; @DESC Builds the PEPSRequest PSSXML element
- +4 ;
- +5 ; @PSSBASE Base of input global
- +6 ;
- +7 ; @RETURNS An xml string representing an entire order check.
- +8 ;
- +9 NEW PSS,PSSXML
- +10 ;
- +11 SET PSS("PSSXMLHeader")=$$XMLHDR^MXMLUTL
- +12 SET PSS("xmlns")=$$ATRIBUTE^PSSHRCOM("xmlns","gov/va/med/pharmacy/peps/external/common/preencapsulation/vo/drug/check/request")
- +13 SET PSS("xsi")=$$ATRIBUTE^PSSHRCOM("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")
- +14 ;
- +15 SET PSSXML=PSS("PSSXMLHeader")
- +16 SET PSSXML=PSSXML_"<PEPSRequest"
- +17 SET PSSXML=PSSXML_" "_PSS("xmlns")
- +18 SET PSSXML=PSSXML_" "_PSS("xsi")
- +19 SET PSSXML=PSSXML_" >"
- +20 SET PSSXML=PSSXML_$$HEADER(PSSBASE)
- +21 IF '$DATA(^TMP($JOB,PSSBASE,"IN","PING"))
- SET PSSXML=PSSXML_$$BODY(PSSBASE)
- +22 SET PSSXML=PSSXML_"</PEPSRequest>"
- +23 ;
- +24 QUIT PSSXML
- +25 ;;
- +1 ; @DESC Builds the Header PSSXML element. A header is the section of the PSSXML
- +2 ; that includes time, server, and user. This item holds no business logic, it
- +3 ; only records debugging information.
- +4 ;
- +5 ; @PSSBASE Base of input global
- +6 ;
- +7 ; @RETURNS A the PSSXML string representing the header element.
- +8 ;
- +9 NEW PSSXML,PSS
- +10 ;
- +11 ; pingOnly is OPTIONAL. If data in global, set pingOnly to true
- +12 IF $DATA(^TMP($JOB,PSSBASE,"IN","PING"))
- Begin DoDot:1
- +13 SET PSS("pingOnly")=$$ATRIBUTE^PSSHRCOM("pingOnly","true")
- +14 QUIT
- End DoDot:1
- +15 ;
- +16 SET PSSXML="<Header "_$GET(PSS("pingOnly"))_">"
- +17 SET PSSXML=PSSXML_$$HDRTIME
- +18 SET PSSXML=PSSXML_$$HDRSERVR
- +19 SET PSSXML=PSSXML_$$HDRMUSER
- +20 SET PSSXML=PSSXML_"</Header>"
- +21 ;
- +22 ; Return composed header
- +23 QUIT PSSXML
- +24 ;;
- HDRTIME() ;
- +1 ; @DESC Builds the Time PSSXML element which resides in the header
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An xml string containing the time element.
- +6 ;
- +7 NEW PSS,PSSXML
- +8 ;
- +9 SET PSS("value")=$$ATRIBUTE^PSSHRCOM("value",$GET(DT))
- +10 ;
- +11 SET PSSXML="<Time"
- +12 SET PSSXML=PSSXML_" "_PSS("value")
- +13 SET PSSXML=PSSXML_" />"
- +14 ;
- +15 QUIT PSSXML
- +16 ;;
- HDRSERVR() ;
- +1 ; @DESC Builds the MServer PSSXML element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the server element.
- +6 ;
- +7 NEW PSS,PSSXML,PSSNTDS1,PSSNTDS2,PSSNTDS3,PSSNTDS4,PSSNTDS5
- +8 ;
- +9 SET PSS("IP")=$$ATRIBUTE^PSSHRCOM("ip",$GET(IO("IP")))
- +10 ;
- +11 ; Namespace will remain empty because the method call used to get it
- +12 ; is considered non-standard mumps.
- +13 SET PSS("nameSpace")=$$ATRIBUTE^PSSHRCOM("namespace","")
- +14 ;
- +15 SET PSS("serverName")=$$ATRIBUTE^PSSHRCOM("serverName",$PIECE($GET(XMV("NETNAME")),"@",2))
- +16 ;
- +17 ;SET PSS("stationNumberOnly")=$$IEN^XUAF4($PIECE($$SITE^VASITE(),"^",1))
- +18 ;IF PSS("stationNumberOnly")="" SET PSS("stationNumberOnly")=1
- +19 SET PSSNTDS1=$PIECE($$SITE^VASITE(),"^",3)
- +20 IF PSSNTDS1'?1N.N
- SET PSSNTDS2=$LENGTH(PSSNTDS1)
- SET PSSNTDS5=""
- if PSSNTDS2>0
- Begin DoDot:1
- +21 FOR PSSNTDS3=1:1:PSSNTDS2
- SET PSSNTDS4=$EXTRACT(PSSNTDS1,PSSNTDS3)
- if PSSNTDS4'?1N
- QUIT
- SET PSSNTDS5=PSSNTDS5_PSSNTDS4
- End DoDot:1
- SET PSSNTDS1=PSSNTDS5
- IF PSSNTDS1'?1N.N
- SET PSSNTDS1=0
- +22 SET PSS("stationNumber")=$$ATRIBUTE^PSSHRCOM("stationNumber",PSSNTDS1)
- +23 ;
- +24 ; Namespace will remain empty because the method call used to get it
- +25 ; is considered non-standard mumps.
- +26 SET PSS("UCI")=$$ATRIBUTE^PSSHRCOM("uci","")
- +27 ;
- +28 SET PSSXML="<MServer"
- +29 SET PSSXML=PSSXML_" "_PSS("IP")
- +30 SET PSSXML=PSSXML_" "_PSS("nameSpace")
- +31 SET PSSXML=PSSXML_" "_PSS("serverName")
- +32 SET PSSXML=PSSXML_" "_PSS("stationNumber")
- +33 SET PSSXML=PSSXML_" "_PSS("UCI")
- +34 SET PSSXML=PSSXML_" />"
- +35 ;
- +36 QUIT PSSXML
- +37 ;;
- HDRMUSER() ;
- +1 ; @DESC Builds the user element of the PSSXML
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the M user.
- +6 ;
- +7 NEW PSS,PSSXML,PSSNTDZ,PSSNTDJB
- +8 ;
- +9 SET PSSNTDZ=$GET(DUZ)
- IF PSSNTDZ'?1N.N
- SET PSSNTDZ=0
- +10 ;
- +11 SET PSS("DUZ")=$$ATRIBUTE^PSSHRCOM("duz",PSSNTDZ)
- +12 ;
- +13 SET PSSNTDJB=$JOB
- if PSSNTDJB'?1N.N
- SET PSSNTDJB=0
- SET PSS("jobNumber")=$$ATRIBUTE^PSSHRCOM("jobNumber",PSSNTDJB)
- +14 ;
- +15 ; FIXME need to get username
- +16 SET PSS("userName")=$$ATRIBUTE^PSSHRCOM("userName",$$GET1^DIQ(200,DUZ_",",.01))
- +17 ;
- +18 SET PSSXML="<MUser"
- +19 SET PSSXML=PSSXML_" "_PSS("DUZ")
- +20 SET PSSXML=PSSXML_" "_PSS("jobNumber")
- +21 SET PSSXML=PSSXML_" "_PSS("userName")
- +22 SET PSSXML=PSSXML_" />"
- +23 ;
- +24 QUIT PSSXML
- +25 ;;
- BODY(PSSBASE) ;
- +1 ; @DESC Builds the Body PSSXML element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the body element.
- +6 ;
- +7 NEW PSSXML
- +8 ;
- +9 SET PSSXML="<Body>"
- +10 SET PSSXML=PSSXML_$$DRGCHEK(PSSBASE)
- +11 SET PSSXML=PSSXML_"</Body>"
- +12 ;
- +13 QUIT PSSXML
- +14 ;;
- DRGCHEK(PSSBASE) ;
- +1 ; @DESC Builds the DrugCheck PSSXML element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS an PSSXML string representing the drugCheck element
- +6 ;
- +7 NEW PSSXML
- +8 ;
- +9 SET PSSXML="<drugCheck>"
- +10 SET PSSXML=PSSXML_$$CHECKS(PSSBASE)
- +11 SET PSSXML=PSSXML_$$DRUGPROS(PSSBASE)
- +12 SET PSSXML=PSSXML_$$MEDPROF(PSSBASE)
- +13 SET PSSXML=PSSXML_"</drugCheck>"
- +14 ;
- +15 ; Return the full drugCheck element
- +16 QUIT PSSXML
- +17 ;;
- CHECKS(PSSBASE) ;
- +1 ; @DESC Builds the checks PSSXML element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the checks element.
- +6 ;
- +7 NEW PSS,PSSXML
- +8 ;
- +9 ; If data in global, set prospective only to false
- +10 IF $DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE"))
- Begin DoDot:1
- +11 SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","false")
- +12 QUIT
- End DoDot:1
- +13 ;
- +14 ; If no data in global, set prospective only to true
- +15 IF '$DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE"))
- Begin DoDot:1
- +16 SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","true")
- +17 QUIT
- End DoDot:1
- +18 ;
- +19 ; OPTIONAL. TBA Right now set to false, will be used in future
- +20 SET PSS("useCustomTables")=$$ATRIBUTE^PSSHRCOM("useCustomTables","true")
- +21 ;
- +22 SET PSSXML="<checks"
- +23 SET PSSXML=PSSXML_" "_$GET(PSS("prospectiveOnly"))
- +24 SET PSSXML=PSSXML_" "_$GET(PSS("useCustomTables"))
- +25 SET PSSXML=PSSXML_" >"
- +26 SET PSSXML=PSSXML_$$CHEKDOSE(PSSBASE)
- +27 SET PSSXML=PSSXML_$$CHEKDRUG(PSSBASE)
- +28 SET PSSXML=PSSXML_$$CHEKTHER(PSSBASE)
- +29 SET PSSXML=PSSXML_"</checks>"
- +30 ;
- +31 ; Return the full drugCheck element
- +32 QUIT PSSXML
- +33 ;;
- CHEKDOSE(PSSBASE) ;
- +1 ; @DESC Sets the drugDoseCheck element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the doseCheck element
- +6 ;
- +7 NEW PSSXML
- +8 ;
- +9 SET PSSXML=""
- +10 ;
- +11 IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE"))
- Begin DoDot:1
- +12 SET PSSXML="<drugDoseCheck>"
- +13 ; Get the demographics PSSXML section
- +14 SET PSSXML=PSSXML_$$DEMOGRAF(PSSBASE)
- +15 SET PSSXML=PSSXML_"</drugDoseCheck>"
- +16 QUIT
- End DoDot:1
- +17 ;
- +18 QUIT PSSXML
- +19 ;;
- DEMOGRAF(PSSBASE) ;
- +1 ; @DESC Builds the demographic element
- +2 ;
- +3 ; @PSSBASE Input global base
- +4 ;
- +5 ; @RETURNS An PSSXML string representation of the demographics element
- +6 ;
- +7 NEW PSSXML,PSS
- +8 ;
- +9 SET PSS("bsa")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","BSA"))
- +10 SET PSS("bodySurfaceAreaInSqM")=$$ATRIBUTE^PSSHRCOM("bodySurfaceAreaInSqM",PSS("bsa"))
- +11 ;
- +12 SET PSS("wt")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","WT"))
- +13 SET PSS("weightInKG")=$$ATRIBUTE^PSSHRCOM("weightInKG",PSS("wt"))
- +14 ;
- +15 SET PSS("age")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","AGE"))
- +16 SET PSS("ageInDays")=$$ATRIBUTE^PSSHRCOM("ageInDays",PSS("age"))
- +17 ;
- +18 SET PSSXML="<demographics "_PSS("bodySurfaceAreaInSqM")_" "_PSS("weightInKG")_" "_PSS("ageInDays")_"/>"
- +19 QUIT PSSXML
- +20 ;;
- CHEKDRUG(PSSBASE) ;
- +1 ; @DESC Sets the drugDrugCheck element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML String representing drugDoseCheck element
- +6 ;
- +7 NEW PSSXML
- +8 ;
- +9 SET PSSXML=""
- +10 ; If drug drug global set, add drug drug check
- +11 IF $DATA(^TMP($JOB,PSSBASE,"IN","DRUGDRUG"))=1
- Begin DoDot:1
- +12 SET PSSXML="<drugDrugCheck />"
- +13 QUIT
- End DoDot:1
- +14 ;
- +15 QUIT PSSXML
- +16 ;;
- CHEKTHER(PSSBASE) ;
- +1 ; @DESC Sets the drugTherapyCheck element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing the drugTherapyCheck element
- +6 ;
- +7 NEW PSSXML
- +8 SET PSSXML=""
- +9 ; If drug therapy set, add therapy check
- +10 IF $DATA(^TMP($JOB,PSSBASE,"IN","THERAPY"))=1
- Begin DoDot:1
- +11 SET PSSXML="<drugTherapyCheck />"
- +12 QUIT
- End DoDot:1
- +13 ;
- +14 QUIT PSSXML
- +15 ;;
- MEDPROF(PSSBASE) ;
- +1 ; @DESC Builds a medicationProfile element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS PSSXML string element of the medicationProfile
- +6 ;
- +7 NEW PSS,PSSXML
- +8 ;
- +9 SET PSSXML="<medicationProfile>"
- +10 SET PSSXML=PSSXML_$$DRUGPROF(PSSBASE)
- +11 SET PSSXML=PSSXML_"</medicationProfile>"
- +12 ;
- +13 QUIT PSSXML
- +14 ;;
- DRUGPROS(PSSBASE) ;
- +1 ; @DESC Builds prospectiveDrugs element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing prospectiveDrugs
- +6 ;
- +7 NEW PSSXML,PSSDRUGS
- +8 ;
- +9 ; Read drug info from input global, store in PSSDRUGS hash
- +10 DO READRUGS(PSSBASE,"PROSPECTIVE",.PSSDRUGS)
- +11 Begin DoDot:1
- +12 ;if no prospective drug just return null
- IF '$DATA(PSSDRUGS("DRUG"))
- SET PSSXML=""
- QUIT
- +13 ; Write the drugs as PSSXML
- +14 SET PSSXML="<prospectiveDrugs>"_$$RITEDRGS(.PSSDRUGS)_"</prospectiveDrugs>"
- End DoDot:1
- +15 ;
- +16 QUIT PSSXML
- +17 ;;
- DRUGPROF(PSSBASE) ;
- +1 ; @DESC Builds a prospective drug element
- +2 ;
- +3 ; @PSSBASE Base of input global
- +4 ;
- +5 ; @RETURNS An PSSXML string representing profile drugs
- +6 ;
- +7 NEW PSSXML,PSSDRUGS
- +8 ;
- +9 ; Read from the input global and put in PSSDRUGS hash
- +10 DO READRUGS(PSSBASE,"PROFILE",.PSSDRUGS)
- +11 ; Write the profile drugs as PSSXML
- +12 SET PSSXML=$$RITEDRGS(.PSSDRUGS)
- +13 ;
- +14 QUIT PSSXML
- +15 ;;
- READRUGS(PSSBASE,DRUGTYPE,PSSDRUGS) ;
- +1 ; @DESC Builds either a prospective or a profile drug element.
- +2 ; Note the "DRUGTYPE" parameter. This param allows for re-use, so either
- +3 ; a profile or a prospective drug can be created.
- +4 ;
- +5 ; @PSSBASE Base of input global
- +6 ; @DRUGTYPE A drug type, either Prospective or Profile
- +7 ; @PSSDRUGS ByRef, variable to store drug attributes in
- +8 ;
- +9 ; @RETURNS Nothing, values stored in drugs variable
- +10 ;
- +11 NEW PSS
- +12 ;
- +13 SET PSS("ien")=""
- +14 SET PSS("count")=0
- +15 ;
- +16 ; Loop through the unique order numbers
- +17 SET PSS("orderNumber")=""
- +18 FOR
- SET PSS("orderNumber")=$ORDER(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber")))
- if PSS("orderNumber")=""
- QUIT
- Begin DoDot:1
- +19 SET PSS("count")=PSS("count")+1
- +20 SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber")))
- +21 ; Set the drug order number
- +22 SET PSSDRUGS("DRUG",PSS("count"),"orderNumber")=PSS("orderNumber")
- +23 ; Set the drug gcn sequence number
- +24 SET PSSDRUGS("DRUG",PSS("count"),"gcn")=+$PIECE(PSS("value"),"^",1)
- +25 ; Set the drug vuid
- +26 SET PSSDRUGS("DRUG",PSS("count"),"vuid")=+$PIECE(PSS("value"),"^",2)
- +27 ; Set the drug ien
- +28 SET PSSDRUGS("DRUG",PSS("count"),"ien")=+$PIECE(PSS("value"),"^",3)
- +29 ; Set the drug name
- +30 SET PSSDRUGS("DRUG",PSS("count"),"drugName")=$PIECE(PSS("value"),"^",4)
- +31 ; Set the cprs order number
- +32 SET PSSDRUGS("DRUG",PSS("count"),"cprsOrderNumber")=$PIECE(PSS("value"),"^",5)
- +33 ; Set the package
- +34 SET PSSDRUGS("DRUG",PSS("count"),"package")=$PIECE(PSS("value"),"^",6)
- +35 ;
- +36 ; Get the possible dose information for the drug
- +37 DO READDOSE(PSSBASE,.PSSDRUGS,PSS("count"),PSS("orderNumber"))
- +38 QUIT
- End DoDot:1
- +39 ;
- +40 QUIT
- +41 ;;
- RITEDRGS(PSSDRUGS) ;
- +1 ; @DESC Loop through the drugs and return PSSXML
- +2 ;
- +3 ; @PSSDRUGS Array containing the list of drugs
- +4 ;
- +5 ; @RETURNS PSSXML representing the drugs in array
- +6 ;
- +7 NEW PSSCOUNT,PSSXML
- +8 ;
- +9 SET PSSXML=""
- +10 SET PSSCOUNT=""
- +11 FOR
- SET PSSCOUNT=$ORDER(PSSDRUGS("DRUG",PSSCOUNT))
- if PSSCOUNT=""
- QUIT
- Begin DoDot:1
- +12 ; loop through drugs and append to PSSXML
- +13 SET PSSXML=PSSXML_$$RITEDRUG(.PSSDRUGS,PSSCOUNT)
- +14 QUIT
- End DoDot:1
- +15 ;
- +16 QUIT PSSXML
- +17 ;;
- RITEDRUG(PSSDRUGS,PSSCOUNT) ;
- +1 ; @DESC Builds a single drug xml element
- +2 ;
- +3 ; @PSSDRUGS A handle to the drug object
- +4 ; @PSSCOUNT The counter where the information should be taken from
- +5 ;
- +6 ; @RETURNS An PSSXML string representing a single drug
- +7 ;
- +8 NEW PSS,PSSXML,PSSORDR
- +9 ;
- +10 IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"drugName"))
- Begin DoDot:1
- +11 SET PSS("drugName")=$$ATRIBUTE^PSSHRCOM("drugName",PSSDRUGS("DRUG",PSSCOUNT,"drugName"))
- End DoDot:1
- +12 ;
- +13 SET PSS("gcnSeqNo")=$$ATRIBUTE^PSSHRCOM("gcnSeqNo",PSSDRUGS("DRUG",PSSCOUNT,"gcn"))
- +14 ;
- +15 SET PSS("ien")=$$ATRIBUTE^PSSHRCOM("ien",PSSDRUGS("DRUG",PSSCOUNT,"ien"))
- +16 ;
- +17 ; Concatenate the orderNumber, cprs order number, and package
- +18 ; ex. orderNumber|cprsOrderNumber|package
- +19 SET PSSORDR=PSSDRUGS("DRUG",PSSCOUNT,"orderNumber")_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"cprsOrderNumber"))_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"package"))
- +20 ;
- +21 SET PSS("orderNumber")=$$ATRIBUTE^PSSHRCOM("orderNumber",PSSORDR)
- +22 ;
- +23 ; vuid is optional
- +24 IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"vuid"))
- Begin DoDot:1
- +25 SET PSS("vuid")=$$ATRIBUTE^PSSHRCOM("vuid",PSSDRUGS("DRUG",PSSCOUNT,"vuid"))
- End DoDot:1
- +26 ;
- +27 SET PSSXML="<drug "_PSS("drugName")_" "_PSS("gcnSeqNo")_" "_PSS("ien")_" "_PSS("orderNumber")_" "_PSS("vuid")_" >"
- +28 SET PSSXML=PSSXML_$$RITEDOSE(.PSSDRUGS,PSSCOUNT)
- +29 SET PSSXML=PSSXML_"</drug>"
- +30 ;
- +31 QUIT PSSXML
- +32 ;;
- READDOSE(PSSBASE,PSSHASH,PSSCOUNT,ORDRNM) ;
- +1 ; @DESC Sets the individual drugDose elements, including all dosing amounts,
- +2 ; frequency, etc for an individual drug.
- +3 ;
- +4 ; @DOSE A handle to the drug dose you want to turn into PSSXML
- +5 ;
- +6 ; @RETURNS Nothing, values stored in hash
- +7 ;
- +8 NEW PSS
- +9 ;
- +10 ; If no drug dose information exist for the drug quit
- +11 IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0
- SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=0
- +12 IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0
- QUIT
- +13 IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))>0
- SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=1
- +14 ;
- +15 SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))
- +16 ; If specific get values (doseAmount,doseUnit,doseRate,frequency,
- +17 ; duration,durationRate,medicalRoute,doseType)
- +18 SET PSSHASH("DRUG",PSSCOUNT,"doseAmount")=$PIECE(PSS("value"),"^",5)
- +19 SET PSSHASH("DRUG",PSSCOUNT,"doseUnit")=$PIECE(PSS("value"),"^",6)
- +20 SET PSSHASH("DRUG",PSSCOUNT,"doseRate")=$PIECE(PSS("value"),"^",7)
- +21 SET PSSHASH("DRUG",PSSCOUNT,"frequency")=$PIECE(PSS("value"),"^",8)
- +22 SET PSSHASH("DRUG",PSSCOUNT,"duration")=$PIECE(PSS("value"),"^",9)
- +23 SET PSSHASH("DRUG",PSSCOUNT,"durationRate")=$PIECE(PSS("value"),"^",10)
- +24 SET PSSHASH("DRUG",PSSCOUNT,"route")=$PIECE(PSS("value"),"^",11)
- +25 SET PSSHASH("DRUG",PSSCOUNT,"doseType")=$PIECE(PSS("value"),"^",12)
- +26 QUIT
- +27 ;;
- RITEDOSE(PSSHASH,I) ;
- +1 ; @DESC Writes the doseInformation PSSXML element
- +2 ;
- +3 ; @PSSHASH Hash value with variables used to create element
- +4 ;
- +5 ; @RETURNS A valid drugDose XML element
- +6 ;
- +7 NEW PSSXML
- +8 ;
- +9 SET PSSXML=""
- +10 IF +$GET(PSSHASH("DRUG",I,"hasDose"))=0
- QUIT PSSXML
- +11 ;
- +12 ; Create dose information
- +13 SET PSSXML="<doseInformation>"
- +14 SET PSSXML=PSSXML_"<doseType>"_PSSHASH("DRUG",I,"doseType")_"</doseType>"
- +15 SET PSSXML=PSSXML_"<doseAmount>"_PSSHASH("DRUG",I,"doseAmount")_"</doseAmount>"
- +16 SET PSSXML=PSSXML_"<doseUnit>"_PSSHASH("DRUG",I,"doseUnit")_"</doseUnit>"
- +17 SET PSSXML=PSSXML_"<doseRate>"_PSSHASH("DRUG",I,"doseRate")_"</doseRate>"
- +18 IF $LENGTH(PSSHASH("DRUG",I,"frequency"))
- SET PSSXML=PSSXML_"<frequency>"_PSSHASH("DRUG",I,"frequency")_"</frequency>"
- +19 IF $LENGTH(PSSHASH("DRUG",I,"duration"))
- SET PSSXML=PSSXML_"<duration>"_PSSHASH("DRUG",I,"duration")_"</duration>"
- +20 IF $LENGTH(PSSHASH("DRUG",I,"durationRate"))
- SET PSSXML=PSSXML_"<durationRate>"_PSSHASH("DRUG",I,"durationRate")_"</durationRate>"
- +21 SET PSSXML=PSSXML_"<route>"_PSSHASH("DRUG",I,"route")_"</route>"
- +22 ;
- +23 ; Close off dose information
- +24 SET PSSXML=PSSXML_"</doseInformation>"
- +25 ;
- +26 QUIT PSSXML
- +27 ;;