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

SCCVEAP3.m

Go to the documentation of this file.
  1. SCCVEAP3 ;ALB/RMO,TMP - Appointment Conversion cont.; [ 04/05/95 10:19 AM ]
  1. ;;5.3;Scheduling;**211**;Aug 13, 1993
  1. ;
  1. SET(SCCVEVT,SCLOG,DFN,SCDTM,SCCLN,SCDA,SCOE,SCCV) ; Set variables
  1. ; Input -- SCCVEVT Conversion event
  1. ; SCLOG Scheduling conversion log IEN
  1. ; DFN Patient IEN
  1. ; SCDTM Appointment date/time
  1. ; SCCLN Clinic IEN
  1. ; Output -- SCDA Clinic appt patient sub-file IEN
  1. ; SCOE Outpatient encounter IEN
  1. ; SCCV Conversion array:
  1. ; SCCV("EVT") Conversion event
  1. ; ("LOG") Scheduling conversion log IEN
  1. ; ("NEW") Outpatient encounter
  1. ; created by conversion flag
  1. ; 0 = no new encounter or visit
  1. ; 1 = new encounter and visit
  1. ; 2 = new visit only
  1. ; ("SCDA") Multiple entry in ^SC for this pt
  1. ; ("OE",0) Outpatient encounter 0th node
  1. ; ("PT",0) Patient appt 0th node
  1. ; ("PT","R") Patient appt "R" node (Remarks)
  1. ; ("CL1",0) Clinic's 0th node
  1. ; ("CL",0) Clinic appt patient 0th node
  1. ; ("CL","C") Clinic appt patient "C" node (Check in/out)
  1. ; ("ERR") Code for specific error, if any
  1. ; ("VST") Visit file IEN
  1. ;
  1. N SCOE0,SCDATA,SCIENS
  1. ;
  1. S:'$G(SCDA) SCDA=+$$FIND^SDAM2(DFN,SCDTM,SCCLN) ; Find multiple entry in ^SC for this pt
  1. ;
  1. S SCOE=+$P($G(^DPT(DFN,"S",SCDTM,0)),U,20),SCOE0=$G(^SCE(SCOE,0))
  1. ;
  1. ; -- following is commented out ; left for reference purposes
  1. ; -- this 'if' should always fail ; CON^SCCVEAP1 has this covered
  1. ;IF 'SCOE,'SCDA S SCCV("ERR")=1 G SETQ
  1. ;
  1. S SCCV("SCDA")=SCDA
  1. S SCCV("EVT")=SCCVEVT
  1. ;
  1. S SCCV("LOG")=SCLOG
  1. S SCCV("PT",0)=$G(^DPT(DFN,"S",SCDTM,0)),SCCV("PT","R")=$G(^("R"))
  1. S SCCV("CL",0)=$G(^SC(SCCLN,"S",SCDTM,1,SCDA,0)),SCCV("CL","C")=$G(^("C"))
  1. S SCCV("CL1",0)=$G(^SC(SCCLN,0))
  1. ;
  1. ; On re-convert, delete previously converted data
  1. I SCCVEVT=2 D
  1. . N SCDATA
  1. . ; only delete for reconvert if we created the encounter or completed
  1. . ; the conversion by adding the visit
  1. . Q:'$$CCREATE^SCCVU(SCOE)
  1. . ;
  1. . S SCCV("OE",0)=SCOE0
  1. . D RECNVT(SCOE,SCOE0,.SCCONS)
  1. . S SCOE0=$G(^SCE(SCOE,0)) S:SCOE0="" SCOE=0
  1. ;
  1. S SCCV("NEW")=$S('SCOE:1,'$P(SCOE0,U,5):2,1:0)
  1. ;
  1. G:'SCCV("NEW") SETQ ; Already has both an encounter and visit
  1. ;
  1. ; Increment total number of encounters/visits that would be created by
  1. ; conversion (if estimating)
  1. I 'SCCVEVT D G SETQ ; -- Estimate exits here
  1. . D INCRTOT^SCCVEGU1(.SCTOT,SCCV("NEW")+6,1)
  1. . D EN^SCCVZZ("APPT-"_(SCCV("NEW")+6),SCOE,SCDTM,$P($G(SCCV("PT",0)),U),+$P(SCOE0,U,6))
  1. . D CREDIT^SCCVEAP4(SCOE,SCDTM,.SCCV,0)
  1. ;
  1. I 'SCOE D ; Create enctr/visit
  1. . N SCCVT
  1. . D SETSCCVT^SCCVEAP2(.SCCVT,.SCCONS)
  1. . IF 'SCDA F L +^SC(SCCLN,"S",SCDTM,1,999999):5 IF $T S ^SC(SCCLN,"S",SCDTM,1,999999,0)=DFN Q
  1. . S SCOE=$$GETAPT^SDVSIT2(DFN,SCDTM,SCCLN,"")
  1. . IF 'SCDA K ^SC(SCCLN,"S",SCDTM,1,999999) L -^SC(SCCLN,"S",SCDTM,1,999999)
  1. . Q:'SCOE
  1. . I $P($G(^SCE(SCOE,0)),U,3) S SCCV("HIST")=1
  1. . S SCTOT(1.02)=$G(SCTOT(1.02))+1
  1. ;
  1. S SCCV("OE")=+SCOE
  1. S SCCV("OE",0)=$G(^SCE(+SCOE,0))
  1. S SCCV("VST")=$P(SCCV("OE",0),U,5)
  1. S SCCV("ORG")=1,SCCV("REF")=SCDA
  1. ;
  1. I 'SCCV("VST"),SCOE,SCCV("NEW")'=1 D
  1. . S SCCV("VST")=$$VISIT^SCCVEAP2(SCDTM,.SCCV) ; create visit if encounter already exists, but no visit
  1. . D CREDIT^SCCVEAP4(SCOE,SCDTM,.SCCV,SCCVEVT)
  1. ;
  1. SETQ Q
  1. ;
  1. RECNVT(SCOE,SCOE0,SCCONS) ;Delete data added by conversion
  1. ;
  1. N Z,SCVST,SCENC,SCENC0,SCCHLD,PXKNOEVT
  1. ;
  1. S PXKNOEVT=1 ;Don't want event driver to fire off
  1. ;
  1. S SCVST(0,SCOE,+$P(SCOE0,U,5))=+$G(^SCE(SCOE,"CNV")) ;Parent
  1. D DELPTR(SCOE)
  1. ;
  1. S SCENC=0 F S SCENC=$O(^SCE("APAR",SCOE,SCENC)) Q:'SCENC D
  1. . S SCVST(1,SCENC,+$P($G(^SCE(SCENC,0)),U,5))=+$G(^SCE(SCENC,"CNV"))
  1. . D DELPTR(SCENC)
  1. ;
  1. S SCCHLD="" F S SCCHLD=$O(SCVST(SCCHLD)) Q:SCCHLD="" S SCENC=0 F S SCENC=$O(SCVST(SCCHLD,SCENC)) Q:'SCENC S SCVST="" F S SCVST=$O(SCVST(SCCHLD,SCENC,SCVST)) Q:SCVST="" D
  1. . I SCVST(SCCHLD,SCENC,SCVST),$D(^SCE(SCENC,0)) D DELE^SCCVCST2(SCENC) ;Created by conversion - delete enctr
  1. . Q:'SCVST!SCCHLD ;No need to delete children visits - they should go away w/parent
  1. . S Z=$$DELVFILE^PXAPI("ALL",SCVST,$G(SCCONS("PKG")),$G(SCCONS("SRCE")))
  1. Q
  1. ;
  1. DELPTR(SCE) ; Delete visit pointer if encounter still exists
  1. ; SCE = encounter IEN
  1. N SCDATA
  1. I $P($G(^SCE(SCE,0)),U,5) S SCDATA(.05)="@" D UPD^SCCVDBU(409.68,SCE,.SCDATA)
  1. ;
  1. Q
  1. ;