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

PXKCO.m

Go to the documentation of this file.
  1. PXKCO ;ISL/JVS,ESW - Provider-Dx-CPT-VSIT at check-out ; 11/20/02 4:43pm
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**28,41,96**;Aug 12, 1996
  1. ;Routine-set varibles-Check-out
  1. ; VARIABLE LIST
  1. ;
  1. ; PXKAFT = After picture of the encounter provider entry
  1. ; PXKBEF = Before picture of the encounter provider entry
  1. ; PXKDFN = The DFN of the patient(IEN in file 2 or 9000001)
  1. ; PXKNODA,PXKNODB = Before and After Enounter NODE
  1. ; PXKPR,PXKAPR,PXKBPR = PROVIDER IEN in VA(200
  1. ; PXKREF = Reference to the temp global
  1. ; PXKSOR = Source of data(CO,EF,WS,DE)
  1. ; PXKOE = outpatient encounter IEN in SCE
  1. ; PXKOA = Operating/attending(e.g "O" or "A")
  1. ; PXKORG = Orginating process
  1. ; PXKPRI = IFN of OUTPATIENT PROVIDER (#409.44) file entry
  1. ; PXKPS,PXKAPS = primary/secondary(e.g. "P" or "S")
  1. ; PXKVDT = Visit date and time in fileman format
  1. ; PXKVST = Encounter equavalent visit IEN in VISIT file
  1. ;
  1. W !,"This is NOT an entry point!!" Q
  1. ;
  1. EN1 ;Pims Check-out entry point
  1. N VSIT
  1. I '$D(SDHDL) Q
  1. ;
  1. EN ;---ENTRY POINT
  1. N PXKREF,PXKORG,STOP,PXKOE
  1. S PXKREF="^TMP(""SDEVT"",$J,SDHDL)",STOP=0
  1. ;
  1. ; -- SDHDL is the current process
  1. ; It's always defined.
  1. ;
  1. S PXKORG=0
  1. F S PXKORG=$O(@PXKREF@(PXKORG)) S:"1234"'[PXKORG STOP=1 Q:STOP=1 Q:'PXKORG D
  1. .Q:STOP=1
  1. .N PXKNODB,PXKNODA
  1. .S PXKOE=0 F S PXKOE=$O(@PXKREF@(PXKORG,"SDOE",PXKOE)) Q:'PXKOE D
  1. ..K VSIT
  1. ..N NODE,NODE0,PXKDIV
  1. ..S PXKNODB=$G(@PXKREF@(PXKORG,"SDOE",PXKOE,0,"BEFORE"))
  1. ..S PXKNODA=$G(@PXKREF@(PXKORG,"SDOE",PXKOE,0,"AFTER"))
  1. ..S VSIT("IENB")=$P(PXKNODB,"^",5) ;BEFORE IEN
  1. ..S VSIT("IEN")=$P(PXKNODA,"^",5) ;VISIT IEN
  1. ..Q:$G(VSIT("IEN"))<1
  1. ..;
  1. ..S NODE0=$G(^AUPNVSIT(VSIT("IEN"),0))
  1. ..S NODE=$G(^AUPNVSIT(VSIT("IEN"),150))
  1. ..Q:NODE0=""
  1. ..;
  1. ..;gathering the changed data elements
  1. ..I $P(NODE0,U,21)'=$P(PXKNODA,U,13) S VSIT("ELG")=$P(PXKNODA,"^",13) ;ELIGIBILITY
  1. ..I $P(PXKNODB,U,3)'=$P(PXKNODA,U,3) S VSIT("DSS")=$P(PXKNODA,"^",3) ;CLINIC STOP CODE
  1. ..I $P(PXKNODB,U,11)'=$P(PXKNODA,U,11) S PXKDIV=$P($G(PXKNODA),"^",11) ;DIVISION
  1. ..I $D(PXKDIV) S VSIT("INS")=$S(+$P(NODE0,U,6)>0:$P(NODE0,U,6),+PXKDIV>0:$P($G(^DG(40.8,+PXKDIV,0)),"^",7),1:"") ;INSTITUTION; PX/96 - accept INSTITUTION if passed to PCE.
  1. ..;
  1. ..I '$D(VSIT("ELG")),'$D(VSIT("DSS")),'$D(VSIT("INS")) Q
  1. ..;
  1. ..;check for necessary changes to SVC and PRI
  1. ..I ($D(VSIT("DSS"))),($P(PXKNODA,U,8)'=4),(NODE]"") DO
  1. ...S VSIT("SVC")=$$SVC("A",VSIT("DSS"),$P(NODE,U,2),$P(PXKNODA,U,4))
  1. ...S VSIT("PRI")=$$PRI($P(NODE,U,3),VSIT("DSS"))
  1. ..;
  1. ..D UPD^VSIT
  1. ..K VSIT
  1. Q
  1. ;
  1. SVC(SVC,DSS,PXKIO,LOC) ;
  1. ;This tag performs the same tests for the Service Catagory that are in
  1. ;the visit tracking routine VSITDEF. This has been added as part of
  1. ;patch SD*5.3*66
  1. ;INPUTS SVC - The service category to start with.
  1. ; DSS - The Clinic stop code or DSS Identifier.
  1. ; PXKIO - The Patient status.
  1. ; LOC - The location of the visit.
  1. ;
  1. ;OUTPUT SVC - The service category need based upon DSS and PXKIO
  1. ;
  1. I SVC="E" G SVCQ
  1. I $P(^DIC(40.7,+DSS,0),"^",1)["TELE" S SVC="T" G SVCQ ;any TELEphone
  1. I $O(^VSIT(150.1,"B",$P(^DIC(40.7,+DSS,0),"^",2),0)) S SVC="X"
  1. I SVC="",+DSS=$P($G(^SC(+LOC,0)),"^",7) S SVC="A"
  1. I SVC="" S SVC="X"
  1. I PXKIO S SVC=$S(SVC="A":"I",SVC="X":"D",1:SVC)
  1. E S SVC=$S(SVC="I":"A",SVC="D":"X",1:SVC)
  1. SVCQ Q SVC
  1. ;
  1. PRI(PRI,DSS) ;
  1. ;This tag performs the same checks for the encounter type as in VSITDEF
  1. ;It has been added as part of SD*5.3*66
  1. ;INPUT PRI - Encounter type
  1. ; DSS - The Clinic stop code or DSS ID.
  1. ;
  1. ;OUTPUT PRI - The Encounter type based upon DSS
  1. ;
  1. I PRI="P",$O(^VSIT(150.1,"B",+$P($G(^DIC(40.7,+DSS,0)),"^",2),0)) S PRI="O"
  1. E I PRI="O",'$O(^VSIT(150.1,"B",+$P($G(^DIC(40.7,+DSS,0)),"^",2),0)) S PRI="P"
  1. Q PRI