med directions working

This commit is contained in:
george 2008-10-06 15:46:35 +00:00
parent 80bdc77c6c
commit 9a7a927275
3 changed files with 422 additions and 396 deletions

View File

@ -112,18 +112,20 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. ; ==>[7P:51.2] ^ (#7) SCHEDULE [8F] ^ (#8) VERB [9F] ^ . ; ==>[7P:51.2] ^ (#7) SCHEDULE [8F] ^ (#8) VERB [9F] ^
. ; . ;
. N DIRNUM S DIRNUM=0 ; Sigline number . N DIRNUM S DIRNUM=0 ; Sigline number
. S DIRCNT=0 ; COUNT OF MULTIPLE DIRECTIONS
. F S DIRNUM=$O(^PSRX(RXIEN,6,DIRNUM)) Q:DIRNUM="" D . F S DIRNUM=$O(^PSRX(RXIEN,6,DIRNUM)) Q:DIRNUM="" D
. . S @MAP@("M",DIRNUM,"MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components. . . S DIRCNT=DIRCNT+1 ; INCREMENT DIRECTIONS COUNT
. . S @MAP@("M",DIRNUM,"MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05. . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components.
. . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05.
. . N SIGDATA S SIGDATA=^PSRX(RXIEN,6,DIRNUM,0) . . N SIGDATA S SIGDATA=^PSRX(RXIEN,6,DIRNUM,0)
. . S @MAP@("M",DIRNUM,"MEDDELIVERYMETHOD")=$P(SIGDATA,U,9) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDELIVERYMETHOD")=$P(SIGDATA,U,9)
. . S @MAP@("M",DIRNUM,"MEDDOSEVALUE")=$P(SIGDATA,U,1) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEVALUE")=$P(SIGDATA,U,1)
. . S @MAP@("M",DIRNUM,"MEDDOSEUNIT")=@MAP@("MEDCONCUNIT") . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEUNIT")=@MAP@("MEDCONCUNIT")
. . S @MAP@("M",DIRNUM,"MEDRATEVALUE")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEVALUE")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDRATEUNIT")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEUNIT")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDVEHICLETEXT")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDVEHICLETEXT")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDDIRECTIONROUTETEXT")=$$GET1^DIQ(51.2,$P(SIGDATA,U,7),.01) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONROUTETEXT")=$$GET1^DIQ(51.2,$P(SIGDATA,U,7),.01)
. . S @MAP@("M",DIRNUM,"MEDFREQUENCYVALUE")=$P(SIGDATA,U,8) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDFREQUENCYVALUE")=$P(SIGDATA,U,8)
. . ; Invervals... again another call. . . ; Invervals... again another call.
. . ; In the wisdom of the original programmers, the schedule is a free text field . . ; In the wisdom of the original programmers, the schedule is a free text field
. . ; However, it gets translated by a call to the administration schedule file . . ; However, it gets translated by a call to the administration schedule file
@ -140,22 +142,22 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. . E D . . E D
. . . N SUB S SUB=$O(SCHEDATA(0)) . . . N SUB S SUB=$O(SCHEDATA(0))
. . . S INTERVAL=SCHEDATA(SUB,2) . . . S INTERVAL=SCHEDATA(SUB,2)
. . S @MAP@("M",DIRNUM,"MEDINTERVALVALUE")=INTERVAL . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALVALUE")=INTERVAL
. . S @MAP@("M",DIRNUM,"MEDINTERVALUNIT")="Minute" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALUNIT")="Minute"
. . S @MAP@("M",DIRNUM,"MEDDURATIONVALUE")=$P(SIGDATA,U,5) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONVALUE")=$P(SIGDATA,U,5)
. . S @MAP@("M",DIRNUM,"MEDDURATIONUNIT")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONUNIT")=""
. . S @MAP@("M",DIRNUM,"MEDPRNFLAG")=$P(SIGDATA,U,8)["PRN" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPRNFLAG")=$P(SIGDATA,U,8)["PRN"
. . S @MAP@("M",DIRNUM,"MEDPROBLEMOBJECTID")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMOBJECTID")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMTYPETXT")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMTYPETXT")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMDESCRIPTION")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMDESCRIPTION")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODEVALUE")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODEVALUE")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODINGSYSTEM")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODINGSYSTEM")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODINGVERSION")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODINGVERSION")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMSOURCEACTORID")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMSOURCEACTORID")=""
. . S @MAP@("M",DIRNUM,"MEDSTOPINDICATOR")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDSTOPINDICATOR")=""
. . S @MAP@("M",DIRNUM,"MEDDIRSEQ")=DIRNUM . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRSEQ")=DIRNUM
. . N DIRMOD S DIRMOD=$P(SIGDATA,U,6) . . N DIRMOD S DIRMOD=$P(SIGDATA,U,6)
. . S @MAP@("M",DIRNUM,"MEDMULDIRMOD")=$S(DIRMOD="T":"THEN",DIRMOD="A":"AND",DIRMOD="X":"EXCEPT",1:"") . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDMULDIRMOD")=$S(DIRMOD="T":"THEN",DIRMOD="A":"AND",DIRMOD="X":"EXCEPT",1:"")
. ; . ;
. ; --- END OF DIRECTIONS --- . ; --- END OF DIRECTIONS ---
. ; . ;
@ -168,6 +170,17 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. K @RESULT . K @RESULT
. D MAP^GPLXPATH(MINXML,MAP,RESULT) . D MAP^GPLXPATH(MINXML,MAP,RESULT)
. ; D PARY^GPLXPATH(RESULT) . ; D PARY^GPLXPATH(RESULT)
. ; MAPPING DIRECTIONS
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
. ; N MDZ1,MDZNA
. I DIRCNT>0 D ; IF THERE ARE DIRCTIONS
. . F MDZ1=1:1:DIRCNT D ; FOR EACH DIRECTION
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",MDZ1))
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
. . . D INSINNER^GPLXPATH(RESULT,DIRXML2)
. D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy . D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
. D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML . D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
N MEDTMP,MEDI N MEDTMP,MEDI

