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

BHSPL.m

Go to the documentation of this file.
BHSPL ;IHS/MSC/MGH  - Health Summary for Problem list ;18-Sep-2013 09:44;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,6,8**;Mar 17,2006;Build 22
 ;===================================================================
 ; IHS/TUCSON/LAB - PART 4 OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;  [ 06/24/97  2:42 PM ]
 ;;2.0;IHS RPMS/PCC Health Summary;;JUN 24, 1997
 ;Copied and changed to be used in VA health summary
 ;Patch 8 updated for SNOMED problem list
 ;
PROB ; EP ******************** PROBLEM / NOTES * 9000011 *********
APROB S BHSTAT="ASEO" G COMMON
IPROB S BHSTAT="I"
 ; <SETUP>
COMMON ;
 N BHSPAT,BHSX,BHSFPP,BHSFAC,BHSQ
 S BHSPAT=DFN
 ;Q:'$D(^AUPNPROB("AC",BHSPAT))
 K BHSDFT S BHSNDF=0
 S BHSFAC="" F BHSQ=0:0 S BHSFAC=$O(^AUPNPROB("AA",BHSPAT,BHSFAC)) Q:'BHSFAC  D PROBSCH
 ;Q:BHSNDF=0
 D CKP^GMTSUP G:$D(GMTSQIT) PROBX
 ; <DISPLAY>
 D CKP^GMTSUP Q:$D(GMTSQIT)
 I BHSNDF>0 W ?13,"ENT.    MODIFIED",!
 S BHSFPP="" F BHSQ=0:0 S BHSFPP=$O(BHSDFT(BHSFPP)) Q:BHSFPP=""  S BHSDFN=BHSDFT(BHSFPP) D PROBDSP
COMMON1 ;additional stuff for review IHS/MSC/MGH
 ;get date last reviewed and display
 S BHSX=$$LASTPLR^APCLAPI6(BHSPAT,,DT,"A")
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W !,"Problem List Reviewed On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",?54,$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
 S BHSX=$$LASTPLU^APCLAPI6(BHSPAT,,DT,"A")
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W "Problem List Updated On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",?54,$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
 I BHSTAT]"" D
 .S BHSX=$$LASTNAP^APCLAPI6(BHSPAT,,DT,"A")
 .D CKP^GMTSUP Q:$D(GMTSQIT)
 .W "No Active Problems Documented On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
PROBX K BHSDFT,BHSNDF,BHSFPP,BHSFAC,BHSPLN,BHSPBN,BHSDTM,BHSDTN,BHSPRB,BHSTAT,BHSNFP,BHSNRQ,BHSPNM,BHSDFN,BHSFCN,BHSICD,BHSDOO
 K BHSICL,BHSILN,BHSN,BHSNAR,BHSNTE,BHSQ,BHSTXT,BHSSNO
 K BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,Y,X
 Q
PROBSCH ;
 S BHSPRB="" F BHSQ=0:0 S BHSPRB=$O(^AUPNPROB("AA",BHSPAT,BHSFAC,BHSPRB)) Q:BHSPRB=""  D
 .S BHSDFN=$O(^AUPNPROB("AA",BHSPAT,BHSFAC,BHSPRB,"")) Q:BHSDFN=""  D
 ..S:BHSTAT[$P(^AUPNPROB(BHSDFN,0),U,12) BHSNDF=BHSNDF+1,BHSDFT(BHSFAC_BHSPRB)=BHSDFN
 Q
PROBDSP ;
 ; <SETUP PROBLEM>
 S BHSN=^AUPNPROB(BHSDFN,0)
 S BHSSNO=$$GET1^DIQ(9000011,BHSDFN,80001)
 S BHSICD=$P(BHSN,U,1) D GETPLICD^BHSUTL
 S BHSNRQ=$P(BHSN,U,5) D GETNARR^BHSUTL
 S BHSITE=$P(BHSN,U,6) D GETSITE^BHSUTL
 S BHSPNM=$P(BHSN,U,7) ;***** EDE *****
 S BHSPNM=BHSNAB_BHSPNM ;***** EDE *****
 S X=$P(BHSN,U,3) D REGDT4^GMTSU S BHSDTM=X
 S X=$P(BHSN,U,8) D REGDT4^GMTSU S BHSDTN=X
 S X=$P(BHSN,U,13)
 I X]"" D REGDT4^GMTSU S BHSDOO=X
 I X="" S BHSDOO=""
 S:BHSDOO]"" BHSNTE=" (onset "_BHSDOO_")"
 S BHSPLN=BHSPNM_$E("         ",1,12-$L(BHSPNM))_BHSDTN_" "_BHSDTM_" "
 D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG ?13,"ENT.    MODIFIED",!
 I BHSSNO'="" S BHSNRQ=BHSNRQ_" ("_BHSSNO_")"
 W BHSPLN S BHSICL=30,BHSILN=50 D PRTICD^BHSUTL
 D NOTEDSP
 D QUAL(BHSDFN)
 D RECON(BHSDFN)
 Q
NOTEDSP ; DISPLAY NOTES UNDER BHSPRBLEM
 S BHSNFP=0 F BHSQ=0:0 S BHSNFP=$O(^AUPNPROB(BHSDFN,11,BHSNFP)) Q:'BHSNFP  D DSPFACN
 Q
