source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLGERA.m@ 1352

Last change on this file since 1352 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1SPNLGERA ; ISC-SF/GMB - SCD GATHER RADIOLOGY DATA;25 MAY 94 [ 08/09/94 9:45 AM ] ;6/23/95 11:23
2 ;;2.0;Spinal Cord Dysfunction;**13**;01/02/1997
3EXTRACT(DFN,FDATE,TDATE,CLEARTXT,ABORT) ;
4 ; This entry point is to be used solely for gathering data to be sent
5 ; to the national registry
6 ; DFN Patient's internal entry number in the Patient file
7 ; FDATE "From" date
8 ; TDATE "Thru" date, default=today
9 ; CLEARTXT 1=translate all codes to their meaning,
10 ; 0=don't translate codes (default=0)
11 N LASTDATE,EXAMDATE,RECNR,REALDATE,MODLIST,MRECNR,MOD,MODPTR
12 N PROCPTR,PROCREC,PROCNAME,CPTCODE,PROCCOST,COMPLETE,REC0,EXAMSTAT
13 I '$D(TDATE) S TDATE=DT
14 I '$D(CLEARTXT) S CLEARTXT=0
15 ; Need to be able to recognize if an exam has been completed.
16 ;S COMPLETE=$O(^RA(72,"B","COMPLETE",0)) ; obsolete. See DBIA #996
17 ; We are interested in any radiology procedure administered within the
18 ; 'from' and 'thru' date range. The record numbers are date/time (of
19 ; procedure), subtracted from 9999999.9999. This causes the procedures
20 ; to be listed in order from most recent to oldest. So we must modify
21 ; our from & to dates.
22 S LASTDATE=9999999.9999-FDATE
23 S EXAMDATE=9999999.9999-(TDATE+1) ; for each exam date in range
24 F S EXAMDATE=$O(^RADPT(DFN,"DT",EXAMDATE)) Q:EXAMDATE'>0!(EXAMDATE>LASTDATE) D
25 . S REALDATE=9999999.9999-EXAMDATE\1
26 . S COMPLETE=$O(^RA(72,"AA",$P(^RA(79.2,$P(^RADPT(DFN,"DT",EXAMDATE,0),U,2),0),U,1),9,"")) ; updated call to radiology
27 . S RECNR=0 ; for each procedure on that date
28 . F S RECNR=$O(^RADPT(DFN,"DT",EXAMDATE,"P",RECNR)) Q:RECNR'>0 D
29 . . S REC0=$G(^RADPT(DFN,"DT",EXAMDATE,"P",RECNR,0))
30 . . S EXAMSTAT=+$P(REC0,U,3)
31 . . Q:EXAMSTAT'=COMPLETE
32 . . S PROCPTR=+$P(REC0,U,2)
33 . . Q:PROCPTR=0
34 . . S PROCREC=$G(^RAMIS(71,PROCPTR,0))
35 . . Q:PROCREC=""
36 . . S PROCNAME=$P(PROCREC,U,1)
37 . . S CPTCODE=$P(PROCREC,U,9)
38 . . S PROCCOST=$P(PROCREC,U,10)
39 . . S MODLIST=""
40 . . S MRECNR=0 ; for each modifier
41 . . F S MRECNR=$O(^RADPT(DFN,"DT",EXAMDATE,"P",RECNR,"M",MRECNR)) Q:MRECNR'>0 D
42 . . . S MODPTR=+$G(^RADPT(DFN,"DT",EXAMDATE,"P",RECNR,"M",MRECNR,0))
43 . . . S MOD=$P($G(^RAMIS(71.2,MODPTR,0)),U,1)
44 . . . S:MOD'="" MODLIST=MODLIST_"^"_MOD
45 . . S MODLIST=$P(MODLIST,U,2,5) ; just take first four modifiers
46 . . D ADDREC^SPNLGE("RA",REALDATE_"^"_PROCNAME_"^"_CPTCODE_"^"_MODLIST)
47 Q
Note: See TracBrowser for help on using the repository browser.