Skip to content

Commit

Permalink
Changes to visit note and bill request structs (#42)
Browse files Browse the repository at this point in the history
* Changes to visit note and bill request structs WIP

* Removed updated at from bullets and fix unit tests

* Fix Bill mapping fields

---------

Co-authored-by: Felipe Fuerback <[email protected]>
  • Loading branch information
willfitze and Fuerback authored Sep 3, 2024
1 parent 3a88706 commit 5729dc1
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 90 deletions.
95 changes: 49 additions & 46 deletions bill.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,61 @@ type BillService struct {
}

type Bill struct {
ID int64 `json:"id"` //: 65099661468,
RefNumber *string `json:"ref_number"` //: null, // string(50). required for PATCH that marks bill as processed.
ServiceDate time.Time `json:"service_date"` //: "2016-10-12T12:00:00Z",
BillingDate *time.Time `json:"billing_date"` //: null, // datetime(iso8601). required for PATCH that marks bill as processed.
BillingStatus string `json:"billing_status"` //: "Unbilled",
BillingError *string `json:"billing_error"` //: null, // string(200). required for PATCH that marks bill as failed.
BillingRawError *string `json:"billing_raw_error"` //: null, // longtext. optional for PATCH that marks bill as failed.
Notes string `json:"notes"` //: "patient has not paid yet",
CPTs []*BillCPT `json:"cpts"` //: [{}],
Payment *BillPayment `json:"payment"` //: {},
VisitNoteID int64 `json:"visit_note_id"` //: 64409108504,
VisitNoteSignedDate time.Time `json:"visit_note_signed_date"` //: "2016-10-12T22:11:01Z",
VisitNoteDeletedDate *time.Time `json:"visit_note_deleted_date"` //: null,
ReferringProvider *BillProvider `json:"referring_provider"` //: {},
BillingProvider int64 `json:"billing_provider"` //: 42120898,
RenderingProvider int64 `json:"rendering_provider"` //: 68382673,
SupervisingProvider int64 `json:"supervising_provider"` //: 52893234,
OrderingProvider *BillProvider `json:"ordering_provider"` //: {}
ServiceLocation *BillServiceLocation `json:"service_location"` //: {}
Physician int64 `json:"physician"` //: 64811630594,
Practice int64 `json:"practice"` //: 65540,
Patient int64 `json:"patient"` //: 64901939201,
PriorAuthorization string `json:"prior_authorization"` //: "1234-ABC",
Metadata any `json:"metadata"` //: null,
CreatedDate time.Time `json:"created_date"` //: "2016-05-23T17:50:50Z",
LastModifiedDate time.Time `json:"last_modified_date"` //: "2016-10-12T22:39:46Z"
ID int64 `json:"id"` //: 65099661468,
RefNumber *string `json:"ref_number"` //: null, // string(50). required for PATCH that marks bill as processed.
ServiceDate time.Time `json:"service_date"` //: "2016-10-12T12:00:00Z",
BillingDate *time.Time `json:"billing_date"` //: null, // datetime(iso8601). required for PATCH that marks bill as processed.
BillingStatus string `json:"billing_status"` //: "Unbilled",
BillingError *string `json:"billing_error"` //: null, // string(200). required for PATCH that marks bill as failed.
BillingRawError *string `json:"billing_raw_error"` //: null, // longtext. optional for PATCH that marks bill as failed.
Notes string `json:"notes"` //: "patient has not paid yet",
CPTs []*BillCPT `json:"cpts"` //: [{}],
Payment int64 `json:"payment"` //: 142502884606313,
VisitNote int64 `json:"visit_note"` //: 64409108504,
VisitNoteSignedDate time.Time `json:"visit_note_signed_date"` //: "2016-10-12T22:11:01Z",
VisitNoteDeletedDate *time.Time `json:"visit_note_deleted_date"` //: null,
ReferringProvider *BillProvider `json:"referring_provider"` //: {},
BillingProvider *int64 `json:"billing_provider"` //: 42120898,
RenderingProvider *int64 `json:"rendering_provider"` //: 68382673,
SupervisingProvider *int64 `json:"supervising_provider"` //: 52893234,
OrderingProvider *BillProvider `json:"ordering_provider"` //: {}
ServiceLocation int64 `json:"service_location"` //: 141103949480183,
Physician int64 `json:"physician"` //: 64811630594,
Practice int64 `json:"practice"` //: 65540,
Patient int64 `json:"patient"` //: 64901939201,
PriorAuthorization *string `json:"prior_authorization"` //: "1234-ABC",
Metadata any `json:"metadata"` //: null,
CreatedDate time.Time `json:"created_date"` //: "2016-05-23T17:50:50Z",
LastModifiedDate time.Time `json:"last_modified_date"` //: "2016-10-12T22:39:46Z"
}

type BillCreate struct {
ServiceLocation int64 `json:"service_location"` //: 10 // required
VisitNoteID int64 `json:"visit_note_id"` //: 64409108504, // required
Patient int64 `json:"patient"` //: 64901939201, // required
Practice int64 `json:"practice"` //: 65540, // required
Physician int64 `json:"physician"` //: 64811630594, // required
CPTs []*BillCPT `json:"cpts"` //: [{}],
BillingProvider int64 `json:"billing_provider"` //: 42120898,
RenderingProvider int64 `json:"rendering_provider"` //: 68382673,
SupervisingProvider int64 `json:"supervising_provider"` //: 52893234,
ReferringProvider *BillProvider `json:"referring_provider"` //: {},
OrderingProvider *BillProvider `json:"ordering_provider"` //: {},
PriorAuthorization string `json:"prior_authorization"` //: "1234-ABC",
PaymentAmount float64 `json:"payment_amount"` //: 10.00,
Notes string `json:"notes"` //: "patient has not paid yet",
ServiceLocation int64 `json:"service_location"` //: 10 // required
VisitNote int64 `json:"visit_note"` //: 64409108504, // required
Patient int64 `json:"patient"` //: 64901939201, // required
Practice int64 `json:"practice"` //: 65540, // required
Physician int64 `json:"physician"` //: 64811630594, // required
CPTs []*BillCPT `json:"cpts,omitempty"` //: [{}],
BillingProvider int64 `json:"billing_provider,omitempty"` //: 42120898,
RenderingProvider int64 `json:"rendering_provider,omitempty"` //: 68382673,
SupervisingProvider int64 `json:"supervising_provider,omitempty"` //: 52893234,
ReferringProvider *BillProvider `json:"referring_provider,omitempty"` //: {},
OrderingProvider *BillProvider `json:"ordering_provider,omitempty"` //: {},
PriorAuthorization string `json:"prior_authorization,omitempty"` //: "1234-ABC",
PaymentAmount float64 `json:"payment_amount,omitempty"` //: 10.00,
Notes string `json:"notes,omitempty"` //: "patient has not paid yet",
}

type BillDX struct {
ICD10Code string `json:"icd10_code"`
}
type BillCPT struct {
CPT int64 `json:"cpt"` //: "99213",
Modifiers []string `json:"modifiers"` //: ["10"],
DXs []string `json:"dxs"` //: ["D23.4"],
AltDXs []string `json:"alt_dxs"` //: ["216.4"],
UnitCharge any `json:"unit_charge"` //: null,
Units any `json:"units"` //: null
CPT string `json:"cpt"` //: "99213",
Modifiers []string `json:"modifiers,omitempty"` //: ["10"],
DXs []BillDX `json:"dxs"` //: ["D23.4"],
AltDXs []string `json:"alt_dxs,omitempty"` //: ["216.4"],
UnitCharge string `json:"unit_charge"` //: "10.0",
Units string `json:"units"` //: "1.0"
}

type BillPayment struct {
Expand Down
14 changes: 8 additions & 6 deletions bill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBillService_Create(t *testing.T) {
"required fields only request": {
create: &BillCreate{
ServiceLocation: 10,
VisitNoteID: 64409108504,
VisitNote: 64409108504,
Patient: 64901939201,
Practice: 65540,
Physician: 64811630594,
Expand All @@ -27,16 +27,18 @@ func TestBillService_Create(t *testing.T) {
"all specified fields request": {
create: &BillCreate{
ServiceLocation: 10,
VisitNoteID: 64409108504,
VisitNote: 64409108504,
Patient: 64901939201,
Practice: 65540,
Physician: 64811630594,
CPTs: []*BillCPT{
{
CPT: 12,
Modifiers: []string{"modifier 1", "modifier 2"},
DXs: []string{"dx 1", "dx 2"},
AltDXs: []string{"alt dx 1", "alt dx 2"},
CPT: "12",
Units: "1.0",
UnitCharge: "122.0",
Modifiers: []string{"modifier 1", "modifier 2"},
DXs: []BillDX{{ICD10Code: "dx 1"}, {ICD10Code: "dx 2"}},
AltDXs: []string{"alt dx 1", "alt dx 2"},
},
},
BillingProvider: 42120898,
Expand Down
49 changes: 24 additions & 25 deletions visit_note.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,33 @@ type VisitNote struct {
}

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"` //: "Office Visit Note",
Confidential bool `json:"confidential"` //: false,
SignedBy int64 `json:"signed_by"` //: 131074,
SignedDate time.Time `json:"signed_date"` //: "2010-06-10T11:05:08Z",
Signatures []*VisitNoteSignature `json:"signatures"` //: [{}],
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,
UpdatedDate time.Time `json:"updated_date"` //: "2022-05-15T13:50:09"
ReplacedByEdit *string `json:"replaced_by_edit"` //: null,
ReplacedBy *string `json:"replaced_by"` //: null,
Edit *string `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"` //: [{}] // Not visible in the Find Visit Notes endpoint
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 *string `json:"replaced_by_edit"` //: null,
ReplacedBy *string `json:"replaced_by"` //: null,
Edit *string `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 {
Expand Down
23 changes: 10 additions & 13 deletions visit_note_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ func TestVisitNoteService_Create(t *testing.T) {
create: &VisitNoteCreate{
Bullets: []*VisitNoteBullet{
{
Category: "Subjective",
Text: "Patient",
Version: 1,
Sequence: 1,
Author: 12345,
UpdatedDate: time.Date(2024, 4, 15, 0, 0, 0, 0, time.UTC),
Category: "Subjective",
Text: "Patient",
Version: 1,
Sequence: 1,
Author: 12345,
},
},
ChartDate: time.Date(2024, 4, 15, 0, 0, 0, 0, time.UTC),
Expand All @@ -39,12 +38,11 @@ func TestVisitNoteService_Create(t *testing.T) {
create: &VisitNoteCreate{
Bullets: []*VisitNoteBullet{
{
Category: "Subjective",
Text: "Patient",
Version: 1,
Sequence: 1,
Author: 12345,
UpdatedDate: time.Date(2024, 4, 15, 0, 0, 0, 0, time.UTC),
Category: "Subjective",
Text: "Patient",
Version: 1,
Sequence: 1,
Author: 12345,
},
},
ChartDate: time.Date(2024, 4, 15, 0, 0, 0, 0, time.UTC),
Expand All @@ -55,7 +53,6 @@ func TestVisitNoteService_Create(t *testing.T) {
Type: "Office Visit Note",
Confidential: true,
SignedBy: 12345,
SignedDate: time.Date(2024, 4, 15, 0, 0, 0, 0, time.UTC),
Signatures: []*VisitNoteSignature{
{
User: 12345,
Expand Down

0 comments on commit 5729dc1

Please sign in to comment.