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