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

ACHSTX3.m

Go to the documentation of this file.
ACHSTX3 ; IHS/ITSC/PMF - EXPORT DATA (4/9) - RECORD 3(PATIENT FOR AO/FI) ;
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**13,19**;JUN 11,2001
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ PULL INSURED FR CORRECT FILES
 ;
 I $$PARM^ACHS(2,11)'="Y" G AEND
 W !!?10,"BUILDING ",$$REC^ACHSACO1(3)," : ",!?9
 ;*****************BEGIN LOOP THRU PATIENT RECORD 3
 S ACHSR=0
 S ACHSDB=$S($$GET1^DIQ(9999999.06,DUZ(2),.32)=17121:1,1:" ") ;ACHS*3.1*19 NEW LINE TO IDENT DB
A1 ; ^ACHSTXPT(DFN,<facility_pointer>,HRN)
 S ACHSRR=0,ACHSR=$O(^ACHSTXPT(ACHSR))
 G AEND:'ACHSR,A1:'$D(^AUPNPAT(ACHSR,0)),A1:'$D(^DPT(ACHSR,0))
 I ACHSREEX,$D(ACHS("REXNUM")),$P($G(^AUPNPAT(ACHSR,0)),U,15)=$P($G(^ACHSTXST(DUZ(2),1,ACHS("REXNUM"),0)),U,1) G A2
 ;
 ;if the date of last export is greater than the date of last
 ;registration update, stop.  don't export. pmf  11/22/00
 ;
 ;there are TWO 'date of last registration update' fields in ^AUPNPAT 
 ;we want to check against the LATEST one, so figure out which one 
 ;it is 
 S ACHSPND1=$P(^AUPNPAT(ACHSR,0),U,3),ACHSPND2=$P(^AUPNPAT(ACHSR,0),U,16)
 I ACHSPND2>ACHSPND1 S ACHSPND1=ACHSPND2
 I $P(^AUPNPAT(ACHSR,0),U,15)>ACHSPND1 G A1
 ;
A2 ;
 S ACHSHRN=0,ACHSRR=$O(^ACHSTXPT(ACHSR,ACHSRR))
 G A1:'ACHSRR,A1:'$D(^ACHSTXPT(ACHSR,ACHSRR))
 S ACHSFAC=$E(ACHSAFAC_$J("",6),1,6)
A3 ;
 S ACHSHRN=$O(^ACHSTXPT(ACHSR,ACHSRR,ACHSHRN))
 G A2:'ACHSHRN
 S ACHSDEST=$P($G(^ACHSTXPT(ACHSR,ACHSRR,ACHSHRN)),U),ACHSDOB="0000000"
 I +$P($G(^DPT(ACHSR,0)),U,3) S ACHSDOB=$E($P(^(0),U,3),1,3)+1700,ACHSDOB=$E(ACHSDOB,2)_$E($P(^(0),U,3),2,7)
 S ACHSSEX=$E($P($G(^DPT(ACHSR,0)),U,2)_" "),DFN=ACHSR
 D TRIB^ACHSTX8
A4 ;
 S ACHSNAME=$E($P($G(^DPT(ACHSR,0)),U)_$J("",30),1,30),ACHSCOV="N"
 I $D(^AUPNMCR(ACHSR,0))!$D(^AUPNMRE(ACHSR,0))!$D(^AUPNPRVT(ACHSR,0))!$D(^AUPNMCD("AB",ACHSR)) S ACHSCOV="Y"
 F ACHSCOMM=0:0 Q:'$O(^AUPNPAT(ACHSR,51,ACHSCOMM))  S ACHSCOMM=$O(^(ACHSCOMM))
 I 'ACHSCOMM S ACHSCOMM=$J("",7) G A5
 S ACHSCOMM=$S($D(^AUPNPAT(ACHSR,51,ACHSCOMM,0)):$P(^(0),U,3),1:0)
 I 'ACHSCOMM S ACHSCOMM=$J("",7) G A5
 S ACHSCOMM=$S($D(^AUTTCOM(ACHSCOMM,0)):$E($P($G(^AUTTCOM(ACHSCOMM,0)),U,8)_$J("",7),1,7),1:"")
