source: FOIAVistA/tag/r/INCIDENT_REPORTING-QAN/QANAHOC.m@ 628

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1QANAHOC ;HISC/DAD-Ad Hoc Report interface for the QA Patient Incident Review file (#742) ;2/8/93 10:12
2 ;;2.0;Incident Reporting;**1,15,17,27,26**;08/07/1992
3 ; *** Set up required and optional variables and call Ad Hoc Rpt Gen
4 S QAQMRTN="MENU^QANAHOC",QAQORTN="OTHER^QANAHOC",QAQDIC=742
5 S QANXIT=0 D ^QAQAHOC0
6 K %Y,B,D,DIJ,DP,QAND0,QAQ,QANXIT,QAQFOUND,QB,QC
7 Q
8CONVERT ;Convert sort parameters for Incident Case Status.
9 ;Codes from ^DD(742.4,.09,0)
10 ;0 --->'Closed' 1 --->'Open'
11 ;2 --->'Deleted' 3 --->'Quick'
12 Q:'$D(QAQBEGIN(QB))!('$D(QAQEND(QB)))
13 Q:(QAQBEGIN(QB)=0)&(QAQEND(QB)=0)
14 Q:(QAQBEGIN(QB)=2)&(QAQEND(QB)=2)
15 ;Quit if the input vars do not exist, of if 'open' is not included in
16 ;the sort parameters.
17 ;If 'open' is included, and 'deleted' is not, screen out 'deleted'.
18 ;If 'open' is included, and 'closed' is not, screen out 'closed'.
19 I QAQBEGIN(QB)=0,(QAQEND(QB)=1) D Q
20 . S TO(QB)=3
21 . S DIS(0)="S QAND0=$P($G(^QA(742,D0,0)),U,3) I $G(QAND0)]"""",($P($G(^QA(742.4,QAND0,0)),U,8))#3'>1"
22 I QAQBEGIN(QB)=0,(QAQEND(QB)=2) S TO(QB)=3 Q
23 I QAQBEGIN(QB)=1,(QAQEND(QB)=1) D Q
24 . S TO(QB)=3
25 . S DIS(0)="S QAND0=$P($G(^QA(742,D0,0)),U,3) I $G(QAND0)]"""",($P($G(^QA(742.4,QAND0,0)),U,8)>0),($P($G(^QA(742.4,QAND0,0)),U,8)#3'>1)"
26 I QAQBEGIN(QB)=1,(QAQEND(QB)=2) S TO(QB)=3 Q
27 Q
28MENU ; *** Build the menu array
29 F QA=1:1 S X=$P($T(TEXT+QA),";;",2,99) Q:X="" S QAQMENU(QA)=X
30 Q
31OTHER ; *** Set up other (optional) EN1^DIP variables, e.g.
32 ; *** DCOPIES,DHD,DHIT,DIOBEG,DIOEND,DIS(),IOP,PG
33 K DIS,QAQFOUND S QAQFOUND=0,DHIT="S QAQFOUND=1"
34 S DIOEND="I 'QAQFOUND W !!,""No data found for this report !!"""
35 ;Check if 'Incident Case Status' is a sort field.
36 F QB=0:0 S QB=$O(QAQOPTN("S",QB)) Q:QB'>0!(QANXIT) D
37 . S QC=$O(QAQOPTN("S",QB,0)) Q:QC'>0
38 . I $P(QAQOPTN("S",QB,QC),";",1)=".03:,.09" S QANXIT=1 D CONVERT
39 F S %=2 W !!?5,"Do you want the report to include 'deleted' records" D YN^DICN Q:"-12"[% W !?5,"Please answer (Y)es or (N)o."
40 I %=2 D
41 . I $D(DIS(0)) S DIS(0)=DIS(0)_",($P($G(^QA(742,D0,0)),U,12)'=-1),($P($G(^QA(742.4,QAND0,0)),U,8)'=2)"
42 . E S DIS(0)="S QAND0=$P($G(^QA(742,D0,0)),U,3) I $G(QAND0)]"""",($P($G(^QA(742,D0,0)),U,12)'=-1),($P($G(^QA(742.4,QAND0,0)),U,8)'=2)"
43 Q
44TEXT ;;*** Sort Yes/No ^ Menu Text ^ ~Field # ^ DIR(0)
45 ;;1^Patient^~.01;"Patient"^PAO^2:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
46 ;;1^Patient Id^~.02;"Patient Id"^FAO^1:30^
47 ;;1^Date of Admission^~.04;"Date Of Admission"^DAO^::AET^S Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_(1700+$E(Y,1,3))
48 ;;1^Patient Type^~.05;"Patient Type"^SO^0:OUTPATIENT;1:INPATIENT;^;I $D(Y(0))#2 S Y=$P(Y(0),U)
49 ;;1^Ward/Clinic^~.06;"Ward/Clinic"^PAO^44:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
50 ;;1^Treating Specialty^~.07;"Treating Specialty"^PAO^45.7:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
51 ;;1^Service^~.08;"Service"^PAO^730:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
52 ;;1^Responsible Service^.12,~.01;"Responsible Service"^PAO^730:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
53 ;;1^Medication Errors^~.11;"Medication Errors"^PAO^742.13:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
54 ;;0^Case Number^~.03:.01;"Case Number"^FAO^7:13^
55 ;;1^Incident^~.03:.02;"Incident"^PAO^742.1:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
56 ;;1^Incident Location^~.03:.04;"Incident Location"^PAO^742.5:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
57 ;;1^Type of Death^~.03:.15;"Type of Death"^PAO^742.14:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
58 ;;1^Level of Review^~.03:.12;"Level of Review"^SO^^;I $D(Y(0))#2 S Y=$P(Y(0),U)
59 ;;1^Date of Incident^~.03:.03;"Date of Incident"^DAO^::AET^S Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_(1700+$E(Y,1,3))
60 ;;1^Incident Case Status^~.03:,.09;"Incident Case Status"^SO^0:CLOSED;1:OPEN;2:DELETED;^;I $D(Y(0))#2 S Y=$P(Y(0),U)
61 ;;1^Severity Level^~.1;"Severity Level"^SO^0:NO INJURY OR DISABILITY;1:MINOR;2:MAJOR;3:DEATH;^;I $D(Y(0))#2 S Y=$P(Y(0),U)
62 ;;1^National Case Status^~.03:.17;"National Case Status"^SO^^;I $D(Y(0))#2 S Y=$P(Y(0),U)
63 ;;0^Fall Assessment Score^~.09;"Fall Assessment Score"^FAO^1:3^
64 ;;0^Person Reporting the Incident^~.03:.06;"Person Reporting the Incident"^PAO^200:AEMNQZ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
65 ;;0^Patient Diagnosis^.15,~.01;"Patient Diagnosis"^FAO^3:60^
66 ;;0^Medical Center Action^.03:.16;"Medical Center Action"^SO^1:CHANGE IN POLICY/PROCEDURE;2:EDUCATION/TRAINING;3:SYSTEMS CHANGE;4:DISCIPLINARY;5:DISTRICT COUNCIL NOTIFIED;6:NONE INDICATED;^;I $D(Y(0))#2 S Y=$P(Y(0),U)
67 ;;0^Incident Description^.03:.05;"Incident Description"^
68 ;;0^Pertinent Information^.03:.2;"Pertinent Information"^
69 ;;1^Division^~.03:52;"Division"^PAO^4:AEMNZQ^I $D(Y(0,0))#2 S Y=$P(Y(0,0),U)
Note: See TracBrowser for help on using the repository browser.