oro-sdk-apis 4.3.1 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Drug, TreatmentPlan, TreatmentPlans, TreatmentPlansRequest, TreatmentPlansResponse, Uuid } from '..';
1
+ import { Consult, Drug, TreatmentAssociatedConsultData, TreatmentPlan, TreatmentPlans, TreatmentPlansRequest, TreatmentPlansResponse, Uuid } from '..';
2
2
  import { Diagnosis, Treatment, DiagnosisRequest, TreatmentAndDrugPrescriptionUpdateRequest, TreatmentRequest } from '../models/diagnosis';
3
3
  import { APIService } from './api';
4
4
  export declare class DiagnosisService {
@@ -35,6 +35,9 @@ export declare class DiagnosisService {
35
35
  getTreatmentPlansPopulatedFromConsultUuid(uuidConsult: Uuid): Promise<TreatmentPlans>;
36
36
  postPlans(plans: TreatmentPlansRequest): Promise<TreatmentPlansResponse>;
37
37
  updateTreatmentPlan(uuidPlan: string, uuidConsult: string, diagnosisRequest: DiagnosisRequest, plan: TreatmentAndDrugPrescriptionUpdateRequest, refill?: boolean): Promise<TreatmentPlan>;
38
+ updateTreatmentPlanAndSetAssociatedConsult(uuidPlan: string, consultAssociated: Consult, diagnosisRequest: DiagnosisRequest, plan: TreatmentAndDrugPrescriptionUpdateRequest, refill?: boolean): Promise<TreatmentPlan>;
39
+ setAssociatedConsultsToTreatment(uuidPlan: string, arrAssociatedConsults: TreatmentAssociatedConsultData[]): Promise<TreatmentAssociatedConsultData[]>;
40
+ updateAssociatedConsultsToTreatment(uuidPlan: string, arrAssociatedConsults: TreatmentAssociatedConsultData[]): Promise<TreatmentAssociatedConsultData[]>;
38
41
  acceptTreatmentPlan(uuidPlan: string, uuidConsult: string): Promise<TreatmentPlan>;
39
42
  /**
40
43
  * retrieves all the drugs of the specified practice
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.3.1",
2
+ "version": "4.3.2",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -55,4 +55,4 @@
55
55
  "buffer": "^6.0.3",
56
56
  "hash.js": "^1.1.7"
57
57
  }
58
- }
58
+ }
@@ -191,4 +191,6 @@ export interface TreatmentPlansResponseEntry {
191
191
  treatmentPlan: TreatmentPlan
192
192
  }
193
193
 
194
- export interface TreatmentPlansResponse extends Array<TreatmentPlansResponseEntry> {}
194
+ export interface TreatmentPlansResponse extends Array<TreatmentPlansResponseEntry> {}
195
+
196
+ export interface TreatmentAssociatedConsultDataResponse extends Array<TreatmentAssociatedConsultData> {}
@@ -1,5 +1,7 @@
1
1
  import {
2
+ Consult,
2
3
  Drug,
4
+ TreatmentAssociatedConsultData,
3
5
  TreatmentPlan,
4
6
  TreatmentPlans,
5
7
  TreatmentPlansRequest,
@@ -94,6 +96,48 @@ export class DiagnosisService {
94
96
  })
95
97
  }
96
98
 
99
+ public updateTreatmentPlanAndSetAssociatedConsult(
100
+ uuidPlan: string,
101
+ consultAssociated: Consult,
102
+ diagnosisRequest: DiagnosisRequest,
103
+ plan: TreatmentAndDrugPrescriptionUpdateRequest,
104
+ refill?: boolean
105
+ ): Promise<TreatmentPlan> {
106
+ const associatedConsultData : TreatmentAssociatedConsultData = {
107
+ uuidConsult: consultAssociated.uuid,
108
+ consultKind: consultAssociated.consultType,
109
+ }
110
+ //this is fire and forget and may fail later
111
+ try{
112
+ this.updateAssociatedConsultsToTreatment(uuidPlan, [ associatedConsultData ])
113
+ }
114
+ catch{
115
+ console.error( `[SDK Diagnosis] We failed to updated associated consult to the treatment plan ${uuidPlan}`)
116
+ }
117
+
118
+ return this.updateTreatmentPlan( uuidPlan, consultAssociated.uuid, diagnosisRequest, plan, refill )
119
+ }
120
+
121
+ public setAssociatedConsultsToTreatment(
122
+ uuidPlan: string,
123
+ arrAssociatedConsults: TreatmentAssociatedConsultData[]
124
+ ): Promise<TreatmentAssociatedConsultData[]> {
125
+ return this.api.post<TreatmentAssociatedConsultData[]>(
126
+ `${this.baseURL}/v1/treatment-plans/${uuidPlan}/associated-consults`,
127
+ arrAssociatedConsults
128
+ )
129
+ }
130
+
131
+ public updateAssociatedConsultsToTreatment(
132
+ uuidPlan: string,
133
+ arrAssociatedConsults: TreatmentAssociatedConsultData[]
134
+ ): Promise<TreatmentAssociatedConsultData[]> {
135
+ return this.api.put<TreatmentAssociatedConsultData[]>(
136
+ `${this.baseURL}/v1/treatment-plans/${uuidPlan}/associated-consults`,
137
+ arrAssociatedConsults
138
+ )
139
+ }
140
+
97
141
  public acceptTreatmentPlan(uuidPlan: string, uuidConsult: string): Promise<TreatmentPlan> {
98
142
  return this.api.put<TreatmentPlan>(`${this.baseURL}/v1/treatment-plans/${uuidPlan}/accept`, { uuidConsult })
99
143
  }