source: PGC/trunk/p/GMVDCSAV.m@ 1071

Last change on this file since 1071 was 958, checked in by George Lilly, 14 years ago

Pediatric Growth Charts initial release

File size: 4.4 KB
RevLine 
[958]1GMVDCSAV ;HOIFO/DAD-VITALS COMPONENT: SAVE DATA ;11/15/07 11:11
2 ;;5.0;GEN. MED. REC. - VITALS;**9,3**;Oct 31, 2002;Build 15
3 ;
4 ; This routine uses the following IAs:
5 ; #10103 - ^XLFDT calls (supported)
6 ;
7 ; This routine supports the following IAs:
8 ; #3996 - GMV ADD VM RPC called at EN1 (private)
9 ;
10 ; 01/28/2005 KAM GMRV*5*9 Record midnight with 1 second added
11 ; Stop adding second on multiple patent entry
12 ;
13EN1(RESULT,GMVDATA) ; GMV ADD VM [RPC entry point]
14 ; Saves vitals data
15 N GMVCNT,GMVD0,GMVFDA,GMVINUM,GMVQNUM,GMVRNUM,GMVIEN,GMVDUN
16 N GMVVNUM,GMVVMEAS,GMVVQUAL,GMVVREAS
17 D QUALTWO
18 Q
19 ;I $O(@GMVDATA@("V",0))>0 D VITMEA
20 ;I $O(@GMVDATA@("I",0))>0 D ENTERR
21 ;I $G(RESULT(0))="OK" D MSG("OK: Data saved")
22 ;Q
23 ;
24VITMEA ; *** Save vital measurement data ***
25 S GMVVNUM=0 K GMVFDA
26 S GMVCNT=+$O(@GMVDATA@("V",1E25),-1)
27 F S GMVVNUM=$O(@GMVDATA@("V",GMVVNUM)) Q:GMVVNUM'>0 D
28 . S GMVVMEAS=$G(@GMVDATA@("V",GMVVNUM))
29 . S GMVFDA(120.5,"+"_GMVVNUM_",",.01)=GMVDTDUN ; Date time taken
30 . S GMVFDA(120.5,"+"_GMVVNUM_",",.02)=GMVDFN ; Patient
31 . S GMVFDA(120.5,"+"_GMVVNUM_",",.03)=$P(GMVVMEAS,U) ;
32 . S GMVFDA(120.5,"+"_GMVVNUM_",",.04)=GMVDTENT ; Date Time entered
33 . S GMVFDA(120.5,"+"_GMVVNUM_",",.05)=GMVHOSPL ; Hospital
34 . S GMVFDA(120.5,"+"_GMVVNUM_",",.06)=GMVENTBY ; Entered by (DUZ)
35 . S GMVFDA(120.5,"+"_GMVVNUM_",",1.2)=$P($P(GMVVMEAS,U,2),";",1) ; Rate
36 . S GMVFDA(120.5,"+"_GMVVNUM_",",1.4)=$P($P(GMVVMEAS,U,2),";",2) ; Sup 02
37 . S GMVQNUM=0
38 . F S GMVQNUM=$O(@GMVDATA@("Q",GMVVNUM,GMVQNUM)) Q:GMVQNUM'>0 D
39 .. S GMVVQUAL=$G(@GMVDATA@("Q",GMVVNUM,GMVQNUM))
40 .. S GMVCNT=GMVCNT+1
41 .. S GMVFDA(120.505,"+"_GMVCNT_",","+"_GMVVNUM_",",.01)=GMVVQUAL
42 .. Q
43 . Q
44 D UPDATE^DIE("","GMVFDA"),FMERROR
45 S RESULT(0)="OK"
46 Q
47 ;
48ENTERR ; *** Save entered in error data ***
49 S GMVINUM=0 K GMVFDA
50 S GMVCNT=+$O(@GMVDATA@("I",1E25),-1)
51 F S GMVINUM=$O(@GMVDATA@("I",GMVINUM)) Q:GMVINUM'>0 D
52 . S GMVD0=$G(@GMVDATA@("I",GMVINUM))
53 . S GMVFDA(120.5,GMVD0_",",2)=1
54 . S GMVFDA(120.5,GMVD0_",",3)=GMVERRBY
55 . S GMVRNUM=0
56 . F S GMVRNUM=$O(@GMVDATA@("R",GMVINUM,GMVRNUM)) Q:GMVRNUM'>0 D
57 .. S GMVVREAS=$G(@GMVDATA@("R",GMVINUM,GMVRNUM))
58 .. S GMVCNT=GMVCNT+1
59 .. S GMVFDA(120.506,"+"_GMVCNT_","_GMVD0_",",.01)=GMVVREAS
60 .. Q
61 . Q
62 D UPDATE^DIE("","GMVFDA"),FMERROR
63 S RESULT(0)="OK"
64 Q
65QUALTWO ; Add a new entry to FILE 120.5
66 S GMVVNUM=0 K GMVFDA
67 S GMVVMEAS=$P(GMVDATA,"*",1) ;
68 S GMVDTDUN=$P(GMVVMEAS,"^",1) ; Date time
69 ;01/28/2005 KAM GMRV*5*9 Added next Line PAL-0105-60940
70 I +$P(GMVDTDUN,".",2)'>0 S GMVDTDUN=$$FMADD^XLFDT(GMVDTDUN,"","","",1)
71 S GMVDFN=$P(GMVVMEAS,"^",2) ; Patient DFN
72 S GMVVTYP=$P(GMVVMEAS,"^",3) ; Vital type
73 S GMVDTDUN=$$CHKDT(GMVDTDUN,$P(GMVVTYP,";",1))
74 S GMVDTENT=$$NOW^XLFDT ; Current date time
75 S GMVHOSPL=$P(GMVVMEAS,"^",4) ; Hospital
76 S GMVENTBY=$P(GMVVMEAS,"^",5) ; DUZ
77 S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ; Date time taken
78 S GMVFDA(120.5,"+1,",.02)=GMVDFN ; Patient
79 S GMVFDA(120.5,"+1,",.03)=$P(GMVVTYP,";",1) ; Vital Type
80 S GMVFDA(120.5,"+1,",.04)=GMVDTENT ; Date Time entered
81 S GMVFDA(120.5,"+1,",.05)=GMVHOSPL ; Hospital
82 S GMVFDA(120.5,"+1,",.06)=GMVENTBY ; Entered by (DUZ)
83 S GMVFDA(120.5,"+1,",1.2)=$P(GMVVTYP,";",2) ; Rate
84 S GMVFDA(120.5,"+1,",1.4)=$P(GMVVTYP,";",3) ; Sup 02
85 S GMVIEN=""
86 D UPDATE^DIE("","GMVFDA","GMVIEN"),FMERROR
87 S GMVCNT=1
88 S GMVQUALS=$P(GMVDATA,"*",2)
89 F GMVLOOP=1:1:$L(GMVQUALS,":")+1 D
90 . S GMVVQUAL=$P(GMVQUALS,":",GMVLOOP)
91 . Q:GMVVQUAL=""
92 . S GMVCNT=GMVCNT+1
93 . D ADDQUAL^GMVGETQ(.GMVRES,GMVIEN(1)_"^"_GMVVQUAL)
94 . Q
95 I "^HT^WT^CG^"[$P($G(^GMRD(120.51,+GMVVTYP,0)),U,2) D EN^GMRVPGC(GMVDFN)
96 Q
97 ;
98CHKDT(GMVDT,GMVSAV) ;Check id there ios a vital entered for that date and time
99 N GMVA,GMVQ
100 S GMVQ=0
101 S GMVA=""
102 F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:GMVA="" D
103 . ;01/28/2005 KAM GMRV*5*9 Added next Line BHS-0504-10643
104 . I GMVDFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q
105 . S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3)
106 . I GMVTY=GMVSAV D
107 . . S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1)
108 . . Q
109 . Q
110 Q GMVDT
111MSG(X) ; *** Add a line to the message array ***
112 S (GMVMSG,RESULT(-1))=1+$G(RESULT(-1),0)
113 S RESULT(GMVMSG)=X
114 I $P(X,":")="ERROR" S RESULT(0)="ERROR"
115 Q
116 ;
117FMERROR ;
118 I $O(^TMP("DIERR",$J,0))>0 D
119 . N GMVER1,GMVER2
120 . S GMVER1=0
121 . F S GMVER1=$O(^TMP("DIERR",$J,GMVER1)) Q:GMVER1'>0 D
122 .. S GMVER2=0
123 .. F S GMVER2=$O(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)) Q:GMVER2'>0 D
124 ... D MSG("ERROR: "_$G(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)))
125 ... Q
126 .. Q
127 . Q
128 D CLEAN^DILF
129 Q
Note: See TracBrowser for help on using the repository browser.