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

ACHSTX3C.m

Go to the documentation of this file.
ACHSTX3C ; IHS/ITSC/PMF - EXPORT DATA (4A/9) - RECORD 3(PATIENT FOR AO/FI) ;
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**13,18,22,27**;JUN 11, 2001;Build 43
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ PRT POL & COV TYPE FR CORRECT FILE
 ;ACHS*3.1*22 9/9/13 IHS.OIT.FCJ FIXED CENTURY DATE
 ;
MCR ;
 N ACHSMBI,ACHSMBIS   ;ACHS*3.1*27
 G MCD:'$D(^AUPNMCR(ACHSR,0))
 S ACHSINSR=$P(^AUPNMCR(ACHSR,0),U,2)
 F ACHS=0:0 S ACHS=$O(^AUPNMCR(ACHSR,11,ACHS)) G MCD:'ACHS D INIT3C,MCR1
MCR1 ;
 S ACHSMBI=0,ACHSMBIS=0,ACHSMBI=$$GETMBI^AUPNMBI(DFN,DT,0)                 ;ACHS*3.1*27 check for new MBI
 S:+ACHSMBI<1 ACHSMBI=$P(^AUPNMCR(ACHSR,0),U,3),ACHSMBIS=1                  ;ACHS*3.1*27
 ;D SET3C(33,47,$E($P(^AUPNMCR(ACHSR,0),U,3)_$J("",15),1,15))    ;ACHS*3.1*27
 S:$P(^AUPNMCR(ACHSR,11,ACHS,0),U,3) ACHSMBI=$P(^(0),U,6)        ;ACHS*3.1*27 check for coverage type "D"
 D SET3C(33,47,$E(ACHSMBI_$J("",15),1,15))                       ;ACHS*3.1*27 
 I ACHSMBIS>0,$P(^AUPNMCR(ACHSR,0),U,4)]"",$D(^AUTTMCS($P(^AUPNMCR(ACHSR,0),U,4),0)) D SET3C(50,51,$E($P(^(0),U)_"  ",1,2))
 D  ;IV&V DATE CHANGE (ADD CC & CC TO END OF 3C RECORD)
 . N ACHSTDT ;TEMPORARY DATE VARIABLE
 . S ACHSTDT=17000000+$P(^AUPNMCR(ACHSR,11,ACHS,0),U)
 . D SET3C(52,57,$E(ACHSTDT,3,8))
 . D SET3C(77,78,$E(ACHSTDT,1,2))
 . S ACHSTDT=17000000+$P(^AUPNMCR(ACHSR,11,ACHS,0),U,2)
 . D SET3C(58,63,$E(ACHSTDT,3,8))
 . D SET3C(79,80,$E(ACHSTDT,1,2))
 ;FCJ;CHANGE 16 TO 13 IN NXT LINE
 ;D SET3C(64,76,$E($P(^AUPNMCR(ACHSR,11,ACHS,0),U,3)_$J("",16),1,16)) ;IV&V DATE FIX (SHORTEN COVERAGE TYPE FIELD)
 D SET3C(64,76,$E($P(^AUPNMCR(ACHSR,11,ACHS,0),U,3)_$J("",13),1,13))
 S:'$D(ACHS3CFL) ACHSRCT=ACHSRCT+1,^ACHSDATA(ACHSRCT)=ACHS3C,ACHSRTYP(3)=ACHSRTYP(3)+1
 ;
 I '$D(ACHS3CFL) S PMFF=^ACHSDATA(ACHSRCT) D ^ACHSTX99
 ;
 S:$D(ACHS3CFL) ACHS3CFL=ACHS3CFL+1,ACHS3C(ACHS3CFL)=ACHS3C
 Q
 ;
MCD ;
 G RRE:'$D(^AUPNMCD("AB",ACHSR))
 S ACHSST=0
MCDA ;
 S ACHSST=$O(^AUPNMCD("AB",ACHSR,ACHSST))
 G RRE:'ACHSST
 S ACHSMCD=""
MCDB ;
 S ACHSMCD=$O(^AUPNMCD("AB",ACHSR,ACHSST,ACHSMCD))
 G MCDA:ACHSMCD=""
 S DA=0
 D MCD1
 G MCDB
 ;
MCD1 ;
 S DA=$O(^AUPNMCD("AB",ACHSR,ACHSST,ACHSMCD,DA))
 Q:+DA=0
 G MCD1:'$D(^AUPNMCD(DA,0))
 S ACHSINSR=$P(^AUPNMCD(DA,0),U,2)
 D INIT3C,MCD2
 G MCD1
 ;
MCD2 ;
 D SET3C(33,47,$E($P(^AUPNMCD(DA,0),U,3)_$J("",15),1,15))
 D SET3C(48,49,$P(^DIC(5,ACHSST,0),U,2))
 F ACHS=0:0 S ACHS=$O(^AUPNMCD(DA,11,ACHS)) Q:'ACHS  D MCD3
 Q
 ;
