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

ABMMRS.m

Go to the documentation of this file.
ABMMRS ; IHS/ASDST/DMJ - NEW PROGRAM ;
 ;;2.4;IHS 3P BILLING SYSTEM;;APR 14, 2000
 ;IHS/DSD/MRS
INIT S SITE=0,BDFN="",U="^"
 K ^ABMMRS
 F  S SITE=$O(^ABMDBILL(SITE)) Q:'SITE  D
 .S BDFN=0 F  S BDFN=$O(^ABMDBILL(SITE,BDFN)) Q:'BDFN  D
 ..I '$D(^ABMDBILL(SITE,BDFN,0)) Q
 ..S STR1=^ABMDBILL(SITE,BDFN,0)
 ..S BSTAT=$P(STR1,U,4),PDFN=$P(STR1,U,5),BTYP=$P(STR1,U,2)
 ..S PAT=PDFN I PDFN="" S PDFN="NULL"
 ..D GETPAT
 ..S BILL=$P(STR1,U,1),CLAIM=+BILL,IIEN=$P(STR1,U,8)
 ..D GETINS
 ..D SET
 ..D CKCL
 S N=0,X="" F  S X=$O(^ABMMRS(X)) Q:X=""  S N=N+1
 S ^ABMMRS=N
 D KILL
 Q
SET ;
 S STR2=BILL_U_BTYP_U_VLOC_U_STAT_U_PAT_U_MODE_U_VTYP_U_IIEN_U_CODE
 S STR=STR1_"***"_STR2_U_CLINIC_U_VIEN
 S ^ABMMRS(CLAIM,BDFN,"BILL",PDFN,SITE)=STR
 I PDFN="NULL" S ^ABMMRS(CLAIM,"NULL")=STR
 S ^ABMMRS(CLAIM)=$G(^ABMMRS(CLAIM))+1
 Q
GETPAT ; Get info from visit file
 S (CLINIC,STAT,VLOC)=""
 S VIEN=$P($G(^ABMDBILL(SITE,BDFN,11,0)),U,3)
 I VIEN'="" D
 .S TMP=$G(^AUPNVSIT(VIEN,0))
 .S PAT=$P(TMP,U,5),CLINIC=$P(TMP,U,8),STAT=$P(TMP,U,4),VLOC=$P(TMP,U,6)
 I STAT="" S STAT=BSTAT
 I VLOC="" S VLOC=SITE
 I PAT="" S PAT="NULL"
 Q
GETINS ; Get more info from insurance file
 S (VTYP,CODE,MODE)=""
 I $D(^ABMDBILL(SITE,BDFN,13,"C",1)) S INX="" D
 .S INX=$O(^ABMDBILL(SITE,BDFN,13,"C",1,""))
 .I INX="" Q
 .S IIEN=$P(^ABMDBILL(SITE,BDFN,13,INX,0),U,1)
 Q:IIEN=""!(BTYP="")
 S TMP=$G(^ABMNINS(SITE,IIEN,1,BTYP,0))
 S VTYP=$P(TMP,U,1),CODE=$P(TMP,U,2),MODE=$P(TMP,U,4)
 Q
CKCL S CSITE=0
 F  S CSITE=$O(^ABMDCLM(CSITE)) Q:'CSITE  D
 .I '$D(^ABMDCLM(CSITE,CLAIM,0)) Q
 .S CSTR=^ABMDCLM(CSITE,CLAIM,0),CPDFN=$P(CSTR,U,1)
 .I CPDFN="" S CPDFN="NULL"
 .I CPDFN="NULL" S ^ABMMRS(CLAIM,BDFN,"NULL",CPDFN,CSITE)=CSTR
 .S ^ABMMRS(CLAIM,BDFN,"CLAIM",CPDFN,CSITE)=CSTR
 .S ^ABMMRS(CLAIM)=^ABMMRS(CLAIM)+1
 Q
KILL S CLAIM=""
 F  S CLAIM=$O(^ABMMRS(CLAIM)) Q:CLAIM=""  D
 .I '$D(^ABMMRS(CLAIM,"NULL")) K ^ABMMRS(CLAIM) Q
 .K ^ABMMRS(CLAIM,"NULL")
 S N=0,X="" F  S X=$O(^ABMMRS(X)) Q:X=""  S N=N+1
 S ^ABMMRS=^ABMMRS_"^"_N
 Q