source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNALERT.m@ 873

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1SPNALERT ;SAN/WDE/Main Alert Driver
2 ;;2.0;Spinal Cord Dysfunction;**11,12,13,15**;01/02/1997
3 ; called from the protocal DGPM MOVEMENT
4 ; for the time we are only going to check for
5 ; admits.
6EN ;
7 Q:'$D(DFN)
8 Q:'$D(DGPMT)
9 ;we only want admits and discharges ignore the rest
10 Q:DGPMT=2
11 Q:DGPMT>3
12 Q:'$D(^SPNL(154,DFN))
13 S SPNACT=DGPMT
14 ;this is a new parm that will go in 154.91
15 S SPNSITE=0,SPNSITE=$O(^SPNL(154.91,SPNSITE)) I SPNSITE="" D ZAP Q
16 S SPNSEND=$P($G(^SPNL(154.91,SPNSITE,0)),U,8) I SPNSEND'=1 D CHKOTHER D ZAP Q
17 ;must have a site entered and yes to send alerts
18 D 1,CHKOTHER D ZAP
19 D ZAP
20 Q
21 ;------------------------------------------------------
221 ;Check to see if the local station has the notice turned on
23 ;if so check for type of patient and build send to group
24TEST ;
25 ;Check to see if the pt has an etiology of ms
26 S SPNTYP="",SPNNU=""
27 S SPNNU=0 F S SPNNU=$O(^SPNL(154,DFN,"E",SPNNU)) Q:(SPNNU="")!('+SPNNU) D
28 .S SPNTYP=$P($G(^SPNL(154,DFN,"E",SPNNU,0)),U,1)
29 .S SPNTYP=$G(^SPNL(154.03,SPNTYP,0))
30 .I SPNTYP["MULTIPLE SCLEROSIS" S SPNNU=999999 Q
31 .Q
32 I SPNTYP["MULTIPLE SCLEROSIS" S SPNTO=$P($G(^SPNL(154.91,SPNSITE,0)),U,10)
33 I SPNTYP'["MULTIPLE SCLEROSIS" S SPNTO=$P($G(^SPNL(154.91,SPNSITE,0)),U,9)
34 I $G(SPNTO)'="" S SPNTO=$P($G(^XMB(3.8,SPNTO,0)),U,1)
35 I $G(SPNTO)="" S SPNTO="SPNL SCD COORDINATOR"
36 S SPNTO="G."_SPNTO
37 S XMY(SPNTO)=""
38 Q
39 ;---------------------------------------------------------------------
40ZAP ;
41 K SPNTO,SPNTYP,SPNNU,SPNSITE
42 K SPWARD,SPNTXT,SPNINST,SPNDOM,SPNLN
43 K SPZ,SPLN,SPNTEXT
44 Q
45CHKOTHER ;looks at additional care va and sends to that sci coord grp
46 ; Note that its getting the host site from 154.7
47 S SPNDOM="" F SPZ=3.2,3.3,3.4 D
48 .S SPNINST=$$GET1^DIQ(154,DFN_",",SPZ,"I") Q:SPNINST=""
49 .Q:SPNINST=$G(^DD("SITE",1)) ;Checks for same site pt is adm to.
50 .S SPNDOM="" S SPNDOM=$P($G(^SPNL(154.7,SPNINST,0)),U,4) Q:SPNDOM=""
51 .S XMY("G.SPNL SCD COORDINATOR@"_SPNDOM)=""
52 ;-------------------------------------------------------------------
53 Q:'$D(XMY) ;no one to send it to
54 ;at this point pt is seen at other va
55 S SPNLAS=$E($P($G(^DPT(DFN,0)),U,1),1)_$E($P($G(^DPT(DFN,0)),U,9),6,9)
56 S SPNTXT(1)="Patient : "_SPNLAS
57 I DGPMT=1 S SPWARD=$P($G(DGPMA),U,6) S:SPWARD="" SPWARD="Ward Unknown" I +SPWARD S SPWARD=$S($D(^DIC(42,SPWARD,0)):$P(^DIC(42,SPWARD,0),U,1),1:"Ward Unknown")
58 I DGPMT=3 S SPWARD=$P($G(DGPMVI(5)),U,2) S:SPWARD="" SPWARD="Ward Unknown"
59 S Y=$P($G(DGPMA),U,1) X ^DD("DD") S SPTIME=Y S:Y="" Y="Missing date"
60 S SPNTXT(2)=$S(SPNACT=1:"Date Admitted : ",1:"Date Discharged : ")_SPTIME
61 S SPNTXT(3)=$S(SPNACT=1:"Admitted to : ",1:"Discharged From : ")_SPWARD
62 I SPNACT=1 S SPNBD=$P($G(DGPMA),U,7) I +SPNBD S SPNBD=$P($G(^DG(405.4,SPNBD,0)),U,1)
63 I SPNACT=1 S SPNTXT(4)="Room-Bed : "_SPNBD
64 S SPNTXT(5)="REGISTRATION STATUS : "_$$GET1^DIQ(154,DFN_",",.03)
65 S SPNTXT(6)="VA SCI STATUS : "_$$GET1^DIQ(154,DFN_",",2.6)
66 S SPNTXT(7)="PRIMARY CARE PROVIDER : "_$$GET1^DIQ(154,DFN_",",8.1)
67 S SPNTXT(8)="SCI LEVEL : "_$$GET1^DIQ(154,DFN_",",2.1)
68 S SPNTXT(9)="Etiology Onset Other"
69 S SPNTXT(10)="------------------------------------------------------------------------------"
70 D GETS^DIQ(154,DFN_",","4*","","SPNTMP")
71 S SPENT=0,SPLN=11 F S SPENT=$O(SPNTMP(154.004,SPENT)) Q:SPENT="" D
72 .S SPTXT=$G(SPNTMP(154.004,SPENT,.01))_" "
73 .S SPTXT=$E(SPTXT,1,32)_$G(SPNTMP(154.004,SPENT,.02))_" "_$G(SPNTMP(154.004,SPENT,.03))
74 .S SPLN=SPLN+1 S SPNTXT(SPLN)=SPTXT S SPTXT=""
75 S SPLN=SPLN+1 S SPNTXT(SPLN)="-------------------------------------------------------------------------------"
76 S SPLN=SPLN+1 S SPNTXT(SPLN)="Recipients of this message:"
77 S SPLN=SPLN+1 S SPSENT="" F S SPSENT=$O(XMY(SPSENT)) Q:SPSENT="" S SPNTXT(SPLN)=SPSENT S SPLN=SPLN+1
78 S XMSUB=$S(SPNACT=1:"Admission",1:"Discharge")_" notice for "_SPNLAS_" from "_$P($G(^DD("SITE")),".",1)
79 S XMTEXT="SPNTXT("
80 D ^XMD
81 K XMTEXT,SPTXT,SPENT,XMA,SPNSENT,SPNSITE,SPNDOM,SPNTO,SPWARD,SPNBD
82 K SPNTMP,SPWARD,SPNACT,SPNL,SPSENT,SPNTXT,SPNBD,SPTIME
83 K SPNSEND,SPNLAS
Note: See TracBrowser for help on using the repository browser.