MCD3 ;
 ;ACHS*3.1*22 IHS.OIT.FCJ MODIFIED NXT SECTION TO INCLUDE CENTURY IN POSITION 77-80
 ;D SET3C(52,57,$E($E($P(^AUPNMCD(DA,11,ACHS,0),U),2,7)_$J("",6),1,6))
 ;D SET3C(58,63,$E($E($P(^AUPNMCD(DA,11,ACHS,0),U,2),2,7)_$J("",6),1,6))
 ;D SET3C(64,79,$E($P(^AUPNMCD(DA,11,ACHS,0),U,3)_$J("",16),1,16))
 S ACHSTDT=17000000+$P(^AUPNMCD(DA,11,ACHS,0),U)
 D ELGB
 S ACHSTDT=17000000+$P(^AUPNMCD(DA,11,ACHS,0),U,2)
 D ELGE
 D SET3C(64,76,$E($P(^AUPNMCD(DA,11,ACHS,0),U,3)_$J("",13),1,13))
 S:'$D(ACHS3CFL) ACHSRCT=ACHSRCT+1,^ACHSDATA(ACHSRCT)=ACHS3C,ACHSRTYP(3)=ACHSRTYP(3)+1
 ;
 I '$D(ACHS3CFL) S PMFF=^ACHSDATA(ACHSRCT) D ^ACHSTX99
 ;
 S:$D(ACHS3CFL) ACHS3CFL=ACHS3CFL+1,ACHS3C(ACHS3CFL)=ACHS3C
 Q
 ;
RRE ;
 N ACHSMBI,ACHSMBIS   ;ACHS*3.1*27
 G PRI:'$D(^AUPNRRE(ACHSR,0))
 S ACHSINSR=$P(^AUPNRRE(ACHSR,0),U,2)
 F ACHS=0:0 S ACHS=$O(^AUPNRRE(ACHSR,11,ACHS)) G PRI:'ACHS D INIT3C,RRE1
RRE1 ;
 S ACHSMBI=0,ACHSMBIS=0,ACHSMBI=$$GETMBI^AUPNMBI(DFN,DT,0)                 ;ACHS*3.1*27 check for new MBI
 S:+ACHSMBI<1 ACHSMBI=$P(^AUPNRRE(ACHSR,0),U,4),ACHSMBIS=1                  ;ACHS*3.1*27
 ;D SET3C(33,47,$E($P(^AUPNRRE(ACHSR,0),U,4)_$J("",15),1,15))    ;ACHS*3.1*27
 D SET3C(33,47,$E(ACHSMBI_$J("",15),1,15))                       ;ACHS*3.1*27 
 ;I $P(^AUPNRRE(ACHSR,0),U,3)]"",$D(^AUTTRRP($P(^AUPNRRE(ACHSR,0),U,3),0)) D SET3C(50,51,$E($P(^(0),U)_"  ",1,2))
 I ACHSMBIS>0,$P(^AUPNRRE(ACHSR,0),U,3)]"",$D(^AUTTRRP($P(^AUPNRRE(ACHSR,0),U,3),0)) D SET3C(50,51,$E($P(^(0),U)_"  ",1,2))
 ;ACHS*3.1*22 IHS.OIT.FCJ MODIFIED NXT SECTION TO INCLUDE CENTURY IN POSITION 77-80
 ;D SET3C(52,57,$E($E($P(^AUPNRRE(ACHSR,11,ACHS,0),U),2,7)_$J("",6),1,6))
 ;D SET3C(58,63,$E($E($P(^AUPNRRE(ACHSR,11,ACHS,0),U,2),2,7)_$J("",6),1,6))
 ;D SET3C(64,79,$E($P(^AUPNRRE(ACHSR,11,ACHS,0),U,3)_$J("",16),1,16))
 S ACHSTDT=17000000+$P(^AUPNRRE(ACHSR,11,ACHS,0),U)
 D ELGB
 S ACHSTDT=17000000+$P(^AUPNRRE(ACHSR,11,ACHS,0),U,2)
 D ELGE
 D SET3C(64,76,$E($P(^AUPNRRE(ACHSR,11,ACHS,0),U,3)_$J("",13),1,13))
 S:'$D(ACHS3CFL) ACHSRCT=ACHSRCT+1,^ACHSDATA(ACHSRCT)=ACHS3C,ACHSRTYP(3)=ACHSRTYP(3)+1
 I '$D(ACHS3CFL) S PMFF=^ACHSDATA(ACHSRCT) D ^ACHSTX99
 ;
 S:$D(ACHS3CFL) ACHS3CFL=ACHS3CFL+1,ACHS3C(ACHS3CFL)=ACHS3C
 Q
 ;
