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

AGCAT.m

Go to the documentation of this file.
AGCAT ;IHS/SD/EFG - WORK WITH CATEGORY PRIORITIZING ; MAR 19, 2010
 ;;7.1;PATIENT REGISTRATION;**1,2,7**;AUG 25, 2005
 ;THIS ROUTINE WAS CREATED TO REMOVE THESE SUBROUTINES
 ;FROM ^AGED4A DUE TO ROUTINE SIZE RESTRICTIONS
 Q
BLDAGCAT ;EP - LOAD ARRAY "AGCAT" WITH SEQUENCED INSURERS
 K AGCAT(CATPTR,SEQEFDT)
 N AGSEL,AGI,AGC,INS,COV,RECPTR,EBEG,EEND,PHOLDER,POLNUM,ST,STPTR,PLANPTR
 S AGSEL=0
 S AGI=""
 F AGC=1:1 S AGI=$P(PRSEQ,",",AGC) Q:AGI=""  D
 . S AGSEL=AGSEL+1
 . S INS=$P(AGINS(AGI),U,2)
 . S COV=$P(AGINS(AGI),U,4)
 . S EBEG=$P(AGINS(AGI),U,5)
 . S EEND=$P(AGINS(AGI),U,6)
 . S PHPTR=$P(AGINS(AGI),U,7)
 . S POLNUM=$P(AGINS(AGI),U,9)
 . S RECPTR=$P(AGINS(AGI),U,11)
 . S PLANPTR=$P(AGINS(AGI),U,12)
 . ;S AGCAT(CATPTR,SEQEFDT,AGSEL)=INS_"^"_COV_"^"_EBEG_"^"_EEND_"^"_PHPTR_"^"_POLNUM_"^"_SEQEFDT_"^"_PLANPTR_U_RECPTR
 . S USER=DUZ
 . S AGCAT(CATPTR,SEQEFDT,AGSEL)=INS_"^"_COV_"^"_EBEG_"^"_EEND_"^"_PHPTR_"^"_POLNUM_"^"_SEQEFDT_"^"_PLANPTR_"^"_USER_"^"_DT_U_RECPTR
 ;"^"_USER_"^"_ENTDAT_U_RECPTR
 I $D(^AUPNICP("EFF2",DFN,SEQEFDT,CATPTR)) D DELICP
 Q
LOADICP ;EP - LOAD THE CATEGORY PRIORITIZING GLOBAL WITH WHAT
 ;THE USER CATEGORIZED AND SEQUENCED IN ARRAY "AGCAT"
 N AGA,AGDT,AGB,CATREC,EFFDT,PATIEN,X
 N INS,COV,EBEG,EEND,PHOLDER,POLNUM,ST,PLANPTR
 S AGA=""
 F  S AGA=$O(AGCAT(AGA)) Q:AGA=""  D            ; AGA = CATEGORY
 . S AGDT=""
 . F  S AGDT=$O(AGCAT(AGA,AGDT)) Q:AGDT=""  D   ; AGDT = PRIORITY EFF DT
 .. I '$D(^AUPNICP("EFF2",DFN,AGDT,AGA))  D
 ... S AGB=0
 ... F  S AGB=$O(AGCAT(AGA,AGDT,AGB)) Q:'AGB  D  ; AGB = SEQUENCE
 .... S CATREC=$G(AGCAT(AGA,AGDT,AGB))
 .... ; ADD NEW RECORD TO AUPNICP
 .... S INS=$P(CATREC,U)
 .... S COV=$P(CATREC,U,2)
 .... S EBEG=$P(CATREC,U,3)
 .... S EEND=$P(CATREC,U,4)
 .... S PHOLDER=$P(CATREC,U,5)
 .... S POLNUM=$P(CATREC,U,6)
 .... S EFFDT=$P(CATREC,U,7)
 .... S PLANPTR=$P(CATREC,U,8)
 .... ;S RECPTR=$P(CATREC,U,9)
 .... S RECPTR=$P(CATREC,U,11)
 .... S USER=DUZ
 .... S PATIEN=DFN
 .... S DIC="^AUPNICP("
 .... S DIC(0)="L"
 .... S DLAYGO=9000035
 .... S DIC("DR")=".02////^S X=PATIEN"
 .... S DIC("DR")=DIC("DR")_";.03////^S X=INS"
 .... S DIC("DR")=DIC("DR")_";.04////^S X=AGA"
 .... S DIC("DR")=DIC("DR")_";.05///^S X=AGB"
 .... S DIC("DR")=DIC("DR")_";.06////^S X=EFFDT"
 .... S DIC("DR")=DIC("DR")_";.07///^S X=COV"
 .... S DIC("DR")=DIC("DR")_";.08////^S X=EBEG"
 .... S DIC("DR")=DIC("DR")_";.09////^S X=EEND"
 .... S DIC("DR")=DIC("DR")_";.11///^S X=POLNUM"
 .... S DIC("DR")=DIC("DR")_";.12////^S X=PLANPTR"
 .... S DIC("DR")=DIC("DR")_";.13///^S X=PHOLDER"
 .... ;S DIC("DR")=DIC("DR")_";.14///^S X=USER"
 .... S DIC("DR")=DIC("DR")_";.14////"_DUZ  ;AG*7.1*1 IM18549;IM8663
 .... S DIC("DR")=DIC("DR")_";.15///^S X=RECPTR"
 .... W "."
 .... H 1  ;ED EXPLAINED THIS WAS IN HERE TO MAKE SURE EACH .01 ENTRY WAS A
 .... ;DATE TIME STAMP. HE WAS NOT SURE WHETHER IT WAS FOR FUTURE USE AND API OR
 .... ;OR AN IMMEDIATE NEED.
 .... D NOW^%DTC
 .... S X=%
 .... K DD,DO,DINUM
 .... D FILE^DICN
 .... K DIC
 Q
