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

AMHLETN.m

Go to the documentation of this file.
AMHLETN ; IHS/CMI/LAB - DISPLAY/EDIT TREATMENT NOTES ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**5**;JUN 02, 2010;Build 18
 ;
 ;
 ;
PRTTXT ; GENERALIZED TEXT PRINTER
 S AMHLETP("DLT")=1,AMHLETP("ILN")=80-AMHLETP("ICL")-1
 F AMHLETP("Q")=0:0 S:AMHLETP("NRQ")]""&(($L(AMHLETP("NRQ"))+$L(AMHLETP("TXT"))+2)<255) AMHLETP("TXT")=$S(AMHLETP("TXT")]"":AMHLETP("TXT")_"; ",1:"")_AMHLETP("NRQ"),AMHLETP("NRQ")="" Q:AMHLETP("TXT")=""  D PRTTXT2
 K AMHLETP("ILN"),AMHLETP("DLT"),AMHLETP("F"),AMHLETP("C"),AMHLETP("TXT"),AMHTDOO
 Q
PRTTXT2 D GETFRAG W ?AMHLETP("ICL") W AMHLETP("F"),! S AMHLETP("ICL")=AMHLETP("ICL")+AMHLETP("DLT"),AMHLETP("ILN")=AMHLETP("ILN")-AMHLETP("DLT"),AMHLETP("DLT")=0
 Q
GETFRAG I $L(AMHLETP("TXT"))<AMHLETP("ILN") S AMHLETP("F")=AMHLETP("TXT"),AMHLETP("TXT")="" Q
 F AMHLETP("C")=AMHLETP("ILN"):-1:1 Q:$E(AMHLETP("TXT"),AMHLETP("C"))=" "
 S AMHLETP("F")=$E(AMHLETP("TXT"),1,AMHLETP("C")-1),AMHLETP("TXT")=$E(AMHLETP("TXT"),AMHLETP("C")+1,255)
 Q
 ;
GETNUM(AMHPROBN) ;EP - get next TP NUMBER
 NEW %,Y,X,AMHLETP
 S (%,X)=0 F  S %=$O(^AMHPTP("AE",AMHPROBN,%)) Q:%'=+%  S X=%
 S AMHLETP("NUM")=X+1
 Q AMHLETP("NUM")
DISP ;EP - display current Treatment plans for this problem
 ;AMHLETP("PROB IEN")=PROBLEM IEN
 ;NO paging is done, just scroll
 Q:'$G(AMHLETP("PROB IEN"))
 S AMHLETP("PROB REC")=^AMHPPROB(AMHLETP("PROB IEN"),0)
 W !!,"Problem #",+$P(AMHLETP("PROB REC"),U,7),?17,"Problem Diagnosis: ",$P(^AMHPROB($P(AMHLETP("PROB REC"),U),0),U),?45,"Patient: ",$E($P(^DPT($P(AMHLETP("PROB REC"),U,2),0),U),1,25)
 W !,"Provider Narrative: " S AMHLETP("NRQ")=$$GET1^DIQ(9002011.51,AMHLETP("PROB IEN"),.05),AMHLETP("ICL")=21,AMHLETP("TXT")="" D PRTTXT
 I $O(^AMHPTP("AE",AMHLETP("PROB IEN"),"")) W !,"TREATMENT NOTES:",!
 ;I '$O(^AMHPTP("AE",AMHLETP("PROB IEN"),"")) W !!,"No Treatment Plans recorded for this problem.",! K AMHLETP Q
 NEW %
 S %=0 F  S %=$O(^AMHPTP("AE",AMHLETP("PROB IEN"),%)) Q:%'=+%  D
 .S AMHLETP("TP IEN")=$O(^AMHPTP("AE",AMHLETP("PROB IEN"),%,""))
 .Q:'AMHLETP("TP IEN")
 .S AMHLETP("TN")=^AMHPTP(AMHLETP("TP IEN"),0)
 .S AMHLETP("DON")=$P(AMHLETP("TN"),U,5) I AMHLETP("DON")]"" S AMHLETP("DON")=$E(AMHLETP("DON"),4,5)_"/"_$E(AMHLETP("DON"),6,7)_"/"_$E(AMHLETP("DON"),2,3)
 .S AMHLETP("PT")=$P(AMHLETP("TN"),U,7) S AMHLETP("PT")=$S(AMHLETP("PT")=1:"STP",AMHLETP("PT")=2:"LTP",1:"   ")
 .S AMHLETP("AUTH")=$P(AMHLETP("TN"),U,6) I AMHLETP("AUTH")]"" S AMHLETP("AUTH")=$P(^VA(200,AMHLETP("AUTH"),0),U,2)
 .W ?2,+AMHLETP("TN"),?5,AMHLETP("PT"),?10,AMHLETP("DON"),?19,AMHLETP("AUTH")
 .S AMHLETP("NRQ")=$P(AMHLETP("TN"),U,4),AMHLETP("ICL")=23,AMHLETP("TXT")="" D PRTTXT
 .Q
 K AMHLETP,Y
 Q
 ;
DEL ;EP - called from template to delete all TP's for a PROBLEM
 ;AMHPDFN - problem ien
 D EN^XBNEW("EN1^AMHLETN","AMHPDFN;AUPN*")
 Q
EN1 ;EP - called from xbnew
 S AMHX=0 F  S AMHX=$O(^AMHPTP("AD",AMHPDFN,AMHX)) Q:AMHX'=+AMHX  S DA=AMHX,DIK="^AMHPTP(" D ^DIK
 K AMHX
 Q