new LAB interface

This commit is contained in:
george 2009-04-21 03:00:43 +00:00
parent 2fb69de493
commit 28cb8065d0
4 changed files with 87 additions and 80 deletions

View File

@ -11,7 +11,7 @@ LAB(C0CPTID,C0CSDT,C0CEDT,C0CSC,C0CSPEC,C0CERR,C0CDEST,C0CHL7) ; Entry point for
K ^TMP("C0C-VLAB",$J)
;
; Check and retrieve lab results from LAB DATA file (#63)
D GCPR^LA7QRY($G(C0CPTID),$G(C0CSDT),$G(C0CEDT),.C0CSC,.C0CSPEC,.C0CERR,$G(C0CDEST),$G(C0CHL7))
S C0CDEST=$$GCPR^LA7QRY($G(C0CPTID),$G(C0CSDT),$G(C0CEDT),.C0CSC,.C0CSPEC,.C0CERR,$G(C0CDEST),$G(C0CHL7))
;
; If V LAB file present then check for lab results that are only in this file
; If results found in V Lab file then build results and add to above results.
@ -26,28 +26,32 @@ LAB(C0CPTID,C0CSDT,C0CEDT,C0CSC,C0CSPEC,C0CERR,C0CDEST,C0CHL7) ; Entry point for
;
VCHECK ; If V LAB file present then check for lab results that are only in this file.
;
N C0CDA,C0CEND,C0CROOT,C0CVLAB,LA7PTID,LA7SCRC,LA7SPEC,TMP
N C0CDA,C0CEND,C0CROOT,C0CVLAB,LA7PTID,LA7SC,LA7SCRC,LA7SPEC
;
S LA7PTID=C0CPTID
D PATID^LA7QRY2
I $D(LA7ERR) Q
;
; Resolve search codes to lab datanames
S LA7SCSRC=$G(C0CSC)
S TMP=$$SCLIST^LA7QRY2(LA7SCSRC)
Q:$D(LA7ERR) ""
S LA7SC=TMP D:LA7SC'="*" CHKSC^LA7QRY1
S LA7SC=$G(C0CSC)
I $T(SCLIST^LA7QRY2)'="" D
. N TMP
. S LA7SCSRC=$G(C0CSC)
. S TMP=$$SCLIST^LA7QRY2(LA7SCSRC)
. S LA7SC=TMP
;
I LA7SC'="*" D CHKSC^LA7QRY1
;
; Convert specimen codes to file #61 Topography entries
S LA7SPEC=$G(C0CSPEC)
I LA7SPEC'="*" D SPEC^LA7QRY1
;
S C0CROOT="^AUPNVLAB(""ALR4"",DFN,COCSDT)",C0CEND=0
S C0CROOT="^AUPNVLAB(""ALR4"",DFN,C0CSDT)",C0CEND=0
;
F S C0CROOT=$Q(@C0CROOT) Q:C0CROOT="" D Q:C0CEND
. I $QS(C0CROOT,1)'="ALR4"!($QS(C0CROOT,2)'=DFN) S C0CEND=1 Q ; Left x-ref or patient
. I $QS(C0CROOT,3)>C0CEDT S C0CEND=1 Q ; Exceeded end date/time
. S C0CDA=$QS(C0CROOT,6)
. S C0CDA=$QS(C0CROOT,4)
. I $D(^TMP("C0C-VLAB",$J,1,C0CDA)) Q ; Already checked during scan of file #63
. D VCHK1
;
@ -64,7 +68,7 @@ VBUILD ; Build results found only in V LAB file into HL7 structure.
LNCHK ; Check for corresponding entry in V LAB file and related LOINC code for a result in file #63.
; Call from LA7QRY2
;
N DFN,C0C60,C0C63,C0CACC,C0CDA,C0CDT,C0CLN,X
N DFN,C0C60,C0C63,C0CACC,C0CDA,C0CDT,C0CLN,C0CPDA,C0CPTEST,C0CTEST,X
;
S DFN=$P(^LR(LRDFN,0),"^",3)
S C0C63(0)=^LR(LRDFN,LRSS,LRIDT,0)
@ -77,8 +81,13 @@ LNCHK ; Check for corresponding entry in V LAB file and related LOINC code for a
. S C0CDA=$O(^AUPNVLAB("ALR1",DFN,C0CDT,C0CACC,C0C60,0))
. I C0CDA<1 Q
. S C0CLN=$P($G(^AUPNVLAB(C0CDA,11)),"^",13)
. S C0CPDA=$P($G(^AUPNVLAB(C0CDA,12)),"^",8)
. I C0CPDA="" S C0CPDA=C0CDA
. S C0CTEST=$P($G(^AUPNVLAB(C0CDA,0)),"^")
. S C0CPTEST=$P($G(^AUPNVLAB(C0CPDA,0)),"^")
. S ^TMP("C0C-VLAB",$J,1,C0CDA)=""
. S ^TMP("C0C-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB)=C0CLN_"^"_C0CDA
. I C0CDA'=C0CPDA S ^TMP("C0C-VLAB",$J,1,C0CPDA)=""
. S ^TMP("C0C-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB)=C0CLN_"^"_C0CDA_"^"_C0CTEST_"^"_C0CPDA_"^"_C0CPTEST
;
; If LOINC found then update variable with LN code
I C0CLN'="" D
@ -103,17 +112,15 @@ VCHK1 ; Check the entry in V Lab to determine if it meets criteria
;
VSTORE ; Store entry for building in HL7 message when parent is from V LAB file.
;
N PARENT
N C0CPDA,C0CPTEST
;
; Determine parent test to use for OBR segment
S PARENT=$P(C0CVLAB(12),"^",8)
I PARENT="" S PARENT=$P(C0CVLAB(0),"^")
S C0CPDA=$P(C0CVLAB(12),"^",8)
I C0CPDA="" S C0CPDA=C0CDA
;
; patient ien
; | collection date/time
; | | parent test (ordered test)
; | | | ien of entry in V LAB file
; | | | |
S ^TMP("C0C-VLAB",$J,3,$P(C0CVLAB(0),"^",2),$P(C0CVLAB(12),"^"),PARENT,C0CDA)=""
; Determine parent test
S C0CPTEST=$P($G(^AUPNVLAB(C0CPDA,0)),"^")
;
S ^TMP("C0C-VLAB",$J,3,$P(C0CVLAB(0),"^",2),$P(C0CVLAB(12),"^"),C0CPTEST,C0CDA)=C0CPDA
;
Q

View File

@ -152,7 +152,7 @@ GHL7 ; GET HL7 MESSAGE FOR LABS FOR THIS PATIENT
D DT^DILF(,C0CLLMT,.C0CSDT) ;
W "LAB LIMIT: ",C0CLLMT,!
D DT^DILF(,C0CLSTRT,.C0CEDT) ; END DATE TODAY - IMPLEMENT END DATE PARM
S C0CR=$$GCPR^LA7QRY(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
S C0CR=$$LAB^C0CLA7Q(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
Q
;
LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB

View File

@ -1,62 +1,62 @@
C0CPARMS ; CCDCCR/GPL - CCR/CCD PARAMETER PROCESSING ; 1/29/09
;;0.3;CCDCCR;nopatch;noreleasedate
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
;;0.3;CCDCCR;nopatch;noreleasedate
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License along
;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
SET(INPARMS) ;INITIALIZE RUNTIME PARMS USING INPARMS TO OVERRIDE DEFAULTS
; PARAMETERS ARE PASSED AS A STRING: "PARM1:VALUE1^PARM2:VALUE2^ETC"
; THE SAME FORMAT IS USED BY RPC AND COMMAND LINE ENTRY POINTS
;
N PTMP ;
S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;BASE FOR THIS RUN
;K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
I $G(INPARMS)'="" D ; OVERRIDES PROVIDED
. N C0CI S C0CI=""
. N C0CN S C0CN=1
. F S C0CI=$P(INPARMS,"^",C0CN) Q:C0CI="" D ;
. . S C0CN=C0CN+1 ;NEXT PARM
. . N C1,C2
. . S C1=$P(C0CI,":",1) ; PARAMETER
. . S C2=$P(C0CI,":",2) ; VALUE
. . I C2="" S C2=1
. . S @C0CPARMS@(C1)=C2
. I C0CN=1 S @C0CPARMS@($P(INPARMS,":",1))=$P(C0CI,":",2) ; ONLY ONE
; THIS IS WHERE WE WILL INSERT CALLS TO THE PARAMETER FILE FOR DEFAULTS
; IF THEY FAIL, THE FOLLOWING WILL BE HARDCODED DEFAULTS
I '$D(@C0CPARMS@("LABLIMIT")) S @C0CPARMS@("LABLIMIT")="T-360" ;ONE YR WORTH
I '$D(@C0CPARMS@("LABSTART")) S @C0CPARMS@("LABSTART")="T" ;TODAY
I '$D(@C0CPARMS@("VITLIMIT")) S @C0CPARMS@("VITLIMIT")="T-360" ;ONE YR VITALS
I '$D(@C0CPARMS@("VITSTART")) S @C0CPARMS@("VITSTART")="T" ;TODAY
I '$D(@C0CPARMS@("MEDSTART")) S @C0CPARMS@("MEDSTART")="T" ; TODAY
I '$D(@C0CPARMS@("MEDSLIMIT")) S @C0CPARMS@("MEDLIMIT")="T-360" ; ONE YR MEDS
I '$D(@C0CPARMS@("MEDACTIVE")) S @C0CPARMS@("MEDACTIVE")=1 ; YES
I '$D(@C0CPARMS@("MEDPENDING")) S @C0CPARMS@("MEDPENDING")=0 ; NO
I '$D(@C0CPARMS@("MEDALL")) S @C0CPARMS@("MEDALL")=0 ; NON-PENDING NON-ACTIVE
Q
;
; PARAMETERS ARE PASSED AS A STRING: "PARM1:VALUE1^PARM2:VALUE2^ETC"
; THE SAME FORMAT IS USED BY RPC AND COMMAND LINE ENTRY POINTS
;
N PTMP ;
S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;BASE FOR THIS RUN
;K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
I $G(INPARMS)'="" D ; OVERRIDES PROVIDED
. N C0CI S C0CI=""
. N C0CN S C0CN=1
. F S C0CI=$P(INPARMS,"^",C0CN) Q:C0CI="" D ;
. . S C0CN=C0CN+1 ;NEXT PARM
. . N C1,C2
. . S C1=$P(C0CI,":",1) ; PARAMETER
. . S C2=$P(C0CI,":",2) ; VALUE
. . I C2="" S C2=1
. . S @C0CPARMS@(C1)=C2
. I C0CN=1 S @C0CPARMS@($P(INPARMS,":",1))=$P(C0CI,":",2) ; ONLY ONE
; THIS IS WHERE WE WILL INSERT CALLS TO THE PARAMETER FILE FOR DEFAULTS
; IF THEY FAIL, THE FOLLOWING WILL BE HARDCODED DEFAULTS
I '$D(@C0CPARMS@("LABLIMIT")) S @C0CPARMS@("LABLIMIT")="T-360" ;ONE YR WORTH
I '$D(@C0CPARMS@("LABSTART")) S @C0CPARMS@("LABSTART")="T" ;TODAY
I '$D(@C0CPARMS@("VITLIMIT")) S @C0CPARMS@("VITLIMIT")="T-360" ;ONE YR VITALS
I '$D(@C0CPARMS@("VITSTART")) S @C0CPARMS@("VITSTART")="T" ;TODAY
I '$D(@C0CPARMS@("MEDSTART")) S @C0CPARMS@("MEDSTART")="T" ; TODAY
I '$D(@C0CPARMS@("MEDSLIMIT")) S @C0CPARMS@("MEDLIMIT")="T-360" ; ONE YR MEDS
I '$D(@C0CPARMS@("MEDACTIVE")) S @C0CPARMS@("MEDACTIVE")=1 ; YES
I '$D(@C0CPARMS@("MEDPENDING")) S @C0CPARMS@("MEDPENDING")=0 ; NO
I '$D(@C0CPARMS@("MEDALL")) S @C0CPARMS@("MEDALL")=0 ; NON-PENDING NON-ACTIVE
Q
;
CHECK ; CHECK TO SEE IF PARMS ARE PRESENT, ELSE RUN SET
;
I '$D(C0CPARMS) S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;SHOULDN'T HAPPEN
I '$D(@C0CPARMS) D SET("SETWITHCHECK:1")
Q
;
;
I '$D(C0CPARMS) S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;SHOULDN'T HAPPEN
I '$D(@C0CPARMS) D SET("SETWITHCHECK:1")
Q
;
GET(WHICHP) ;EXTRINSIC TO RETURN THE VALUE OF PARAMETER WHICHP
;
D CHECK ; SHOULDN'T HAPPEN BUT TO BE SAFE
N GTMP
Q $G(@C0CPARMS@(WHICHP)) ;PULL THE PARM FROM THE TABLE
;
;
D CHECK ; SHOULDN'T HAPPEN BUT TO BE SAFE
N GTMP
Q $G(@C0CPARMS@(WHICHP)) ;PULL THE PARM FROM THE TABLE
;

View File

@ -1,4 +1,4 @@
LA7VOBX1 ;DALOI/JMC - LAB OBX Segment message builder (CH subscript) cont'd; 04/13/09
LA7VOBX1 ;DALOI/JMC - LAB OBX Segment message builder (CH subscript) cont'd; 04/14/09
;;5.2;AUTOMATED LAB INSTRUMENTS;**46,61,63**;Sep 27, 1994
; JMC - mods to check for IHS V LAB file
;
@ -22,7 +22,7 @@ CH ; Observation/Result segment for "CH" subscript results.
; If no result NLT or LOINC try to determine from file #60
S LA7X=$P(LA7VAL,"^",3)
; Check for no LOINC in 63 and LOINC found in V LAB file.
I $P(LA7X,"!",3)="",$D(^TMP("LA7-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB)) S $P(LA7X,"!",3)=$P(^TMP("LA7-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB),"^")
I $P(LA7X,"!",3)="",$D(^TMP("C0C-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB)) S $P(LA7X,"!",3)=$P(^TMP("C0C-VLAB",$J,2,LRDFN,LRSS,LRIDT,LRSB),"^")
;
I $P(LA7X,"!",2)=""!($P(LA7X,"!",3)="") S $P(LA7VAL,"^",3)=$$DEFCODE^LA7VHLU5(LRSS,LRSB,LA7X,$P(LA76304(0),"^",5))
; No result NLT code - log error