View File

@ -122,20 +122,22 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
. ; DIRNUM is the proper Sigline numer. . ; DIRNUM is the proper Sigline numer.
. ; SIGDATA is the simplfied array. Subscripts are really field numbers . ; SIGDATA is the simplfied array. Subscripts are really field numbers
. ; in subfile 52.413. . ; in subfile 52.413.
. N DIRCNT S DIRCNT=0 ; COUNT OF DIRECTIONS
. F S FMSIGNUM=$O(FMSIG(52.413,FMSIGNUM)) Q:FMSIGNUM="" D . F S FMSIGNUM=$O(FMSIG(52.413,FMSIGNUM)) Q:FMSIGNUM="" D
. . N DIRNUM S DIRNUM=$P(FMSIGNUM,",") . . N DIRNUM S DIRNUM=$P(FMSIGNUM,",")
. . S DIRCNT=DIRCNT+1 ; INCREMENT DIRECTIONS COUNT
. . N SIGDATA M SIGDATA=FMSIG(52.413,FMSIGNUM) . . N SIGDATA M SIGDATA=FMSIG(52.413,FMSIGNUM)
. . ; If this is an order for a refill; it's not really a new order; move on to next . . ; If this is an order for a refill; it's not really a new order; move on to next
. . S @MAP@("M",DIRNUM,"MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components. . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components.
. . S @MAP@("M",DIRNUM,"MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05. . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05.
. . S @MAP@("M",DIRNUM,"MEDDELIVERYMETHOD")=SIGDATA(13) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDELIVERYMETHOD")=SIGDATA(13)
. . S @MAP@("M",DIRNUM,"MEDDOSEVALUE")=SIGDATA(8) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEVALUE")=SIGDATA(8)
. . S @MAP@("M",DIRNUM,"MEDDOSEUNIT")=@MAP@("MEDCONCUNIT") . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEUNIT")=@MAP@("MEDCONCUNIT")
. . S @MAP@("M",DIRNUM,"MEDRATEVALUE")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEVALUE")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDRATEUNIT")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEUNIT")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDVEHICLETEXT")="" ; For inpatient . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDVEHICLETEXT")="" ; For inpatient
. . S @MAP@("M",DIRNUM,"MEDDIRECTIONROUTETEXT")=SIGDATA(10) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONROUTETEXT")=SIGDATA(10)
. . S @MAP@("M",DIRNUM,"MEDFREQUENCYVALUE")=SIGDATA(1) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDFREQUENCYVALUE")=SIGDATA(1)
. . ; Invervals... again another call. . . ; Invervals... again another call.
. . ; The schedule is a free text field . . ; The schedule is a free text field
. . ; However, it gets translated by a call to the administration . . ; However, it gets translated by a call to the administration
@ -155,24 +157,24 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
. . E D . . E D
. . . N SUB S SUB=$O(SCHEDATA(0)) . . . N SUB S SUB=$O(SCHEDATA(0))
. . . S INTERVAL=SCHEDATA(SUB,2) . . . S INTERVAL=SCHEDATA(SUB,2)
. . S @MAP@("M",DIRNUM,"MEDINTERVALVALUE")=INTERVAL . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALVALUE")=INTERVAL
. . S @MAP@("M",DIRNUM,"MEDINTERVALUNIT")="Minute" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALUNIT")="Minute"
. . ; Duration comes as M2,H2,D2,W2,L2 for 2 minutes,hours,days,weeks,months . . ; Duration comes as M2,H2,D2,W2,L2 for 2 minutes,hours,days,weeks,months
. . N DUR S DUR=SIGDATA(2) . . N DUR S DUR=SIGDATA(2)
. . S @MAP@("M",DIRNUM,"MEDDURATIONVALUE")=$E(DUR,2,$L(DUR)) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONVALUE")=$E(DUR,2,$L(DUR))
. . N DURUNIT S DURUNIT=$E(DUR) . . N DURUNIT S DURUNIT=$E(DUR)
. . S @MAP@("M",DIRNUM,"MEDDURATIONUNIT")=$S(DURUNIT="M":"Minutes",DURUNIT="H":"Hours",DURUNIT="D":"Days",DURUNIT="W":"Weeks",DURUNIT="L":"Months",1:"") . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONUNIT")=$S(DURUNIT="M":"Minutes",DURUNIT="H":"Hours",DURUNIT="D":"Days",DURUNIT="W":"Weeks",DURUNIT="L":"Months",1:"")
. . S @MAP@("M",DIRNUM,"MEDPRNFLAG")=SIGDATA(1)["PRN" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPRNFLAG")=SIGDATA(1)["PRN"
. . S @MAP@("M",DIRNUM,"MEDPROBLEMOBJECTID")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMOBJECTID")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMTYPETXT")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMTYPETXT")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMDESCRIPTION")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMDESCRIPTION")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODEVALUE")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODEVALUE")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODINGSYSTEM")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODINGSYSTEM")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMCODINGVERSION")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMCODINGVERSION")=""
. . S @MAP@("M",DIRNUM,"MEDPROBLEMSOURCEACTORID")="" . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMSOURCEACTORID")=""
. . S @MAP@("M",DIRNUM,"MEDSTOPINDICATOR")="" ; Vista doesn't have that field . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDSTOPINDICATOR")="" ; Vista doesn't have that field
. . S @MAP@("M",DIRNUM,"MEDDIRSEQ")=DIRNUM . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRSEQ")=DIRNUM
. . S @MAP@("M",DIRNUM,"MEDMULDIRMOD")=SIGDATA(6) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDMULDIRMOD")=SIGDATA(6)
. ; . ;
. ; --- END OF DIRECTIONS --- . ; --- END OF DIRECTIONS ---
. ; . ;
@ -183,6 +185,17 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
. K @RESULT . K @RESULT
. D MAP^GPLXPATH(MINXML,MAP,RESULT) . D MAP^GPLXPATH(MINXML,MAP,RESULT)
. ; D PARY^GPLXPATH(RESULT) . ; D PARY^GPLXPATH(RESULT)
. ; MAPPING DIRECTIONS
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
. ; N MDZ1,MDZNA
. I DIRCNT>0 D ; IF THERE ARE DIRCTIONS
. . F MDZ1=1:1:DIRCNT D ; FOR EACH DIRECTION
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",MDZ1))
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
. . . D INSINNER^GPLXPATH(RESULT,DIRXML2)
. D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy . D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
. D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML . D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
N MEDTMP,MEDI N MEDTMP,MEDI