| [613] | 1 | SCDXPRN1 ;ALB/JRP - HISTORY FILE REPORTS;21-JUL-1997
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**128,140**;AUG 13, 1993
 | 
|---|
 | 3 |  ;
 | 
|---|
 | 4 | PATHIST ;Print transmission history report for patient
 | 
|---|
 | 5 |  ; - Report based within the ACRP Transmission History file (#409.77)
 | 
|---|
 | 6 |  ; - User prompted for patient and encounter date range
 | 
|---|
 | 7 |  ; - Report formatted for 80 columns (allows output to screen)
 | 
|---|
 | 8 |  ;
 | 
|---|
 | 9 |  ;Declare variables
 | 
|---|
 | 10 |  N DFN,BEGDATE,ENDDATE
 | 
|---|
 | 11 |  N DIC,L,FLDS,BY,FR,TO,DISPAR,DHD,X,Y,DTOUT,DUOUT
 | 
|---|
 | 12 |  ;Get patient
 | 
|---|
 | 13 |  W !!!,">> PATIENT SELECTION <<",!
 | 
|---|
 | 14 |  S DIC=2
 | 
|---|
 | 15 |  S DIC(0)="AEMQZ"
 | 
|---|
 | 16 |  D ^DIC
 | 
|---|
 | 17 |  Q:(($D(DTOUT))!($D(DUOUT))!(Y<0))
 | 
|---|
 | 18 |  S DFN=+Y
 | 
|---|
 | 19 |  ;Get date range
 | 
|---|
 | 20 |  W !!!,">> DATE RANGE SELECTION <<",!
 | 
|---|
 | 21 |  ; Earliest and latest date allowed
 | 
|---|
 | 22 |  S BEGDATE=2961001
 | 
|---|
 | 23 |  S ENDDATE=$$DT^XLFDT()
 | 
|---|
 | 24 |  ; Begin date help text
 | 
|---|
 | 25 |  S FR(1)="Enter encounter date to begin search from"
 | 
|---|
 | 26 |  S FR(2)=" "
 | 
|---|
 | 27 |  S FR(3)=$$FMTE^XLFDT(BEGDATE)_" is the earliest date allowed"
 | 
|---|
 | 28 |  S FR(4)=$$FMTE^XLFDT(ENDDATE)_" will be the latest date allowed"
 | 
|---|
 | 29 |  S FR(5)=" "
 | 
|---|
 | 30 |  S FR(6)="Note: Encounter date does not always match date of"
 | 
|---|
 | 31 |  S FR="      transmission to the National Patient Care Database"
 | 
|---|
 | 32 |  ; End date help text
 | 
|---|
 | 33 |  S TO(1)="Enter encounter date to end search at"
 | 
|---|
 | 34 |  S TO(2)=" "
 | 
|---|
 | 35 |  S TO(3)=$$FMTE^XLFDT(ENDDATE)_" is the latest date allowed"
 | 
|---|
 | 36 |  S TO(4)=$$FMTE^XLFDT(BEGDATE)_" was the earliest date allowed"
 | 
|---|
 | 37 |  S TO(5)=" "
 | 
|---|
 | 38 |  S TO(6)="Note: Encounter date does not always match date of"
 | 
|---|
 | 39 |  S TO="      transmission to the National Patient Care Database"
 | 
|---|
 | 40 |  S L=$$GETDTRNG^SCDXUTL1(BEGDATE,ENDDATE,"FR","TO")
 | 
|---|
 | 41 |  Q:(L<0)
 | 
|---|
 | 42 |  S BEGDATE=+$P(L,"^",1)
 | 
|---|
 | 43 |  S ENDDATE=+$P(L,"^",2)
 | 
|---|
 | 44 |  K FR,TO
 | 
|---|
 | 45 |  ;Make end date midnight
 | 
|---|
 | 46 |  S ENDDATE=$$FMADD^XLFDT(ENDDATE,0,23,59,59)
 | 
|---|
 | 47 |  ;Define sort criteria
 | 
|---|
 | 48 |  S DIC="^SD(409.77,"
 | 
|---|
 | 49 |  S L=0
 | 
|---|
 | 50 |  S BY="+.06;S"
 | 
|---|
 | 51 |  S FR=""
 | 
|---|
 | 52 |  S TO=""
 | 
|---|
 | 53 |  ;Pre-sort accomplished through ADFN x-ref
 | 
|---|
 | 54 |  S BY(0)="^SD(409.77,""ADFN"","
 | 
|---|
 | 55 |  S L(0)=3
 | 
|---|
 | 56 |  S FR(0,1)=DFN
 | 
|---|
 | 57 |  S TO(0,1)=DFN
 | 
|---|
 | 58 |  S FR(0,2)=BEGDATE
 | 
|---|
 | 59 |  S TO(0,2)=ENDDATE
 | 
|---|
 | 60 |  ;Define subheader
 | 
|---|
 | 61 |  S DISPAR(0,1)="^;""PATIENT: """
 | 
|---|
 | 62 |  S DISPAR(0,1,"OUT")="N DFN,VA,VAERR S DFN=Y D PID^VADPT S Y=$P($G(^DPT(DFN,0),""BAD DFN""),""^"",1)_""  (""_$S(VAERR:(""#""_DFN),1:VA(""BID""))_"")"""
 | 
|---|
 | 63 |  ;Define print fields
 | 
|---|
 | 64 |  S FLDS="[SCDX XMIT HIST FOR PATIENT]"
 | 
|---|
 | 65 |  ;Define header
 | 
|---|
 | 66 |  S DHD="ACRP TRANSMISSIONS FOR ENCOUNTERS OCCURRING BETWEEN "_$$FMTE^XLFDT(BEGDATE,"5D")_" AND "_$$FMTE^XLFDT(ENDDATE,"5D")
 | 
|---|
 | 67 |  ;Print report
 | 
|---|
 | 68 |  D EN1^DIP
 | 
|---|
 | 69 |  ;Done
 | 
|---|
 | 70 |  Q
 | 
|---|