MAGT7SN ;WOIFO/MLH/PMK - telepathology - create HL7 message to DPS - segment build - NTE ; 17 Jul 2013 11:53 AM
;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
NTESEGC(SEGELTS,FILE,IENSX,ACNUMB,IX) ;create a NTE segment for comments
N FLDSETID S FLDSETID=1 ; set ID field number
N FLDCMTSRC S FLDCMTSRC=2 ; source of comment field number
N FLDCMTTEXT S FLDCMTTEXT=3 ; comment field number
N FLDCMTTYPE S FLDCMTTYPE=4 ; comment type field number
N SETID ; --- counters used for message segments
N ERRSTAT S ERRSTAT=0 ; error status - assume nothing to report
;
K SEGELTS ; always refresh *segment* array (not message array) on entry
;
D SET^HLOAPI(.SEGELTS,"NTE",0) ; segment type
D ; set up fields, check exit flag after each
. S SETID=$G(SETID("NTE"))+1,SETID("NTE")=SETID
. D Q:ERRSTAT ; NTE-1-set ID
. . D SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
. . Q
. D Q:ERRSTAT ; NTE-2-source of comment
. . D SET^HLOAPI(.SEGELTS,"L",FLDCMTSRC)
. . Q
. D Q:ERRSTAT ; NTE-3-comment
. . N COMMENT
. . S COMMENT=$G(@LABDATA@(FILE("COMMENT"),IENSX,.01,"I"))
. . D SET^HLOAPI(.SEGELTS,COMMENT,FLDCMTTEXT)
. . Q
. D Q:ERRSTAT ; NTE-4-comment type
. . D SET^HLOAPI(.SEGELTS,"I",FLDCMTTYPE,1)
. . Q
. Q
;
Q ERRSTAT
;
NTESEGT(SEGELTS,TEXT) ; create a NTE segment for text objects
N FLDSETID S FLDSETID=1 ; set ID field number
N FLDCMTSRC S FLDCMTSRC=2 ; source of comment field number
N FLDCMTTEXT S FLDCMTTEXT=3 ; comment field number
N FLDCMTTYPE S FLDCMTTYPE=4 ; comment type field number
N SETID ; --- counters used for message segments
N ERRSTAT S ERRSTAT=0 ; error status - assume nothing to report
;
K SEGELTS ; always refresh *segment* array (not message array) on entry
;
D SET^HLOAPI(.SEGELTS,"NTE",0) ; segment type
D ; set up fields, check exit flag after each
. S SETID=$G(SETID("NTE"))+1,SETID("NTE")=SETID
. D Q:ERRSTAT ; NTE-1-set ID
. . D SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
. . Q
. D Q:ERRSTAT ; NTE-2-source of comment
. . D SET^HLOAPI(.SEGELTS,"L",FLDCMTSRC)
. . Q
. D Q:ERRSTAT ; NTE-3-comment
. . D SET^HLOAPI(.SEGELTS,TEXT,FLDCMTTEXT)
. . Q
. D Q:ERRSTAT ; NTE-4-comment type
. . D SET^HLOAPI(.SEGELTS,"I",FLDCMTTYPE,1)
. . Q
. Q
;
Q ERRSTAT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGT7SN 3297 printed Dec 13, 2024@02:08:31 Page 2
MAGT7SN ;WOIFO/MLH/PMK - telepathology - create HL7 message to DPS - segment build - NTE ; 17 Jul 2013 11:53 AM
+1 ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
NTESEGC(SEGELTS,FILE,IENSX,ACNUMB,IX) ;create a NTE segment for comments
+1 ; set ID field number
NEW FLDSETID
SET FLDSETID=1
+2 ; source of comment field number
NEW FLDCMTSRC
SET FLDCMTSRC=2
+3 ; comment field number
NEW FLDCMTTEXT
SET FLDCMTTEXT=3
+4 ; comment type field number
NEW FLDCMTTYPE
SET FLDCMTTYPE=4
+5 ; --- counters used for message segments
NEW SETID
+6 ; error status - assume nothing to report
NEW ERRSTAT
SET ERRSTAT=0
+7 ;
+8 ; always refresh *segment* array (not message array) on entry
KILL SEGELTS
+9 ;
+10 ; segment type
DO SET^HLOAPI(.SEGELTS,"NTE",0)
+11 ; set up fields, check exit flag after each
Begin DoDot:1
+12 SET SETID=$GET(SETID("NTE"))+1
SET SETID("NTE")=SETID
+13 ; NTE-1-set ID
Begin DoDot:2
+14 DO SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
+15 QUIT
End DoDot:2
if ERRSTAT
QUIT
+16 ; NTE-2-source of comment
Begin DoDot:2
+17 DO SET^HLOAPI(.SEGELTS,"L",FLDCMTSRC)
+18 QUIT
End DoDot:2
if ERRSTAT
QUIT
+19 ; NTE-3-comment
Begin DoDot:2
+20 NEW COMMENT
+21 SET COMMENT=$GET(@LABDATA@(FILE("COMMENT"),IENSX,.01,"I"))
+22 DO SET^HLOAPI(.SEGELTS,COMMENT,FLDCMTTEXT)
+23 QUIT
End DoDot:2
if ERRSTAT
QUIT
+24 ; NTE-4-comment type
Begin DoDot:2
+25 DO SET^HLOAPI(.SEGELTS,"I",FLDCMTTYPE,1)
+26 QUIT
End DoDot:2
if ERRSTAT
QUIT
+27 QUIT
End DoDot:1
+28 ;
+29 QUIT ERRSTAT
+30 ;
NTESEGT(SEGELTS,TEXT) ; create a NTE segment for text objects
+1 ; set ID field number
NEW FLDSETID
SET FLDSETID=1
+2 ; source of comment field number
NEW FLDCMTSRC
SET FLDCMTSRC=2
+3 ; comment field number
NEW FLDCMTTEXT
SET FLDCMTTEXT=3
+4 ; comment type field number
NEW FLDCMTTYPE
SET FLDCMTTYPE=4
+5 ; --- counters used for message segments
NEW SETID
+6 ; error status - assume nothing to report
NEW ERRSTAT
SET ERRSTAT=0
+7 ;
+8 ; always refresh *segment* array (not message array) on entry
KILL SEGELTS
+9 ;
+10 ; segment type
DO SET^HLOAPI(.SEGELTS,"NTE",0)
+11 ; set up fields, check exit flag after each
Begin DoDot:1
+12 SET SETID=$GET(SETID("NTE"))+1
SET SETID("NTE")=SETID
+13 ; NTE-1-set ID
Begin DoDot:2
+14 DO SET^HLOAPI(.SEGELTS,SETID,FLDSETID)
+15 QUIT
End DoDot:2
if ERRSTAT
QUIT
+16 ; NTE-2-source of comment
Begin DoDot:2
+17 DO SET^HLOAPI(.SEGELTS,"L",FLDCMTSRC)
+18 QUIT
End DoDot:2
if ERRSTAT
QUIT
+19 ; NTE-3-comment
Begin DoDot:2
+20 DO SET^HLOAPI(.SEGELTS,TEXT,FLDCMTTEXT)
+21 QUIT
End DoDot:2
if ERRSTAT
QUIT
+22 ; NTE-4-comment type
Begin DoDot:2
+23 DO SET^HLOAPI(.SEGELTS,"I",FLDCMTTYPE,1)
+24 QUIT
End DoDot:2
if ERRSTAT
QUIT
+25 QUIT
End DoDot:1
+26 ;
+27 QUIT ERRSTAT