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

BHSPLOB.m

Go to the documentation of this file.
BHSPLOB ;IHS/MSC/MGH  - Health Summary for V OB notes ;12-Jul-2016 17:35;MGH
 ;;1.0;HEALTH SUMMARY COMPONENTS;**14**;Mar 17,2006;Build 4
 ;===================================================================
OBDT ;DISPLAY V OB DATA SORTED BY DATE IN HEALTH SUMMARY
 N X,LINE,NUM,PRIEN,PROB,VCNT,VSCNT
 N INVDT,IEN,EDATE,SIGN,STAT,FOUND,SDATE,EIE,SIGNDT
 ;The default is the latest visit
 I $G(GMTSNDM)="" S NUM=99
 E  S NUM=GMTSNDM
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ;Get last date entries for each date  of OB notes
 S VCNT=0,FOUND=0,SDATE="",VSCNT=0
 S VIEN=$G(VIEN)
 S PRIEN="" F  S PRIEN=$O(^AUPNVOB("AE",DFN,PRIEN)) Q:'+PRIEN  D
 .S INVDT="" F  S INVDT=$O(^AUPNVOB("AE",DFN,PRIEN,INVDT)) Q:'+INVDT  D
 ..S IEN="" F  S IEN=$O(^AUPNVOB("AE",DFN,PRIEN,INVDT,IEN)) Q:IEN=""  D
 ...S EIE=$$GET1^DIQ(9000010.43,IEN,.06,"I")
 ...Q:EIE=1
 ...S STAT=$P($G(^AUPNPROB(PRIEN,0)),U,12)
 ...Q:STAT="D"
 ...S EDATE=9999999-INVDT
 ...S EDATE=$$FMTE^XLFDT($P(EDATE,".",1),5)
 ...S SIGNDT=$$GET1^DIQ(9000010.58,IEN,.05,"I")
 ...S SIGNDT=$$FMTE^XLFDT($P(SIGNDT,".",1),5)
 ...S SIGN=$$GET1^DIQ(9000010.43,IEN,.04,"E")
 ...S PROB=$$GET1^DIQ(9000011,PRIEN,.05)
 ...W !,"Date: "_EDATE_"   Problem: "_PROB
 ...D TEXT2(IEN)
 Q
OBPR ;DISPLAY V OB data SORTED BY PROBLEM IN HEALTH SUMMARY
 N X,LINE,NUM,PRIEN,INVDT,IEN,EIE,STAT,OLDPRB,EDATE,SIGNDT,SIGN,PROB
 ;The default is the latest visit
 I $G(GMTSNDM)="" S NUM=99
 E  S NUM=GMTSNDM
 D CKP^GMTSUP Q:$D(GMTSQIT)
 S PRIEN="" F  S PRIEN=$O(^AUPNVOB("AE",DFN,PRIEN)) Q:'+PRIEN  D
 .S OLDPRB=""
 .S INVDT="" F  S INVDT=$O(^AUPNVOB("AE",DFN,PRIEN,INVDT)) Q:'+INVDT  D
 ..S IEN="" F  S IEN=$O(^AUPNVOB("AE",DFN,PRIEN,INVDT,IEN)) Q:IEN=""  D
 ...S EIE=$$GET1^DIQ(9000010.43,IEN,.06,"I")
 ...Q:EIE=1
 ...S STAT=$P($G(^AUPNPROB(PRIEN,0)),U,12)
 ...Q:STAT="D"
 ...I OLDPRB="" D
 ....W !,"Problem: "_$$GET1^DIQ(9000011,PRIEN,.05)
 ....S OLDPRB=PRIEN
 ...S EDATE=9999999-INVDT
 ...S EDATE=$$FMTE^XLFDT($P(EDATE,".",1),5)
 ...S SIGNDT=$$GET1^DIQ(9000010.58,IEN,.05,"I")
 ...S SIGNDT=$$FMTE^XLFDT($P(SIGNDT,".",1),5)
 ...S SIGN=$$GET1^DIQ(9000010.43,IEN,.04,"E")
 ...S PROB=$$GET1^DIQ(9000010.43,IEN,.01)
 ...W !,"Date: "_EDATE
 ...D TEXT2(IEN)
 Q
TEXT2(IEN) ;do the text
 N TXTIEN,WRAP,TXT,PRNT2,PRNT
 S (PRNT,PRNT2,WRAP)=""
 S TXTIEN=0 F  S TXTIEN=$O(^AUPNVOB(IEN,11,TXTIEN)) Q:'+TXTIEN  D
 .S TXT=$G(^AUPNVOB(IEN,11,TXTIEN,0))
 .S PRNT=PRNT2_TXT S PRNT2=""
 .I $L(PRNT)>500 S PRNT2=$E(PRNT,501,$L(PRNT))
 .D WRAP^BTIUPV1(.WRAP,PRNT,70)
 ;Process each wrapped line
 I $D(WRAP)>1 D PROC(.WRAP)
 W !
 Q
PROC(WRAP) ;Process the word wrap
 N I,LINE
 F I=1:1:WRAP D
 .I I=WRAP D
 ..I $L(WRAP(I))<45 D
 ...S LINE="   "_$G(WRAP(I))_" ("_SIGNDT_" by "_SIGN_")"
 ...W !,LINE
 ..E  D
 ...W !,"   "_$G(WRAP(I))
 ...W !,"   ("_SIGNDT_" by "_SIGN_")"
 .E  W !,"   "_$G(WRAP(I))
 Q
TMPGBL() ;EP
 K ^TMP("BHSPL",$J) Q $NA(^($J))