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

VENPCC10.m

Go to the documentation of this file.
VENPCC10 ; IHS/OIT/GIS - CREATE THE PCC+ ENCOUNTER FORM AND HEALTH SUMMARY ;
 ;;2.6;PCC+;;NOV 12, 2007
 ;
 ; POINTS TO NEW DATA EXTRACTION METHODS FOR VER 2.2 AND 2.5
 ; PATCH 4 INCLUDES SUPPORT FOR LABEL PRINTERS
 ;
PRINT(VISIT,VCN,DEPTIEN,PRV,DEFEF,DEFHS,APPT,VARS,EXT) ; EP-PRINT ENCOUNTER FORMS
 ; VISIT=visit ien, VCN=visit control id, PRV=providerien, DEFEF=default enc form IEN, DEFHS=default health summary IEN
 N X S X="MERR^VENPCC1",@^%ZOSF("TRAP") ; SET M ERROR TRAP FOR THIS BACKGROUND PROCESS
 I $L($G(VARS)) S U="^" D UNPACK(VARS) K VARS
 I $D(^VA(200,+$G(PRV),0)),$D(^VEN(7.95,+$G(DEPTIEN),0))
 E  Q
 I $G(JOB),'$G(MOJOFLAG) S %=$NA(^TMP("VEN MON")),@%@(JOB)="Monitoring the process...." H 3
NEW N %,%1,%DT,%HELP,%Q,%T,%Y,CFIGIEN,DATE,DFN,ERR,PATH2,PIEN,POP
 N STOP,TMP,UID,X,Y,MSG,FFIEN,FCIEN,PEIEN,VER25,HDR25,LPFLAG,FCIEN
