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

VENPCC.m

Go to the documentation of this file.
VENPCC ; IHS/OIT/GIS - ENTRY POINTS FOR THE PCC+ CHECK IN MODULE ;
 ;;2.6;PCC+;;NOV 12, 2007
 ;
 ; DEDICATED TO DON ENOS, DEAR FRIEND AND PRIMARY AUTHOR OF THE PCC
 ; 2.5 ENHANCEMENTS: NURSE CHECK IN AND EFNOTASK ENTRY POINT
 ; 
CKIN ; EP-TO GENERATE AN EF AND HS DURING A NON-ILC CHECK-IN
 NEW CLINIC,DEPTIEN,DIC,LOC,NOW,PATIENT,PRVIEN,TYPE,VIEN,X,Y,%,%H,%I,%Q,%Y,DTOUT,DUOUT,DEFEF,DEFHS,RESULT,CFIGIEN,VCN,AUPNDAYS,AUPNDOB,AUPNDOD,AUPNPAT,AUPNSEX,DIPGM,APPT,VPFLAG,POP,NCCANCEL
 N DISYS,DDH,AGE,SEX,SSN,DFN,DOB,%T,%1,%DT,ELIG,OGFLAG,EXT,UPDEM
 D ^XBCLS
 W !,"Welcome to the PATIENT CHECK-IN MODULE...."
 S CFIGIEN=$$CFG^VENPCCU I 'CFIGIEN W !,"Unable to find configuration parameters!  Notify the site manager...",!! Q
PATIENT ; EP-CHECK IN PATIENT
 G ^VENPCCA ; VER 2.2 CHECK IN PROCESS
 ; 
 ; -------------------------------------------------------------------
 ; CHECK-IN CODE IN VENPCCA AFTER VER 1.X
 ; ---------------------------------------------------------------------
 ; 
DEBUG ; EP-FOR DEBUG MODE - NO VISIT CREATED AND RECORD SENT TO FILE NOT TCP SOCKET
 N VENDEMO,VENNOTCP,NOTASK,VENDEBUG
 S (NOTASK,VENDEMO,VENNOTCP)=1
 D CKIN
 Q
 ; 
EFNOTASK ; EP-NO TASK (FOREGROUND MODE), DEBUG, NO VISIT, ENCOUNTER FORM ONLY
 N EFONLY S EFONLY=1
NOTASK ; EP-NO TASK, DEBUG, NO VISIT
 N NOTASK,VENDEMO S NOTASK=1,VENDEMO=1
 D VENPCC
 Q
 ; 
HSNOTASK ; EP-NO TASK (FOREGROUND MODE), HEALTH SUMMARY ONLY
 N NOTASK,HSONLY
 S NOTASK=1,HSONLY=1
 D VENPCC
 Q
 ; 
NCI ; EP-NURSE CHECK IN
 N NCIFLAG
 S NCIFLAG=1
 D CKIN
 Q
 ; 
DEMO ; EP-FROM VEN MENU OPTION ; DEMO MODE - NO VISIT CREATED
 N VENDEMO S VENDEMO=1
 D CKIN
 Q
 ;
DEMODATA ; EP-CREATE A DEMO DATA FILE IN THE TEMP DIRECTORY
 ; ASSUMES THAT DEMODATA ALREADY HAS A VALUE = DEMO FILE NAME
 N EFONLY,VENDEMO,NOTASK
 I '$L($G(DEMODATA)) Q  ; THE DEMO DATA FILE MUST HAVE A NAME
 S DEMODATA=$P(DEMODATA,".") ; STRIP OFF FILE EXTENSION
 S EFONLY=1,VENDEMO=1,NOTASK=1
 D CKIN
 Q
 ; 
REPRINT ; EP-FROM THE MENU OPTION ; REPRINT THE EF
 N REPRINT S REPRINT=1
EFONLY ; EP-FROM VEN MENU OPTION ; PRINT THE EF ONLY
 N EFONLY S EFONLY=1
 D CKIN
 Q
 ; 
HSONLY ; EP-FROM VEN MENU OPTION ; PRINT THE HS ONLY
 N HSONLY,VENDEMO S (HSONLY,VENDEMO)=1
 D CKIN
 Q
 ; 
OGONLY ; EP-FROM VEN MENU OPTION ; OUTGUIDE ONLY
 N OGONLY,VENDEMO S (OGONLY,VENDEMO)=1
 D VENPCC
 Q
 ; 
EHR ; EP - USE THE VISIT CREATED BY THE EHR
 N EHRFLAG
 S EHRFLAG=1
 D VENPCC
 Q
 ; 
CKONLY ; EP-CHECKIN ONLY
 N CHECKIN S CHECKIN=1
 D CKIN
 Q
 ; 