DELICP ;DELETE RE-CATEGORIZED RECORDS IN "^AUPNICP" BASED ON ARRAY "AGCAT"
 N AGB,DA
 S AGB=0
 F  S AGB=$O(^AUPNICP("EFF2",DFN,SEQEFDT,CATPTR,AGB)) Q:'AGB  D
 . S DA=AGB
 . S DIK="^AUPNICP("
 . D ^DIK
 Q
LOADCAT ;EP - FIND PATIENT'S RECORDS IN CATEGORY PRIORITIZING GLOBAL (AUPNICP)
 ;AND LOAD INTO ARRAY "AGCAT"
 N CPTR,SQDT,RECNO,RECORD,SEQEFDT,AGSEL,RECPTR
 N ST,INS,COV,EBEG,EEND,PHOLDER,POLNUM,PLANPTR
 K AGCAT  ;IHS/SD/TPF 5/1/2006 AG*7.1*2 IM20494
 S CPTR=""
 F  S CPTR=$O(^AUPNICP("EFF",DFN,CPTR)) Q:CPTR=""  D
 . S SQDT=""
 . F  S SQDT=$O(^AUPNICP("EFF",DFN,CPTR,SQDT)) Q:'SQDT  D
 .. S RECNO=0
 .. F  S RECNO=$O(^AUPNICP("EFF",DFN,CPTR,SQDT,RECNO)) Q:'RECNO  D
 ... S RECORD=$G(^AUPNICP(RECNO,0))
 ... S ENTDAT=$P(RECORD,U)
 ... S SEQEFDT=$P(RECORD,U,6)
 ... I $P(RECORD,U,7)="",$P(RECORD,U,8)="",$P(RECORD,U,9)="",$P(RECORD,U,10)="",$P(RECORD,U,11)="",$P(RECORD,U,12)="" D
 .... S AGFRMSG2=$S(CPTR="D":"DENTAL COVERAGE",CPTR="O":"OPTOMETRY COVERAGE",CPTR="R":"PHARMACY COVERAGE",CPTR="P":"MENTAL HEALTH COVERAGE",CPTR="A":"AUTO ACCIDENT/TORT COVERAGE",CPTR="W":"WORKMAN'S COMP COVERAGE",1:"MEDICAL COVERAGE")
 .... S AGFRMMSG=$E(SQDT,4,5)_"/"_$E(SQDT,6,7)_"/"_($E(SQDT,1,3)+1700)
 .... S INSPTR=$P(RECORD,U,3)
 .... S AGREC=0
 .... F  S AGREC=$O(AGINS(AGREC)) Q:'AGREC  D
 ..... S AGINSREC=$G(AGINS(AGREC))
 ..... I $P(AGINSREC,U,2)=INSPTR D
 ...... S INS=$P(AGINSREC,U,2)
 ...... S COV=$P(AGINSREC,U,4)
 ...... S EBEG=$P(AGINSREC,U,5)
 ...... S EEND=$P(AGINSREC,U,6)
 ...... S PHOLDER=$P(AGINSREC,U,7)
 ...... S POLNUM=$P(AGINSREC,U,9)
 ...... S PLANPTR=$P(AGINSREC,U,12)
 ...... S USER=$P(AGINSREC,U,13)
 ...... S RECPTR=$P(AGINSREC,U,14)
 ...... S AGCAT(CPTR,SEQEFDT,$P(RECORD,U,5))=INS_"^"_COV_"^"_EBEG_"^"_EEND_"^"_PHOLDER_"^"_POLNUM_"^"_SEQEFDT_"^"_PLANPTR_"^"_USER_"^"_ENTDAT_U_RECPTR
 ... E  D
 .... ;S CPTR=$P(RECORD,U,4)   ;IHS/SD/AR AG*7.1*7 3/15/2010
 .... S AGSEL=$P(RECORD,U,5)
 .... ;I $P(RECORD,U,3)'="" S INS=$P(RECORD,U,3)
 .... ;I $P(RECORD,U,3)="" S INS=3
 .... S INS=$P(RECORD,U,3)  ;IHS/SD/TPF AG*7.1*1 9/6/2005 
 .... ;S INS=""  ;TESTING TPF
 .... S COV=$P(RECORD,U,7)
 .... S EBEG=$P(RECORD,U,8)
 .... S EEND=$P(RECORD,U,9)
 .... S PHOLDER=$P(RECORD,U,12)
 .... S POLNUM=$P(RECORD,U,10)
 .... S PLANPTR=$P(RECORD,U,11)
 .... S USER=$P(RECORD,U,13)
 .... S RECPTR=$P(RECORD,U,14)
 .... S AGCAT(CPTR,SEQEFDT,AGSEL)=INS_"^"_COV_"^"_EBEG_"^"_EEND_"^"_PHOLDER_"^"_POLNUM_"^"_SEQEFDT_"^"_PLANPTR_"^"_USER_"^"_ENTDAT_U_RECPTR
 Q