commit 97eed73da228f46c7c81fd4ba8789a973674692a Author: sam Date: Fri Aug 3 22:12:21 2012 +0000 Removing PHP Growth Charts from trunk and putting them in tag diff --git a/GMRVED2.m b/GMRVED2.m new file mode 100644 index 0000000..5d8a150 --- /dev/null +++ b/GMRVED2.m @@ -0,0 +1,142 @@ +GMRVED2 ;HIOFO/RM,YH,FT-VITAL SIGNS EDIT SHORT FORM ;7/20/07 13:43 + ;;5.0;GEN. MED. REC. - VITALS;**2**;Oct 31, 2002;Build 15 + ; + ; This routine uses the following IAs: + ; #10035 - ^DPT( references (supported) + ; #10061 - ^VADPT calls (supported) + ; #10103 - ^XLFDT calls (supported) + ; #10104 - ^XLFSTR calls (supported) + ; +EN1 ; SORT PATIENTS ON WARD + K ^TMP($J) +WSA1 ; SET ^TMP($J, FOR SORT + D DEM^VADPT,INP^VADPT S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK"),GMRNAM=$S(VADM(1)'="":VADM(1),1:" BLANK") D KVAR^VADPT K VA + S:$S("Aa"[GMREDB:1,$D(GMRROOM($P(GMRRMBD,"-"))):1,1:0) ^TMP($J,GMRRMBD,GMRNAM,DFN)="" + S DFN=$O(^DPT("CN",GMRWARD(1),DFN)) + Q:DFN="" G WSA1 +EN2 ; BEGIN EDITING WARD VITALS + I $O(^TMP($J,0))="" S GMROUT=1 Q + W !,"Begin entering patient vitals." S GMRDT0=GMRVIDT + S GMRRMBD="" F GMRI=0:0 S GMRRMBD=$O(^TMP($J,GMRRMBD)) Q:GMRRMBD=""!GMROUT S GMRNAM="" F GMRI=0:0 S GMRNAM=$O(^TMP($J,GMRRMBD,GMRNAM)) Q:GMRNAM=""!GMROUT F DFN=0:0 S DFN=$O(^TMP($J,GMRRMBD,GMRNAM,DFN)) Q:DFN'>0 D V1 Q:GMROUT + W !,"Enter return to continue" R X:DTIME Q +V1 ; + W !!,$S(GMRNAM'=" BLANK":GMRNAM,1:DFN),?$X+10,$S(GMRRMBD'=" BLANK":GMRRMBD,1:"")," OK? YES// " R GMRX:DTIME + I GMRX="^"!('$T) S GMROUT=1 Q + S GMRX=$$UP^XLFSTR(GMRX) I ((GMRX="")!($E(GMRX)="Y")) K GMRTO S GDT=GMRVIDT D EN1^GMRVADM G:GMROUT&'$D(GMRTO) V2 D EN2^GMRVED3 G:GMROUT&'$D(GMRTO) V2 Q + G:GMRX?1"N".E V2 + W !,"ANSWER YES OR NO" G V1 +V2 ; + W !!,"Do you wish to stop looping through names? YES//" R GMRX:DTIME + S GMRX=$$UP^XLFSTR(GMRX) I (('$T)!(GMRX="")!($E(GMRX)="Y")!(GMRX="^")) S GMROUT=1 Q + I GMRX?1"N".E S GMROUT=0 Q + W !,"ANSWER YES OR NO" G V2 +EN4 ; ENTRY FROM GMRVED0 TO ADD THE PATIENT DATA TO THE 120.5 FILE + D NOW^%DTC S GMRDATE=% + F GMRX=2:1:$L(GMRSTR(0),";")-1 S GMRVITY=$P(GMRSTR(0),";",GMRX) D + . S GMRVIT=$S(GMRVITY="T":"TEMPERATURE",GMRVITY="P":"PULSE",GMRVITY="R":"RESPIRATION",GMRVITY="BP":"BLOOD PRESSURE",GMRVITY="HT":"HEIGHT",GMRVITY="CG":"CIRCUMFERENCE/GIRTH",1:"") + . S:GMRVIT="" GMRVIT=$S(GMRVITY="WT":"WEIGHT",GMRVITY="CVP":"CENTRAL VENOUS PRESSURE",GMRVITY="PO2":"PULSE OXIMETRY",GMRVITY="PN":"PAIN",1:"") + . D:$G(GMRDAT(GMRVITY))'=""&(GMRVIT'="") ADDNODE + Q +ADDNODE ; add data to the 120.5 file + N GMVDTDUN,GMVFDA,GMVIEN + S GMVDTDUN=GMRVIDT + S GMRVIT(1)=$O(^GMRD(120.51,"B",GMRVIT,0)) + S GMVDTDUN=$$CHKDT(GMRVIDT,GMRVIT(1)) + S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ;Date/Time + S GMVFDA(120.5,"+1,",.02)=DFN ;Patient + S GMVFDA(120.5,"+1,",.03)=GMRVIT(1) ;Vital Type + S GMVFDA(120.5,"+1,",.04)=GMRDATE ;Date Time entered + S GMVFDA(120.5,"+1,",.05)=GMRVHLOC ;Hospital + S GMVFDA(120.5,"+1,",.06)=DUZ ;Entered by (DUZ) + S GMVFDA(120.5,"+1,",1.2)=GMRDAT(GMRVITY) ;Rate + S GMVFDA(120.5,"+1,",1.4)=$G(GMRO2(GMRVITY)) ;Sup 02 + S GMVIEN="" + D UPDATE^DIE("","GMVFDA","GMVIEN") + ;file any qualifiers + I $D(GMRSITE(GMRVITY))!$D(GMRINF(GMRVITY)) D + .I $G(GMRSITE(GMRVITY))'="" D + ..S GDATA=+$P(GMRSITE(GMRVITY),U,2) + ..Q:'GDATA + ..D ADDQUAL(GMVIEN(1)_"^"_GDATA) + ..Q + .I $D(GMRINF(GMRVITY)) D + ..S I=0 + ..F S I=$O(GMRINF(GMRVITY,I)) Q:I'>0 D + ...S I(1)="" + ...F S I(1)=$O(GMRINF(GMRVITY,I,I(1))) Q:I(1)="" D + ....S GDATA=+$P(GMRINF(GMRVITY,I,I(1)),"^") + ....Q:'GDATA + ....D ADDQUAL(GMVIEN(1)_"^"_GDATA) + ....Q + ...Q + ..Q + .Q + S DA=+GMVIEN(1) + I GMREDB="P1" S GMRVIEN(GMRVITY)=DA_"^"_GMRDAT(GMRVITY)_"^"_$G(GMRSITE(GMRVITY)) + S:GMRENTY>4 GLAST=GMRVIDT,GLAST(1)=$G(GLAST(1))+1 + ; for VOE Pediatric Growth Charts + I "8920"[(+GMRVIT(1)) D EN^GMRVPGC(DFN) ; 8=Height 9=Weight 20=Circumference + Q +XREF(DA) ; Set cross-references for FILE 120.5 entry + ; Execute SET logic only. Set's all cross-references for this entry. + ; DA is the record number + N DIC,DIK,X,Y + Q:'DA + S DIK="^GMR(120.5," + D IX1^DIK + Q +XREF1(DA) ; Set cross-references for FILE 120.5 entry + ; Execute SET logic only. Set's all cross-references for this entry. + ; DA is the record number + N DIC,DIK,GMRVDA,GMRVIEN,X,Y + Q:'DA + S GMRVIEN=0,GMRVDA=DA + F S GMRVIEN=$O(^GMR(120.5,GMRVDA,5,GMRVIEN)) Q:'GMRVIEN D + .S DA(1)=GMRVDA,DA=GMRVIEN + .S DIK="^GMR(120.5,DA(1),5," + .D IX1^DIK + .Q + Q +SETPRMT ; SET VITAL TYPE PATTERN MATCH + S G=$P(GMRSTR(0),";",GMRX) + S GMRHELP=GMRHELP_$S(G="P":"PPP",G="WT":"WWW.WW",G="R":"RR",G="CG":"NNN.NN",G="CVP":"NN",G="PO2":"NNN",G="HT":"HH",G="BP":"BBB/BBB/BBB (or BBB/BBB)",G="T":"TTT.T",G="PN":"NN",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"") + S GMRHELP(1)=GMRHELP(1)_$S(GMRHELP(1)'="":",",1:"")_$P(GMRSTR(0),";",GMRX)_"^GMRVUT1" + S GMRPRMT=GMRPRMT_$S(G="T":"Temp",G="P":"Pulse",G="WT":"Wt.",G="R":"Resp",G="HT":"Ht.",G="BP":"BP",G="CG":"Circumference/Girth",G="CVP":"CVP",G="PO2":"PO2",G="PN":"Pain",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"") + Q +CHKDT(GMVDT,GMVSAV) ;Check if there is an entry for that date & time + N GMVA,GMVTY + S GMVA=0 + F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:'GMVA D + .I DFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q + .S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3) + .I GMVTY=GMVSAV D + ..S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1) + ..Q + .Q + Q GMVDT + ; +ADDQUAL(GMRVDATA) ; Add qualifiers to FILE 120.5 entry + ; ADD QUALIFIER TO 120.505 SUBFILE + ; Input: + ; GMRVDATA=120.5 IEN^QUALIFIER (120.52) IEN + ; + N GMVCNT,GMVERR,GMVFDA,GMVOKAY,GMRVIEN,GMRVQUAL + S GMRVIEN=+$P(GMRVDATA,"^",1) ;File 120.5 ien + S GMRVQUAL=+$P(GMRVDATA,"^",2) ;File 120.52 ien + ; Does File 120.5 entry exist? + I '$D(^GMR(120.5,GMRVIEN,0)) Q + ; Is the qualifier already stored? + I $O(^GMR(120.5,GMRVIEN,5,"B",GMRVQUAL,0))>0 Q + ; Legitimate Qualifier? + I '$D(^GMRD(120.52,GMRVQUAL,0)) Q + S GMVCNT=0 ;counter for number of tries to lock an entry +B2 ; Lock the entry + I GMVCNT>3 Q ;4 strikes and you're out + L +^GMR(120.5,GMRVIEN,0):1 + S GMVCNT=GMVCNT+1 + I '$T L -^GMR(120.5,GMRVIEN,0) G B2 + ; Store the qualifier + S GMVFDA(120.505,"+1,"_GMRVIEN_",",.01)=GMRVQUAL + D UPDATE^DIE("","GMVFDA","GMVOKAY","GMVERR") + L -^GMR(120.5,GMRVIEN,0) + Q diff --git a/GMRVPGC.m b/GMRVPGC.m new file mode 100644 index 0000000..1adf788 --- /dev/null +++ b/GMRVPGC.m @@ -0,0 +1,117 @@ +GMRVPGC ;DBA/CJS - Pediatric Growth Chart HTML generator ;9/26/10 21:59 + ;;5.0;GEN. MED. REC. - VITALS;**[patch list]**;Oct 31, 2002;Build 15 + ; +EN(DFN) ; + N BMI,DIC,DIV,IO,LABEL,LINE,MAXAGE,NAME,NONE,POP,REF,ROOT,SERVER,SEX,STYLE,TMP,TYPE,VAL,VDT,XPARSYS,XQDIC,XQPSM,XQVOL,XVALS,YVALS + S SERVER=$$GET^XPAR("SYS","GMRV PED GROWTH CHART SERVER") + S ROOT=$$GET^XPAR("SYS","GMRV PED GROWTH CHART FOLDER") + ; + S D=^DPT(DFN,0),NAME=$P(D,U),SEX=$P(D,U,2),SEX=$S(SEX="M":1,SEX="F":2,1:0),DOB=$P(D,U,3),DOD=$P($G(^DPT(DFN,.35)),U),PID=$P($G(^DPT(DFN,.36)),U,3) + S Y=DOB D DD^%DT S BIRTH=Y,MAXAGE=$$MNTHSOLD($S(DOD="":DT,DOD'="":DOD),DOB) + ; + ; See if there are any pediatric vitals to be had + ; ^GMR(120.5,"AA",GMRVDFN,GMRVTYP,9999999-GMRVDT,DA)="" "rate" on 0 node piece 8 + ; types: 8 = Height, 9 - Weight, 20 = Circumference/Girth, 73 - Head qualifier + S NONE=1 F TYPE=8,9,20 D + . S XVALS(TYPE)="",YVALS(TYPE)="" + . S VDT=0 F S VDT=$O(^GMR(120.5,"AA",DFN,TYPE,VDT)) Q:VDT'>0 D + . . S DA=+$O(^GMR(120.5,"AA",DFN,TYPE,VDT,0)) + . . I TYPE=20 Q:'$D(^GMR(120.5,DA,5,"B",73)) ; Quit if not "HEAD" + . . Q:+$G(^GMR(120.5,DA,2)) ; Quit if Entered in Error + . . S AGE=$$MNTHSOLD(9999999-VDT,DOB),NONE=0 + . . S XVALS(TYPE)=XVALS(TYPE)_","_AGE + . . S VAL=$P(^GMR(120.5,DA,0),U,8),VAL=$S("8,20"[TYPE:VAL*2.54,TYPE=9:VAL/2.2),VAL=$$ROUND(VAL) + . . I TYPE=8!(TYPE=9) S BMI(AGE,TYPE)=VAL + . . S YVALS(TYPE)=YVALS(TYPE)_","_VAL + . . Q + . Q + ; + ; BMI=WEIGHT/(HEIGHT**2) Weight in Kg, Height in meters + S AGE="",XVALS("BMI")="",YVALS("BMI")="",XVALS("WTHT")="",YVALS("WTHT")="" + F S AGE=$O(BMI(AGE)) Q:AGE'>0 I $D(BMI(AGE,8)),$D(BMI(AGE,9)) D + . S DIV=BMI(AGE,8)**2 + . S:DIV'=0 XVALS("BMI")=XVALS("BMI")_","_AGE,YVALS("BMI")=YVALS("BMI")_","_$$ROUND(10000*BMI(AGE,9)/DIV) + . S XVALS("WTHT")=XVALS("WTHT")_","_BMI(AGE,8),YVALS("WTHT")=YVALS("WTHT")_","_BMI(AGE,9) + . Q + ; + ; Establish HTML doctype & head + S LINE=0 F S LINE=LINE+1,TMP(LINE)=$P($T(HEAD+LINE),";",3) Q:TMP(LINE)="" + ; + ; Set up the href links + S TMP(LINE)="

