source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLGEFM.m@ 767

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

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1SPNLGEFM ;ISC-SF/DAD - RETRIEVE DATA FROM FILE 154.1 ;10/25/2001
2 ;;2.0;Spinal Cord Dysfunction;**2,16**;01/02/1997
3 ;;
4EXTRACT(RECN,FORMAT,FLAG) ;
5 ;RECN...........This is an IEN in file 2.
6 ;FORMAT.........This is determines whether the data will be in
7 ; internal or external format. (IS NOT USED IN THIS VERSION)
8 ;FLAG...........This is set to 1 if there is an error retrieveing the
9 ; data.
10 ;
11 N SPNFD0,SPNFD1
12 S (SPNFD0,FLAG)=0
13 F S SPNFD0=$O(^SPNL(154.1,"B",RECN,SPNFD0)) Q:SPNFD0'>0 D
14 . I RECN'=$P($G(^SPNL(154.1,SPNFD0,0)),U) Q ; *** Bad B xref
15 . I "^1^2^"'[(U_$P($G(^SPNL(154.1,SPNFD0,0)),U,2)_U) Q
16 . I $O(^SPNL(154.1,SPNFD0,1,0)) D ; *** Clinician mult WITH data
17 .. S ^TMP("SPNXMRK",$J,SPNFD0)=""
18 .. S SPNFD1=0
19 .. F S SPNFD1=$O(^SPNL(154.1,SPNFD0,1,SPNFD1)) Q:SPNFD1'>0 D
20 ... D ADDREC^SPNLGE("FM",$$GETFIM(SPNFD0,SPNFD1))
21 ... Q
22 .. Q
23 . Q
24 Q
25 ;
26GETFIM(SPNFD0,SPNFD1) ; *** Get FIM data (file #154.1)
27 ;
28 ;Required:
29 ; SPNFD0 = FIM file (#154.1) IEN
30 ;Optional:
31 ; SPNFD1 = CLINICIAN multiple (#154.101) IEN
32 ;Returns:
33 ; FIM_Type ^ Respondent_Type ^ Date_Recorded ^ Eating ^ Grooming ^
34 ; Bathing ^ Dressing_Upper_Body ^ Dressing_Lower_Body_From_Bath ^
35 ; Toileting ^ Bladder_Management ^ Bowel_Management ^
36 ; Xfer_To_Bed/Chair/Wheelchair ^ Xfer_To_Toilet ^ Xfer_To_Tub/Shower ^
37 ; Walk/Wheelchair ^ Stairs ^ Comprehension ^ Expression ^
38 ; Social_Interaction ^ Problem_Solving ^ Memory ^ Clinician ^
39 ; Get_To_Places_Outside_Of_Home ^ Shopping ^
40 ; Planning_And_Cooking_Own_Meals ^ Doing_Housework ^ Handling_Money ^
41 ; Method_Ambulation_(Walking) ^ Method_Ambulation_(Wheelchair) ^
42 ; Help_During_Last_2_Weeks ^ Number_Of_Hours_Of_Help ^
43 ; Received_Most_Medical_Care ^ VA_Medical_Center_1 ^ VA_Medical_Center_2
44 ;
45 N SPNF,SPNFDATA,SPNPIECE,SPNSTAT
46 S SPNPIECE="22^^12"
47 F SPNF=0,2 D
48 . S SPNFDATA(SPNF)=$G(^SPNL(154.1,SPNFD0,SPNF))
49 . I $L(SPNFDATA(SPNF),U)'=$P(SPNPIECE,U,SPNF+1) D
50 .. S $P(SPNFDATA(SPNF),U,$P(SPNPIECE,U,SPNF+1))=""
51 .. Q
52 . Q
53 F SPNF=5:1:22 D ; FIM Data
54 . S $P(SPNFDATA(0),U,SPNF)=$$FIMLEVEL($P(SPNFDATA(0),U,SPNF))
55 . Q
56 S SPNFDATA(1)=$$CLIN($P($G(^SPNL(154.1,SPNFD0,1,+$G(SPNFD1),0)),U))
57 F SPNF=10:1:12 S $P(SPNFDATA(2),U,SPNF)=""
58 I $G(^SPNL(154,$P($G(^SPNL(154.1,SPNFD0,0)),U),3))'="" D
59 .S SPNSTAT=$G(^SPNL(154,$P($G(^SPNL(154.1,SPNFD0,0)),U),3))
60 .S $P(SPNFDATA(2),U,10)=$P(SPNSTAT,U) ; RECEIVED
61 .S $P(SPNFDATA(2),U,11)=$$STATNUMB($P(SPNSTAT,U,2)) ; VA1
62 .S $P(SPNFDATA(2),U,12)=$$STATNUMB($P(SPNSTAT,U,3)) ; VA2
63 .Q
64 S $P(SPNFDATA(0),U,22)=$P(SPNFDATA(0),U,22)
65 S $P(SPNFDATA(2),U,12)=$P(SPNFDATA(2),U,12)
66 Q $P(SPNFDATA(0),U,2,22)_U_SPNFDATA(1)_U_$P(SPNFDATA(2),U,1,12)
67 ;
68STATNUMB(D0) ; *** Return: Station_Number
69 ; D0 = INSTITUTION file ($4) IEN
70 Q $P($G(^DIC(4,+D0,99)),U)
71 ;
72FIMLEVEL(D0) ; *** Return: FIM_Level_Number
73 ; D0 = FIM LEVEL file (#154.11) IEN
74 Q $P($G(^SPNL(154.11,+D0,0)),U)
75 ;
76CLIN(D0) ; *** Return Clinician_Name
77 ; D0 = NEW PERSON file (#200) IEN
78 Q $P($G(^VA(200,+D0,0)),U)
Note: See TracBrowser for help on using the repository browser.