-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvisit_note.go
214 lines (185 loc) · 12 KB
/
visit_note.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package elation
import (
"context"
"fmt"
"net/http"
"time"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)
type VisitNoteServicer interface {
Create(ctx context.Context, create *VisitNoteCreate) (*VisitNote, *http.Response, error)
Find(ctx context.Context, opts *FindVisitNotesOptions) (*Response[[]*VisitNote], *http.Response, error)
}
var _ VisitNoteServicer = (*VisitNoteService)(nil)
type VisitNoteService struct {
client *HTTPClient
}
type VisitNote struct {
ID int64 `json:"id"`
Bullets []*VisitNoteBullet `json:"bullets"` //: [{}],
Checklists *VisitNoteChecklists `json:"checklists"` //: {},
Edits []*VisitNoteEdit `json:"edits"` //: [{}],
Signatures []*VisitNoteSignature `json:"signatures"` //: [{}],
Type string `json:"type"` //: "Office Visit Note", // string(50). This list is managed in the practice"s setting page
Template string `json:"template"` //: "SOAP", ["Simple", "SOAP", "Complete H&P (1 col)", "Complete H&P (2 col)", "Complete H&P (2 col A/P)", "Pre-Op"]
AmendmentRequest any `json:"amendment_request"` //: null,
Patient int64 `json:"patient"` //: 1638401,
Physician int64 `json:"physician"` //: 131074,
Practice int64 `json:"practice"` //: 34323,
DocumentDate time.Time `json:"document_date"` //: "2010-06-10T11:05:08Z",
ChartDate time.Time `json:"chart_date"` //: "2010-06-10T11:05:08Z",
ClinicalSummaryLink string `json:"clinical_summary_link"` //: "http://localhost/api/2.0/visit_notes/140758496444440/clinical_summary",
VisitSummaryLink string `json:"visit_summary_link"` //: "http://localhost/api/2.0/visit_notes/140758496444440/clinical_summary",
SignedDate time.Time `json:"signed_date"` //: "2010-06-10T11:05:08Z",
SignedBy int64 `json:"signed_by"` //: 131074,
CreatedDate time.Time `json:"created_date"` //: "2010-06-10T11:05:08Z",
LastModified time.Time `json:"last_modified"` //: "2022-05-20T11:06:12.507775Z",
DeletedDate *time.Time `json:"deleted_date"` //: null,
Tags []any `json:"tags"` //: [],
Confidential bool `json:"confidential"` //: false
}
type VisitNoteCreate struct {
Bullets []*VisitNoteBullet `json:"bullets"` //: [{}], // Required
ChartDate time.Time `json:"chart_date"` //: "2010-06-10T11:05:08Z", // Required
DocumentDate time.Time `json:"document_date"` //: "2010-06-10T11:05:08Z", // Required
Patient int64 `json:"patient"` //: 1638401, // Required
Template string `json:"template"` //: "SOAP", ["Simple", "SOAP", "Complete H&P (1 col)", "Complete H&P (2 col)", "Complete H&P (2 col A/P)", "Pre-Op"] // Required
Physician int64 `json:"physician"` //: 131074, // Required
Type string `json:"type,omitempty"` //: "Office Visit Note",
Confidential bool `json:"confidential,omitempty"` //: false,
SignedBy int64 `json:"signed_by,omitempty"` //: 131074,
SignedDate *time.Time `json:"signed_date,omitempty"` //: "2010-06-10T11:05:08Z",
Signatures []*VisitNoteSignature `json:"signatures,omitempty"` //: [{}],
}
type VisitNoteBullet struct {
Category string `json:"category"` //: "Problem", ["Problem", "Past", "Family", "Social", "Instr", "PE", "ROS", "Med", "Data", "Assessment", "Test", "Tx", "Narrative", "Followup", "Reason", "Plan", "Objective", "Hpi", "Allergies", "Habits", "Assessplan", "Consultant", "Attending", "Dateprocedure", "Surgical", "Orders", "Referenced", "Procedure"],
Text string `json:"text"` //: "Dizziness" string(500),
Version int64 `json:"version"` //: 1,
Sequence int64 `json:"sequence"` //: 0,
Author int64 `json:"author"` //: 10,
ReplacedByEdit any `json:"replaced_by_edit"` //: null,
ReplacedBy any `json:"replaced_by"` //: null,
Edit any `json:"edit"` //: null,
DeletedDate *time.Time `json:"deleted_date"` //: null,
NoteDocument *VisitNoteNoteDocument `json:"note_document"` //: null,
NoteItem *VisitNoteNoteItem `json:"note_item"` //: null,
Handout *int64 `json:"handout"` //: null,
Children []*VisitNoteChild `json:"children,omitempty"` //: [{}] // Not visible in the Find Visit Notes endpoint
}
type VisitNoteChild struct {
Category string `json:"category"` //: "Problem", ["Problem", "Past", "Family", "Social", "Instr", "PE", "ROS", "Med", "Data", "Assessment", "Test", "Tx", "Narrative", "Followup", "Reason", "Plan", "Objective", "Hpi", "Allergies", "Habits", "Assessplan", "Consultant", "Attending", "Dateprocedure", "Surgical", "Orders", "Referenced", "Procedure"],
Text string `json:"text"` //: "Dizziness", string(500),
Version int64 `json:"version"` //: 1,
Sequence int64 `json:"sequence"` //: 0,
Author int64 `json:"author"` //: 10,
UpdatedDate time.Time `json:"updated_date"` //: "2022-05-15T13:50:09"
ReplacedByEdit any `json:"replaced_by_edit"` //: null,
ReplacedBy any `json:"replaced_by"` //: null,
Edit any `json:"edit"` //: null,
DeletedDate *time.Time `json:"deleted_date"` //: null,
NoteItem *VisitNoteNoteItem `json:"note_item"` //: null,
NoteDocument *VisitNoteNoteDocument `json:"note_document"` //: null,
Handout int64 `json:"handout"` //: 140758529736869
}
type VisitNoteNoteItem struct {
ID int64 `json:"id"` //: 338362508,
Item *VisitNoteItem `json:"item"` //: {}
}
type VisitNoteItem struct {
ID int64 `json:"id"` //: 240582699
CreatedDate time.Time `json:"created_date"` //: "2013-04-09T18:41:23Z",
DeletedDate *time.Time `json:"deleted_date"` //: null,
Patient int64 `json:"patient"` //: 234160129,
Type string `json:"type"` //: "PatientProblem",
IsConfidential bool `json:"is_confidential"` //: false,
ItemType string `json:"itemType"` //: "PatientProblem"
}
type VisitNoteNoteDocument struct {
ID int64 `json:"id"` //: 99483787,
Document *VisitNoteDocument `json:"document"` //: {}
Summary *string `json:"summary"` //: null
}
type VisitNoteDocument struct {
AuthoringPractice int64 `json:"authoring_practice"` // 65540,
ChartDate time.Time `json:"chart_date"` // "2010-06-10T17:57:35Z",
CreatedDate time.Time `json:"created_date"` // "2010-06-10T17:57:35Z",
DeletedDate *time.Time `json:"deleted_date"` // null,
DocumentDate time.Time `json:"document_date"` // "2010-06-10T17:57:35Z",
DocumentType int64 `json:"document_type"` // 33,
ID int64 `json:"id"` // 2687009,
LastModified *time.Time `json:"last_modified"` // null,
Patient int64 `json:"patient"` // 1638401,
SignDate time.Time `json:"sign_date"` // "2010-06-10T17:57:35Z",
SignedBy int64 `json:"signed_by"` // 4
}
type VisitNoteChecklists struct {
PE []*VisitNoteChecklistItem `json:"PE"` //: [{}] // Physical Exam
ROS []*VisitNoteChecklistItem `json:"ROS"` //: [{}] // Review of Systems
}
type VisitNoteChecklistItem struct {
Name string `json:"name"` //: "General",
Value string `json:"value"` //: "well nourished",
Sequence int64 `json:"sequence"` // 0
}
type VisitNoteEdit struct {
VisitNote int64 `json:"visit_note"` //: 140755736526872,
CreateUser int64 `json:"create_user"` //: 1273,
CreatedDate time.Time `json:"created_date"` //: "2021-07-21T08:14:40Z",
PreviousNoteType any `json:"previous_note_type"` //: null,
PreviousNoteTime any `json:"previous_note_time"` //: null,
NewNoteType any `json:"new_note_type"` //: null,
NewNoteTime any `json:"new_note_time"` //: null,
PreviousPrevWeight any `json:"previous_prev_weight"` //: null,
NewPrevWeight any `json:"new_prev_weight"` //: null,
PreviousPrevBMI any `json:"previous_prev_bmi"` //: null,
NewPrevBMI any `json:"new_prev_bmi"` //: null,
PreviousPrevTime any `json:"previous_prev_time"` //: null,
NewPrevTime any `json:"new_prev_time"` //: null,
PreviousBMI any `json:"previous_bmi"` //: null,
NewBMI any `json:"new_bmi"` //: null,
}
type VisitNoteSignature struct {
User int64 `json:"user"` //: 12,
UserName string `json:"user_name"` //: "Douglas Ross, MD",
SignedDate time.Time `json:"signed_date"` //: "2022-10-31T12:30:00Z",
Role string `json:"role"` //: "cosigner",
Comments *string `json:"comments"` //: null
}
func (v *VisitNoteService) Create(ctx context.Context, create *VisitNoteCreate) (*VisitNote, *http.Response, error) {
ctx, span := v.client.tracer.Start(ctx, "create visit note", trace.WithSpanKind(trace.SpanKindClient))
defer span.End()
vn := &VisitNote{}
res, err := v.client.request(ctx, http.MethodPost, "/visit_notes", nil, create, &vn)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, "error making request")
return nil, res, fmt.Errorf("making request: %w", err)
}
return vn, res, nil
}
type FindVisitNotesOptions struct {
*Pagination
Patient int64 `url:"patient,omitempty"`
Physician int64 `url:"physician,omitempty"`
Practice int64 `url:"practice,omitempty"`
LastModifiedGT time.Time `url:"last_modified__gt,omitempty"`
LastModifiedGTE time.Time `url:"last_modified__gte,omitempty"`
LastModifiedLT time.Time `url:"last_modified__lt,omitempty"`
LastModifiedLTE time.Time `url:"last_modified__lte,omitempty"`
FromSignedDate time.Time `url:"from_signed_date,omitempty"`
ToSignedDate time.Time `url:"to_signed_date,omitempty"`
Unsigned bool `url:"unsigned,omitempty"`
}
func (v *VisitNoteService) Find(ctx context.Context, opts *FindVisitNotesOptions) (*Response[[]*VisitNote], *http.Response, error) {
ctx, span := v.client.tracer.Start(ctx, "find visit notes", trace.WithSpanKind(trace.SpanKindClient))
defer span.End()
out := &Response[[]*VisitNote]{}
res, err := v.client.request(ctx, http.MethodGet, "/visit_notes", opts, nil, &out)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, "error making request")
return nil, res, fmt.Errorf("making request: %w", err)
}
return out, res, nil
}