"_NAME_"

DOB: "_BIRTH_"

",LINE=LINE+1 + S REF="

" + S LABEL(1)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Length centimeters 0-36 months

" + S LABEL(2)=$S(SEX=1:"Male",1:"Female")_" Age in months vs Head Circumference in centimeters 0-36 months

" + S LABEL(4)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Height centimeters over 36 months

" + S LABEL(5)=$S(SEX=1:"Male",1:"Female")_" Body Mass Index-for age

" + S LABEL(6)=$S(SEX=1:"Male",1:"Female")_" Weight vs Stature

" + S LABEL(7)=$S(SEX=1:"Male",1:"Female")_" Weight vs Length

" + S TITLE(0)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Weight in kilograms" + S TITLE(1)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Length centimeters for 0-36 months" + S TITLE(2)=$S(SEX=1:"Male",1:"Female")_" Age in months vs Head Circumference in centimeters for 0-36 months" + S TITLE(4)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Height centimeters over 36 months" + S TITLE(5)=$S(SEX=1:"Male",1:"Female")_" Body Mass Index vs. Age in Months from 24-240 Months" + S TITLE(6)=$S(SEX=1:"Male",1:"Female")_" Weight in Kilograms vs. Height in centimeters" + S TITLE(7)=$S(SEX=1:"Male",1:"Female")_" Weight in Kilograms vs. Length in centimeters" + F STYLE=0,1,2,4,5,6,7 S TYPE=$$TYPE(STYLE) D:$L(XVALS(TYPE)) + . Q:("456"[STYLE)&(MAXAGE<36) + . S TMP(LINE)=REF_SERVER_"?style="_$$STRING(STYLE)_"&title="_TITLE(STYLE)_"&sex="_SEX_"&maxage="_$$AGE(MAXAGE,STYLE)_"&xvals="_$P(XVALS(TYPE),",",2,99)_"&yvals="_$P(YVALS(TYPE),",",2,99)_""">"_LABEL(STYLE) + . S LINE=LINE+1 + . Q + ; + S:NONE TMP(LINE)="

THERE ARE NO GROWTH VITALS TO PLOT.

",LINE=LINE+1 + ; last of the labels + S TMP(LINE)="

Note: should any xvals or yvals value be inappropriate, or there be an unequal number of values in both lists,",LINE=LINE+1 + S TMP(LINE)="the patient plot will be ignored, and a ""blank"" growth chart with percentile values only will be shown.

",LINE=LINE+1 + S TMP(LINE)="" + S TMP(LINE+1)="" + ; + ; Write out the file + D OPEN^%ZISH("OUTFILE",ROOT,DFN_".html","W") S:POP GMRVPGC="ERROR" + Q:POP + U IO + S LINE=0 F S LINE=$O(TMP(LINE)) Q:LINE'>0 W TMP(LINE),! + D CLOSE^%ZISH("OUTFILE") + Q + ; + ; convert age to months +MNTHSOLD(DATE,DOB) ; + S X1=DATE,X2=DOB D ^%DTC S X=X/30.42,X=$$ROUND(X) + Q X + ; +ROUND(X) ; + Q $P(X,".")_"."_$E($P(X,".",2),1,2) + ; +TYPE(STYLE) ; + Q $S(STYLE=0:9,STYLE=1:8,STYLE=2:20,STYLE=4:8,STYLE=5:"BMI",1:"WTHT") + ; +AGE(MAXAGE,STYLE) ; + I MAXAGE<36 Q MAXAGE + I "0456"[STYLE Q MAXAGE + Q 36 + ; +STRING(STYLE) ; + I STYLE=0 Q "weight-age" + I STYLE=1 Q "length-age" + I STYLE=2 Q "head-age" + I STYLE=4 Q "stature-age" + I STYLE=5 Q "bmi-age" + I STYLE=6 Q "weight-stature" + I STYLE=7 Q "weight-length" + Q 0 ;oops! + ; +HEAD ;; + ;; + ;; + ;; + ;; Growth Chart Example + ;; + ;; + ;; + ;; + ;; + ;; + ;;Click on any one of the following to display the available growth charts for your patient. Use the back button to return to the main page. + ;; diff --git a/GMVDCSAV.m b/GMVDCSAV.m new file mode 100644 index 0000000..42fa8be --- /dev/null +++ b/GMVDCSAV.m @@ -0,0 +1,129 @@ +GMVDCSAV ;HOIFO/DAD-VITALS COMPONENT: SAVE DATA ;11/15/07 11:11 + ;;5.0;GEN. MED. REC. - VITALS;**9,3**;Oct 31, 2002;Build 15 + ; + ; This routine uses the following IAs: + ; #10103 - ^XLFDT calls (supported) + ; + ; This routine supports the following IAs: + ; #3996 - GMV ADD VM RPC called at EN1 (private) + ; + ; 01/28/2005 KAM GMRV*5*9 Record midnight with 1 second added + ; Stop adding second on multiple patent entry + ; +EN1(RESULT,GMVDATA) ; GMV ADD VM [RPC entry point] + ; Saves vitals data + N GMVCNT,GMVD0,GMVFDA,GMVINUM,GMVQNUM,GMVRNUM,GMVIEN,GMVDUN + N GMVVNUM,GMVVMEAS,GMVVQUAL,GMVVREAS + D QUALTWO + Q + ;I $O(@GMVDATA@("V",0))>0 D VITMEA + ;I $O(@GMVDATA@("I",0))>0 D ENTERR + ;I $G(RESULT(0))="OK" D MSG("OK: Data saved") + ;Q + ; +VITMEA ; *** Save vital measurement data *** + S GMVVNUM=0 K GMVFDA + S GMVCNT=+$O(@GMVDATA@("V",1E25),-1) + F S GMVVNUM=$O(@GMVDATA@("V",GMVVNUM)) Q:GMVVNUM'>0 D + . S GMVVMEAS=$G(@GMVDATA@("V",GMVVNUM)) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.01)=GMVDTDUN ; Date time taken + . S GMVFDA(120.5,"+"_GMVVNUM_",",.02)=GMVDFN ; Patient + . S GMVFDA(120.5,"+"_GMVVNUM_",",.03)=$P(GMVVMEAS,U) ; + . S GMVFDA(120.5,"+"_GMVVNUM_",",.04)=GMVDTENT ; Date Time entered + . S GMVFDA(120.5,"+"_GMVVNUM_",",.05)=GMVHOSPL ; Hospital + . S GMVFDA(120.5,"+"_GMVVNUM_",",.06)=GMVENTBY ; Entered by (DUZ) + . S GMVFDA(120.5,"+"_GMVVNUM_",",1.2)=$P($P(GMVVMEAS,U,2),";",1) ; Rate + . S GMVFDA(120.5,"+"_GMVVNUM_",",1.4)=$P($P(GMVVMEAS,U,2),";",2) ; Sup 02 + . S GMVQNUM=0 + . F S GMVQNUM=$O(@GMVDATA@("Q",GMVVNUM,GMVQNUM)) Q:GMVQNUM'>0 D + .. S GMVVQUAL=$G(@GMVDATA@("Q",GMVVNUM,GMVQNUM)) + .. S GMVCNT=GMVCNT+1 + .. S GMVFDA(120.505,"+"_GMVCNT_",","+"_GMVVNUM_",",.01)=GMVVQUAL + .. Q + . Q + D UPDATE^DIE("","GMVFDA"),FMERROR + S RESULT(0)="OK" + Q + ; +ENTERR ; *** Save entered in error data *** + S GMVINUM=0 K GMVFDA + S GMVCNT=+$O(@GMVDATA@("I",1E25),-1) + F S GMVINUM=$O(@GMVDATA@("I",GMVINUM)) Q:GMVINUM'>0 D + . S GMVD0=$G(@GMVDATA@("I",GMVINUM)) + . S GMVFDA(120.5,GMVD0_",",2)=1 + . S GMVFDA(120.5,GMVD0_",",3)=GMVERRBY + . S GMVRNUM=0 + . F S GMVRNUM=$O(@GMVDATA@("R",GMVINUM,GMVRNUM)) Q:GMVRNUM'>0 D + .. S GMVVREAS=$G(@GMVDATA@("R",GMVINUM,GMVRNUM)) + .. S GMVCNT=GMVCNT+1 + .. S GMVFDA(120.506,"+"_GMVCNT_","_GMVD0_",",.01)=GMVVREAS + .. Q + . Q + D UPDATE^DIE("","GMVFDA"),FMERROR + S RESULT(0)="OK" + Q +QUALTWO ; Add a new entry to FILE 120.5 + S GMVVNUM=0 K GMVFDA + S GMVVMEAS=$P(GMVDATA,"*",1) ; + S GMVDTDUN=$P(GMVVMEAS,"^",1) ; Date time + ;01/28/2005 KAM GMRV*5*9 Added next Line PAL-0105-60940 + I +$P(GMVDTDUN,".",2)'>0 S GMVDTDUN=$$FMADD^XLFDT(GMVDTDUN,"","","",1) + S GMVDFN=$P(GMVVMEAS,"^",2) ; Patient DFN + S GMVVTYP=$P(GMVVMEAS,"^",3) ; Vital type + S GMVDTDUN=$$CHKDT(GMVDTDUN,$P(GMVVTYP,";",1)) + S GMVDTENT=$$NOW^XLFDT ; Current date time + S GMVHOSPL=$P(GMVVMEAS,"^",4) ; Hospital + S GMVENTBY=$P(GMVVMEAS,"^",5) ; DUZ + S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ; Date time taken + S GMVFDA(120.5,"+1,",.02)=GMVDFN ; Patient + S GMVFDA(120.5,"+1,",.03)=$P(GMVVTYP,";",1) ; Vital Type + S GMVFDA(120.5,"+1,",.04)=GMVDTENT ; Date Time entered + S GMVFDA(120.5,"+1,",.05)=GMVHOSPL ; Hospital + S GMVFDA(120.5,"+1,",.06)=GMVENTBY ; Entered by (DUZ) + S GMVFDA(120.5,"+1,",1.2)=$P(GMVVTYP,";",2) ; Rate + S GMVFDA(120.5,"+1,",1.4)=$P(GMVVTYP,";",3) ; Sup 02 + S GMVIEN="" + D UPDATE^DIE("","GMVFDA","GMVIEN"),FMERROR + S GMVCNT=1 + S GMVQUALS=$P(GMVDATA,"*",2) + F GMVLOOP=1:1:$L(GMVQUALS,":")+1 D + . S GMVVQUAL=$P(GMVQUALS,":",GMVLOOP) + . Q:GMVVQUAL="" + . S GMVCNT=GMVCNT+1 + . D ADDQUAL^GMVGETQ(.GMVRES,GMVIEN(1)_"^"_GMVVQUAL) + . Q + I "^HT^WT^CG^"[$P($G(^GMRD(120.51,+GMVVTYP,0)),U,2) D EN^GMRVPGC(GMVDFN) + Q + ; +CHKDT(GMVDT,GMVSAV) ;Check id there ios a vital entered for that date and time + N GMVA,GMVQ + S GMVQ=0 + S GMVA="" + F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:GMVA="" D + . ;01/28/2005 KAM GMRV*5*9 Added next Line BHS-0504-10643 + . I GMVDFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q + . S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3) + . I GMVTY=GMVSAV D + . . S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1) + . . Q + . Q + Q GMVDT +MSG(X) ; *** Add a line to the message array *** + S (GMVMSG,RESULT(-1))=1+$G(RESULT(-1),0) + S RESULT(GMVMSG)=X + I $P(X,":")="ERROR" S RESULT(0)="ERROR" + Q + ; +FMERROR ; + I $O(^TMP("DIERR",$J,0))>0 D + . N GMVER1,GMVER2 + . S GMVER1=0 + . F S GMVER1=$O(^TMP("DIERR",$J,GMVER1)) Q:GMVER1'>0 D + .. S GMVER2=0 + .. F S GMVER2=$O(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)) Q:GMVER2'>0 D + ... D MSG("ERROR: "_$G(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2))) + ... Q + .. Q + . Q + D CLEAN^DILF + Q diff --git a/GrowthChart.class.php b/GrowthChart.class.php new file mode 100644 index 0000000..e0d7bc8 --- /dev/null +++ b/GrowthChart.class.php @@ -0,0 +1,181 @@ + + * @version 1.1 + * @copyright Jonathan Abbett and Children's Hospital Informatics Program, 2007 + * + */ +class GrowthChart +{ + /** + * Male sex + * + */ + const SEX_MALE = 1; + /** + * Female sex + * + */ + const SEX_FEMALE = 2; + + private $style; + private $title; + private $sex; + private $maxAgeMonths; + private $patientXarray; + private $patientYarray; + private $width; + private $height; + /** + * Constructor, used to initialize necessary variables. + * + * @param string $style Chart style, from available dataset filenames, i.e. bmi-age, weight-length + * @param string $title Title for the graph, provided by M program + * @param integer $sex Patient sex, from available SEX constants + * @param decimal $maxAgeMonths The greatest patient age used in the chart, used to decide whether chart is infant (0-36 mo.) or regular (2-20 yrs.) + * @param integer $width Width of chart in pixels + * @param integer $height Height of chart in pixels + * @param array $patientXarray Array of decimals for patient X data (i.e. age in months) + * @param array $patientYarray Array of decimals for patient Y data (i.e. length, height, BMI, etc.) + * @return GrowthChart + */ + public function GrowthChart($style, $title = null, $sex, $maxAgeMonths, $width = 800, $height = 800, $patientXarray = null, $patientYarray = null) + { + $this->style = $style; + $this->title = $title; + $this->sex = $sex; + $this->maxAgeMonths = $maxAgeMonths; + $this->width = $width; + $this->height = $height; + $this->patientXarray = $patientXarray; + $this->patientYarray = $patientYarray; + } + + private static function generateSourceXData($min, $max) { + + $data = array(); + + $data[] = $min; + + for ($i = $min + 0.5; $i < $max; $i++) { + $data[] = $i; + } + + $data[] = $max; + + return $data; + + } + + /** + * Renders the chart, outputting a PNG image. + * + */ + public function render() + { + + // Create and set-up the graph + $g = new Graph($this->width, $this->height, "auto"); + $g->SetColor('white'); + $g->SetFrame(false); + $g->SetMargin(25,20,20,25); + $g->SetMarginColor('white'); + // Load data from XML + + if ($this->sex == GrowthChart::SEX_MALE) { + $this->style .= '-male'; + } else { + $this->style .= '-female'; + } + + if ($this->maxAgeMonths <= 36) { + $this->style .= '-infant'; + } + + $xml = simplexml_load_file("data/$this->style.xml"); + + $xdata = GrowthChart::generateSourceXData((float)$xml->sourceXStart, (float)$xml->sourceXEnd); + + $g->SetScale("linlin", (float)$xml->yMin, (float)$xml->yMax, (float)$xml->xMin, (float)$xml->xMax); + if ((float)$xml->ticksMajor != 0) { + $g->yscale->ticks->Set((float)$xml->ticksMajor, (float)$xml->ticksMinor); + } + $g->xaxis->SetLabelFormat('%1.1f'); + $g->xaxis->SetFont(FF_TREBUCHE, FS_NORMAL, 9); + $g->xgrid->Show(true); + $g->yaxis->HideZeroLabel(); + $g->yaxis->SetFont(FF_TREBUCHE, FS_NORMAL, 9); + $g->ygrid->SetFill(true,'#EFEFEF@0.5','#FFFFFF@0.5'); + if (!empty($this->title)) + { + $g->title->Set($this->title); + $g->title->SetColor("red"); + $g->title->SetFont( FF_FONT2, FS_BOLD); + } + $xml = simplexml_load_file("data/$this->style.xml"); + + + foreach ($xml->percentile as $p) { + + $percentile = $p->label; + $yp = array(); + + foreach ($p->value as $value) { + $yp[] = (float)$value; + } + + // Create the spline + $spline = new Spline($xdata, $yp); + + // Get smoothed points + list($newx, $newy) = $spline->Get(100); + + $lplot = new LinePlot($newy, $newx); + $lplot->SetColor('#CCCCCC'); + + if ($percentile == '50') + { + $lplot->SetColor('#666666'); + } + + // Add the plots to the graph and stroke + $g->Add($lplot); + + // Add percentile label to graph + $txt = new Text($percentile . ($percentile == '3' ? 'rd' : 'th')); + $txt->SetScalePos($xdata[sizeof($xdata)-1]+(float)$xml->percentileXNudge,$yp[sizeof($yp)-1]+(float)$xml->percentileYNudge); + $txt->SetColor('#666666'); + $txt->SetFont(FF_TREBUCHE, FS_NORMAL, 9); + $g->AddText($txt); + } + + if (!empty($this->patientXarray) && !empty($this->patientYarray) && sizeof($this->patientXarray) == sizeof($this->patientYarray)) + { + $patientPlot = new LinePlot($this->patientYarray, $this->patientXarray); + $patientPlot->SetColor('orange'); + $patientPlot->SetWeight(3); + $patientPlot->value->Show(); + $patientPlot->value->SetColor('brown'); + $patientPlot->value->SetFont(FF_COURIER, FS_BOLD); + $patientPlot->value->SetAlign('left', 'top'); + $patientPlot->value->SetMargin(-5); + $patientPlot->mark->SetType(MARK_DIAMOND); + $patientPlot->mark->SetWidth(7); + $patientPlot->mark->SetColor('orange'); + $patientPlot->mark->SetFillColor('red'); + + $g->Add($patientPlot); + } + + $g->Stroke(); + } +} + +?> \ No newline at end of file diff --git a/InstallingPediatricGrowthChartsForVistAVer6.odt b/InstallingPediatricGrowthChartsForVistAVer6.odt new file mode 100644 index 0000000..7052dbc Binary files /dev/null and b/InstallingPediatricGrowthChartsForVistAVer6.odt differ diff --git a/PEDHTML-T14.KID b/PEDHTML-T14.KID new file mode 100644 index 0000000..df2d588 --- /dev/null +++ b/PEDHTML-T14.KID @@ -0,0 +1,1078 @@ +KIDS Distribution saved on Sep 26, 2010@21:44:11 +Added titles and changed date on file +**KIDS**:PEDHTML 1.0^ + +**INSTALL NAME** +PEDHTML 1.0 +"BLD",7337,0) +PEDHTML 1.0^^0^3100926^n +"BLD",7337,1,0) +^^35^35^3071115^ +"BLD",7337,1,1,0) + This patch adds the ability to view Pediatric Growth Charts to CPRS. +"BLD",7337,1,2,0) + +"BLD",7337,1,3,0) + Installation instructions are in the multi-build containing this build. +"BLD",7337,1,4,0) + +"BLD",7337,1,5,0) + The following two Parameters are added: +"BLD",7337,1,6,0) + +"BLD",7337,1,7,0) + GMRV PED GROWTH CHART FOLDER for example: /srv/www/htdocs/growth +"BLD",7337,1,8,0) + +"BLD",7337,1,9,0) + GMRV PED GROWTH CHART SERVER for example: +"BLD",7337,1,10,0) + http://voe2.openforum.opensourcevista.net/PGC-new/chart.php +"BLD",7337,1,11,0) + +"BLD",7337,1,12,0) + The following parameter is also added to: +"BLD",7337,1,13,0) + CPRS GUI TOOLS for System add Command: +"BLD",7337,1,14,0) + Growth Charts=C:\StartGrowthCharts.bat %DFN +"BLD",7337,1,15,0) + (or any other apporpriate directory) +"BLD",7337,1,16,0) + +"BLD",7337,1,17,0) + In C: have StartGrowthCharts.bat with for example the following in it: +"BLD",7337,1,18,0) + START http://vistaehr/growth/%1.html +"BLD",7337,1,19,0) + (the "growth" folder name matches with the FOLDER listed in the +"BLD",7337,1,20,0) + GMRV PED GROWTH CHART FOLDER parameter above) +"BLD",7337,1,21,0) + +"BLD",7337,1,22,0) + Routine Summary: +"BLD",7337,1,23,0) + ================ +"BLD",7337,1,24,0) + +"BLD",7337,1,25,0) + The second line now reads as follows: +"BLD",7337,1,26,0) + +"BLD",7337,1,27,0) + ;;5.0;GEN. MED. REC. - VITALS;**[patch list]**;Oct 31, 2002 +"BLD",7337,1,28,0) + +"BLD",7337,1,29,0) + CHECK^XTSUMBLD results: +"BLD",7337,1,30,0) + +"BLD",7337,1,31,0) + Routine Before Patch After Patch Patch List +"BLD",7337,1,32,0) + ======================================================================== +"BLD",7337,1,33,0) + GMRVED2 12357440 12600612 2,nn +"BLD",7337,1,34,0) + GMRVPGC 11805207 nn +"BLD",7337,1,35,0) + GMVDCSAV 5563465 nn +"BLD",7337,4,0) +^9.64PA^^ +"BLD",7337,6.3) +15 +"BLD",7337,"KRN",0) +^9.67PA^8989.52^19 +"BLD",7337,"KRN",.4,0) +.4 +"BLD",7337,"KRN",.401,0) +.401 +"BLD",7337,"KRN",.402,0) +.402 +"BLD",7337,"KRN",.403,0) +.403 +"BLD",7337,"KRN",.5,0) +.5 +"BLD",7337,"KRN",.84,0) +.84 +"BLD",7337,"KRN",3.6,0) +3.6 +"BLD",7337,"KRN",3.8,0) +3.8 +"BLD",7337,"KRN",9.2,0) +9.2 +"BLD",7337,"KRN",9.8,0) +9.8 +"BLD",7337,"KRN",9.8,"NM",0) +^9.68A^3^3 +"BLD",7337,"KRN",9.8,"NM",1,0) +GMRVPGC^^0^B34589005 +"BLD",7337,"KRN",9.8,"NM",2,0) +GMRVED2^^0^B31440386 +"BLD",7337,"KRN",9.8,"NM",3,0) +GMVDCSAV^^0^B20608743 +"BLD",7337,"KRN",9.8,"NM","B","GMRVED2",2) + +"BLD",7337,"KRN",9.8,"NM","B","GMRVPGC",1) + +"BLD",7337,"KRN",9.8,"NM","B","GMVDCSAV",3) + +"BLD",7337,"KRN",19,0) +19 +"BLD",7337,"KRN",19.1,0) +19.1 +"BLD",7337,"KRN",101,0) +101 +"BLD",7337,"KRN",409.61,0) +409.61 +"BLD",7337,"KRN",771,0) +771 +"BLD",7337,"KRN",870,0) +870 +"BLD",7337,"KRN",8989.51,0) +8989.51 +"BLD",7337,"KRN",8989.51,"NM",0) +^9.68A^2^2 +"BLD",7337,"KRN",8989.51,"NM",1,0) +GMRV PED GROWTH CHART FOLDER^^0 +"BLD",7337,"KRN",8989.51,"NM",2,0) +GMRV PED GROWTH CHART SERVER^^0 +"BLD",7337,"KRN",8989.51,"NM","B","GMRV PED GROWTH CHART FOLDER",1) + +"BLD",7337,"KRN",8989.51,"NM","B","GMRV PED GROWTH CHART SERVER",2) + +"BLD",7337,"KRN",8989.52,0) +8989.52 +"BLD",7337,"KRN",8989.52,"NM",0) +^9.68A^^ +"BLD",7337,"KRN",8994,0) +8994 +"BLD",7337,"KRN","B",.4,.4) + +"BLD",7337,"KRN","B",.401,.401) + +"BLD",7337,"KRN","B",.402,.402) + +"BLD",7337,"KRN","B",.403,.403) + +"BLD",7337,"KRN","B",.5,.5) + +"BLD",7337,"KRN","B",.84,.84) + +"BLD",7337,"KRN","B",3.6,3.6) + +"BLD",7337,"KRN","B",3.8,3.8) + +"BLD",7337,"KRN","B",9.2,9.2) + +"BLD",7337,"KRN","B",9.8,9.8) + +"BLD",7337,"KRN","B",19,19) + +"BLD",7337,"KRN","B",19.1,19.1) + +"BLD",7337,"KRN","B",101,101) + +"BLD",7337,"KRN","B",409.61,409.61) + +"BLD",7337,"KRN","B",771,771) + +"BLD",7337,"KRN","B",870,870) + +"BLD",7337,"KRN","B",8989.51,8989.51) + +"BLD",7337,"KRN","B",8989.52,8989.52) + +"BLD",7337,"KRN","B",8994,8994) + +"BLD",7337,"QUES",0) +^9.62^^ +"BLD",7337,"REQB",0) +^9.611^^ +"KRN",8989.51,547,-1) +0^2 +"KRN",8989.51,547,0) +GMRV PED GROWTH CHART SERVER^Pediatric Growth Chart HTML Server^0 +"KRN",8989.51,547,1) +F^^Value should be of the form http://yourserver.net/etc/chart.php +"KRN",8989.51,547,6) + +"KRN",8989.51,547,30,0) +^8989.513I^2^1 +"KRN",8989.51,547,30,2,0) +1^4.2 +"KRN",8989.51,548,-1) +0^1 +"KRN",8989.51,548,0) +GMRV PED GROWTH CHART FOLDER^Pediatric Growth Chart Directory^0 +"KRN",8989.51,548,1) +F^^The directory where growth chart html pages for each patient are stored +"KRN",8989.51,548,30,0) +^8989.513I^1^1 +"KRN",8989.51,548,30,1,0) +1^4.2 +"MBREQ") +0 +"ORD",20,8989.51) +8989.51;20;;;PAR1E1^XPDTA2;PAR1F1^XPDIA3;PAR1E1^XPDIA3;PAR1F2^XPDIA3;;PAR1DEL^XPDIA3(%) +"ORD",20,8989.51,0) +PARAMETER DEFINITION +"QUES","XPF1",0) +Y +"QUES","XPF1","??") +^D REP^XPDH +"QUES","XPF1","A") +Shall I write over your |FLAG| File +"QUES","XPF1","B") +YES +"QUES","XPF1","M") +D XPF1^XPDIQ +"QUES","XPF2",0) +Y +"QUES","XPF2","??") +^D DTA^XPDH +"QUES","XPF2","A") +Want my data |FLAG| yours +"QUES","XPF2","B") +YES +"QUES","XPF2","M") +D XPF2^XPDIQ +"QUES","XPI1",0) +YO +"QUES","XPI1","??") +^D INHIBIT^XPDH +"QUES","XPI1","A") +Want KIDS to INHIBIT LOGONs during the install +"QUES","XPI1","B") +NO +"QUES","XPI1","M") +D XPI1^XPDIQ +"QUES","XPM1",0) +PO^VA(200,:EM +"QUES","XPM1","??") +^D MG^XPDH +"QUES","XPM1","A") +Enter the Coordinator for Mail Group '|FLAG|' +"QUES","XPM1","B") + +"QUES","XPM1","M") +D XPM1^XPDIQ +"QUES","XPO1",0) +Y +"QUES","XPO1","??") +^D MENU^XPDH +"QUES","XPO1","A") +Want KIDS to Rebuild Menu Trees Upon Completion of Install +"QUES","XPO1","B") +NO +"QUES","XPO1","M") +D XPO1^XPDIQ +"QUES","XPZ1",0) +Y +"QUES","XPZ1","??") +^D OPT^XPDH +"QUES","XPZ1","A") +Want to DISABLE Scheduled Options, Menu Options, and Protocols +"QUES","XPZ1","B") +NO +"QUES","XPZ1","M") +D XPZ1^XPDIQ +"QUES","XPZ2",0) +Y +"QUES","XPZ2","??") +^D RTN^XPDH +"QUES","XPZ2","A") +Want to MOVE routines to other CPUs +"QUES","XPZ2","B") +NO +"QUES","XPZ2","M") +D XPZ2^XPDIQ +"RTN") +3 +"RTN","GMRVED2") +0^2^B31440386 +"RTN","GMRVED2",1,0) +GMRVED2 ;HIOFO/RM,YH,FT-VITAL SIGNS EDIT SHORT FORM ;7/20/07 13:43 +"RTN","GMRVED2",2,0) + ;;5.0;GEN. MED. REC. - VITALS;**2**;Oct 31, 2002;Build 15 +"RTN","GMRVED2",3,0) + ; +"RTN","GMRVED2",4,0) + ; This routine uses the following IAs: +"RTN","GMRVED2",5,0) + ; #10035 - ^DPT( references (supported) +"RTN","GMRVED2",6,0) + ; #10061 - ^VADPT calls (supported) +"RTN","GMRVED2",7,0) + ; #10103 - ^XLFDT calls (supported) +"RTN","GMRVED2",8,0) + ; #10104 - ^XLFSTR calls (supported) +"RTN","GMRVED2",9,0) + ; +"RTN","GMRVED2",10,0) +EN1 ; SORT PATIENTS ON WARD +"RTN","GMRVED2",11,0) + K ^TMP($J) +"RTN","GMRVED2",12,0) +WSA1 ; SET ^TMP($J, FOR SORT +"RTN","GMRVED2",13,0) + D DEM^VADPT,INP^VADPT S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK"),GMRNAM=$S(VADM(1)'="":VADM(1),1:" BLANK") D KVAR^VADPT K VA +"RTN","GMRVED2",14,0) + S:$S("Aa"[GMREDB:1,$D(GMRROOM($P(GMRRMBD,"-"))):1,1:0) ^TMP($J,GMRRMBD,GMRNAM,DFN)="" +"RTN","GMRVED2",15,0) + S DFN=$O(^DPT("CN",GMRWARD(1),DFN)) +"RTN","GMRVED2",16,0) + Q:DFN="" G WSA1 +"RTN","GMRVED2",17,0) +EN2 ; BEGIN EDITING WARD VITALS +"RTN","GMRVED2",18,0) + I $O(^TMP($J,0))="" S GMROUT=1 Q +"RTN","GMRVED2",19,0) + W !,"Begin entering patient vitals." S GMRDT0=GMRVIDT +"RTN","GMRVED2",20,0) + S GMRRMBD="" F GMRI=0:0 S GMRRMBD=$O(^TMP($J,GMRRMBD)) Q:GMRRMBD=""!GMROUT S GMRNAM="" F GMRI=0:0 S GMRNAM=$O(^TMP($J,GMRRMBD,GMRNAM)) Q:GMRNAM=""!GMROUT F DFN=0:0 S DFN=$O(^TMP($J,GMRRMBD,GMRNAM,DFN)) Q:DFN'>0 D V1 Q:GMROUT +"RTN","GMRVED2",21,0) + W !,"Enter return to continue" R X:DTIME Q +"RTN","GMRVED2",22,0) +V1 ; +"RTN","GMRVED2",23,0) + W !!,$S(GMRNAM'=" BLANK":GMRNAM,1:DFN),?$X+10,$S(GMRRMBD'=" BLANK":GMRRMBD,1:"")," OK? YES// " R GMRX:DTIME +"RTN","GMRVED2",24,0) + I GMRX="^"!('$T) S GMROUT=1 Q +"RTN","GMRVED2",25,0) + S GMRX=$$UP^XLFSTR(GMRX) I ((GMRX="")!($E(GMRX)="Y")) K GMRTO S GDT=GMRVIDT D EN1^GMRVADM G:GMROUT&'$D(GMRTO) V2 D EN2^GMRVED3 G:GMROUT&'$D(GMRTO) V2 Q +"RTN","GMRVED2",26,0) + G:GMRX?1"N".E V2 +"RTN","GMRVED2",27,0) + W !,"ANSWER YES OR NO" G V1 +"RTN","GMRVED2",28,0) +V2 ; +"RTN","GMRVED2",29,0) + W !!,"Do you wish to stop looping through names? YES//" R GMRX:DTIME +"RTN","GMRVED2",30,0) + S GMRX=$$UP^XLFSTR(GMRX) I (('$T)!(GMRX="")!($E(GMRX)="Y")!(GMRX="^")) S GMROUT=1 Q +"RTN","GMRVED2",31,0) + I GMRX?1"N".E S GMROUT=0 Q +"RTN","GMRVED2",32,0) + W !,"ANSWER YES OR NO" G V2 +"RTN","GMRVED2",33,0) +EN4 ; ENTRY FROM GMRVED0 TO ADD THE PATIENT DATA TO THE 120.5 FILE +"RTN","GMRVED2",34,0) + D NOW^%DTC S GMRDATE=% +"RTN","GMRVED2",35,0) + F GMRX=2:1:$L(GMRSTR(0),";")-1 S GMRVITY=$P(GMRSTR(0),";",GMRX) D +"RTN","GMRVED2",36,0) + . S GMRVIT=$S(GMRVITY="T":"TEMPERATURE",GMRVITY="P":"PULSE",GMRVITY="R":"RESPIRATION",GMRVITY="BP":"BLOOD PRESSURE",GMRVITY="HT":"HEIGHT",GMRVITY="CG":"CIRCUMFERENCE/GIRTH",1:"") +"RTN","GMRVED2",37,0) + . S:GMRVIT="" GMRVIT=$S(GMRVITY="WT":"WEIGHT",GMRVITY="CVP":"CENTRAL VENOUS PRESSURE",GMRVITY="PO2":"PULSE OXIMETRY",GMRVITY="PN":"PAIN",1:"") +"RTN","GMRVED2",38,0) + . D:$G(GMRDAT(GMRVITY))'=""&(GMRVIT'="") ADDNODE +"RTN","GMRVED2",39,0) + Q +"RTN","GMRVED2",40,0) +ADDNODE ; add data to the 120.5 file +"RTN","GMRVED2",41,0) + N GMVDTDUN,GMVFDA,GMVIEN +"RTN","GMRVED2",42,0) + S GMVDTDUN=GMRVIDT +"RTN","GMRVED2",43,0) + S GMRVIT(1)=$O(^GMRD(120.51,"B",GMRVIT,0)) +"RTN","GMRVED2",44,0) + S GMVDTDUN=$$CHKDT(GMRVIDT,GMRVIT(1)) +"RTN","GMRVED2",45,0) + S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ;Date/Time +"RTN","GMRVED2",46,0) + S GMVFDA(120.5,"+1,",.02)=DFN ;Patient +"RTN","GMRVED2",47,0) + S GMVFDA(120.5,"+1,",.03)=GMRVIT(1) ;Vital Type +"RTN","GMRVED2",48,0) + S GMVFDA(120.5,"+1,",.04)=GMRDATE ;Date Time entered +"RTN","GMRVED2",49,0) + S GMVFDA(120.5,"+1,",.05)=GMRVHLOC ;Hospital +"RTN","GMRVED2",50,0) + S GMVFDA(120.5,"+1,",.06)=DUZ ;Entered by (DUZ) +"RTN","GMRVED2",51,0) + S GMVFDA(120.5,"+1,",1.2)=GMRDAT(GMRVITY) ;Rate +"RTN","GMRVED2",52,0) + S GMVFDA(120.5,"+1,",1.4)=$G(GMRO2(GMRVITY)) ;Sup 02 +"RTN","GMRVED2",53,0) + S GMVIEN="" +"RTN","GMRVED2",54,0) + D UPDATE^DIE("","GMVFDA","GMVIEN") +"RTN","GMRVED2",55,0) + ;file any qualifiers +"RTN","GMRVED2",56,0) + I $D(GMRSITE(GMRVITY))!$D(GMRINF(GMRVITY)) D +"RTN","GMRVED2",57,0) + .I $G(GMRSITE(GMRVITY))'="" D +"RTN","GMRVED2",58,0) + ..S GDATA=+$P(GMRSITE(GMRVITY),U,2) +"RTN","GMRVED2",59,0) + ..Q:'GDATA +"RTN","GMRVED2",60,0) + ..D ADDQUAL(GMVIEN(1)_"^"_GDATA) +"RTN","GMRVED2",61,0) + ..Q +"RTN","GMRVED2",62,0) + .I $D(GMRINF(GMRVITY)) D +"RTN","GMRVED2",63,0) + ..S I=0 +"RTN","GMRVED2",64,0) + ..F S I=$O(GMRINF(GMRVITY,I)) Q:I'>0 D +"RTN","GMRVED2",65,0) + ...S I(1)="" +"RTN","GMRVED2",66,0) + ...F S I(1)=$O(GMRINF(GMRVITY,I,I(1))) Q:I(1)="" D +"RTN","GMRVED2",67,0) + ....S GDATA=+$P(GMRINF(GMRVITY,I,I(1)),"^") +"RTN","GMRVED2",68,0) + ....Q:'GDATA +"RTN","GMRVED2",69,0) + ....D ADDQUAL(GMVIEN(1)_"^"_GDATA) +"RTN","GMRVED2",70,0) + ....Q +"RTN","GMRVED2",71,0) + ...Q +"RTN","GMRVED2",72,0) + ..Q +"RTN","GMRVED2",73,0) + .Q +"RTN","GMRVED2",74,0) + S DA=+GMVIEN(1) +"RTN","GMRVED2",75,0) + I GMREDB="P1" S GMRVIEN(GMRVITY)=DA_"^"_GMRDAT(GMRVITY)_"^"_$G(GMRSITE(GMRVITY)) +"RTN","GMRVED2",76,0) + S:GMRENTY>4 GLAST=GMRVIDT,GLAST(1)=$G(GLAST(1))+1 +"RTN","GMRVED2",77,0) + ; for VOE Pediatric Growth Charts +"RTN","GMRVED2",78,0) + I "8920"[(+GMRVIT(1)) D EN^GMRVPGC(DFN) ; 8=Height 9=Weight 20=Circumference +"RTN","GMRVED2",79,0) + Q +"RTN","GMRVED2",80,0) +XREF(DA) ; Set cross-references for FILE 120.5 entry +"RTN","GMRVED2",81,0) + ; Execute SET logic only. Set's all cross-references for this entry. +"RTN","GMRVED2",82,0) + ; DA is the record number +"RTN","GMRVED2",83,0) + N DIC,DIK,X,Y +"RTN","GMRVED2",84,0) + Q:'DA +"RTN","GMRVED2",85,0) + S DIK="^GMR(120.5," +"RTN","GMRVED2",86,0) + D IX1^DIK +"RTN","GMRVED2",87,0) + Q +"RTN","GMRVED2",88,0) +XREF1(DA) ; Set cross-references for FILE 120.5 entry +"RTN","GMRVED2",89,0) + ; Execute SET logic only. Set's all cross-references for this entry. +"RTN","GMRVED2",90,0) + ; DA is the record number +"RTN","GMRVED2",91,0) + N DIC,DIK,GMRVDA,GMRVIEN,X,Y +"RTN","GMRVED2",92,0) + Q:'DA +"RTN","GMRVED2",93,0) + S GMRVIEN=0,GMRVDA=DA +"RTN","GMRVED2",94,0) + F S GMRVIEN=$O(^GMR(120.5,GMRVDA,5,GMRVIEN)) Q:'GMRVIEN D +"RTN","GMRVED2",95,0) + .S DA(1)=GMRVDA,DA=GMRVIEN +"RTN","GMRVED2",96,0) + .S DIK="^GMR(120.5,DA(1),5," +"RTN","GMRVED2",97,0) + .D IX1^DIK +"RTN","GMRVED2",98,0) + .Q +"RTN","GMRVED2",99,0) + Q +"RTN","GMRVED2",100,0) +SETPRMT ; SET VITAL TYPE PATTERN MATCH +"RTN","GMRVED2",101,0) + S G=$P(GMRSTR(0),";",GMRX) +"RTN","GMRVED2",102,0) + S GMRHELP=GMRHELP_$S(G="P":"PPP",G="WT":"WWW.WW",G="R":"RR",G="CG":"NNN.NN",G="CVP":"NN",G="PO2":"NNN",G="HT":"HH",G="BP":"BBB/BBB/BBB (or BBB/BBB)",G="T":"TTT.T",G="PN":"NN",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"") +"RTN","GMRVED2",103,0) + S GMRHELP(1)=GMRHELP(1)_$S(GMRHELP(1)'="":",",1:"")_$P(GMRSTR(0),";",GMRX)_"^GMRVUT1" +"RTN","GMRVED2",104,0) + S GMRPRMT=GMRPRMT_$S(G="T":"Temp",G="P":"Pulse",G="WT":"Wt.",G="R":"Resp",G="HT":"Ht.",G="BP":"BP",G="CG":"Circumference/Girth",G="CVP":"CVP",G="PO2":"PO2",G="PN":"Pain",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"") +"RTN","GMRVED2",105,0) + Q +"RTN","GMRVED2",106,0) +CHKDT(GMVDT,GMVSAV) ;Check if there is an entry for that date & time +"RTN","GMRVED2",107,0) + N GMVA,GMVTY +"RTN","GMRVED2",108,0) + S GMVA=0 +"RTN","GMRVED2",109,0) + F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:'GMVA D +"RTN","GMRVED2",110,0) + .I DFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q +"RTN","GMRVED2",111,0) + .S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3) +"RTN","GMRVED2",112,0) + .I GMVTY=GMVSAV D +"RTN","GMRVED2",113,0) + ..S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1) +"RTN","GMRVED2",114,0) + ..Q +"RTN","GMRVED2",115,0) + .Q +"RTN","GMRVED2",116,0) + Q GMVDT +"RTN","GMRVED2",117,0) + ; +"RTN","GMRVED2",118,0) +ADDQUAL(GMRVDATA) ; Add qualifiers to FILE 120.5 entry +"RTN","GMRVED2",119,0) + ; ADD QUALIFIER TO 120.505 SUBFILE +"RTN","GMRVED2",120,0) + ; Input: +"RTN","GMRVED2",121,0) + ; GMRVDATA=120.5 IEN^QUALIFIER (120.52) IEN +"RTN","GMRVED2",122,0) + ; +"RTN","GMRVED2",123,0) + N GMVCNT,GMVERR,GMVFDA,GMVOKAY,GMRVIEN,GMRVQUAL +"RTN","GMRVED2",124,0) + S GMRVIEN=+$P(GMRVDATA,"^",1) ;File 120.5 ien +"RTN","GMRVED2",125,0) + S GMRVQUAL=+$P(GMRVDATA,"^",2) ;File 120.52 ien +"RTN","GMRVED2",126,0) + ; Does File 120.5 entry exist? +"RTN","GMRVED2",127,0) + I '$D(^GMR(120.5,GMRVIEN,0)) Q +"RTN","GMRVED2",128,0) + ; Is the qualifier already stored? +"RTN","GMRVED2",129,0) + I $O(^GMR(120.5,GMRVIEN,5,"B",GMRVQUAL,0))>0 Q +"RTN","GMRVED2",130,0) + ; Legitimate Qualifier? +"RTN","GMRVED2",131,0) + I '$D(^GMRD(120.52,GMRVQUAL,0)) Q +"RTN","GMRVED2",132,0) + S GMVCNT=0 ;counter for number of tries to lock an entry +"RTN","GMRVED2",133,0) +B2 ; Lock the entry +"RTN","GMRVED2",134,0) + I GMVCNT>3 Q ;4 strikes and you're out +"RTN","GMRVED2",135,0) + L +^GMR(120.5,GMRVIEN,0):1 +"RTN","GMRVED2",136,0) + S GMVCNT=GMVCNT+1 +"RTN","GMRVED2",137,0) + I '$T L -^GMR(120.5,GMRVIEN,0) G B2 +"RTN","GMRVED2",138,0) + ; Store the qualifier +"RTN","GMRVED2",139,0) + S GMVFDA(120.505,"+1,"_GMRVIEN_",",.01)=GMRVQUAL +"RTN","GMRVED2",140,0) + D UPDATE^DIE("","GMVFDA","GMVOKAY","GMVERR") +"RTN","GMRVED2",141,0) + L -^GMR(120.5,GMRVIEN,0) +"RTN","GMRVED2",142,0) + Q +"RTN","GMRVPGC") +0^1^B34589005 +"RTN","GMRVPGC",1,0) +GMRVPGC ;DBA/CJS - Pediatric Growth Chart HTML generator ;9/26/10 21:59 +"RTN","GMRVPGC",2,0) + ;;5.0;GEN. MED. REC. - VITALS;**[patch list]**;Oct 31, 2002;Build 15 +"RTN","GMRVPGC",3,0) + ; +"RTN","GMRVPGC",4,0) +EN(DFN) ; +"RTN","GMRVPGC",5,0) + N BMI,DIC,DIV,IO,LABEL,LINE,MAXAGE,NAME,NONE,POP,REF,ROOT,SERVER,SEX,STYLE,TMP,TYPE,VAL,VDT,XPARSYS,XQDIC,XQPSM,XQVOL,XVALS,YVALS +"RTN","GMRVPGC",6,0) + S SERVER=$$GET^XPAR("SYS","GMRV PED GROWTH CHART SERVER") +"RTN","GMRVPGC",7,0) + S ROOT=$$GET^XPAR("SYS","GMRV PED GROWTH CHART FOLDER") +"RTN","GMRVPGC",8,0) + ; +"RTN","GMRVPGC",9,0) + S D=^DPT(DFN,0),NAME=$P(D,U),SEX=$P(D,U,2),SEX=$S(SEX="M":1,SEX="F":2,1:0),DOB=$P(D,U,3),DOD=$P($G(^DPT(DFN,.35)),U),PID=$P($G(^DPT(DFN,.36)),U,3) +"RTN","GMRVPGC",10,0) + S Y=DOB D DD^%DT S BIRTH=Y,MAXAGE=$$MNTHSOLD($S(DOD="":DT,DOD'="":DOD),DOB) +"RTN","GMRVPGC",11,0) + ; +"RTN","GMRVPGC",12,0) + ; See if there are any pediatric vitals to be had +"RTN","GMRVPGC",13,0) + ; ^GMR(120.5,"AA",GMRVDFN,GMRVTYP,9999999-GMRVDT,DA)="" "rate" on 0 node piece 8 +"RTN","GMRVPGC",14,0) + ; types: 8 = Height, 9 - Weight, 20 = Circumference/Girth, 73 - Head qualifier +"RTN","GMRVPGC",15,0) + S NONE=1 F TYPE=8,9,20 D +"RTN","GMRVPGC",16,0) + . S XVALS(TYPE)="",YVALS(TYPE)="" +"RTN","GMRVPGC",17,0) + . S VDT=0 F S VDT=$O(^GMR(120.5,"AA",DFN,TYPE,VDT)) Q:VDT'>0 D +"RTN","GMRVPGC",18,0) + . . S DA=+$O(^GMR(120.5,"AA",DFN,TYPE,VDT,0)) +"RTN","GMRVPGC",19,0) + . . I TYPE=20 Q:'$D(^GMR(120.5,DA,5,"B",73)) ; Quit if not "HEAD" +"RTN","GMRVPGC",20,0) + . . Q:+$G(^GMR(120.5,DA,2)) ; Quit if Entered in Error +"RTN","GMRVPGC",21,0) + . . S AGE=$$MNTHSOLD(9999999-VDT,DOB),NONE=0 +"RTN","GMRVPGC",22,0) + . . S XVALS(TYPE)=XVALS(TYPE)_","_AGE +"RTN","GMRVPGC",23,0) + . . S VAL=$P(^GMR(120.5,DA,0),U,8),VAL=$S("8,20"[TYPE:VAL*2.54,TYPE=9:VAL/2.2),VAL=$$ROUND(VAL) +"RTN","GMRVPGC",24,0) + . . I TYPE=8!(TYPE=9) S BMI(AGE,TYPE)=VAL +"RTN","GMRVPGC",25,0) + . . S YVALS(TYPE)=YVALS(TYPE)_","_VAL +"RTN","GMRVPGC",26,0) + . . Q +"RTN","GMRVPGC",27,0) + . Q +"RTN","GMRVPGC",28,0) + ; +"RTN","GMRVPGC",29,0) + ; BMI=WEIGHT/(HEIGHT**2) Weight in Kg, Height in meters +"RTN","GMRVPGC",30,0) + S AGE="",XVALS("BMI")="",YVALS("BMI")="",XVALS("WTHT")="",YVALS("WTHT")="" +"RTN","GMRVPGC",31,0) + F S AGE=$O(BMI(AGE)) Q:AGE'>0 I $D(BMI(AGE,8)),$D(BMI(AGE,9)) D +"RTN","GMRVPGC",32,0) + . S DIV=BMI(AGE,8)**2 +"RTN","GMRVPGC",33,0) + . S:DIV'=0 XVALS("BMI")=XVALS("BMI")_","_AGE,YVALS("BMI")=YVALS("BMI")_","_$$ROUND(10000*BMI(AGE,9)/DIV) +"RTN","GMRVPGC",34,0) + . S XVALS("WTHT")=XVALS("WTHT")_","_BMI(AGE,8),YVALS("WTHT")=YVALS("WTHT")_","_BMI(AGE,9) +"RTN","GMRVPGC",35,0) + . Q +"RTN","GMRVPGC",36,0) + ; +"RTN","GMRVPGC",37,0) + ; Establish HTML doctype & head +"RTN","GMRVPGC",38,0) + S LINE=0 F S LINE=LINE+1,TMP(LINE)=$P($T(HEAD+LINE),";",3) Q:TMP(LINE)="" +"RTN","GMRVPGC",39,0) + ; +"RTN","GMRVPGC",40,0) + ; Set up the href links +"RTN","GMRVPGC",41,0) + S TMP(LINE)="

"_NAME_"

DOB: "_BIRTH_"

",LINE=LINE+1 +"RTN","GMRVPGC",42,0) + S REF="

" +"RTN","GMRVPGC",44,0) + S LABEL(1)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Length centimeters 0-36 months

" +"RTN","GMRVPGC",45,0) + S LABEL(2)=$S(SEX=1:"Male",1:"Female")_" Age in months vs Head Circumference in centimeters 0-36 months

" +"RTN","GMRVPGC",46,0) + S LABEL(4)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Height centimeters over 36 months

" +"RTN","GMRVPGC",47,0) + S LABEL(5)=$S(SEX=1:"Male",1:"Female")_" Body Mass Index-for age

" +"RTN","GMRVPGC",48,0) + S LABEL(6)=$S(SEX=1:"Male",1:"Female")_" Weight vs Stature

" +"RTN","GMRVPGC",49,0) + S LABEL(7)=$S(SEX=1:"Male",1:"Female")_" Weight vs Length

" +"RTN","GMRVPGC",50,0) + S TITLE(0)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Weight in kilograms" +"RTN","GMRVPGC",51,0) + S TITLE(1)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Length centimeters for 0-36 months" +"RTN","GMRVPGC",52,0) + S TITLE(2)=$S(SEX=1:"Male",1:"Female")_" Age in months vs Head Circumference in centimeters for 0-36 months" +"RTN","GMRVPGC",53,0) + S TITLE(4)=$S(SEX=1:"Male",1:"Female")_" Age in months vs. Height centimeters over 36 months" +"RTN","GMRVPGC",54,0) + S TITLE(5)=$S(SEX=1:"Male",1:"Female")_" Body Mass Index vs. Age in Months from 24-240 Months" +"RTN","GMRVPGC",55,0) + S TITLE(6)=$S(SEX=1:"Male",1:"Female")_" Weight in Kilograms vs. Height in centimeters" +"RTN","GMRVPGC",56,0) + S TITLE(7)=$S(SEX=1:"Male",1:"Female")_" Weight in Kilograms vs. Length in centimeters" +"RTN","GMRVPGC",57,0) + F STYLE=0,1,2,4,5,6,7 S TYPE=$$TYPE(STYLE) D:$L(XVALS(TYPE)) +"RTN","GMRVPGC",58,0) + . Q:("456"[STYLE)&(MAXAGE<36) +"RTN","GMRVPGC",59,0) + . S TMP(LINE)=REF_SERVER_"?style="_$$STRING(STYLE)_"&title="_TITLE(STYLE)_"&sex="_SEX_"&maxage="_$$AGE(MAXAGE,STYLE)_"&xvals="_$P(XVALS(TYPE),",",2,99)_"&yvals="_$P(YVALS(TYPE),",",2,99)_""">"_LABEL(STYLE) +"RTN","GMRVPGC",60,0) + . S LINE=LINE+1 +"RTN","GMRVPGC",61,0) + . Q +"RTN","GMRVPGC",62,0) + ; +"RTN","GMRVPGC",63,0) + S:NONE TMP(LINE)="

THERE ARE NO GROWTH VITALS TO PLOT.

",LINE=LINE+1 +"RTN","GMRVPGC",64,0) + ; last of the labels +"RTN","GMRVPGC",65,0) + S TMP(LINE)="

Note: should any xvals or yvals value be inappropriate, or there be an unequal number of values in both lists,",LINE=LINE+1 +"RTN","GMRVPGC",66,0) + S TMP(LINE)="the patient plot will be ignored, and a ""blank"" growth chart with percentile values only will be shown.

",LINE=LINE+1 +"RTN","GMRVPGC",67,0) + S TMP(LINE)="" +"RTN","GMRVPGC",68,0) + S TMP(LINE+1)="" +"RTN","GMRVPGC",69,0) + ; +"RTN","GMRVPGC",70,0) + ; Write out the file +"RTN","GMRVPGC",71,0) + D OPEN^%ZISH("OUTFILE",ROOT,DFN_".html","W") S:POP GMRVPGC="ERROR" +"RTN","GMRVPGC",72,0) + Q:POP +"RTN","GMRVPGC",73,0) + U IO +"RTN","GMRVPGC",74,0) + S LINE=0 F S LINE=$O(TMP(LINE)) Q:LINE'>0 W TMP(LINE),! +"RTN","GMRVPGC",75,0) + D CLOSE^%ZISH("OUTFILE") +"RTN","GMRVPGC",76,0) + Q +"RTN","GMRVPGC",77,0) + ; +"RTN","GMRVPGC",78,0) + ; convert age to months +"RTN","GMRVPGC",79,0) +MNTHSOLD(DATE,DOB) ; +"RTN","GMRVPGC",80,0) + S X1=DATE,X2=DOB D ^%DTC S X=X/30.42,X=$$ROUND(X) +"RTN","GMRVPGC",81,0) + Q X +"RTN","GMRVPGC",82,0) + ; +"RTN","GMRVPGC",83,0) +ROUND(X) ; +"RTN","GMRVPGC",84,0) + Q $P(X,".")_"."_$E($P(X,".",2),1,2) +"RTN","GMRVPGC",85,0) + ; +"RTN","GMRVPGC",86,0) +TYPE(STYLE) ; +"RTN","GMRVPGC",87,0) + Q $S(STYLE=0:9,STYLE=1:8,STYLE=2:20,STYLE=4:8,STYLE=5:"BMI",1:"WTHT") +"RTN","GMRVPGC",88,0) + ; +"RTN","GMRVPGC",89,0) +AGE(MAXAGE,STYLE) ; +"RTN","GMRVPGC",90,0) + I MAXAGE<36 Q MAXAGE +"RTN","GMRVPGC",91,0) + I "0456"[STYLE Q MAXAGE +"RTN","GMRVPGC",92,0) + Q 36 +"RTN","GMRVPGC",93,0) + ; +"RTN","GMRVPGC",94,0) +STRING(STYLE) ; +"RTN","GMRVPGC",95,0) + I STYLE=0 Q "weight-age" +"RTN","GMRVPGC",96,0) + I STYLE=1 Q "length-age" +"RTN","GMRVPGC",97,0) + I STYLE=2 Q "head-age" +"RTN","GMRVPGC",98,0) + I STYLE=4 Q "stature-age" +"RTN","GMRVPGC",99,0) + I STYLE=5 Q "bmi-age" +"RTN","GMRVPGC",100,0) + I STYLE=6 Q "weight-stature" +"RTN","GMRVPGC",101,0) + I STYLE=7 Q "weight-length" +"RTN","GMRVPGC",102,0) + Q 0 ;oops! +"RTN","GMRVPGC",103,0) + ; +"RTN","GMRVPGC",104,0) +HEAD ;; +"RTN","GMRVPGC",105,0) + ;; +"RTN","GMRVPGC",107,0) + ;; +"RTN","GMRVPGC",108,0) + ;; +"RTN","GMRVPGC",109,0) + ;; Growth Chart Example +"RTN","GMRVPGC",110,0) + ;; +"RTN","GMRVPGC",111,0) + ;; +"RTN","GMRVPGC",112,0) + ;; +"RTN","GMRVPGC",113,0) + ;; +"RTN","GMRVPGC",114,0) + ;; +"RTN","GMRVPGC",115,0) + ;; +"RTN","GMRVPGC",116,0) + ;;Click on any one of the following to display the available growth charts for your patient. Use the back button to return to the main page. +"RTN","GMRVPGC",117,0) + ;; +"RTN","GMVDCSAV") +0^3^B20608743 +"RTN","GMVDCSAV",1,0) +GMVDCSAV ;HOIFO/DAD-VITALS COMPONENT: SAVE DATA ;11/15/07 11:11 +"RTN","GMVDCSAV",2,0) + ;;5.0;GEN. MED. REC. - VITALS;**9,3**;Oct 31, 2002;Build 15 +"RTN","GMVDCSAV",3,0) + ; +"RTN","GMVDCSAV",4,0) + ; This routine uses the following IAs: +"RTN","GMVDCSAV",5,0) + ; #10103 - ^XLFDT calls (supported) +"RTN","GMVDCSAV",6,0) + ; +"RTN","GMVDCSAV",7,0) + ; This routine supports the following IAs: +"RTN","GMVDCSAV",8,0) + ; #3996 - GMV ADD VM RPC called at EN1 (private) +"RTN","GMVDCSAV",9,0) + ; +"RTN","GMVDCSAV",10,0) + ; 01/28/2005 KAM GMRV*5*9 Record midnight with 1 second added +"RTN","GMVDCSAV",11,0) + ; Stop adding second on multiple patent entry +"RTN","GMVDCSAV",12,0) + ; +"RTN","GMVDCSAV",13,0) +EN1(RESULT,GMVDATA) ; GMV ADD VM [RPC entry point] +"RTN","GMVDCSAV",14,0) + ; Saves vitals data +"RTN","GMVDCSAV",15,0) + N GMVCNT,GMVD0,GMVFDA,GMVINUM,GMVQNUM,GMVRNUM,GMVIEN,GMVDUN +"RTN","GMVDCSAV",16,0) + N GMVVNUM,GMVVMEAS,GMVVQUAL,GMVVREAS +"RTN","GMVDCSAV",17,0) + D QUALTWO +"RTN","GMVDCSAV",18,0) + Q +"RTN","GMVDCSAV",19,0) + ;I $O(@GMVDATA@("V",0))>0 D VITMEA +"RTN","GMVDCSAV",20,0) + ;I $O(@GMVDATA@("I",0))>0 D ENTERR +"RTN","GMVDCSAV",21,0) + ;I $G(RESULT(0))="OK" D MSG("OK: Data saved") +"RTN","GMVDCSAV",22,0) + ;Q +"RTN","GMVDCSAV",23,0) + ; +"RTN","GMVDCSAV",24,0) +VITMEA ; *** Save vital measurement data *** +"RTN","GMVDCSAV",25,0) + S GMVVNUM=0 K GMVFDA +"RTN","GMVDCSAV",26,0) + S GMVCNT=+$O(@GMVDATA@("V",1E25),-1) +"RTN","GMVDCSAV",27,0) + F S GMVVNUM=$O(@GMVDATA@("V",GMVVNUM)) Q:GMVVNUM'>0 D +"RTN","GMVDCSAV",28,0) + . S GMVVMEAS=$G(@GMVDATA@("V",GMVVNUM)) +"RTN","GMVDCSAV",29,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.01)=GMVDTDUN ; Date time taken +"RTN","GMVDCSAV",30,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.02)=GMVDFN ; Patient +"RTN","GMVDCSAV",31,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.03)=$P(GMVVMEAS,U) ; +"RTN","GMVDCSAV",32,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.04)=GMVDTENT ; Date Time entered +"RTN","GMVDCSAV",33,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.05)=GMVHOSPL ; Hospital +"RTN","GMVDCSAV",34,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",.06)=GMVENTBY ; Entered by (DUZ) +"RTN","GMVDCSAV",35,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",1.2)=$P($P(GMVVMEAS,U,2),";",1) ; Rate +"RTN","GMVDCSAV",36,0) + . S GMVFDA(120.5,"+"_GMVVNUM_",",1.4)=$P($P(GMVVMEAS,U,2),";",2) ; Sup 02 +"RTN","GMVDCSAV",37,0) + . S GMVQNUM=0 +"RTN","GMVDCSAV",38,0) + . F S GMVQNUM=$O(@GMVDATA@("Q",GMVVNUM,GMVQNUM)) Q:GMVQNUM'>0 D +"RTN","GMVDCSAV",39,0) + .. S GMVVQUAL=$G(@GMVDATA@("Q",GMVVNUM,GMVQNUM)) +"RTN","GMVDCSAV",40,0) + .. S GMVCNT=GMVCNT+1 +"RTN","GMVDCSAV",41,0) + .. S GMVFDA(120.505,"+"_GMVCNT_",","+"_GMVVNUM_",",.01)=GMVVQUAL +"RTN","GMVDCSAV",42,0) + .. Q +"RTN","GMVDCSAV",43,0) + . Q +"RTN","GMVDCSAV",44,0) + D UPDATE^DIE("","GMVFDA"),FMERROR +"RTN","GMVDCSAV",45,0) + S RESULT(0)="OK" +"RTN","GMVDCSAV",46,0) + Q +"RTN","GMVDCSAV",47,0) + ; +"RTN","GMVDCSAV",48,0) +ENTERR ; *** Save entered in error data *** +"RTN","GMVDCSAV",49,0) + S GMVINUM=0 K GMVFDA +"RTN","GMVDCSAV",50,0) + S GMVCNT=+$O(@GMVDATA@("I",1E25),-1) +"RTN","GMVDCSAV",51,0) + F S GMVINUM=$O(@GMVDATA@("I",GMVINUM)) Q:GMVINUM'>0 D +"RTN","GMVDCSAV",52,0) + . S GMVD0=$G(@GMVDATA@("I",GMVINUM)) +"RTN","GMVDCSAV",53,0) + . S GMVFDA(120.5,GMVD0_",",2)=1 +"RTN","GMVDCSAV",54,0) + . S GMVFDA(120.5,GMVD0_",",3)=GMVERRBY +"RTN","GMVDCSAV",55,0) + . S GMVRNUM=0 +"RTN","GMVDCSAV",56,0) + . F S GMVRNUM=$O(@GMVDATA@("R",GMVINUM,GMVRNUM)) Q:GMVRNUM'>0 D +"RTN","GMVDCSAV",57,0) + .. S GMVVREAS=$G(@GMVDATA@("R",GMVINUM,GMVRNUM)) +"RTN","GMVDCSAV",58,0) + .. S GMVCNT=GMVCNT+1 +"RTN","GMVDCSAV",59,0) + .. S GMVFDA(120.506,"+"_GMVCNT_","_GMVD0_",",.01)=GMVVREAS +"RTN","GMVDCSAV",60,0) + .. Q +"RTN","GMVDCSAV",61,0) + . Q +"RTN","GMVDCSAV",62,0) + D UPDATE^DIE("","GMVFDA"),FMERROR +"RTN","GMVDCSAV",63,0) + S RESULT(0)="OK" +"RTN","GMVDCSAV",64,0) + Q +"RTN","GMVDCSAV",65,0) +QUALTWO ; Add a new entry to FILE 120.5 +"RTN","GMVDCSAV",66,0) + S GMVVNUM=0 K GMVFDA +"RTN","GMVDCSAV",67,0) + S GMVVMEAS=$P(GMVDATA,"*",1) ; +"RTN","GMVDCSAV",68,0) + S GMVDTDUN=$P(GMVVMEAS,"^",1) ; Date time +"RTN","GMVDCSAV",69,0) + ;01/28/2005 KAM GMRV*5*9 Added next Line PAL-0105-60940 +"RTN","GMVDCSAV",70,0) + I +$P(GMVDTDUN,".",2)'>0 S GMVDTDUN=$$FMADD^XLFDT(GMVDTDUN,"","","",1) +"RTN","GMVDCSAV",71,0) + S GMVDFN=$P(GMVVMEAS,"^",2) ; Patient DFN +"RTN","GMVDCSAV",72,0) + S GMVVTYP=$P(GMVVMEAS,"^",3) ; Vital type +"RTN","GMVDCSAV",73,0) + S GMVDTDUN=$$CHKDT(GMVDTDUN,$P(GMVVTYP,";",1)) +"RTN","GMVDCSAV",74,0) + S GMVDTENT=$$NOW^XLFDT ; Current date time +"RTN","GMVDCSAV",75,0) + S GMVHOSPL=$P(GMVVMEAS,"^",4) ; Hospital +"RTN","GMVDCSAV",76,0) + S GMVENTBY=$P(GMVVMEAS,"^",5) ; DUZ +"RTN","GMVDCSAV",77,0) + S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ; Date time taken +"RTN","GMVDCSAV",78,0) + S GMVFDA(120.5,"+1,",.02)=GMVDFN ; Patient +"RTN","GMVDCSAV",79,0) + S GMVFDA(120.5,"+1,",.03)=$P(GMVVTYP,";",1) ; Vital Type +"RTN","GMVDCSAV",80,0) + S GMVFDA(120.5,"+1,",.04)=GMVDTENT ; Date Time entered +"RTN","GMVDCSAV",81,0) + S GMVFDA(120.5,"+1,",.05)=GMVHOSPL ; Hospital +"RTN","GMVDCSAV",82,0) + S GMVFDA(120.5,"+1,",.06)=GMVENTBY ; Entered by (DUZ) +"RTN","GMVDCSAV",83,0) + S GMVFDA(120.5,"+1,",1.2)=$P(GMVVTYP,";",2) ; Rate +"RTN","GMVDCSAV",84,0) + S GMVFDA(120.5,"+1,",1.4)=$P(GMVVTYP,";",3) ; Sup 02 +"RTN","GMVDCSAV",85,0) + S GMVIEN="" +"RTN","GMVDCSAV",86,0) + D UPDATE^DIE("","GMVFDA","GMVIEN"),FMERROR +"RTN","GMVDCSAV",87,0) + S GMVCNT=1 +"RTN","GMVDCSAV",88,0) + S GMVQUALS=$P(GMVDATA,"*",2) +"RTN","GMVDCSAV",89,0) + F GMVLOOP=1:1:$L(GMVQUALS,":")+1 D +"RTN","GMVDCSAV",90,0) + . S GMVVQUAL=$P(GMVQUALS,":",GMVLOOP) +"RTN","GMVDCSAV",91,0) + . Q:GMVVQUAL="" +"RTN","GMVDCSAV",92,0) + . S GMVCNT=GMVCNT+1 +"RTN","GMVDCSAV",93,0) + . D ADDQUAL^GMVGETQ(.GMVRES,GMVIEN(1)_"^"_GMVVQUAL) +"RTN","GMVDCSAV",94,0) + . Q +"RTN","GMVDCSAV",95,0) + I "^HT^WT^CG^"[$P($G(^GMRD(120.51,+GMVVTYP,0)),U,2) D EN^GMRVPGC(GMVDFN) +"RTN","GMVDCSAV",96,0) + Q +"RTN","GMVDCSAV",97,0) + ; +"RTN","GMVDCSAV",98,0) +CHKDT(GMVDT,GMVSAV) ;Check id there ios a vital entered for that date and time +"RTN","GMVDCSAV",99,0) + N GMVA,GMVQ +"RTN","GMVDCSAV",100,0) + S GMVQ=0 +"RTN","GMVDCSAV",101,0) + S GMVA="" +"RTN","GMVDCSAV",102,0) + F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:GMVA="" D +"RTN","GMVDCSAV",103,0) + . ;01/28/2005 KAM GMRV*5*9 Added next Line BHS-0504-10643 +"RTN","GMVDCSAV",104,0) + . I GMVDFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q +"RTN","GMVDCSAV",105,0) + . S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3) +"RTN","GMVDCSAV",106,0) + . I GMVTY=GMVSAV D +"RTN","GMVDCSAV",107,0) + . . S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1) +"RTN","GMVDCSAV",108,0) + . . Q +"RTN","GMVDCSAV",109,0) + . Q +"RTN","GMVDCSAV",110,0) + Q GMVDT +"RTN","GMVDCSAV",111,0) +MSG(X) ; *** Add a line to the message array *** +"RTN","GMVDCSAV",112,0) + S (GMVMSG,RESULT(-1))=1+$G(RESULT(-1),0) +"RTN","GMVDCSAV",113,0) + S RESULT(GMVMSG)=X +"RTN","GMVDCSAV",114,0) + I $P(X,":")="ERROR" S RESULT(0)="ERROR" +"RTN","GMVDCSAV",115,0) + Q +"RTN","GMVDCSAV",116,0) + ; +"RTN","GMVDCSAV",117,0) +FMERROR ; +"RTN","GMVDCSAV",118,0) + I $O(^TMP("DIERR",$J,0))>0 D +"RTN","GMVDCSAV",119,0) + . N GMVER1,GMVER2 +"RTN","GMVDCSAV",120,0) + . S GMVER1=0 +"RTN","GMVDCSAV",121,0) + . F S GMVER1=$O(^TMP("DIERR",$J,GMVER1)) Q:GMVER1'>0 D +"RTN","GMVDCSAV",122,0) + .. S GMVER2=0 +"RTN","GMVDCSAV",123,0) + .. F S GMVER2=$O(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)) Q:GMVER2'>0 D +"RTN","GMVDCSAV",124,0) + ... D MSG("ERROR: "_$G(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2))) +"RTN","GMVDCSAV",125,0) + ... Q +"RTN","GMVDCSAV",126,0) + .. Q +"RTN","GMVDCSAV",127,0) + . Q +"RTN","GMVDCSAV",128,0) + D CLEAN^DILF +"RTN","GMVDCSAV",129,0) + Q +"VER") +8.0^22.0 +**END** +**END** diff --git a/PGC.tar.gz b/PGC.tar.gz new file mode 100644 index 0000000..92eacd9 Binary files /dev/null and b/PGC.tar.gz differ