PGRP(CIEN) ; EP-RETURN THE SPECIAL PRINTER GROUP (SPGRP) ; ONLY FOR HS ONLY, TELEPHONE TRIAGE, OR CHART REV
 ; PATCHED BY GIS/OIT 1/15/06 ; PCC+ 2.5 PATCH 2
 N DIC,X,Y,LOC,DUOUT,DTOUT,CNAME,PGRP
 I $G(HSONLY) G PGRP0
 S CNAME=$P($G(^DIC(40.7,CIEN,0)),U) ; GET THE STANDARD CLINIC STOP NAME
 I CNAME'["TELEPHONE",CNAME'["CHART REVIEW" Q "" ; CAN ONLY DEFINE SPGRP FOR TELE TRIAGE & CHART REVIEW
PGRP0 S DIC="^VEN(7.95,",DIC(0)="AEQM",DIC("A")="Printer location: "
 S DIC("S")="I $P($G(^(2)),U,1)"
PGRP1 D ^DIC I Y=-1 D ^XBFMK Q -1
 S PGRP=$P($G(^VEN(7.95,+Y,2)),U)
 D ^XBFMK
 Q PGRP
 ; 
DOCS N PATH,% ; EP-FROM VENPCCMX ; COUNT DOCUMENTS
 S PATH=$G(^VEN(7.5,CFIGIEN,1)) I '$L(PATH) Q
 S %=$$COUNT^VENPCCP(PATH)
 I %'=1 W !,"There are now ",%," documents in the print queue"
 E  W !,"There is one document in the print queue"
 Q
 ;
PACK() ; EP-TO PACK UP ENVIRONMENTAL VARIABLES
 N %,Y,I,X,JOB,VENDEV
 S %="DT^DTIME^DUZ^DUZ(0)^DUZ(2)^VENDEV^JOB^NOTASK^VENDEMO^VENNOTCP^EFONLY^HSONLY^OGONLY^OGFLAG^SPGRP",Y="",JOB=$J,VENDEV=$G(IO)
 F I=1:1:$L(%,U) S X=$P(%,U,I) I $D(@X) S $P(Y,U,I)=X_"="_@X
 Q Y
 ; 
DUP(DFN,DIEN) ; EP-GIVEN A DFN AND DEPT STOP IEN RETURN A '1' IF DUPLICATE VISIT
 I '$D(^DPT(+$G(DFN),0)) Q 0
 I '$D(^VEN(7.95,+$G(DIEN),0)) Q 0
 N QIEN,TIME,DIFF,DEPT,STOP,VISIT,LIM,VIEN,X,CS,V,VDT,CSIEN,%,%Y,TIME
 ; FIRST CHECK THE VISIT FILE
 S VISIT=999999999999,STOP=0,LIM=$$FMADD^XLFDT($$NOW^VENPCCU,0,-6,0,0),VIEN=0
 F V=1:1:10 S VISIT=$O(^AUPNVSIT("AC",DFN,VISIT),-1) Q:'VISIT  D  I STOP Q  ; CHK LAST 10 VISITS FOR MATCHES
 . S X=$G(^AUPNVSIT(VISIT,0)) I '$L(X) Q
 . S VDT=+X
 . I VDT<LIM Q
 . S CS=$P(X,U,8) I CS,CS=$P($G(^VEN(7.95,+$G(DIEN),0)),U,4) S STOP=1,VIEN=VISIT Q
 . Q
 I 'VIEN,$G(EHRFLAG) W !,"PCC+ can't locate a valid EHR visit! Request cancelled.." Q "" ; IF EHR FLAG IS SET, A DUPLCATE MUST EXIST!!!!
 I 'VIEN W !,"A new VISIT will be created for this encounter" Q "" ; NO DUPLICATE FOUND
 ; AT THIS POINT A POTENTIAL VISIT EXISTS
 I $G(EHRFLAG) W !,"PCC+ has  successfully located the EHR visit!" Q VIEN
DNCI I $G(NCIFLAG) D  Q VIEN ; AUTOMATICALLY ASSIGN THE VISIT IF NURSE CHECK IN FLAG IS SET
 . S CSIEN=$P($G(^AUPNVSIT(VIEN,0)),U,8) I 'CSIEN S VIEN="" Q
 . S CS=$P($G(^DIC(40.7,CSIEN,0)),U) I '$L(CS) S VIEN="" Q
 . S TIME="today"
 . S %=+$G(^AUPNVSIT(VIEN,0)) I '% Q
 . I $P(%,".",2)'=12 S TIME="on "_$$FMTE^XLFDT(%)
 . W !,"This patient checked into a """,CS,""" clinic ",TIME
 . W !,"Want to link your check-in measurements to this existing"
 . W !,"visit (Answer NO only if you want to create a new visit!)"
 . S %=1 D YN^DICN
 . I %=1 Q
 . W !,"OK, a new visit will be created to contain your check-in measurements"
 . S VIEN="" ; FORCE THE CREATION OF A NEW NCI VISIT
 . Q
DREG ; FROM HERE ON, POSSIBLE MATCH EXISTS BUT IT IS A REG VISIT - NOT AN NCI VISIT
 W !,"This patient had a visit in this clinic within the past 6 hours..."
 W !,"Want to create another visit" S %=2
 D YN^DICN
 I %=1 Q VIEN ; FORCE THE CREATION OF A NEW VISIT
 Q ""
 ;
QUEUE(VISIT,DEPTIEN,OGFLAG,TRFLAG,UPDEM,PRVIEN) ; EP-LEGACY SIGNATURE EP FOR ANMC
 G QSIG^VENPCCA
 ;
PIMS(PIMSDFN) ; EP - PRINTS A PCC+ FORM VIA USUAL DIALOG. CALLED DURING PIMS SCHEDULING
 ; PATIENT DFN IS KNOWN BUT NO VISIT WILL BE CREATED
 ; PATCHED BY GIS/OIT 6/15/06 ; PCC+ 2.5 PATCH 5
 I '$D(^DPT(+$G(PIMSDFN),0)) Q
 N NOVISIT
 S NOVISIT=1
 D CKIN
 Q
 ;