A5 ;
 S ACHSSSN=$P($G(^DPT(ACHSR,0)),U,9)
 I $L(ACHSSSN)'=9 S ACHSSSN=$J("",9)
 S ACHSUPDT=$E($P($G(^AUPNPAT(ACHSR,0)),U,16),2,7)
 ;I '$L(ACHSUPDT) S ACHSUPDT="000000"   ;ACHS*3.1*19
 I $L(ACHSUPDT)'=6 S ACHSUPDT="000000"
 S ACHSRCT=ACHSRCT+1,ACHSRTYP(3)=ACHSRTYP(3)+1
 ;ACHS*3.1*19 CHANGED NXT LINE TO SEND THE DATABASE ID INSTEAD OF THE DOC DEST
 ;S ^ACHSDATA(ACHSRCT)="3A"_ACHSFAC_$E(ACHSHRN+1000000,2,7)_ACHSDOB_ACHSSEX_ACHSTRIB_ACHSNAME_ACHSCOV_ACHSCOMM_ACHSSSN_ACHSUPDT_$E($$SSV(ACHSR)_" ",1)_ACHSDEST
 S ^ACHSDATA(ACHSRCT)="3A"_ACHSFAC_$E(ACHSHRN+1000000,2,7)_ACHSDOB_ACHSSEX_ACHSTRIB_ACHSNAME_ACHSCOV_ACHSCOMM_ACHSSSN_ACHSUPDT_$E($$SSV(ACHSR)_" ",1)_ACHSDB
 ;
 S ACHSRCT=ACHSRCT+1,ACHSRTYP(3)=ACHSRTYP(3)+1
 I '$D(^DPT(ACHSR,.11)) S ^ACHSDATA(ACHSRCT)="3B"_$J("",78) G A7
 S ACHSADDR=$E($P(^DPT(ACHSR,.11),U)_$J("",30),1,30),ACHSCITY=$E($P(^DPT(ACHSR,.11),U,4)_$J("",20),1,20),X=$P(^DPT(ACHSR,.11),U,5),ACHSST=$S('X:"  ",1:$P(^DIC(5,X,0),U,2)),ACHSZIP=$E($P(^DPT(ACHSR,.11),U,6)_$J("",9),1,9),ACHSINSR=$J("",16)
 S X=""
A5A ;
 S X=$O(^AUPNPRVT(ACHSR,11,X))
 G A6:+X=0
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ PULL INSURED FR CORRECT FILES
 ;I $P($G(^AUPNPRVT(ACHSR,11,X,0)),U,4)="" G A5A
 ;S ACHSINSR=$E($P($G(^AUPNPRVT(ACHSR,11,X,0)),U,4)_$J("",16),1,16)
 S X1=$P($G(^AUPNPRVT(ACHSR,11,X,0)),U,8)
 I $P(^AUPNPRVT(ACHSR,0),U)=$P(^AUPN3PPH(X1,0),U,2) G A5A
 S ACHSINSR=$E($P(^AUPN3PPH(X1,0),U)_$J("",16),1,16)
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ END OF CHANGES
A6 ;
 S ^ACHSDATA(ACHSRCT)="3B"_ACHSADDR_ACHSCITY_ACHSST_ACHSZIP_ACHSINSR_ACHSDEST,$P(^AUPNPAT(ACHSR,0),U,15)=DT
 ;D ^ACHSTX3C  do this AFTER tag A7  pmf  12/15/00
A7 ;
 D ^ACHSTX3C
 I ACHSRTYP(3)#10=0 W $J(ACHSRTYP(3),8)
 G A3
 ;
AEND ;
 S ACHSROUT=ACHSRCT
 K ACHSAPN,ACHSINSR,ACHSCITY,ACHSCOMM,ACHSCN,ACHSCOV,ACHSEIN,ACHSFAC,ACHSFED,X1
 K ACHSFONE,ACHSHRN,ACHSUPDT,ACHSNAME,ACHS1099,ACHSDOB,ACHSPTYP,ACHSSEX,ACHSST,ACHSADDR,ACHSTRIB,ACHSSSN,ACHSDAP,ACHSZIP
 S ACHSROUT=ACHSRCT
 G ^ACHSTX4
 ;
SSV(X) ;EP - Given the pt's DFN, return the SSN verification status code.
 S X=$P($G(^AUPNPAT(X,0)),U,23)       ;SSN VERIFICATION STATUS
                                      ;FROM PATIENT FILE, PTR TO SSN
 I 'X Q ""
 Q $P($G(^AUTTSSN(X,0)),U)          ;CODE FIELD IN STATUS FILE  
 ;