Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PXBAPI

PXBAPI.m

Go to the documentation of this file.
  1. 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
  1. Q
  1. ;
  1. 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
  1. ;to document an encounter.
  1. ;+Interview Questions
  1. ;+Parameters
  1. ;+ WHAT Required, defines the series of prompts. Valid values are:
  1. ;+ "INTV" all of the prompts in the checkout interview.
  1. ;+ "ADQ" all of the administrative prompts related to the interview.
  1. ;+ "CODT" prompts for the Check Out Date/Time.
  1. ;+ "SCC" prompts for the service connected conditions.
  1. ;+ "PRV" prompts for the providers
  1. ;+ "CPT" prompts for the provider and then the procedures that
  1. ;+ the provider did.
  1. ;+ "POV" prompts for the diagnoses
  1. ;+ "STP" prompts for the stop codes
  1. ;+----------
  1. ;+ PACKAGE Required, text string of the package name space
  1. ;+ or a pointer to the Package file (#9.4)
  1. ;+ SOURCE Required, text string that describes the source of the data.
  1. ;+ This will be added to the PCE Data Source file (#839.7) if
  1. ;+ it is not already in the file.
  1. ;+ PXBVST Required except for on "INTV" and "ADQ".
  1. ;+ This is a pointer to the Visit file (#9000010)
  1. ;+ PXBHLOC Optional (passed if known) pointer to the Hospital
  1. ;+ Location file (#44)
  1. ;+ PXBPAT Pointer to the Patient file (#2)
  1. ;+ Required if there is no PXBVST and there is a PXBAPPT
  1. ;+ otherwise it is Optional (passed if known)
  1. ;+ PXBAPPT Optional (passed if known) pointer to the Apointment
  1. ;+ subfile (#2.98) of the Patient file (#2)
  1. ;+ PXLIMDT Optional if passed then user cannot create an encounter
  1. ;+ (Visit file entry) before this date.
  1. ;+ PXALHLOC Optional if is not passed, 0, or null then only clinics
  1. ;+ can be entered for hospital locations otherwise
  1. ;+ any non-disposition hospital location can be entered.
  1. ;+
  1. ;+ Returns:
  1. ;+ 1 if no errors and process completely
  1. ;+ 0 if user up arrows out may have did part of the processing
  1. ;+ but at least have a visit
  1. ;+ -1 if user up arrows out or errors out and did not do anything
  1. ;+ -2 if could not get a visit
  1. ;+ -3 if called incorrectly
  1. ;
  1. ;---------------NEW CURSOR CONTROL VARIABLE-----------------------
  1. N IOARM0,IOARM1,IOAWM0,IOAWM1,IOBOFF,IOBON,IOCOMMA,IOCUB,IOCUD,IOCUF
  1. N IOCUON,IOCUOFF,IOCUU,IODCH,IODHLB,IODHLT,IODL,IODWL,IOECH,IOEDALL
  1. N IOEDBOP,IOEDEOP,IOEFLD,IOELALL,IOELBOL,IOELEOL,IOENTER,IOFIND
  1. N IOHDWN,IOHOME,IOHTS,IOHUP,IOICH,IOIL,IOIND,IOINHI,IOINLOW,IOINORM
  1. N IOINSERT,IOKP0,IOKP1,IOKP2,IOKP3,IOKP4,IOKP5,IOKP6,IOKP7,IOKP8,IOKP9
  1. N IOIRM0,IOIRM1,IOKPAM,IOKPNM,IOMC,IOMINUS,IONEL,IONEXTSC,IOPERIOD
  1. N IOPF1,IOPF2,IOPF3,IOPF4,IOPREVSC,IOPROB,IOPTCH10,IOPTCH12,IOPTCH16
  1. N IORC,IOREMOVE,IORESET,IORI,IORVOFF,IORVON,IOSC,IOSGR0,IOSELECT
  1. N IOSTBM,IOSWL,IOTBC,IOTBCALL,IOUOFF,IOUON,IOIS
  1. ;
  1. ;------------------------*******----------------------------------
  1. ; Fix IHS Patient files.
  1. N PX,DA
  1. S DA=DFN D
  1. .D CHECK^PXXDPT Q:'$T
  1. .S PX=$P($G(^DPT(DA,0)),U,9)
  1. .D EN^PXXDPT
  1. .K DR,DIE,DA,PXDA,PX
  1. ;
  1. D FIX1^PXBCC
  1. N DIQ,TANA
  1. N PXBPXXX S PXBPXXX="1^1" ;--PROMPTING CONTROL VARIABLE
  1. ;
  1. N PXBSOURC,PXBEXIT,PXBVSTDT,PXELAP,PXBCODT,PXB800,PXBPRBON,DFN
  1. N PXBEXIT,PAT,ITEM,NF,POP,PXBCNTPL,Q,TEST,UID,PXBPKG
  1. N VAL,VAR,PXBNCPTF,DXX,DYY
  1. S PXBEXIT=1
  1. ;
  1. I $G(WHAT)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""WHAT"", contact IRM." Q -3
  1. I $G(PACKAGE)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""PACKAGE"", contact IRM." Q -3
  1. I $G(SOURCE)']"" W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""SOURCE"", contact IRM." Q -3
  1. ;Get package pointer
  1. I PACKAGE=+PACKAGE S PXBPKG=PACKAGE
  1. E S PXBPKG=$$PKG2IEN^VSIT(PACKAGE)
  1. I '($D(^DIC(9.4,PXBPKG,0))#2) W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a valid ""PACKAGE"", contact IRM." Q -3
  1. ;
  1. ;Lookup source in PCE DATA SOURCE file (#839.7) with LAYGO
  1. I SOURCE=+SOURCE S PXBSOURC=SOURCE
  1. E S PXBSOURC=$$SOURCE^PXAPIUTL(SOURCE)
  1. ;
  1. I PXBVST'>0,WHAT'="INTV"&(WHAT'="ADQ")&(WHAT'="ADDEDIT") W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""VISIT"", contact IRM." Q -3
  1. I PXBVST>0 D Q:PXBEXIT<1 PXBEXIT
  1. . S PXBVSTDT=$P(^AUPNVSIT(PXBVST,0),"^",1)
  1. . I PXBPAT'>0 S PXBPAT=$P(^AUPNVSIT(PXBVST,0),"^",5)
  1. . 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
  1. . I PXBHLOC'>0 S PXBHLOC=$P(^AUPNVSIT(PXBVST,0),"^",22)
  1. . 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
  1. . I PXBAPPT'>0 D
  1. .. 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)
  1. . 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
  1. E I PXBAPPT>0 D Q:PXBEXIT<1 PXBEXIT
  1. . I PXBPAT'>0 W !,"Procedure ""INTV^PXAPI"" was called incorrectly without a ""PATIENT"", contact IRM." S PXBEXIT=-3 Q
  1. . S PXBVSTDT=PXBAPPT
  1. . I PXBHLOC'>0,+$G(^DPT(PXBPAT,"S",PXBAPPT,0)) S PXBHLOC=+^DPT(PXBPAT,"S",PXBAPPT,0)
  1. S DFN=PXBPAT
  1. S PXBPRBON=$L($T(^GMPLUTL)) ;see if Problem List exists
  1. ;If a visit has been passed lock the encounter.
  1. N PXRESVAL,PXVISIEN
  1. I PXBVST>0 S PXVISIEN=PXBVST D I 'PXRESVAL Q -2
  1. . N PXMSG
  1. . S PXRESVAL=$$LOCK^PXLOCK(PXVISIEN,DUZ,2,.PXMSG,"PXBAPI")
  1. . I PXRESVAL=0 W !,PXMSG("LOCK")
  1. D PROCESS^PXBAPI1(.PXBEXIT)
  1. W !," - - - - S o r r y A b o u t T h e W a i t - - - -"
  1. W !,"This information is being stored or monitored by Scheduling"
  1. W !,"Integrated Billing, Order Entry, Registration, Prosthetics"
  1. W !,"PCE/Visit Tracking and Automated Med Information Exchange."
  1. D EVENT^PXKMAIN
  1. K PXVDR
  1. I $G(PXVISIEN)>0 D UNLOCK^PXLOCK(PXVISIEN,DUZ,"PXBAPI")
  1. Q PXBEXIT
  1. ;