GO I '$D(VENDEBUG),'$D(^TMP("VEN TASK")) X ("J"_" ^VENPCCP") ; IF NECESSARY, START THE PRINT DEAMON
 I VISIT[U S DFN=$P(VISIT,U,2),DATE=$P(VISIT,U,3),VISIT=$P(VISIT,U) N NOVISIT S NOVISIT=1 G CFG
 S X=$G(^AUPNVSIT(VISIT,0)) I X="" D ERR1^VENPCC1 Q
 S DATE=+X,DFN=$P(X,U,5)
 I 'DATE D ERR3^VENPCC1 Q
 I $G(VENDEMO) D NOW^%DTC S DATE=% K %,%H,%I
 I '$D(^AUPNPAT(DFN)) D ERR3^VENPCC1 Q
 S X=$G(^VEN(7.95,+$G(DEPTIEN),5)) I $P(X,U,3),$P(X,U,2),+X S LPFLAG=$P(X,U,1,2) ; LABEL PRINTER FLAG
BEF I $G(DEFEF),$P($G(^VEN(7.41,DEFEF,0)),U,13) D ERR11^VENPCC1 Q  ; ENCOUNTER FORM TEMPORARILY BLOCKED
CFG S CFIGIEN=$$CFG^VENPCCU I 'CFIGIEN D ERR8^VENPCC1 Q
 I $G(HSONLY),'$G(OGFLAG),'$G(LPFLAG) X ("I 0") G HS ; JUST PRINT HS - NOTHING MORE
EF S TMP="^TMP(""VEN PRNT"",$J)" K @TMP,STOP
 S VER25=$P($G(^VEN(7.5,CFIGIEN,13)),U) ; NO HEADER FILE RED'Q IN VER 2.5
 S HDR25=($P($G(^VEN(7.41,+$G(DEFEF),0)),U,2)=25)
 I $D(DEMODATA) D HEAD25 ; IN VERSION 25, ONLY NEED TO SET TMP(9) GLOBAL IF IN DEMODATA MODE
 I 'VER25,'$D(DEMODATA) D HEAD I $D(STOP) D ERR10^VENPCC1 Q  ; TEMPORARY HEADER GLOBAL
 D DEMO^VENPCC1A(PRV,DFN,VCN,VISIT,DEPTIEN,$G(APPT)) I $G(STOP) D ERR5^VENPCC1 Q  ; DEMOPGRAPHICS
 D SPEC^VENPCC1A(DFN) ; REPRO HX
 D DX^VENPCC1G(PRV,DFN,DEFEF,DEPTIEN) I $G(STOP) D ERR6^VENPCC1 Q  ; DUAL CODES NEW VERSION
 D PROB^VENPCC1H(DFN) ; PROBLEMS AND POVS FOR VER 2.5
 D MED^VENPCC1H(PRV,DFN) I $G(STOP) D ERR6^VENPCC1 Q  ; VER 2.2 EXTENSION
 I $L($G(EXT)) D EXT^VENPCC1B(EXT) ; PROCESS EXTERNAL DATA
 D HDR(DEPTIEN) ; TEMPLATE HEADER
 D SYS(DFN,+$G(DEFEF)) ; IMMUNIZATIONS, ORDRABLES AND REMINDERS
 D ALLERG^VENPCC1C(DFN) ; ALLERGIES
 D HX^VENPCC1F(DFN,DEFEF) ; HX OF SURG, FAMILY HX, PERSONAL HX, PODIATRY HX
 N SPECHOLD I $D(^VEN(7.62,"AB",DEFEF)) D SPEC^VENPCC1C(DFN,DEFEF) ; LINK TO OCX OBJECTS ON PEDS FORM
 S %=$G(^VEN(7.41,+$G(DEFEF),4)) I $L(%) X ("D "_%_"(DFN)") ; SPECIAL DATA MINING CODE FOR THIS TEMPLATE
V22 I $L($T(VER22^VENPCC1G)) D VER22^VENPCC1G(DFN,PRV,VISIT,DEFEF,DEPTIEN) ; UPDATED VER 2.2 EXTENSIONS
V25 I $L($T(VER25^VENPCC1L)) D VER25^VENPCC1L(DFN,PRV,VISIT,DEFEF,DEPTIEN) ; VER 2.5 EXTENSIONS
ANMC I DUZ(2)=1665,$L($T(^VENPCCAK)) D ^VENPCCAK(DFN,DEFEF) ; CUSTOM PCC+ CODE FOR ALASKA
FORM I $P($G(^VEN(7.41,+$G(DEFEF),21)),U),$L($T(FORM^VENPCC1S)) D FORM^VENPCC1S(DFN,VISIT,DEFEF) ; COMPONENT FRAMEWORK DATA
MOJO I $D(MOJOFLAG),$L($T(MOJODATA^VENPCCW)) D  Q  ; SPECIAL EXTENSIONS FOR MOJO (VER 3.0)
 . S @TMP@(1,"u100")=$P($G(^VEN(7.46,+$G(DEFEF),0)),U,2) I @TMP@(1,"u100")="" Q  ; NEW WAY TO GET THE FID FROM THE MOJO FORM FILE
 . D MOJODATA^VENPCCW ; OUTPUTS DATA DIRECTLY TO MOJO ADO ARRAY
 . Q
 I $G(HSONLY),$G(OGFLAG) S OGONLY=1 D TXT^VENPCC1(DFN) K OGONLY,OGFLAG,@TMP X ("I 0") G HS ; HS ONLY WITH OUTGUIDE
DATA D TXT^VENPCC1(DFN) I $D(STOP) Q  ; BUILD THE DATA FILE FOR THE CURRENT TEMPLATE
 K @TMP
 I $G(EFONLY)!($G(OGONLY))
HS E  D HS^VENPCC2A(DFN,DEFHS,VISIT,DEPTIEN) ; BUILD THE HEALTH SUMMARY DATA FILE
 I $G(JOB) K ^TMP("VEN MON",JOB)
 Q
 ;
UNPACK(VARS) ; EP-FOR UNPACKING THE LOCAL VARIABLE LIST
 I '$L($G(DUZ(0))) S %=$C(68,85,90),@%@(0)=$C(64)
 N I,X,Y,%
 F I=1:1:$L(VARS,U) S %=$P(VARS,U,I) I $L(%) S X=$P(%,"=",1),Y=$P(%,"=",2,99) X "S "_X_"="""_Y_""""
 Q
 ; 
 ; TRADITIONAL WAY TO BUILD THE HEADER ARRAY
 NEW F,I,X,Y,%
 S PATH2=$G(^VEN(7.5,CFIGIEN,2))
 I PATH2="" S STOP=1 D ERR7^VENPCC1 Q
 S %=$$HEADER^VENPCCU(+$G(DEFEF))
 S F=%_"header.txt"
 S POP=$$OPN^VENPCCP(PATH2,F,"R","R X")
 I POP S STOP=1 Q
 F I=1:1:$L(X,U) S Y=$P(X,U,I),@TMP@(9,I)=Y
 Q
 ;
HEAD25 ; EP - MAKE HEADER GLOBAL FOR VERSION 25
 N HGIEN,HIEN,HDR,MN,CNT
 S HGIEN=$O(^VEN(7.49,"B","25",0)) I 'HGIEN Q
 S HIEN=0,CNT=0
 F  S HIEN=$O(^VEN(7.49,HGIEN,1,HIEN)) Q:'HIEN  D
 . S MN=$G(^VEN(7.49,HGIEN,1,HIEN,0)) I '$L(MN) Q
 . S CNT=CNT+1
 . S @TMP@(9,CNT)=MN
 . Q
 Q
 ; 
HDR(DEPTIEN) ; EP - HEADER LINES
 NEW %,I,X
 S X=$P($G(^VEN(7.95,DEPTIEN,0)),U) S %=$P($G(^(0)),U,4)
 I % S %=$P($G(^DIC(40.7,%,0)),U,2) I $L(%) S X=X_" "_"("_%_")"
 S @TMP@(1,"hdr")=X
 Q
 ; 
MRP() ; EP-RETURN THE MEDICAL RECORDS PRINTER GROUP
 N IEN,NAME
 S IEN=$P($G(^VEN(7.95,+$G(DEPTIEN),2)),U,16)
 I 'IEN S IEN=$O(^VEN(7.4,"AC",1,0)) I 'IEN Q ""
 S NAME=$P($G(^VEN(7.4,IEN,0)),U)
 Q NAME
 ;
SYS(DFN,DEFEF)  ; EP-NEW SYSTEM PREFERENCES
 I '$D(^DPT(DFN,0)) Q
 I '$D(^VEN(7.41,+$G(DEFEF),0)) Q
 N MIEN,TYPE,MMF,PCE,CLASS,SS,HIEN,OSET,NEWSURV,NEWIMM
 S CLASS=$$CLASS^VENPCC1C(DFN) I 'CLASS Q
 S NEWSURV=0 I $P($G(^VEN(7.41,+$G(DEFEF),5)),U,1) S NEWSURV=1 ; USE NEW SURVEILLANCE LIST
 S NEWIMM=0 X "I $L($T(IMMHX^BIRPC)),$L($T(BI^APCHS11C)),$$BI^APCHS11C S NEWIMM=1" ; USE IMMUNIZATION PKG 7.0
CHKLST I $O(^VEN(7.41,+$G(DEFEF),17,0)),$L($T(POP^VENPCCC)),$P($G(^VEN(7.41,DEFEF,0)),U,17) D POP^VENPCCC(DEFEF,DFN) G TICK ; NEW CHECKLIST, VER 2.5
ORD S OSET=$$OSET^VENPCC1C(+$G(DEFEF)),SS=7.93 ; CHECK ORDERABLES FILE AND GET ALL ORDERABLES FOR THIS DEMOG GRP
 S HIEN=0 F  S HIEN=$O(^VEN(7.42,"AS",1,HIEN)) Q:'HIEN  D  ; ONLY  MM FIELDS FOR ORDERABLES ARE CHECKED
 . S MMF=$P($G(^VEN(7.42,HIEN,0)),U) I '$L(MMF) Q  ; GET MAIL MERGE FIELD NAME
 . S MIEN=0
OSET . I $G(OSET) D  Q  ; IF ORDER SETS ARE DEFINED
 .. F  S MIEN=$O(^VEN(7.93,"AS",OSET,MMF,MIEN)) Q:'MIEN  I $$XSET^VENPCC1C(SS,DFN,MIEN,MMF,CLASS,DEFEF) Q  ; FIND MM FIELD THAT MATCHES THE PATIENTS CLASS AND ASSIGN VALUE
 .. Q
NOOSET .. ; IF ORDER SETS NOT DEFINED
 . F  S MIEN=$O(^VEN(7.93,"C",MMF,MIEN)) Q:'MIEN  I $$XSET^VENPCC1C(SS,DFN,MIEN,MMF,CLASS,DEFEF) Q  ; FIND MM FIELD THAT MATCHES THE PATIENTS CLASS AND ASSIGN VALUE
 . Q
TICK S SS=7.94 ; CHECK TICKLER FILE
ROS S MMF="x" ; GET ROS DATA
 F  S MMF=$O(^VEN(7.94,"C",MMF)) Q:MMF'["x"  D  ; L0OP THROUGH ALL THE "x" MAIL MERGE FIELDS IN TICKLER FILE
 . S MIEN=0
 . F  S MIEN=$O(^VEN(7.94,"C",MMF,MIEN)) Q:'MIEN  I $$XSET^VENPCC1C(SS,DFN,MIEN,MMF,CLASS,DEFEF) Q  ; FIND MM FIELD THAT MATCHES THE PATIENTS CLASS AND ASSIGN VALUE
 . Q
SURV ; GET HEALTH MAINT REMINDER DATA
 I 'NEWSURV,'NEWIMM D OLDSURV Q  ; OLD SURVEILLANCE METHOD
 I NEWSURV,NEWIMM D NEWSURV,NEWIMM Q  ; NEW SURVEILLANCE METHODS
 D OLDSURV
 I NEWIMM D IF^VENPCC1C Q
 D ARR^VENPCC1E(+$G(DFN))
 Q
 ; 
OLDSURV S MMF="h" ; GET HEALTH MAINT REMINDER DATA THE OLD WAY
 F  S MMF=$O(^VEN(7.94,"C",MMF)) Q:MMF'["h"  D  ; L0OP THROUGH ALL THE "h" MAIL MERGE FIELDS IN TICKLER FILE
 . S MIEN=0
 . F  S MIEN=$O(^VEN(7.94,"C",MMF,MIEN)) Q:'MIEN  I $$XSET^VENPCC1C(SS,DFN,MIEN,MMF,CLASS,DEFEF) Q  ; FIND MM FIELD THAT MATCHES THE PATIENTS CLASS AND ASSIGN VALUE
 . Q
 Q
 ;
NEWSURV ; EP - NEW METHOD FOR GETTING HEALTH MAINT REMINDER DATA ; h26-h50
 D ARR^VENPCC1E(+$G(DFN))
 Q
 ;
NEWIMM ; EP - NEW METHOD FOR GETTING IMM HX ; h9-h25
 D IF^VENPCC1C
 Q
 ;