DSPFACN ; DISPLAY NOTES FOR SELECTED APSHCFACILITY
 Q:$D(^AUPNPROB(BHSDFN,11,BHSNFP,11,0))'=1  Q:$O(^(0))=""
 S BHSITE=^AUPNPROB(BHSDFN,11,BHSNFP,0) D GETSITE^BHSUTL S BHSFCN=BHSNAB
 S BHSNDF=0 F BHSQ=0:0 S BHSNDF=$O(^AUPNPROB(BHSDFN,11,BHSNFP,11,BHSNDF)) Q:'BHSNDF  S BHSN=^(BHSNDF,0) D DSPN
 Q
DSPN ; DISPLAY SINGLE NOTE
 Q:$P(BHSN,U,4)="I"
 S BHSNAR=$P(BHSN,U,3) S X=$P(BHSN,U,5) ;S:Y="" Y="            "
 I X>0 D REGDT4^GMTSU S X=X_" -  "
 S BHSNAR=BHSNAR_" "_X
 ;W ?22,BHSFCN,"#",$E(1000+$P(BHSN,U,1),2,4)_" ",$P(BHSN,U,3),!
 F BHSQ=0:0 Q:$E(BHSFCN)'=" "  S BHSFCN=$E(BHSFCN,2,99)
 D CKP^GMTSUP Q:$D(GMTSQIT)  W ?10,BHSFCN_" Note "_$P(BHSN,U)
 S BHSTXT=BHSNAR,BHSICL=31 D PRTTXT^BHSUTL
 Q
PLDETAIL ;DISPLAY PROBLEM DETAILS IN HELATH SUMMARY
 N PROB,CNT,RET,PRIEN,I,STAT,LINE,Y,TYPE
 S TYPE="ASEO"
 I $G(NUM)="" S NUM=99999
 S RET=""
 S (CNT,PRIEN)=0
 D CKP^GMTSUP Q:$D(GMTSQIT)
 F  S PRIEN=$O(^AUPNPROB("AC",DFN,PRIEN)) Q:'PRIEN  D
 .;Check for which statuses to return
 .S STAT=$P($G(^AUPNPROB(PRIEN,0)),U,12)
 .Q:STAT="D"
 .Q:TYPE'[STAT
 .D DETAIL^BGOPRDD(.RET,PRIEN,DFN,"A",NUM)             ;Get a detail report on one problem
 .S LINE=0
 .F  S LINE=$O(@RET@(LINE)) Q:LINE=""  D
 ..D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W !,"Active Problem List",!
 ..W @RET@(LINE),!
 K RET
 Q
INPROB ;DISPLAY PROBLEM DETAILS OF INACTIVE PROBLEMS
 N PROB,CNT,RET,PRIEN,I,STAT,LINE,Y
 S TYPE="I"
 ;For Visit instructions and treatments, the default is the latest visit
 I $G(NUM)="" S NUM=99999
 S RET=$$TMPGBL
 S (CNT,PRIEN)=0
 D CKP^GMTSUP Q:$D(GMTSQIT)
 F  S PRIEN=$O(^AUPNPROB("AC",DFN,PRIEN)) Q:'PRIEN  D
 .;Check for which statuses to return
 .S STAT=$P($G(^AUPNPROB(PRIEN,0)),U,12)
 .Q:STAT="D"
 .Q:TYPE'[STAT
 .D DETAIL^BGOPRDD(.RET,PRIEN,DFN,"C",NUM)             ;Get a detail report on one problem
 .S LINE=0
 .F  S LINE=$O(@RET@(LINE)) Q:LINE=""  D
 ..D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W !,"Inactive Problem List",!
 ..W @RET@(LINE),!
 K RET
 Q
RECON(PROB) ;Find when this problem was reconciled
 N REC,IEN,AIEN,WHEN,BY
 S REC=""
 F  S REC=$O(^BEHOCIR("G","P",PROB,REC)) Q:REC=""  D
 .S IEN="" F  S IEN=$O(^BEHOCIR("G","P",PROB,REC,IEN)) Q:IEN=""  D
 ..S AIEN=IEN_","_REC_","
 ..S WHEN=$$GET1^DIQ(90461.632,AIEN,.01)
 ..S BY=$$GET1^DIQ(90461.632,AIEN,.02)
 ..W ?10,"Reconciled on: "_WHEN_" by "_BY,!
 Q
QUAL(IEN) ;Get any qualifiers for this problem
 N AIEN,IEN2,BY,WHEN,X,FNUM,Q,STRING,STRING2,STRING3
 I $D(^AUPNPROB(IEN,13))!($D(^AUPNPROB(IEN,17)))!($D(^AUPNPROB(IEN,18)))
 S (STRING,STRING2,STRING3)=""
 F X=13,17,18 D
 .S FNUM=$S(X=13:9000011.13,X=17:9000011.17,X=18:9000011.18)
 .S IEN2=0 F  S IEN2=$O(^AUPNPROB(IEN,X,IEN2)) Q:'+IEN2  D
 ..S AIEN=IEN2_","_IEN_","
 ..S Q=$$GET1^DIQ(FNUM,AIEN,.01)
 ..S Q=$$CONCEPT^BGOPAUD(Q)
 ..I X=13 D
 ...I STRING="" S STRING=Q
 ...E  S STRING=STRING_" "_Q
 ..I X=17 D
 ...I STRING2="" S STRING2=Q
 ...E  S STRING2=STRING2_" "_Q
 ..I X=18 D
 ...I STRING="" S STRING=Q
 ...E  S STRING=STRING_" "_Q
 I STRING'=""!(STRING2'="")!(STRING3'="") W !,?10,"QUALIFIERS",!
 I STRING'="" W ?10,STRING,!
 I STRING2'="" W ?10,STRING2,!
 I STRING3'="" W ?10,STRING3,!
TMPGBL() ;EP
 K ^TMP("BHSPL",$J) Q $NA(^($J))