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

IBYZ20R.m

Go to the documentation of this file.
  1. IBYZ20R ;ALB/CPM - FIX CT ENTRIES FOR PATCH IB*2*62 ; 13-JUN-96
  1. ;;Version 2.0 ; INTEGRATED BILLING ;**62**; 21-MAR-94
  1. ;
  1. D ID ; update the Procedures (#399.0304) identifier
  1. D CT ; remove scheduled admission pointers in Claims Tracking
  1. Q
  1. ;
  1. ;
  1. CT ; Remove Scheduled Admission pointer from Claims Tracking entries.
  1. S X(1)=">>> Examining all CT entries with a Scheduled Admission pointer..."
  1. S X(2)=" " D BMES^XPDUTL(.X)
  1. ;
  1. S (IBDELS,IBSCHA)=0 K ^TMP($J,"IBT")
  1. S IBSCH=0 F S IBSCH=$O(^IBT(356,"ASCH",IBSCH)) Q:'IBSCH D
  1. .S IBTRN=0 F S IBTRN=$O(^IBT(356,"ASCH",IBSCH,IBTRN)) Q:'IBTRN D
  1. ..;
  1. ..; - if there is no CT entry, kill x-ref and quit
  1. ..S IBTRND=$G(^IBT(356,IBTRN,0))
  1. ..I IBTRND="" K ^IBT(356,"ASCH",IBSCH,IBTRN) Q
  1. ..;
  1. ..; - if the CT entry is inactive, delete the SA ptr and quit
  1. ..I '$P(IBTRND,"^",20) D INAC Q
  1. ..;
  1. ..; - get the CT admission ptr, event date, DFN
  1. ..S IBADM=$P(IBTRND,"^",5),IBCTED=$P(IBTRND,"^",6),DFN=$P(IBTRND,"^",2)
  1. ..;
  1. ..; - if there's no adm ptr, check to see if the CT entry should
  1. ..; be inactivated (with the SA ptr deleted). Otherwise, it's
  1. ..; a valid SA CT entry, just waiting for the vet to be admitted.
  1. ..I 'IBADM D Q
  1. ...S IBSCHD=$G(^DGS(41.1,IBSCH,0))
  1. ...;
  1. ...; - got a dangling ptr
  1. ...I IBSCHD="" D INAC Q
  1. ...;
  1. ...; - SA is cancelled or already admitted
  1. ...I $P(IBSCHD,"^",13)!$P(IBSCHD,"^",17) D INAC Q
  1. ...;
  1. ...; - the SA patient is not the same as the CT patient
  1. ...I +IBSCHD'=DFN D INAC Q
  1. ...;
  1. ...; - the SA day is not the same as the CT Event day
  1. ...I $P($P(IBSCHD,"^",2),".")'=$P(IBCTED,".") D INAC Q
  1. ...;
  1. ...; - valid SA CT entry
  1. ...S IBSCHA=IBSCHA+1
  1. ...Q
  1. ..;
  1. ..; - CT entry has an adm ptr; the SA ptr will be deleted.
  1. ..;
  1. ..; - if the CT has an IR dated 21 days prior to the CT event date,
  1. ..; or a HR dated prior to the CT event date, the CT is suspect.
  1. ..S (IBSTOP,IBTRC)=0 F S IBTRC=$O(^IBT(356.2,"C",IBTRN,IBTRC)) Q:'IBTRC S IBDATE=+$G(^IBT(356.2,IBTRC,0))\1 I $$FMDIFF^XLFDT(IBCTED\1,IBDATE)>21 S IBSTOP="1^IR: "_$$DAT1^IBOUTL(IBDATE) Q
  1. ..;
  1. ..I 'IBSTOP S IBTRV=0 F S IBTRV=$O(^IBT(356.1,"C",IBTRN,IBTRV)) Q:'IBTRV S IBDATE=+$G(^IBT(356.1,IBTRV,0))\1 I $$FMDIFF^XLFDT(IBCTED\1,IBDATE)>0 S IBSTOP="1^HR: "_$$DAT1^IBOUTL(IBDATE) Q
  1. ..;
  1. ..I IBSTOP S ^TMP($J,"IBT",IBTRN)=DFN_"^"_$P(IBSTOP,"^",2)
  1. ..;
  1. ..; - delete the ptr
  1. ..S DA=IBTRN,DR=".32///@",DIE="^IBT(356," D ^DIE K DA,DR,DIE
  1. ..S IBDELS=IBDELS+1
  1. ;
  1. ;
  1. D BMES^XPDUTL("Scheduled Admission pointers were deleted from "_IBDELS_" entries.")
  1. D BMES^XPDUTL("Found "_IBSCHA_" valid SA CT entries awaiting admission.")
  1. D LIST
  1. K ^TMP($J,"IBT"),IBSCHA,IBSCH,IBSCHD,IBTRN,IBDATE,IBTRND,IBSTOP,IBTRC,IBTRV,DFN,IBADM,IBCTED,IBDELS,X,Y
  1. Q
  1. ;
  1. ;
  1. INAC ; Inactivate a CT entry and delete the Sched Adm ptr.
  1. S DA=IBTRN,DR=".2////0;.32///@",DIE="^IBT(356,"
  1. D ^DIE K DA,DR,DIE S IBDELS=IBDELS+1
  1. Q
  1. ;
  1. LIST ; List CT entries which may have been overlaid.
  1. N IBTRN,X,Y S X(1)=" "
  1. I '$D(^TMP($J,"IBT")) D G LISTQ
  1. .S X(2)="Didn't find any CT entries which may have been overlaid."
  1. .D BMES^XPDUTL(.X)
  1. S X(2)="List of CT entries to be checked:"
  1. S X(3)="---------------------------------"
  1. D BMES^XPDUTL(.X) K X
  1. S IBTRN=0 F S IBTRN=$O(^TMP($J,"IBT",IBTRN)) Q:'IBTRN S Y=$G(^(IBTRN)) D
  1. .S X=$E($E($P($G(^DPT(+Y,0)),"^"),1,25)_" ("_$E($P($G(^(0)),"^",9),6,10)_")"_$J("",35),1,35)
  1. .S X=X_"CT ien: "_IBTRN_" ("_$$DAT1^IBOUTL(IBCTED)_") "_$P(Y,"^",2)
  1. .D MES^XPDUTL(X)
  1. LISTQ Q
  1. ;
  1. ;
  1. ID ; Set the identifier for the Procedures (#399.0304) sub-file.
  1. N X
  1. S X(1)=">>> Updating the Procedures (#399.0304) identifier..."
  1. S X(2)=" " D BMES^XPDUTL(.X)
  1. S ^DD(399.0304,0,"ID","WRITE")="D DISPID^IBCSC4D"
  1. Q