source: FOIAVistA/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXBAPI.m@ 1572

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

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1PXBAPI ;ISL/JVS,ISA/KWP - PCE's API interview questions - encounter ;04/26/99
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**19,67,173**;Aug 12, 1996
3 Q
4 ;
5INTV(WHAT,PACKAGE,SOURCE,PXBVST,PXBHLOC,PXBPAT,PXBAPPT,PXLIMDT,PXALHLOC) ;
6 ;+This api will prompt the user for Visit and related V-file data used to document an encounter.
7 ;+Interview Questions
8 ;+Parameters
9 ;+ WHAT Required, defines the series of prompts. Valid values are:
10 ;+ "INTV" all of the prompts in the checkout interview.
11 ;+ "ADQ" all of the administrative prompts related to the interview.
12 ;+ "CODT" prompts for the Check Out Date/Time.
13 ;+ "SCC" prompts for the service connected conditions.
14 ;+ "PRV" prompts for the providers
15 ;+ "CPT" prompts for the provider and then the procedures that
16 ;+ the provider did.
17 ;+ "POV" prompts for the diagnoses
18 ;+ "STP" prompts for the stop codes
19 ;+----------
20 ;+ PACKAGE Required, text string of the package name space
21 ;+ or a pointer to the Package file (#9.4)
22 ;+ SOURCE Required, text string that discribes the source of the data.
23 ;+ This will be added to the PCE Data Source file (#839.7) if
24 ;+ it is not already in the file.
25 ;+ PXBVST Required except for on "INTV" and "ADQ".
26 ;+ This is a pointer to the Visit file (#9000010)
27 ;+ PXBHLOC Optional (passed if known) pointer to the Hospital
28 ;+ Location file (#44)
29 ;+ PXBPAT Pointer to the Patient file (#2)
30 ;+ Required if there is no PXBVST and there is a PXBAPPT
31 ;+ otherwise it is Optional (passed if known)
32 ;+ PXBAPPT Optional (passed if known) pointer to the Apointment
33 ;+ subfile (#2.98) of the Patient file (#2)
34 ;+ PXLIMDT Optional if passed then user can not create an encounter
35 ;+ (Visit file entry) before this date.
36 ;+ PXALHLOC Optional if is not passed, 0, or null then only clinics
37 ;+ can be entered for hospital locations otherwise
38 ;+ any non disposition hospital location can be entered.
39 ;+
40 ;+ Returns:
41 ;+ 1 if no errors and process completely
42 ;+ 0 if user up arrows out may have did part of the processing
43 ;+ but at least have a visit
44 ;+ -1 if user up arrows out or errors out and did not do anything
45 ;+ -2 if could not get a visit
46 ;+ -3 if called incorrectly
47 ;
48 ;---------------NEW CURSOR CONTROL VARIABLE-----------------------
49 N IOARM0,IOARM1,IOAWM0,IOAWM1,IOBOFF,IOBON,IOCOMMA,IOCUB,IOCUD,IOCUF
50 N IOCUON,IOCUOFF,IOCUU,IODCH,IODHLB,IODHLT,IODL,IODWL,IOECH,IOEDALL
51 N IOEDBOP,IOEDEOP,IOEFLD,IOELALL,IOELBOL,IOELEOL,IOENTER,IOFIND
52 N IOHDWN,IOHOME,IOHTS,IOHUP,IOICH,IOIL,IOIND,IOINHI,IOINLOW,IOINORM
53 N IOINSERT,IOKP0,IOKP1,IOKP2,IOKP3,IOKP4,IOKP5,IOKP6,IOKP7,IOKP8,IOKP9
54 N IOIRM0,IOIRM1,IOKPAM,IOKPNM,IOMC,IOMINUS,IONEL,IONEXTSC,IOPERIOD
55 N IOPF1,IOPF2,IOPF3,IOPF4,IOPREVSC,IOPROB,IOPTCH10,IOPTCH12,IOPTCH16
56 N IORC,IOREMOVE,IORESET,IORI,IORVOFF,IORVON,IOSC,IOSGR0,IOSELECT
57 N IOSTBM,IOSWL,IOTBC,IOTBCALL,IOUOFF,IOUON,IOIS
58 ;
59 ;------------------------*******----------------------------------
60 ; Fix IHS Patient files.
61 N PX,DA
62 S DA=DFN D
63 .D CHECK^PXXDPT Q:'$T
64 .S PX=$P($G(^DPT(DA,0)),U,9)
65 .D EN^PXXDPT
66 .K DR,DIE,DA,PXDA,PX
67 ;
68 D FIX1^PXBCC
69 N DIQ,TANA
70 N PXBPXXX S PXBPXXX="1^1" ;--PROMPTING CONTROL VARIABLE
71 ;
72 N PXBSOURC,PXBEXIT,PXBVSTDT,PXELAP,PXBCODT,PXB800,PXBPRBON,DFN
73 N PXBEXIT,PAT,ITEM,NF,POP,PXBCNTPL,Q,TEST,UID,PXBPKG
74 N VAL,VAR,PXBNCPTF,DXX,DYY
75 S PXBEXIT=1
76 ;
77 I $G(WHAT)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""WHAT"", contact IRM." Q -3
78 I $G(PACKAGE)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""PACKAGE"", contact IRM." Q -3
79 I $G(SOURCE)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""SOURCE"", contact IRM." Q -3
80 ;Get package pointer
81 I PACKAGE=+PACKAGE S PXBPKG=PACKAGE
82 E S PXBPKG=$$PKG2IEN^VSIT(PACKAGE)
83 I '($D(^DIC(9.4,PXBPKG,0))#2) W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a valid ""PACKAGE"", contact IRM." Q -3
84 ;
85 ;Lookup source in PCE DATA SOURCE file (#839.7) with LAYGO
86 I SOURCE=+SOURCE S PXBSOURC=SOURCE
87 E S PXBSOURC=$$SOURCE^PXAPIUTL(SOURCE)
88 ;
89 I PXBVST'>0,WHAT'="INTV"&(WHAT'="ADQ")&(WHAT'="ADDEDIT") W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""VISIT"", contact IRM." Q -3
90 I PXBVST>0 D Q:PXBEXIT<1 PXBEXIT
91 . S PXBVSTDT=$P(^AUPNVSIT(PXBVST,0),"^",1)
92 . I PXBPAT'>0 S PXBPAT=$P(^AUPNVSIT(PXBVST,0),"^",5)
93 . E I PXBPAT'=$P(^AUPNVSIT(PXBVST,0),"^",5) W !,"Procedure ""INTV^PXAPI"" was called incorrectly with the Visit for a different Patient, contact IRM." S PXBEXIT=-3 Q
94 . I PXBHLOC'>0 S PXBHLOC=$P(^AUPNVSIT(PXBVST,0),"^",22)
95 . E I PXBHLOC'=$P(^AUPNVSIT(PXBVST,0),"^",22) W !,"Procedure ""INTV^PXAPI"" was called incorrectly with the Visit for a different Hospital Locations, contact IRM." S PXBEXIT=-3 Q
96 . I PXBAPPT'>0 D
97 .. I $D(^DPT(PXBPAT,"S",PXBVSTDT,0))#2,PXBHLOC'>0!(PXBHLOC=+^DPT(PXBPAT,"S",PXBVSTDT,0)) S PXBAPPT=PXBVSTDT S:PXBHLOC'>0 PXBHLOC=+^DPT(PXBPAT,"S",PXBVSTDT,0)
98 . E I '$D(^DPT(PXBPAT,"S",PXBVSTDT,0))#2!(PXBVSTDT'=PXBAPPT) W !,"Procedure ""INTV^PXAPI"" was called incorrectly with the Visit and Appointment of different times, contact IRM." S PXBEXIT=-3 Q
99 E I PXBAPPT>0 D Q:PXBEXIT<1 PXBEXIT
100 . I PXBPAT'>0 W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""PATIENT"", contact IRM." S PXBEXIT=-3 Q
101 . S PXBVSTDT=PXBAPPT
102 . I PXBHLOC'>0,+$G(^DPT(PXBPAT,"S",PXBAPPT,0)) S PXBHLOC=+^DPT(PXBPAT,"S",PXBAPPT,0)
103 S DFN=PXBPAT
104 S PXBPRBON=$L($T(^GMPLUTL)) ;see if Problem List exists
105 ;+ If visit has been passed lock ^PXLCKUSR(VISIEN)
106 ;+ and create XTMP("PXLCKUSR",VISIEN)=DUZ
107 N PXRESVAL,PXVISIEN
108 I PXBVST>0 S PXVISIEN=PXBVST D I 'PXRESVAL Q -2
109 .N PXMSG,PXUSR
110 .S PXMSG=""
111 .I $D(^XTMP("PXLCKUSR",PXVISIEN)) S PXUSR=$G(^VA(200,^XTMP("PXLCKUSR",PXVISIEN),0)),PXUSR=$S(PXUSR="":"Unknown",1:$P(PXUSR,"^")),PXMSG="Encounter Locked by "_PXUSR
112 .S PXRESVAL=$$LOCK^PXUALOCK("^PXLCKUSR("_PXVISIEN_")",5,0,PXMSG,0)
113 .I 'PXRESVAL Q
114 .S PXRESVAL=$$CREATE^PXUAXTMP("PXLCKUSR",PXVISIEN,365,"PCE Encounter Lock",DUZ) I 'PXRESVAL D UNLOCK^PXUALOCK("^PXLCKUSR("_PXVISIEN_")")
115 D PROCESS^PXBAPI1(.PXBEXIT)
116 W !," - - - - S o r r y A b o u t T h e W a i t - - - -"
117 W !,"This information is being stored or monitored by Scheduling"
118 W !,"Integrated Billing, Order Entry, Registration, Prosthetics"
119 W !,"PCE/Visit Tracking and Automated Med Information Exchange."
120 D EVENT^PXKMAIN
121 K PXVDR
122 I $G(PXVISIEN)>0 D UNLOCK^PXUALOCK("^PXLCKUSR("_PXVISIEN_")"),DELETE^PXUAXTMP("PXLCKUSR",PXVISIEN)
123 Q PXBEXIT
124 ;
Note: See TracBrowser for help on using the repository browser.