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

VENPCCX.m

Go to the documentation of this file.
VENPCCX ; IHS/OIT/GIS - EXTERNAL CALL TO PCC+ DATA EXTRACTOR ;
 ;;2.6;PCC+;;NOV 12, 2007
 ;
 ; ENTRY POINTS FOR , INFORMATIX BILLING PKG, VISIT PALNNING PKG, AND RPMS ER PKG
 ; 2.5 EXTENSIONS FOR THE SCHEDULING PKG (MULTIPLE VERSIONS)
 ; 
IMP(STG,NOQ) ; EP-VISIT PLANNER ENTRY POINT
 N DSTG,FLD,VAL,INIT,EXT,NIEN,TIME,PROV,EF,HS,DEPT,VISIT,VCN,VARS,%,DGBL
 N X,Y,I,PCODE,DISCPL,NIEN16,NURSE,APPT,SPGRP,DEFEF,DEFHS,DEPTIEN,PRV
 S DSTG="^VISIT^NURSE^PROV^EF^HS^DEPT^APPT^SPGRP^",INIT="",EXT="",DGBL=U_$C(68)_"IC(6)"
 F I=1:1:$L(STG,U) S X=$P(STG,U,I) I $L(X) D
 . S FLD=$P(X,";"),VAL=$P(X,";",2) I '$L(FLD) Q
 . I DSTG[(U_FLD_U) S:$L(INIT) INIT=INIT_U S INIT=INIT_X Q
 . I $L(EXT) S EXT=EXT_U
 . S EXT=EXT_X
 . Q
GET F I=1:1:$L(INIT,U) D
 . S %=$P(INIT,U,I)
 . S X=$P(%,";"),Y=$P(%,";",2,99)
 . I $L(X) S @X=Y
 . Q
 S NIEN=+$G(NURSE)
 I '$G(PROV) S PROV=$$GP^VENPCCU I 'PROV S PROV=-1
CHECK I $D(^AUPNVSIT(+$G(VISIT),0)),$D(^VA(200,+$G(NIEN),0)),$D(^VA(200,+$G(PROV),0)),$D(^VEN(7.41,+$G(EF),0)),$D(^VEN(7.95,+$G(DEPT),0))
 E  S ERR="INVALID/MISSING PARAMETERS IN VP STRING" D ERR^VENPCC1(ERR) Q -1
 I $G(HS),'$D(^APCHSCTL(HS,0)) S ERR="INVALID HEALTH SUMMARY IDENTIFIER" D ERR^VENPCC1(ERR) Q -1
MORE S VCN=$P($G(^AUPNVSIT(VISIT,11)),U,3) I '$L(VCN) S ERR="MISSING VCN" D ERR^VENPCC1(ERR) Q -1
 S TIME=$$NOW^VENPCCU
 S APPT=+$G(APPT)
 S NIEN16=$$PRV1^VENPCCU(NIEN) I 'NIEN16 Q -1
 S PCODE=$P($G(@DGBL@(NIEN16,9999999)),U,2)
 S %=+$P($G(@DGBL@(NIEN16,0)),U,4) S DISCPL=$P($G(^DIC(7,%,9999999)),U)
 S EXT=EXT_U_"DISCPL"_";"_DISCPL_U_"PCODE"_";"_PCODE
 S VARS="DUZ="_NIEN_U_"JOB="_$J_U_"DUZ(0)=@^DUZ(2)="_DUZ(2)
 I HS=0 S HS="",VARS=VARS_U_"EFONLY=1"
 I STG["^PROG;1^" S VARS=VARS_U_"OGFLAG=1"
 I $G(SPGRP) S VARS=VARS_U_"SPGRP="_SPGRP
 S DEFEF=$G(EF),DEFHS=$G(HS),PRV=$G(PROV),DEPTIEN=$G(DEPT)
RUN D EN1^VENPCCA("J",1) ; PRIMARY ENTRY PROINT FOR CREATING THE PCC+ DATASET
 Q 1
 ; 
EN(VIEN,DIEN,PIEN) ; EP FROM BILLING PACKAGE CHECK IN MODULE
 S %=U_$C(68)_"IC(6)"
 I $D(^AUPNVSIT(+$G(VIEN),0)),$D(^ABSBDEPT(+$G(DIEN),0)),$D(@%@(+$G(PIEN),0))
 E  W !,"Invalid registration parameters detected!  No encounter form printed..." Q 0
 NEW %,PATIENT,VCN,DEFEF,DEFHS,DIR,X,Y,PRVIEN,CFIGIEN,SBFLAG,APPT,VISIT
 S DEPTIEN=+$P($G(^ABSBDEPT(DIEN,2)),U),VISIT=VIEN
 I '$D(^VEN(7.95,DEPTIEN,0)) W !,"Invalid or missing department!  No encounter form printed..."
 I $P($G(^VEN(7.95,DEPTIEN,2)),U,7) Q 0  ; INACTIVE DEPT
 S PATIENT=$P(^AUPNVSIT(VIEN,0),U,5)
 I 'PATIENT W !,"Unable to locate a valid patient DFN!  No encounter form printed..." Q 0
 S VCN=$P($G(^AUPNVSIT(VIEN,11)),U,3)
 I '$L(VCN) S VCN=$G(^AUPNVSIT(VIEN,"VCN"))
 I '$L(VCN) W !,"Missing VCN!  Visit terminated..." Q 0
 S PRVIEN=$O(^VA(200,"A16",PIEN,0)) I 'PRVIEN W !,"Invalid provider IEN!  No encounter form printed..."
 S CFIGIEN=$$CFG^VENPCCU,SBFLAG=1,APPT=""
 D EF^VENPCCA
 Q 1
 ;
ABORT ; EP - DONT PRINT PCC+ FORMS
 W !,"Request to print PCC+ forms cancelled!"
 Q
 ; 
SC(PRV,VISIT,VCN,CSIEN) ; EP-SCHEDULING PKG INTERFACE FROM ASDV
 N %,%Y,CIEN,TOT,DEPT,CFIGIEN,DEPTIEN,DIC,X,Y,LOC,PGRP,VPFLAG,APPT,DEFEF,DEFHS,EFONLY,EXT,VARS,ELIG,TIME,DFN,%DT,DI,DISYS,DLAYGO
 N IO,IOF,IOM,ION,IOS,IOST,IOT,IOXY,%E,POP
 S PRV=+$$PRV^VENPCCU(+$G(PRV))
 W !!,"Want to print PCC+ forms"
 S %=1
 I $G(DUZ(2))=1665,$G(CSIEN)=30 S %=2 ; ANMC PATCH
 D YN^DICN I %'=1 Q
 S CFIGIEN=$$CFG^VENPCCU
 I $D(^DIC(40.7,+$G(CSIEN),0)),$D(^AUPNVSIT(+$G(VISIT),0)),$L($G(VCN)),CFIGIEN ; PATCHED IHS/ITSC/GIS  11/04/2004
 E  W !,"Missing/Invalid PCC+ parameters!  Request cancelled..." Q
 S (CIEN,TOT)=0
 F  Q:TOT>1  S CIEN=$O(^VEN(7.95,CIEN)) Q:'CIEN  I $P($G(^VEN(7.95,CIEN,0)),U,4)=CSIEN S TOT=TOT+1,DEPT=CIEN
 I TOT=1 S DEPTIEN=DEPT G:'$P($G(^VEN(7.5,+$G(DEPT),2)),U,7) EF
CLINIC S %=$P($G(^VEN(7.5,CFIGIEN,0)),U,6) I '% G CL1
 I $P($G(^VEN(7.95,%,0)),U,4)=CSIEN,'$P(^(0),U,7) S Y=% G CL2
 W !,"Invalid clinic stop!  Request cancelled...",!
 Q
 ; 
CL1 ; EP - GET CLINIC
 S DIC("A")="Clinic: "
 S DIC("S")="I '$P(^(2),U,7),$P(^(0),U,4)=CSIEN"
 S DIC="^VEN(7.95,",DIC(0)="AEQM",DLAYGO=19707.95 D ^DIC K DIC I Y=-1 D ABORT Q
CL2 ; EP - GET PRV
 S DEPTIEN=+Y
 I '$G(PRV) S PRV=$P($G(^VEN(7.95,DEPTIEN,2)),U,2) I 'PRV S PRV=$P($G(^VEN(7.5,CFIGIEN,0)),U,13)
 I '$D(^VA(200,+$G(PRV),0)) W !,"Missing/invalid provider ID!  Request cancelled..." Q
EF ; EP - DEFAULT ENCOUNTER FORM
 S %=+$P($G(^VEN(7.95,DEPTIEN,2)),U,5) S DIC("B")=$P($G(^VEN(7.41,%,0)),U)
 S DIC("A")="Encounter form: "
 S DIC(0)="AEQM",DIC="^VEN(7.41,"
 D ^DIC K DIC
 I Y=-1 D ABORT Q
 S DEFEF=+Y
 I $P($G(^VEN(7.95,DEPTIEN,2)),U,13) S DEFHS="" G VARS  ; NEVER PRINT HEALTH SUMMARY IN THIS CLINIC
 ; PATCHED BY GIS/OIT 10/17/05 ; PCC+ 2.5 PATCH 1
HS ; EP - DEFAULT HEALTH SUMMARY ; PATCHED IHS/ITSC/GIS 11/04/2004
 K DIC
 S %=$P($G(^VEN(7.95,DEPTIEN,2)),U,6) I % S DIC("B")=$P($G(^APCHSCTL(%,0)),U)
 S DIC("A")="Health Summary: "
 S DIC(0)="AEQM",DIC="^APCHSCTL("
 D ^DIC K DIC
 I Y=-1 S EFONLY=1,DEFHS=""
 E  S DEFHS=+Y
VARS S APPT=$G(ASDDT),EXT=""
 W !,"Submitting request for PCC+ Encounter Form...."
 D QUEUE^VENPCCA(VISIT,DEPTIEN,"","","",PRV),DOCS^VENPCC ; 2.5 ADD PARAMETER FOR PROVIDER
TMAN I $D(NOTASK) D EN1^VENPCCA("D")
 S VARS=$$PACK^VENPCC,EXT=$G(EXT)
 D EN1^VENPCCA("J")
 I $D(VPFLAG) K HSONLY,VPFLAG W !,"This information will be sent to the clinic..."
 Q
 ; 
SC53(VISIT,VCN,SDT)   ; EP-SCHEDULING V5.3 INTERFACE FROM PROTOCOL
 ; VEN PRINT PCC+ ENCOUNTER FORM which is an item on protocol
 ; BSDAM APPOINTMENT EVENTS
 ; TO MAKE THE PCC+ DIALOGUE SHOW UP IN THE SCHEDULING CHECK IN PROCESS:
 ;   THERE MUST BE A VISIT CREATED BY PIMS
 ;   THE USER MUST HOLD THE 'VENZPRINT' KEY
 ;   VER 5.3 OF PIMS MUST BE INSTALLED
 ;   'BSDAM APPOINTMENT EVENTS' & 'VEN PRINT PCC+ ENCOUNTER FORM' MUST BE IN THE PROTOCOL FILE
 ;   'VEN PRINT PCC+ ENCOUNTER FORM' MUST BE AN ITEM IN THE 'BSDAM APPOINTMENT EVENTS' PROTOCOL
 Q:'$G(VISIT)  Q:$G(VCN)=""
 N CSIEN,PRV
 S CSIEN=$P(^AUPNVSIT(VISIT,0),U,8)
 S PRV=$O(^AUPNVPRV("AD",VISIT,-1))
 S PRV=$P($G(^AUPNVPRV(+PRV,0)),U)
 S ASDDT=SDT  ; MAKES APPT DATE AVAILABLE
 D SC^VENPCCX($G(PRV),$G(VISIT),$G(VCN),$G(CSIEN))
 Q
 ; 
ER(VISIT,VCN,DEPTIEN,PRV,DEFHS,DEFEF,ACT) ; EP-ENTRY POINT FOR THE ER PACKAGE
 N OGONLY,HSONLY,EFONLY,%,OGFLAG,VARS,APPT
 I PRV,DEFEF,DEFHS,VISIT,VCN
 E  Q 0
 I ACT'["EF",ACT'["HS",ACT'["OG" Q 0
 I ACT["OG" S OGFLAG=1
 I ACT["EF",ACT["HS",ACT["OG" G ER1
 I ACT'["EF",ACT'["HS" S OGONLY=1
 I ACT'["EF" S HSONLY=1
 I ACT'["HS" S EFONLY=1
ER1 S VARS=$$PACK^VENPCC,%="J",APPT=0
 D EN1^VENPCCA(%)
 Q 1
 ; 
SS ; EP-SETUP THE SCHEDULING LINK
 N X,Y,LINE1,LINE2
 W !!,"Attempting to create the PCC+ link to the scheduling package..."
 S X=$T(+2^ASDV),Y=$T(VISIT+67^ASDV)
 I X[5.3 D SSP Q  ; LINK TO SCHEDULING PKG VER 5.3
 I Y["PCCPLUS" W !,"The PCC+ link to the IHS Scheduling Pkg is already present!",!,"Request cancelled..." Q
 I X["5.0;",X["**5,7",Y["PCC"
 E  W !,"Unable to find the IHS Scheduling Package, Version 5.0, Patch 7 on you system",!,"Request cancelled!!" Q
 S LINE1="PCCPLUS ; -- call to print PCC Encounter Form"
 S LINE2=" I $L($T(SC^VENPCCX)) I $O(^VA(200,+$G(DUZ),51,""B"",+$O(^DIC(19.1,""B"",""VENZSCH"",0)),0)) D SC^VENPCCX($G(ASDPROV),$G(ASDVST),$G(ASDVCN),$G(ASDCC))"
 D ZOSF^VENPCCU("ASDV","VISIT+67","LINE1","LINE2")
 I $T(VISIT+68^ASDV)["VENZSCH" W !,"The link to the scheduling package has been successfully inserted!!" Q
 W !,"Unable to insert the link to the scheduling package!! Request cancelled..."
 Q
 ; 
SSP ; EP-MAKE ENTRY IN THE PROTOCOL FILE FOR VER 5.3 OF SHCEDULING PKG
 N X,PIEN,DIC,DIK,DA,Y
 ; S X="PCC+ 2.5",PIEN=$O(^DIC(9.4,"B","PCC+ 2.5",0)) I 'PIEN Q  ; VEN PACKAGE DOESNT EXIST
 S X="VEN PRINT PCC+ ENCOUNTER FORM"
 I $D(^ORD(101,"B",X)) Q  ; ALREADY EXISTS
 I '$D(^ORD(101)) W !,"Can't find the PROTOCOL file" Q
 S DIC="^ORD(101,",DIC(0)="L",DLAYGO=101
 D ^DIC I Y=-1 Q
 S DA=+Y,DIK=DIC
 S ^ORD(101,DA,0)="VEN PRINT PCC+ ENCOUNTER FORM^Print PCC+ form at check-in^^A^"_DUZ_"^^^^^^^"_PIEN
 S ^ORD(101,DA,1,0)="^^4^4^"_DT_U
 S ^ORD(101,DA,1,1,0)="IHS protocol called by the Scheduling Event Driver (BSDAM APPOINTMENT"
 S ^ORD(101,DA,1,2,0)="EVENTS).  This protocol will print PCC+ Encounter Forms at  check-in if the"
 S ^ORD(101,DA,1,3,0)="proper parameters are set for the clinic involved, and PCC + is installed,"
 S ^ORD(101,DA,1,4,0)="and the user has the 'VENZPRINT' security key."
 S ^ORD(101,DA,20)="I $G(SDAMEVT)=4,$D(^XUSEC(""VENZPRINT"",DUZ)) D SC53^VENPCCX($G(BSDVSTN),$G(BSDVCN),$G(SDT))"
 S ^ORD(101,DA,24)=""
 S ^ORD(101,DA,99)=$H
 D IX1^DIK
 W !,"The Scheduling Pkg protocol has been installed"
 Q
 ;