source: FOIAVistA/trunk/r/GEN_MED_OTHER-GMV/GMVDCSAV.m@ 1582

Last change on this file since 1582 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1GMVDCSAV ;HOIFO/DAD-VITALS COMPONENT: SAVE DATA ; 8/5/05 7:01am
2 ;;5.0;GEN. MED. REC. - VITALS;**9,3**;Oct 31, 2002
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 Q
96 ;
97CHKDT(GMVDT,GMVSAV) ;Check id there ios a vital entered for that date and time
98 N GMVA,GMVQ
99 S GMVQ=0
100 S GMVA=""
101 F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:GMVA="" D
102 . ;01/28/2005 KAM GMRV*5*9 Added next Line BHS-0504-10643
103 . I GMVDFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q
104 . S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3)
105 . I GMVTY=GMVSAV D
106 . . S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1)
107 . . Q
108 . Q
109 Q GMVDT
110MSG(X) ; *** Add a line to the message array ***
111 S (GMVMSG,RESULT(-1))=1+$G(RESULT(-1),0)
112 S RESULT(GMVMSG)=X
113 I $P(X,":")="ERROR" S RESULT(0)="ERROR"
114 Q
115 ;
116FMERROR ;
117 I $O(^TMP("DIERR",$J,0))>0 D
118 . N GMVER1,GMVER2
119 . S GMVER1=0
120 . F S GMVER1=$O(^TMP("DIERR",$J,GMVER1)) Q:GMVER1'>0 D
121 .. S GMVER2=0
122 .. F S GMVER2=$O(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)) Q:GMVER2'>0 D
123 ... D MSG("ERROR: "_$G(^TMP("DIERR",$J,GMVER1,"TEXT",GMVER2)))
124 ... Q
125 .. Q
126 . Q
127 D CLEAN^DILF
128 Q
Note: See TracBrowser for help on using the repository browser.