PRI ;
 G END:'$D(^AUPNPRVT(ACHSR,0))
 S ACHS=0
PRIA ;
 S ACHS=$O(^AUPNPRVT(ACHSR,11,ACHS))
 G END:+ACHS=0
 S ACHSINSR=$P(^AUPNPRVT(ACHSR,11,ACHS,0),U)
 D INIT3C
PRI1 ;
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ PRT POLICY # FR CORRECT FILE
 ;D SET3C(33,47,$E($P(^AUPNPRVT(ACHSR,11,ACHS,0),U,2)_$J("",15),1,15))
 I $P(ACHSINSR,U,8),$D(^AUPN3PPH($P(ACHSINSR,U,8),0)) D
 .D SET3C(33,47,$E($P(^AUPN3PPH($P(ACHSINSR,U,8),0),U,4)_$J("",15),1,15))
 ;ACHS*3.1*22 IHS.OIT.FCJ MODIFIED NXT SECTION TO INCLUDE CENTURY IN POSITION 77-80
 ;D SET3C(52,57,$E($E($P(^AUPNPRVT(ACHSR,11,ACHS,0),U,6),2,7)_$J("",6),1,6))
 ;D SET3C(58,63,$E($E($P(^AUPNPRVT(ACHSR,11,ACHS,0),U,7),2,7)_$J("",6),1,6))
 S ACHSTDT=17000000+$P(^AUPNPRVT(ACHSR,11,ACHS,0),U,6)
 D ELGB
 S ACHSTDT=17000000+$P(^AUPNPRVT(ACHSR,11,ACHS,0),U,7)
 D ELGE
 ;
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ PRT COV TYPE FR CORRECT FILE
 ;G:'$P(^AUPNPRVT(ACHSR,11,ACHS,0),U,3) PRIZ
 ;S X=$P(^AUPNPRVT(ACHSR,11,ACHS,0),U,3)
 ;G PRIZ:X=""
 ;I '$D(^AUTTPIC(X,0)) G PRIZ
 I $P(ACHSINSR,U,8),$D(^AUPN3PPH($P(ACHSINSR,U,8),0)) D
 .S X=$P(^AUPN3PPH($P(ACHSPINS,U,8),0),U,5)
 .Q:'$D(^AUTTPIC(X,0))
 .S Y=$G(^AUTTPIC(X,0)),Y=$E($P(Y,U,1),1,10)_$E($P(Y,U,3),1,5)
 .;D SET3C(64,79,$E(Y_$J("",16),1,16))  ;ACHS*3.1*22
 .D SET3C(64,76,$E(Y_$J("",13),1,13))   ;ACHS*3.1*22
 ;ACHS*3.1*13 11/27/06 IHS/OIT/FCJ END OF CHANGES
PRIZ ;
 ;ACHS*3.1*18 3-10-2010 IHS.OIT.FCJ FIXED THE ACHSRTYP IN LINE BELOW
 ;S:'$D(ACHS3CFL) ACHSRCT=ACHSRCT+1,^ACHSDATA(ACHSRCT)=ACHS3C,ACHSTRYP(3)=ACHSRTYP(3)+1
 S:'$D(ACHS3CFL) ACHSRCT=ACHSRCT+1,^ACHSDATA(ACHSRCT)=ACHS3C,ACHSRTYP(3)=ACHSRTYP(3)+1
 ;
 I '$D(ACHS3CFL) S PMFF=^ACHSDATA(ACHSRCT) D ^ACHSTX99
 ;
 S:$D(ACHS3CFL) ACHS3CFL=ACHS3CFL+1,ACHS3C(ACHS3CFL)=ACHS3C
 G PRIA
 ;
END ;
 Q
 ;
ELGB ;SET BEG ELIG DT;ACHS*3.1*22
 D SET3C(52,57,$E(ACHSTDT,3,8))
 D SET3C(77,78,$E(ACHSTDT,1,2))
 Q
ELGE ;SET END ELIG DT;ACHS*3.1*22
 D SET3C(58,63,$E(ACHSTDT,3,8))
 D SET3C(79,80,$E(ACHSTDT,1,2))
 Q
INIT3C ;
 ;S ACHS3C="3C"_$E($P(^AUTNINS(ACHSINSR,0),U)_$J("",30),1,30),ACHS3C=$E(ACHS3C_$J("",79),1,79)_ACHSDEST    ;ACHS*3.1*22
 S ACHS3C="3C"_$E($P(^AUTNINS(ACHSINSR,0),U)_$J("",30),1,30),ACHS3C=$E(ACHS3C_$J("",80),1,80)     ;ACHS*3.1*22
 Q
 ;
SET3C(B,E,V) ;
 S ACHS3C=$E(ACHS3C,1,B-1)_V_$E(ACHS3C,E+1,80)
 Q
 ;