source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXKCO.m@ 1650

Last change on this file since 1650 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1PXKCO ;ISL/JVS,ESW - Provider-Dx-CPT-VSIT at check-out ; 11/20/02 4:43pm
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**28,41,96**;Aug 12, 1996
3 ;Routine-set varibles-Check-out
4 ; VARIABLE LIST
5 ;
6 ; PXKAFT = After picture of the encounter provider entry
7 ; PXKBEF = Before picture of the encounter provider entry
8 ; PXKDFN = The DFN of the patient(IEN in file 2 or 9000001)
9 ; PXKNODA,PXKNODB = Before and After Enounter NODE
10 ; PXKPR,PXKAPR,PXKBPR = PROVIDER IEN in VA(200
11 ; PXKREF = Reference to the temp global
12 ; PXKSOR = Source of data(CO,EF,WS,DE)
13 ; PXKOE = outpatient encounter IEN in SCE
14 ; PXKOA = Operating/attending(e.g "O" or "A")
15 ; PXKORG = Orginating process
16 ; PXKPRI = IFN of OUTPATIENT PROVIDER (#409.44) file entry
17 ; PXKPS,PXKAPS = primary/secondary(e.g. "P" or "S")
18 ; PXKVDT = Visit date and time in fileman format
19 ; PXKVST = Encounter equavalent visit IEN in VISIT file
20 ;
21 W !,"This is NOT an entry point!!" Q
22 ;
23EN1 ;Pims Check-out entry point
24 N VSIT
25 I '$D(SDHDL) Q
26 ;
27EN ;---ENTRY POINT
28 N PXKREF,PXKORG,STOP,PXKOE
29 S PXKREF="^TMP(""SDEVT"",$J,SDHDL)",STOP=0
30 ;
31 ; -- SDHDL is the current process
32 ; It's always defined.
33 ;
34 S PXKORG=0
35 F S PXKORG=$O(@PXKREF@(PXKORG)) S:"1234"'[PXKORG STOP=1 Q:STOP=1 Q:'PXKORG D
36 .Q:STOP=1
37 .N PXKNODB,PXKNODA
38 .S PXKOE=0 F S PXKOE=$O(@PXKREF@(PXKORG,"SDOE",PXKOE)) Q:'PXKOE D
39 ..K VSIT
40 ..N NODE,NODE0,PXKDIV
41 ..S PXKNODB=$G(@PXKREF@(PXKORG,"SDOE",PXKOE,0,"BEFORE"))
42 ..S PXKNODA=$G(@PXKREF@(PXKORG,"SDOE",PXKOE,0,"AFTER"))
43 ..S VSIT("IENB")=$P(PXKNODB,"^",5) ;BEFORE IEN
44 ..S VSIT("IEN")=$P(PXKNODA,"^",5) ;VISIT IEN
45 ..Q:$G(VSIT("IEN"))<1
46 ..;
47 ..S NODE0=$G(^AUPNVSIT(VSIT("IEN"),0))
48 ..S NODE=$G(^AUPNVSIT(VSIT("IEN"),150))
49 ..Q:NODE0=""
50 ..;
51 ..;gathering the changed data elements
52 ..I $P(NODE0,U,21)'=$P(PXKNODA,U,13) S VSIT("ELG")=$P(PXKNODA,"^",13) ;ELIGIBILITY
53 ..I $P(PXKNODB,U,3)'=$P(PXKNODA,U,3) S VSIT("DSS")=$P(PXKNODA,"^",3) ;CLINIC STOP CODE
54 ..I $P(PXKNODB,U,11)'=$P(PXKNODA,U,11) S PXKDIV=$P($G(PXKNODA),"^",11) ;DIVISION
55 ..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.
56 ..;
57 ..I '$D(VSIT("ELG")),'$D(VSIT("DSS")),'$D(VSIT("INS")) Q
58 ..;
59 ..;check for necessary changes to SVC and PRI
60 ..I ($D(VSIT("DSS"))),($P(PXKNODA,U,8)'=4),(NODE]"") DO
61 ...S VSIT("SVC")=$$SVC("A",VSIT("DSS"),$P(NODE,U,2),$P(PXKNODA,U,4))
62 ...S VSIT("PRI")=$$PRI($P(NODE,U,3),VSIT("DSS"))
63 ..;
64 ..D UPD^VSIT
65 ..K VSIT
66 Q
67 ;
68SVC(SVC,DSS,PXKIO,LOC) ;
69 ;This tag performs the same tests for the Service Catagory that are in
70 ;the visit tracking routine VSITDEF. This has been added as part of
71 ;patch SD*5.3*66
72 ;INPUTS SVC - The service category to start with.
73 ; DSS - The Clinic stop code or DSS Identifier.
74 ; PXKIO - The Patient status.
75 ; LOC - The location of the visit.
76 ;
77 ;OUTPUT SVC - The service category need based upon DSS and PXKIO
78 ;
79 I SVC="E" G SVCQ
80 I $P(^DIC(40.7,+DSS,0),"^",1)["TELE" S SVC="T" G SVCQ ;any TELEphone
81 I $O(^VSIT(150.1,"B",$P(^DIC(40.7,+DSS,0),"^",2),0)) S SVC="X"
82 I SVC="",+DSS=$P($G(^SC(+LOC,0)),"^",7) S SVC="A"
83 I SVC="" S SVC="X"
84 I PXKIO S SVC=$S(SVC="A":"I",SVC="X":"D",1:SVC)
85 E S SVC=$S(SVC="I":"A",SVC="D":"X",1:SVC)
86SVCQ Q SVC
87 ;
88PRI(PRI,DSS) ;
89 ;This tag performs the same checks for the encounter type as in VSITDEF
90 ;It has been added as part of SD*5.3*66
91 ;INPUT PRI - Encounter type
92 ; DSS - The Clinic stop code or DSS ID.
93 ;
94 ;OUTPUT PRI - The Encounter type based upon DSS
95 ;
96 I PRI="P",$O(^VSIT(150.1,"B",+$P($G(^DIC(40.7,+DSS,0)),"^",2),0)) S PRI="O"
97 E I PRI="O",'$O(^VSIT(150.1,"B",+$P($G(^DIC(40.7,+DSS,0)),"^",2),0)) S PRI="P"
98 Q PRI
Note: See TracBrowser for help on using the repository browser.