Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGT7SSA

MAGT7SSA.m

Go to the documentation of this file.
  1. MAGT7SSA ;WOIFO/MLH/PMK - telepathology - create HL7 message to DPS - segment build - set up OBXs for each SPM ; 03 Jul 2013 4:08 PM
  1. ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. SPMANC(MSG,FILE,IENSX,LRSS,IX) ; FUNCTION - main entry point - create ancillary OBX segments
  1. N BLKTYPSTGSTR ; block type/stage string
  1. N BLKTYPSTG ; block type/stage
  1. N BLKTYPSTGIX ; block type/stage index
  1. N BLOCKDATA ; block information
  1. N BLOCKFILE ; Fileman file number for block
  1. N BLOCKNAME ; name of block
  1. N BLOCKSS2 ; ss2 in LABDATA for block
  1. N ERRSTAT S ERRSTAT=0 ; assume nothing to report
  1. S BLOCKNAME=""
  1. F S BLOCKNAME=$O(FILE("SPECIMEN",BLOCKNAME)) Q:BLOCKNAME="" D
  1. . S BLOCKFILE=FILE("SPECIMEN",BLOCKNAME) Q:'$D(@LABDATA@(BLOCKFILE))
  1. . S BLOCKSS2="" F S BLOCKSS2=$O(@LABDATA@(BLOCKFILE,BLOCKSS2)) Q:BLOCKSS2="" D
  1. . . I $P(BLOCKSS2,",",2,999)=IENSX S BLOCKDATA(BLOCKNAME,BLOCKSS2)=""
  1. . . Q
  1. . Q
  1. I '$D(BLOCKDATA) Q ERRSTAT ; no blocks found
  1. ;
  1. ; one or more block(s) were found
  1. D ; make OBX segments, bail if a problem arises
  1. . D Q:ERRSTAT ;subspecialty
  1. . . S ERRSTAT=$$OBXSEG^MAGT7SX(.MSG,"SUBSPECIALTY","ST",FILE("NAME"))
  1. . . Q
  1. . D Q:ERRSTAT ;block type/stage
  1. . . S BLOCKNAME=""
  1. . . F S BLOCKNAME=$O(BLOCKDATA(BLOCKNAME)) Q:BLOCKNAME="" D
  1. . . . S BLOCKSS2=""
  1. . . . F S BLOCKSS2=$O(BLOCKDATA(BLOCKNAME,BLOCKSS2)) Q:BLOCKSS2="" D Q:ERRSTAT
  1. . . . . S ERRSTAT=$$BLOCK(.MSG,.FILE,LRSS,BLOCKNAME,BLOCKSS2)
  1. . . . . Q
  1. . . . Q
  1. . . Q
  1. . Q
  1. Q ERRSTAT
  1. ;
  1. BLOCK(MSG,FILE,LRSS,BLOCKNAME,BLOCKSS2) ; output the block information
  1. N BLOCKFILE ; Fileman file number for block
  1. N TIMESTAMP ; date/time for OBX segment
  1. N STAINFILE ; Fileman file number for stain
  1. N STAINNAME ; name of stain
  1. N STAINSS2 ; ss2 in LABDATA for stain
  1. N VALUE ; value of attribute in OBX segment
  1. N ERRSTAT S ERRSTAT=0 ; assume nothing to report
  1. ;
  1. S BLOCKFILE=FILE("SPECIMEN",BLOCKNAME)
  1. S STAINNAME=$O(FILE("SPECIMEN",BLOCKNAME,""))
  1. S STAINFILE=FILE("SPECIMEN",BLOCKNAME,STAINNAME)
  1. D Q:ERRSTAT ; block type/stage
  1. . S ERRSTAT=$$OBXSEG^MAGT7SX(.MSG,"BLOCK TYPE/STAGE","ST",BLOCKNAME) Q:ERRSTAT
  1. . S VALUE=$G(@LABDATA@(BLOCKFILE,BLOCKSS2,.01,"I")) ; block/stage id
  1. . S TIMESTAMP=$G(@LABDATA@(BLOCKFILE,BLOCKSS2,.02,"I")) ; date/time block prepared
  1. . S ERRSTAT=$$OBXSEG^MAGT7SX(.MSG,"BLOCK INDEX","ST",VALUE,TIMESTAMP)
  1. . S STAINSS2=""
  1. . F S STAINSS2=$O(@LABDATA@(STAINFILE,STAINSS2)) Q:STAINSS2="" D Q:ERRSTAT
  1. . . I $P(STAINSS2,",",2,999)=BLOCKSS2 D Q:ERRSTAT
  1. . . . S ERRSTAT=$$STAIN(.MSG,.FILE,LRSS,STAINFILE,STAINSS2)
  1. . . . Q
  1. . . Q
  1. . Q
  1. Q ERRSTAT
  1. ;
  1. STAIN(MSG,FILE,LRSS,STAINFILE,STAINSS2) ; output the stain/procedure information
  1. N DATATYPE ; HL7 datatype for the OBX segment
  1. N FIELDNUMBER ; field in stain file
  1. N LABSECTION ; CY, EM, and/or SP
  1. N NAME ; name of attribute in OBX segment
  1. N PTRFLAG ; indicator for lab file #60 dictionary lookup
  1. N VALUE ; value of attribute in OBX segment
  1. N TIMESTAMP ; date/time for OBX segment - one of these three DTTM* values
  1. N DTTMSTNPREP ; date/time slides stained or sections prepared
  1. N DTTMEXAM ; date/time slides/sections examined
  1. N DTTMPRMADE ; date/time prints made
  1. N I,X
  1. N ERRSTAT S ERRSTAT=0 ; assume nothing to report
  1. ;
  1. S DTTMSTNPREP=$G(@LABDATA@(STAINFILE,STAINSS2,.04,"I")) ; date/time slides stained or sections prepared
  1. S DTTMEXAM=$G(@LABDATA@(STAINFILE,STAINSS2,.05,"I")) ; date/time slides/sections examined
  1. S DTTMPRMADE=$G(@LABDATA@(STAINFILE,STAINSS2,.11,"I")) ; date/time prints made
  1. F I=2:1 S X=$P($T(FIELDS+I),";;",2) Q:"end"[X D Q:ERRSTAT
  1. . S LABSECTION=$P(X,"^",3) I LABSECTION'[LRSS Q
  1. . S FIELDNUMBER=$P(X,"^",1),PTRFLAG=$P(X,"^",2)
  1. . S NAME=$P(X,"^",4),DATATYPE=$P(X,"^",5),TIMESTAMP=$P(X,"^",6)
  1. . S VALUE=$G(@LABDATA@(STAINFILE,STAINSS2,FIELDNUMBER,"I"))
  1. . I PTRFLAG="P",VALUE S VALUE=$$GET1^DIQ(60,VALUE,.01) ; get procedure
  1. . I VALUE="" Q ; don't output null values
  1. . S TIMESTAMP=$S(TIMESTAMP="S":DTTMSTNPREP,TIMESTAMP="P":DTTMSTNPREP,TIMESTAMP="E":DTTMEXAM)
  1. . S ERRSTAT=$$OBXSEG^MAGT7SX(.MSG,NAME,DATATYPE,VALUE,TIMESTAMP)
  1. . Q
  1. Q ERRSTAT
  1. ;
  1. FIELDS ; fields to output
  1. ;;field #^pointer file^lab section^title^datatype^timestamp^comment
  1. ;;.01^P^CY/EM/SP^PROCEDURE DESCRIPTION^ST^S^stain/procedure
  1. ;;.02^^EM^SECTIONS PREPARED^NM^S
  1. ;;.02^^CY/SP^SLIDES PREPARED^NM^S
  1. ;;.03^^EM^CONTROL SECTIONS^NM^S
  1. ;;.03^^CY/SP^CONTROL SLIDES^NM^S
  1. ;;.06^^EM^SECTIONS COUNTED"^NM^E
  1. ;;.06^^CY/SP^SLIDES COUNTED"^NM^E
  1. ;;.07^^EM^NEW SECTIONS^NM^S
  1. ;;.07^^CY/SP^LABELS TO PRINTS^NM^S
  1. ;;.08^^CY^SLIDES SCREENED^NM^E
  1. ;;.08^^EM^SECTIONS EXAMINED^NM^E
  1. ;;.08^^SP^SLIDES EXAMINED^NM^E^free
  1. ;;.09^^CY/EM/SP^NON-CONTROL SLIDES COUNTED^NM^E
  1. ;;.1^^EM^PRINTS MADE^NM^P
  1. ;;.12^^EM^PRINTS COUNTED^NM^P
  1. ;;.13^^EM^EXAMINIATION SECTIONS COUNTED^NM^P
  1. ;;end