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

APCDDVC.m

Go to the documentation of this file.
APCDDVC ; IHS/CMI/LAB - VISIT REVIEW REPORT ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
GETCHART ;get chart number
 S APCDCLOC=""
 I $P(APCDDV("VREC"),U,6),$D(^AUPNPAT(DFN,41,$P(APCDDV("VREC"),U,6),0))#2 S APCDCLOC=$P(^(0),U,1),APCDHRN=$P(^(0),U,2)
 I APCDCLOC="",$D(^AUPNPAT(DFN,41,DUZ(2),0))#2 S APCDCLOC=$P(^(0),U,1),APCDHRN=$P(^AUPNPAT(DFN,41,DUZ(2),0),U,2)
 I APCDCLOC="" S APCDCLOC=$O(^AUPNPAT(DFN,41,0)) I APCDCLOC S APCDHRN=$P(^AUPNPAT(DFN,41,APCDCLOC,0),U,2) G C2
 I APCDCLOC=""!('APCDCLOC) S APCDHRN="NONE",APCDCLOC=DUZ(2) Q
C2  ;
 Q:APCDCSRT'="T"
 S APCDHRN=APCDHRN+10000000,APCDHRN=$E(APCDHRN,7,8)_"-"_+$E(APCDHRN,2,8)
 Q
ZERO ; If no dependent entries, save information.
 K APCDERR
 S APCDEC=1
 D ZERO^APCDRV I $D(APCDERR) D GETCHART S ^XTMP("APCDDV",APCDJOB,APCDBT,"ZERO",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT)="",APCDCNTR("ZERO")=$G(APCDCNTR("ZERO"))+1
 D XIT
 Q
PPPV ; See if Purpose of Visit and Providers entered correctly
 Q:'$P(APCDDV("VREC"),U,9)
 Q:"EINX"[$P(APCDDV("VREC"),U,7)
 K APCDERR
 S APCDEC=1
 S APCDVREC=^AUPNVSIT(APCDVSIT,0) D PPPV^APCDR00 K APCDVREC
 I $D(APCDERR) D GETCHART  S APCDCNTR("PPPV")=$G(APCDCNTR("PPPV"))+1 S APCDX=0 F  S APCDX=$O(APCDERR(APCDX)) Q:APCDX'=+APCDX  D
 .S ^XTMP("APCDDV",APCDJOB,APCDBT,"PPPV",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,APCDX)=$P(^APCDERR(APCDERR(APCDX),0),U)_"-"_$P(^APCDERR(APCDERR(APCDX),0),U,3)
 D XIT
 Q
 ;
MRG ; FOR CALLER PASSING VISIT DATE
 Q:'$P(APCDDV("VREC"),U,9)
 Q:$P(APCDDV("VREC"),U,3)="C"  ;do not display contract visits per Teresa 01/11/93
 Q:"EI"[$P(APCDDV("VREC"),U,7)
 D GETCHART
 Q:$D(^XTMP("APCDDV",APCDJOB,APCDBT,"AM",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT))
 K APCDKT
 S APCDDC=+$P(^AUPNVSIT(APCDVSIT,0),"^")\1,APCDPAT=$P(^(0),"^",5),APCDLOC=$P(^(0),U,6),APCDTYPE=$P(^(0),U,3),APCDCAT=$P(^(0),U,7),(APCDI,APCDV)=0
 F  S APCDV=$O(^AUPNVSIT("AC",APCDPAT,APCDV)) Q:APCDV=""  I APCDDC=(+^AUPNVSIT(APCDV,0)\1),'$P(^(0),U,11),APCDLOC=$P(^(0),U,6),$P(^(0),U,9),APCDTYPE=$P(^(0),U,3),APCDCAT=$P(^(0),U,7) D SETARR
 Q:'$D(APCDKT)
 I APCDI>1 D CHKCLN
 D XIT
 Q
SETARR S APCDI=APCDI+1,APCDKT(APCDI)=APCDV_U_$P(^AUPNVSIT(APCDV,0),U,2)_U_$P(^(0),U,8)_U_$P(^(0),U,3)_U_$P(^(0),U,7)
 Q
CHKCLN ;
 S APCDF="" F APCDII=1:1:APCDI I $P(APCDKT(APCDII),U,3)="" S APCDF=1
 F APCDII=1:1:APCDI Q:APCDF=1  S APCDCLN=$P(APCDKT(APCDII),U,3) F APCDJ=APCDII+1:1:APCDI I $P(APCDKT(APCDJ),U,3)=APCDCLN S APCDF=1
 I APCDF=1 D
 .S APCDCNTR("MRG")=$G(APCDCNTR("MRG"))+1
 .F APCDII=1:1:APCDI S ^XTMP("APCDDV",APCDJOB,APCDBT,"MRG",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,+APCDKT(APCDII))="",^XTMP("APCDDV",APCDJOB,APCDBT,"AM",APCDCLOC,APCDCLIN,APCDHRN,+APCDKT(APCDII))=""
 Q
TXER ; Create transaction error report
 Q:$P(APCDDV("VREC"),U,7)="E"  ;IHS/CMI/LAB - added this line patch 2
 K APCDERR
 S APCDEC=1
 S X=99,DIC="^DIC(40.7,",DIC(0)="M" D ^DIC K DIC
 S APCDDCHS=+Y
 I 'APCDDCHS S APCDDCHS=""
 S APCDVREC=^AUPNVSIT(APCDVSIT,0) D ^APCDRV K APCDVREC
 I $D(APCDERR) D GETCHART S APCDCNTR("TXER")=$G(APCDCNTR("TXER"))+1 S APCDX=0 F  S APCDX=$O(APCDERR(APCDX)) Q:APCDX'=+APCDX  D SETTXER
 D XIT
 Q
SETTXER ;
 I APCDERR(APCDX)="" S APCDMSG="ERROR DESCRIPTION NOT FOUND IN ERROR FILE",APCDCODE=$O(APCDERR("B",APCDERR(APCDX,"FILE"),APCDERR(APCDX,"ENTRY"),"")) G SETTXER1
 S APCDCODE=$P(^APCDERR(APCDERR(APCDX),0),U),APCDMSG=$P(^(0),U,3)
SETTXER1 I $E(APCDCODE,2)=6,$E(APCDCODE,2,4)>612 S ^XTMP("APCDDV",APCDJOB,APCDBT,"TXER","DEMOG",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,APCDX)=APCDCODE_"-"_APCDMSG_"^"_APCDERR(APCDX,"FILE")_"^"_APCDERR(APCDX,"ENTRY") Q
 I $E(APCDCODE,2)=6 S ^XTMP("APCDDV",APCDJOB,APCDBT,"TXER","DEMOGMAND",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,APCDX)=APCDCODE_"-"_APCDMSG_"^"_APCDERR(APCDX,"FILE")_"^"_APCDERR(APCDX,"ENTRY") Q
 S ^XTMP("APCDDV",APCDJOB,APCDBT,"TXER",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,APCDX)=APCDCODE_"-"_APCDMSG_"^"_APCDERR(APCDX,"FILE")_"^"_APCDERR(APCDX,"ENTRY")
 Q
INPT ;
 Q:'$P(APCDDV("VREC"),U,9)
 Q:"H"'[$P(APCDDV("VREC"),U,7)
 Q:"C"[$P(APCDDV("VREC"),U,3)
 ;skip uncoded visits ***** LAB
 K APCDERR
 S APCDEC=1
 S APCDVREC=^AUPNVSIT(APCDVSIT,0) D ^APCDRV K APCDVREC
 I $D(APCDERR) D
 .S APCDCNTR("INPT")=$G(APCDCNTR("INPT"))+1
 .D GETCHART S APCDX=0 F  S APCDX=$O(APCDERR(APCDX)) Q:APCDX'=+APCDX  S ^XTMP("APCDDV",APCDJOB,APCDBT,"INPT",APCDCLOC,APCDCLIN,APCDHRN,APCDVSIT,APCDX)=$P(^APCDERR(APCDERR(APCDX),0),U)_"-"_$P(^(0),U,2)
 D XIT
 Q
ALL ; Entry point to do all reports
 D ZERO,PPPV,MRG,TXER,INPT
 Q
 ;
XIT ; Clean up and exit.
 K APCDERR,APCDEC,APCDKT,APCDDC,APCDPAT,APCDLOC,APCDTYPE,APCDCAT,APCDI,APCDV,APCDF,APCDJ,APCDII,APCDPDIS,APCDPPRV,APCDPCOD,APCDPAFF,APCDCODE,APCDMSG
 Q