source: WorldVistAEHR/trunk/r/INCIDENT_REPORTING-QAN/QANFULL0.m@ 1314

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

initial load of WorldVistAEHR

File size: 2.8 KB
RevLine 
[613]1QANFULL0 ;HISC/GJC-Auto E-Mail for locally closed cases ;8/6/93 10:04
2 ;;2.0;Incident Reporting;**1,13,18,20**;08/07/1992
3 ;
4EN1 ;Patient data
5 F QAN1=0:0 S QAN1=$O(^QA(742,"BCS",QAN0,QAN1)) Q:QAN1'>0 S QAN742=$G(^QA(742,QAN1,0)) S:QAN742]"" (QANOK,QANRSRV)=0 D:QAN742]"" PAT
6 Q
7BULL ;Mail message
8 D KILL^XM
9 ;S QANSERV="CEBELINSKI,G",QANDOM="SUP.QUA.ISC-CHICAGO.VA.GOV"
10 S XMY(QANSERV_"@"_QANDOM)="",XMDUZ=.5
11 S XMSUB="QAN Incident Event: "_^DD("SITE")_" ("_^DD("SITE",1)_")"
12 S XMTEXT="^UTILITY($J,""QAN MAIL""," D ^XMD,KILL^XM
13 Q
14PAT ;Patient data
15 S QANSLEV=+$P(QAN742,U,10) D INCK Q:'QANOK
16 S (QANSRVCE,Y)=$P(QAN742,U,8),C=$P(^DD(742,.08,0),U,2) D:Y]"" Y^DIQ S QANSRVCE=$E(Y,1,35)
17 S QANINCR=QANINCR+1,QANQUIT=1
18 S (DFN,QANPAT)=$P(QAN742,U),QANDOB=$P(^DPT(DFN,0),U,3)
19 S ^UTILITY($J,"QAN PAT",QAN1)=$P(^DPT(QANPAT,0),U)
20 S:$D(^QA(742,QAN1,1,0)) QANRSRV=1
21 I +$P(QAN742,U,5) D
22 . S VAINDT=$G(QANDATE) D:VAINDT]"" INP^VADPT
23 . S QANADMIT=$P($G(VAIN(7)),U)
24 S ^UTILITY($J,"QAN SSN",QAN1)=$P(^DPT(QANPAT,0),U,9)
25 S ^UTILITY($J,"QAN MAIL",QANINCR)="FULL^"_$G(QANCASE)_"^INCD^"_$G(QANINCD)_"^"_$G(QANDATE)_"^"_$G(QANLVL)_"^"_$G(QANLRIN)_"^"_$G(QANLRCP)_"^"_$G(QANMLGP(0))_"^"_$G(VA1026)_"^"_$G(QANINLOC)_"^"_$G(QANPROV)_"^"
26 I QANDESC,$D(^UTILITY($J,"W",DIWL)) F QANY=0:0 S QANY=$O(^UTILITY($J,"W",DIWL,QANY)) Q:QANY'>0 S QANINCR=QANINCR+1,^UTILITY($J,"QAN MAIL",QANINCR)="FULL^"_QANCASE_"^DESC^"_^UTILITY($J,"W",DIWL,QANY,0)_"^"
27 I QANRSRV D
28 . S QAN=0
29 . F S QAN=$O(^QA(742,QAN1,1,QAN)) Q:QAN'>0 D
30 .. S QANRSRV("I")=$P($G(^QA(742,QAN1,1,QAN,0)),U)
31 .. Q:QANRSRV("I")']""
32 .. S QANRSRV("X")=$P($G(^ECC(730,QANRSRV("I"),0)),U)
33 .. S QANINCR=QANINCR+1
34 .. S ^UTILITY($J,"QAN MAIL",QANINCR)="FULL^"_$G(QANCASE)_"^RSRV^"_QANRSRV("X")_"^"
35 S QANINCR=QANINCR+1
36 S ^UTILITY($J,"QAN MAIL",QANINCR)="FULL^"_$G(QANCASE)_"^PAT^"_$G(^UTILITY($J,"QAN PAT",QAN1))_"^"_$G(^UTILITY($J,"QAN SSN",QAN1))_"^"_$G(QANSLEV)_"^"_$G(QANTYDTH)_"^"_$G(QANSRVCE)_"^"_$G(QANADMIT)_"^"_$G(QANDOB)_"^"
37 Q
38INCK ;Check status of incident
39 I QANINCD="HOMICIDE" S QANOK=1
40 I QANINCD="DEATH" D
41 . S QANTYDTH=+$G(QANTYDTH)
42 . I '$D(^QA(742.14,"BUPPER","OTHER",QANTYDTH)),('$D(^QA(742.14,"BUPPER","WITHIN 24 HOURS OF ADMISSION (EX. DOA'S AND TERMINALS)",QANTYDTH))) S QANOK=1
43 I QANINCD="SUICIDE" S QANOK=1
44 I QANINCD="SEXUAL ASSAULT" S QANOK=1
45 I QANINCD="SUICIDE ATTEMPT" S QANOK=1
46 I QANINCD="INFORMED CONSENT-FAIL. TO OBTAIN" S QANOK=1
47 I QANINCD="PATIENT ABUSE" S QANOK=1
48 I QANINCD="INJURY NOT OTHERWISE LISTED",(QANSLEV'<2) S QANOK=1
49 I QANINCD="ASSAULT-PATIENT TO PATIENT",(QANSLEV'<2) S QANOK=1
50 I QANINCD="FIRE-PATIENT INVOLVED IN",(QANSLEV'<2) S QANOK=1
51 I QANINCD="ASSAULT-PATIENT/STAFF",(QANSLEV'<2) S QANOK=1
52 I QANINCD="FALL",(QANSLEV'<2) S QANOK=1
53 I QANINCD="MEDICATION ERROR",(QANSLEV'<2) S QANOK=1
54 I QANINCD="TRANSFUSION ERROR",(QANSLEV'<2) S QANOK=1
55 I QANINCD="MISSING PATIENT",(QANSLEV'<2) S QANOK=1
56 Q
Note: See TracBrowser for help on using the repository browser.