source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLUTL1.m@ 824

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1SPNLUTL1 ;HISC/WAA/CM-SCD REGISTRY FILE UTILITIES #2 ;8/6/96 15:51
2 ;;2.0;Spinal Cord Dysfunction;**12,14**;01/02/1997
3 ;
4 ; This routine is a utility routine that will contain the code
5 ; that will be used in Screen Manager calls.
6 ;
7 ;EN1(SPNLDFN)
8 ; This call is use in the SCREENMAN form SPNLPFM1. It will
9 ; load several varables that are going to be passed back to
10 ; The calling form.
11 ;INPUT:
12 ; SPNLDFN = Patient DFN
13 ;OUTPUT:
14 ; SPNLSSN = Patient SSN
15 ; SPNLDOB = Patient date of birth
16 ; SPNLDEAD = Patient date of death
17 ; SPNLINDC = SCI/SCD patient indicator
18 ; SPNLPHON = Patient phone number
19 ;
20 ;EN2
21 ; This function will is to determine if a patient has a given
22 ; reaction.
23 ;INPUT:
24 ; SPNLDFN = Patient DFN
25 ; SPNLETO = Freetext of Patient Etiology
26 ;OUTPUT:
27 ; 1 = Patient has the given Etiology
28 ; 0 = Patient doesn't have the Etiology
29 ; "" = Etiology doesn't exist
30 ;
31 ;EN3
32 ; This function will is to determine if a patient has a given
33 ; reaction for the current entry.
34 ;INPUT:
35 ; SPNLDFN = Patient DFN
36 ; SPNLETO = Freetext of Patient Etiology
37 ;OUTPUT:
38 ; 1 = Patient has the given Etiology
39 ; 0 = Patient doesn't have the Etiology
40 ; "" = Etiology doesn't exist
41 ;
42 ;EN4
43 ; This function will determine if a patient has a given Type of CAUSE.
44 ;INPUT:
45 ; SPNLDFN = Patient DFN
46 ; SPNLTYPE = Type of CAUSE
47 ; [Values to be passed are TC, NTC, B, U]
48 ;OUTPUT
49 ; 1 = Patient has That type of cause
50 ; 0 = Patient doesn't have that cause
51 ; "" = Error in function
52 ;
53 ;EN5
54 ; This function will total up all the Chart scors for a patient.
55 ;INPUT:
56 ; SPNFDFN = Patient DFN
57 ;OUTPUT;
58 ; "" = Error
59 ; 1 to 500 = Value of all chart scores added.
60 ;
61EN1(SPNLDFN) ; Load Form SPNLPFM1
62 N SPND1
63 Q:SPNLDFN<1
64 S (SPNLSSN,SPNLDOB,SPNLDEAD,SPNLINDC,SPNLPHON)=""
65 S SPNLSSN=$$GET^DDSVAL(2,.SPNLDFN,.09,1)
66 S Y=$$GET^DDSVAL(2,.SPNLDFN,.03,1) X ^DD("DD") S SPNLDOB=Y K Y
67 S Y=$$GET^DDSVAL(2,.SPNLDFN,.351,1) I Y>1 X ^DD("DD") S SPNLDEAD=Y K Y
68 S SPNLINDC=$$GET^DDSVAL(2,.SPNLDFN,57.4,"","E")
69 S SPNLPHON=$$GET^DDSVAL(2,.SPNLDFN,.131,1)
70 S SPND1=0
71 F S SPND1=$O(^SPNL(154,SPNLDFN,"E",SPND1)) Q:SPND1<1 D
72 . N SPNX,SPNCK
73 . S SPNX=SPND1
74 . S SPNX(1)=SPNLDFN
75 . S SPNCK=$$EN3^SPNLUTL1(.SPNX,"OTHER")
76 . D UNED^DDSUTL("DESC OTHER","SPNLPBLK2",1,('SPNCK),SPND1_","_SPNLDFN_",")
77 . Q
78 Q
79EN2(SPNLDFN,SPNLETO) ; Find patient Etiology
80 N SPNLETO1,SPNLIEN,SPNLFLG
81 S SPNLFLG=""
82 I SPNLDFN<1!(SPNLETO="") Q SPNLFLG
83 S SPNLETO1=$O(^SPNL(154.03,"B",SPNLETO,0)) I SPNLETO1<1 Q SPNLFLG
84 S SPNLFLG=0
85 S SPNLIEN=0 F S SPNLIEN=$O(^SPNL(154,SPNLDFN,"E",SPNLIEN)) Q:SPNLIEN<1 I $P($G(^SPNL(154,SPNLDFN,"E",SPNLIEN,0)),U)=SPNLETO1 S SPNLFLG=1 Q
86 Q SPNLFLG
87EN3(SPNLDA,SPNLETO) ; Check to see if a given entry us of a given type.
88 N SPNLTXT,SPNLFLG
89 S SPNLFLG=0
90 S SPNLET1=+$P(^SPNL(154,SPNLDA(1),"E",SPNLDA,0),U)
91 S SPNLTXT=$P($G(^SPNL(154.03,SPNLET1,0)),U)
92 I SPNLTXT[SPNLETO S SPNLFLG=1
93 Q SPNLFLG
94EN4(SPNLDFN,SPNLTYPE) ; Find patient Type of cause.
95 N SPNLIEN,SPNLETO,SPNLFLG
96 S SPNLFLG=""
97 I "^TC^NTC^B^U^"'[(U_SPNLTYPE_U) Q SPNLFLG
98 S SPNLFLG=0
99 I SPNLTYPE="B" G BOTH
100 S SPNLIEN=0 F S SPNLIEN=$O(^SPNL(154,SPNLDFN,"E",SPNLIEN)) Q:SPNLIEN<1 S SPNLETO=+$P($G(^SPNL(154,SPNLDFN,"E",SPNLIEN,0)),U) I $P($G(^SPNL(154.03,SPNLETO,0)),U,2)=SPNLTYPE S SPNLFLG=1 Q
101BOTH I SPNLTYPE="B" S SPNLIEN=0 F S SPNLIEN=$O(^SPNL(154,SPNLDFN,"E",SPNLIEN)) Q:SPNLIEN<1 S SPNLETO=+$P($G(^SPNL(154,SPNLDFN,"E",SPNLIEN,0)),U) I $P($G(^SPNL(154.03,SPNLETO,0)),U,2)'="U" S SPNLFLG=1 Q
102 Q SPNLFLG
103EN5(SPNFDFN) ; Add CHART SCORES
104 N SPNFVAL,SPNFPC
105 S SPNFVAL=""
106 F SPNFPC=4.1:.1:4.6 S SPNFVAL=($$GET^DDSVAL(154.1,.SPNFDFN,SPNFPC,"","I"))+SPNFVAL
107 Q SPNFVAL
Note: See TracBrowser for help on using the repository browser.