source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNPSR20.m@ 1500

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

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1SPNPSR20 ; HIRMFO/JWR,WAA - HUNT LAB TEST; APR 1 96 11:44
2 ;;2.0;Spinal Cord Dysfunction;;01/02/1997
3EN1(D0,FDATE,TDATE,ACTION,SEQUENCE) ;
4 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"LAB TEST",IEN)= LAB TEST
5 ; D0 Patient's internal entry number in the Patient file
6 ; FDATE "From" date
7 ; TDATE "Thru" date, default=today
8 ; ACTION ACTION TYPE
9 ; SEQUENCE SEQUENCE SORT ORDER
10 N LFN,LASTDATE,TESTDATE,TESTNR,VALUE,TEST,RESULTS,PNAME,PSSN
11 S LFN=+$P($G(^DPT(D0,"LR")),U,1) ; IEN in LAB DATA File
12 S MEETSRCH=0 G:'LFN Q
13 I '$D(TDATE) S TDATE=DT
14 S LASTDATE=9999999-FDATE
15 S TESTDATE=9999999-(TDATE+1) ; for each test date in the range
16 F S TESTDATE=$O(^LR(LFN,"CH",TESTDATE)) Q:TESTDATE'>0!(TESTDATE>LASTDATE) D Q:MEETSRCH=1
17 . S TESTNR="" ; for each test we're interested in
18 . F S TESTNR=$O(QLIST(TESTNR)) Q:TESTNR="" D Q:MEETSRCH=1
19 . . Q:'$D(^LR(LFN,"CH",TESTDATE,TESTNR)) ; was this test given?
20 . . S VALUE=$G(^LR(LFN,"CH",TESTDATE,TESTNR))
21 . . ; make sure the test wasn't cancelled
22 . . I VALUE=""!(VALUE["canc")!(VALUE["CANC") Q
23 . . S MEETSRCH=1 Q
24Q Q MEETSRCH
25 ;
26EN2(ACTION,SEQUENCE) ; Prompt Entry Point
27 N DIC,Y,DTOUT,DUOUT,LOC
28 S SPNLEXIT=0
29 I $$VFILE^DILFD(60)'>0 D Q
30 . W !!?5,"*** LABORATORY TEST file (#60) not found ***",$C(7)
31 . Q
32 S DIC("S")="I '$D(^LAB(60,+Y,2))"
33 S DIC="60",DIC(0)="AEQMZ"
34 S CN=0 F D ^DIC Q:Y=-1 D
35 . S LOC=$P(Y(0),U,5)
36 . I LOC="" D Q
37 . . W !,"Sorry, can't use this test."
38 . . W !,"LOCATION (DATA NAME) not defined in ^LAB(60.",!
39 . S CN=CN+1
40 . S ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"LAB TEST",CN)=Y
41 . S QLIST($P(LOC,";",2))=$P(Y,U,2)
42 . S DIC("A")="Another LABORATORY TEST NAME: "
43 I $D(DTOUT)!($D(DUOUT))!('$D(^TMP($J,"SPNPRT",ACTION,SEQUENCE,"LAB TEST",1))) S SPNLEXIT=1
44 I SPNLEXIT=1 K ^TMP($J,"SPNPRT",ACTION,SEQUENCE) Q
45 S (BDATE,EDATE)=""
46 D EN1^SPNPSR00(ACTION,SEQUENCE+.1,.BDATE,.EDATE)
47 S ^TMP($J,"SPNPRT",ACTION,SEQUENCE,0)="$$EN1^SPNPSR20(D0,"_BDATE_","_EDATE_","""_ACTION_""","_SEQUENCE_")"
48 Q
Note: See TracBrowser for help on using the repository browser.