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

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

initial load of WorldVistAEHR

File size: 2.1 KB
RevLine 
[613]1PXRRWLSA ;ISL/PKR - Sort appointments for encounter summary report. ;12/1/98
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**20,61**;Aug 12, 1996
3 ;
4 ;Sort the encounters found in PXRRWLSE and attach them to appointments.
5SORT ;
6 N APPT,BUSY,DATE,DFN,FACILITY,IC,OUPENC,POV,STOIND,VIEN
7 N MULTPR
8 ;
9 ;Allow the task to be cleaned up upon successful completion.
10 S ZTREQ="@"
11 ;
12 I '(PXRRQUE!$D(IO("S"))) D INIT^PXRRBUSY(.BUSY)
13 ;
14 S FACILITY=0
15NFAC S FACILITY=$O(^XTMP(PXRRXTMP,FACILITY))
16 I +FACILITY=0 G DONE
17 ;
18 S STOIND=""
19NIND S STOIND=$O(^XTMP(PXRRXTMP,FACILITY,STOIND))
20 I STOIND="" G NFAC
21 ;
22 S DFN=0
23NDFN S DFN=$O(^XTMP(PXRRXTMP,FACILITY,STOIND,"PATIENT",DFN))
24 I +DFN=0 G NIND
25 ;
26 S DATE=0
27NDATE S DATE=$O(^XTMP(PXRRXTMP,FACILITY,STOIND,"PATIENT",DFN,DATE))
28 I +DATE=0 G NDFN
29 ;
30 ;If this is an interactive session let the user know that something
31 ;is happening.
32 I '(PXRRQUE!$D(IO("S"))) D SPIN^PXRRBUSY("Sorting appointments",.BUSY)
33 ;
34 ;Check for a user request to stop the task.
35 I $$S^%ZTLOAD S ZTSTOP=1 D EXIT^PXRRGUT
36 ;
37 S VIEN=0
38NVISIT S VIEN=$O(^XTMP(PXRRXTMP,FACILITY,STOIND,"PATIENT",DFN,DATE,VIEN))
39 I +VIEN=0 G NDATE
40 ;
41 S MULTPR=$G(^XTMP(PXRRXTMP,FACILITY,STOIND,"PATIENT",DFN,DATE,VIEN))
42 ;
43 ;We have a DFN, DATE, and a VIEN look for an appointment.
44 ;We will need DBIAs for reading DPT and SCE.
45 S APPT=$G(^DPT(DFN,"S",DATE,0))
46 S OUPENC=$P(APPT,U,20)
47 I $L(OUPENC)>0 D
48 .;Make sure that we point back to the same visit.
49 . I $P($G(^SCE(OUPENC,0)),U,5)=VIEN D
50 ..;Save the purpose of visit.
51 .. S POV=$P(APPT,U,7)
52 .. S ^XTMP(PXRRXTMP,FACILITY,STOIND,"POV",POV)=$G(^XTMP(PXRRXTMP,FACILITY,STOIND,"POV",POV))+1
53 .. I MULTPR=1 D
54 ... S ^XTMP(PXRRXTMP,FACILITY,"&&","POV",POV)=$G(^XTMP(PXRRXTMP,FACILITY,"&&","POV",POV))+1
55 G NVISIT
56 ;
57DONE ;
58 ;Sorting is done.
59 I '(PXRRQUE!$D(IO("S"))) D DONE^PXRRBUSY("done")
60EXIT ;
61 ;
62 ;Print the report information.
63 I PXRRQUE D
64 .;Start the printing that was queued but not scheduled.
65 . N DESC,ROUTINE,TASK
66 . S ROUTINE="PXRRWLPR"
67 . S DESC="Encounter Summary Report - print"
68 . S ZTDTH=$$NOW^XLFDT
69 . S TASK=^XTMP(PXRRXTMP,"PRZTSK")
70 . D REQUE^PXRRQUE(DESC,ROUTINE,TASK)
71 E D ^PXRRWLPR
72 Q
73 ;
Note: See TracBrowser for help on using the repository browser.