質問編集履歴
11
内容訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,16 +4,6 @@
|
|
4
4
|
|
5
5
|
`````````````````````````````````````````````````````````````````````````````````
|
6
6
|
|
7
|
-
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
8
|
-
|
9
|
-
|
7
|
+
```````````````````````````````````````
|
10
|
-
|
11
|
-
^
|
12
|
-
|
13
|
-
1 error
|
14
|
-
|
15
|
-
|
16
8
|
|
17
9
|
````````````````````````````````````````````````````````````````````````````````````
|
18
|
-
|
19
|
-
````````````````````````````````````````````````````````````````````````````````````
|
10
内容訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,217 +17,3 @@
|
|
17
17
|
````````````````````````````````````````````````````````````````````````````````````
|
18
18
|
|
19
19
|
````````````````````````````````````````````````````````````````````````````````````
|
20
|
-
|
21
|
-
package assignment;
|
22
|
-
|
23
|
-
import ca.uhn.fhir.context.FhirContext;
|
24
|
-
|
25
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
26
|
-
|
27
|
-
import ca.uhn.fhir.rest.api.MethodOutcome;
|
28
|
-
|
29
|
-
import org.hl7.fhir.dstu3.model.Patient;
|
30
|
-
|
31
|
-
import org.hl7.fhir.dstu3.model.ContactPoint;
|
32
|
-
|
33
|
-
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
|
34
|
-
|
35
|
-
import org.hl7.fhir.dstu3.model.Observation;
|
36
|
-
|
37
|
-
import org.hl7.fhir.dstu3.model.Quantity;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
/**
|
42
|
-
|
43
|
-
* This class contains methods for updating resources in the FHIR server.
|
44
|
-
|
45
|
-
*/
|
46
|
-
|
47
|
-
public class AdvancedUpdate {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
private IGenericClient client = null;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
public AdvancedUpdate(String baseUrl) {
|
56
|
-
|
57
|
-
FhirContext ctx = FhirContext.forDstu3();
|
58
|
-
|
59
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
/**
|
66
|
-
|
67
|
-
* Find the patient with the given ID and update the home phone number. If the
|
68
|
-
|
69
|
-
* patient does not already have a home phone number, add it. Return the ID
|
70
|
-
|
71
|
-
* of the updated resource.
|
72
|
-
|
73
|
-
*/
|
74
|
-
|
75
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
76
|
-
|
77
|
-
//Place your code here
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
/**
|
84
|
-
|
85
|
-
* Find the observation with the given ID and update the value. Recall that
|
86
|
-
|
87
|
-
* observations have a unit of measure value code, units, and a value - this
|
88
|
-
|
89
|
-
* method only updates the value. Return the ID of the updated resource.
|
90
|
-
|
91
|
-
*/
|
92
|
-
|
93
|
-
public String updateObservationValue(String observationId, double value) {
|
94
|
-
|
95
|
-
//Place your code here
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
Copy the code and make your edits below.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
**Your Code:**
|
110
|
-
|
111
|
-
import ca.uhn.fhir.context.FhirContext;
|
112
|
-
|
113
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
114
|
-
|
115
|
-
import org.hl7.fhir.r4.model.*;
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
import java.util.ArrayList;
|
120
|
-
|
121
|
-
import java.util.List;
|
122
|
-
|
123
|
-
import java.util.stream.Collectors;
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
/**
|
128
|
-
|
129
|
-
* This class contains methods for updating resources in the FHIR server.
|
130
|
-
|
131
|
-
*/
|
132
|
-
|
133
|
-
public class AdvancedUpdate {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
FhirContext ctx;
|
138
|
-
|
139
|
-
IGenericClient client;
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
public AdvancedUpdate(String baseUrl) {
|
144
|
-
|
145
|
-
ctx = FhirContext.forR4();
|
146
|
-
|
147
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
/**
|
154
|
-
|
155
|
-
* Find the patient with the given ID and update the home phone number. If the
|
156
|
-
|
157
|
-
* patient does not already have a home phone number, add it. Return the ID
|
158
|
-
|
159
|
-
* of the updated resource.
|
160
|
-
|
161
|
-
*/
|
162
|
-
|
163
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
164
|
-
|
165
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
ContactPoint contactPoint = new ContactPoint();
|
170
|
-
|
171
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
172
|
-
|
173
|
-
contactPoint.setValue(homePhoneNumber);
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
178
|
-
|
179
|
-
if (contactPoints == null) {
|
180
|
-
|
181
|
-
contactPoints = new ArrayList<>();
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
else {
|
186
|
-
|
187
|
-
contactPoints = contactPoints.stream()
|
188
|
-
|
189
|
-
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
190
|
-
|
191
|
-
.collect(Collectors.toList());
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
contactPoints.add(contactPoint);
|
196
|
-
|
197
|
-
patient.setTelecom(contactPoints);
|
198
|
-
|
199
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
/**
|
208
|
-
|
209
|
-
* Find the observation with the given ID and update the value. Recall that
|
210
|
-
|
211
|
-
* observations have a unit of measure value code, units, and a value - this
|
212
|
-
|
213
|
-
* method only updates the value. Return the ID of the updated resource.
|
214
|
-
|
215
|
-
*/
|
216
|
-
|
217
|
-
public String updateObservationValue(String observationId, double value) {
|
218
|
-
|
219
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
220
|
-
|
221
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
222
|
-
|
223
|
-
quantity.setValue(value);
|
224
|
-
|
225
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
````````````````````````````````````````````````````````````````````````````````````
|
9
内容変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Javaコードで下記のようなエラーが出ます。どこが間違っているか教えてください。
|
test
CHANGED
File without changes
|
8
package assignment; 追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
````````````````````````````````````````````````````````````````````````````````````
|
20
20
|
|
21
|
+
package assignment;
|
22
|
+
|
21
23
|
import ca.uhn.fhir.context.FhirContext;
|
22
24
|
|
23
25
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
7
内容変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
````````````````````````````````````````````````````````````````````````````````````
|
18
18
|
|
19
|
-
|
19
|
+
````````````````````````````````````````````````````````````````````````````````````
|
20
20
|
|
21
21
|
import ca.uhn.fhir.context.FhirContext;
|
22
22
|
|
@@ -102,130 +102,130 @@
|
|
102
102
|
|
103
103
|
|
104
104
|
|
105
|
+
|
106
|
+
|
107
|
+
**Your Code:**
|
108
|
+
|
109
|
+
import ca.uhn.fhir.context.FhirContext;
|
110
|
+
|
111
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
112
|
+
|
113
|
+
import org.hl7.fhir.r4.model.*;
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
import java.util.ArrayList;
|
118
|
+
|
119
|
+
import java.util.List;
|
120
|
+
|
121
|
+
import java.util.stream.Collectors;
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
/**
|
126
|
+
|
127
|
+
* This class contains methods for updating resources in the FHIR server.
|
128
|
+
|
129
|
+
*/
|
130
|
+
|
131
|
+
public class AdvancedUpdate {
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
FhirContext ctx;
|
136
|
+
|
137
|
+
IGenericClient client;
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
public AdvancedUpdate(String baseUrl) {
|
142
|
+
|
143
|
+
ctx = FhirContext.forR4();
|
144
|
+
|
145
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
/**
|
152
|
+
|
153
|
+
* Find the patient with the given ID and update the home phone number. If the
|
154
|
+
|
155
|
+
* patient does not already have a home phone number, add it. Return the ID
|
156
|
+
|
157
|
+
* of the updated resource.
|
158
|
+
|
159
|
+
*/
|
160
|
+
|
161
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
162
|
+
|
163
|
+
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
ContactPoint contactPoint = new ContactPoint();
|
168
|
+
|
169
|
+
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
170
|
+
|
171
|
+
contactPoint.setValue(homePhoneNumber);
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
List<ContactPoint> contactPoints = patient.getTelecom();
|
176
|
+
|
177
|
+
if (contactPoints == null) {
|
178
|
+
|
179
|
+
contactPoints = new ArrayList<>();
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
else {
|
184
|
+
|
185
|
+
contactPoints = contactPoints.stream()
|
186
|
+
|
187
|
+
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
188
|
+
|
189
|
+
.collect(Collectors.toList());
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
contactPoints.add(contactPoint);
|
194
|
+
|
195
|
+
patient.setTelecom(contactPoints);
|
196
|
+
|
197
|
+
return client.update().resource(patient).execute().getId().getIdPart();
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
/**
|
206
|
+
|
207
|
+
* Find the observation with the given ID and update the value. Recall that
|
208
|
+
|
209
|
+
* observations have a unit of measure value code, units, and a value - this
|
210
|
+
|
211
|
+
* method only updates the value. Return the ID of the updated resource.
|
212
|
+
|
213
|
+
*/
|
214
|
+
|
215
|
+
public String updateObservationValue(String observationId, double value) {
|
216
|
+
|
217
|
+
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
218
|
+
|
219
|
+
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
220
|
+
|
221
|
+
quantity.setValue(value);
|
222
|
+
|
223
|
+
return client.update().resource(observation).execute().getId().getIdPart();
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
}
|
230
|
+
|
105
231
|
````````````````````````````````````````````````````````````````````````````````````
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
**Your Code:**
|
110
|
-
|
111
|
-
import ca.uhn.fhir.context.FhirContext;
|
112
|
-
|
113
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
114
|
-
|
115
|
-
import org.hl7.fhir.r4.model.*;
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
import java.util.ArrayList;
|
120
|
-
|
121
|
-
import java.util.List;
|
122
|
-
|
123
|
-
import java.util.stream.Collectors;
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
/**
|
128
|
-
|
129
|
-
* This class contains methods for updating resources in the FHIR server.
|
130
|
-
|
131
|
-
*/
|
132
|
-
|
133
|
-
public class AdvancedUpdate {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
FhirContext ctx;
|
138
|
-
|
139
|
-
IGenericClient client;
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
public AdvancedUpdate(String baseUrl) {
|
144
|
-
|
145
|
-
ctx = FhirContext.forR4();
|
146
|
-
|
147
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
/**
|
154
|
-
|
155
|
-
* Find the patient with the given ID and update the home phone number. If the
|
156
|
-
|
157
|
-
* patient does not already have a home phone number, add it. Return the ID
|
158
|
-
|
159
|
-
* of the updated resource.
|
160
|
-
|
161
|
-
*/
|
162
|
-
|
163
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
164
|
-
|
165
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
ContactPoint contactPoint = new ContactPoint();
|
170
|
-
|
171
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
172
|
-
|
173
|
-
contactPoint.setValue(homePhoneNumber);
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
178
|
-
|
179
|
-
if (contactPoints == null) {
|
180
|
-
|
181
|
-
contactPoints = new ArrayList<>();
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
else {
|
186
|
-
|
187
|
-
contactPoints = contactPoints.stream()
|
188
|
-
|
189
|
-
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
190
|
-
|
191
|
-
.collect(Collectors.toList());
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
contactPoints.add(contactPoint);
|
196
|
-
|
197
|
-
patient.setTelecom(contactPoints);
|
198
|
-
|
199
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
/**
|
208
|
-
|
209
|
-
* Find the observation with the given ID and update the value. Recall that
|
210
|
-
|
211
|
-
* observations have a unit of measure value code, units, and a value - this
|
212
|
-
|
213
|
-
* method only updates the value. Return the ID of the updated resource.
|
214
|
-
|
215
|
-
*/
|
216
|
-
|
217
|
-
public String updateObservationValue(String observationId, double value) {
|
218
|
-
|
219
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
220
|
-
|
221
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
222
|
-
|
223
|
-
quantity.setValue(value);
|
224
|
-
|
225
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
6
変更追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Java コードどこが間違っているか教えてください。
|
1
|
+
えJava コードどこが間違っているか教えてください。
|
test
CHANGED
@@ -16,29 +16,113 @@
|
|
16
16
|
|
17
17
|
````````````````````````````````````````````````````````````````````````````````````
|
18
18
|
|
19
|
+
|
20
|
+
|
21
|
+
import ca.uhn.fhir.context.FhirContext;
|
22
|
+
|
23
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
24
|
+
|
25
|
+
import ca.uhn.fhir.rest.api.MethodOutcome;
|
26
|
+
|
27
|
+
import org.hl7.fhir.dstu3.model.Patient;
|
28
|
+
|
29
|
+
import org.hl7.fhir.dstu3.model.ContactPoint;
|
30
|
+
|
31
|
+
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
|
32
|
+
|
33
|
+
import org.hl7.fhir.dstu3.model.Observation;
|
34
|
+
|
35
|
+
import org.hl7.fhir.dstu3.model.Quantity;
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
/**
|
40
|
+
|
41
|
+
* This class contains methods for updating resources in the FHIR server.
|
42
|
+
|
43
|
+
*/
|
44
|
+
|
45
|
+
public class AdvancedUpdate {
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
private IGenericClient client = null;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
public AdvancedUpdate(String baseUrl) {
|
54
|
+
|
55
|
+
FhirContext ctx = FhirContext.forDstu3();
|
56
|
+
|
57
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
/**
|
64
|
+
|
65
|
+
* Find the patient with the given ID and update the home phone number. If the
|
66
|
+
|
67
|
+
* patient does not already have a home phone number, add it. Return the ID
|
68
|
+
|
69
|
+
* of the updated resource.
|
70
|
+
|
71
|
+
*/
|
72
|
+
|
73
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
74
|
+
|
75
|
+
//Place your code here
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
/**
|
82
|
+
|
83
|
+
* Find the observation with the given ID and update the value. Recall that
|
84
|
+
|
85
|
+
* observations have a unit of measure value code, units, and a value - this
|
86
|
+
|
87
|
+
* method only updates the value. Return the ID of the updated resource.
|
88
|
+
|
89
|
+
*/
|
90
|
+
|
91
|
+
public String updateObservationValue(String observationId, double value) {
|
92
|
+
|
93
|
+
//Place your code here
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
Copy the code and make your edits below.
|
102
|
+
|
103
|
+
|
104
|
+
|
19
105
|
````````````````````````````````````````````````````````````````````````````````````
|
20
106
|
|
107
|
+
|
108
|
+
|
21
|
-
|
109
|
+
**Your Code:**
|
22
|
-
|
23
|
-
|
24
110
|
|
25
111
|
import ca.uhn.fhir.context.FhirContext;
|
26
112
|
|
27
113
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
28
114
|
|
29
|
-
import ca.uhn.fhir.rest.api.MethodOutcome;
|
30
|
-
|
31
|
-
import org.hl7.fhir.
|
115
|
+
import org.hl7.fhir.r4.model.*;
|
116
|
+
|
32
|
-
|
117
|
+
|
118
|
+
|
119
|
+
import java.util.ArrayList;
|
120
|
+
|
121
|
+
import java.util.List;
|
122
|
+
|
33
|
-
import
|
123
|
+
import java.util.stream.Collectors;
|
34
|
-
|
35
|
-
|
124
|
+
|
36
|
-
|
37
|
-
import org.hl7.fhir.dstu3.model.Observation;
|
38
|
-
|
39
|
-
|
125
|
+
|
40
|
-
|
41
|
-
|
42
126
|
|
43
127
|
/**
|
44
128
|
|
@@ -48,21 +132,23 @@
|
|
48
132
|
|
49
133
|
public class AdvancedUpdate {
|
50
134
|
|
51
|
-
|
135
|
+
|
136
|
+
|
52
|
-
|
137
|
+
FhirContext ctx;
|
138
|
+
|
53
|
-
|
139
|
+
IGenericClient client;
|
140
|
+
|
54
|
-
|
141
|
+
|
55
|
-
|
56
142
|
|
57
143
|
public AdvancedUpdate(String baseUrl) {
|
58
144
|
|
59
|
-
|
145
|
+
ctx = FhirContext.forR4();
|
60
146
|
|
61
147
|
client = ctx.newRestfulGenericClient(baseUrl);
|
62
148
|
|
63
149
|
}
|
64
150
|
|
65
|
-
|
151
|
+
|
66
152
|
|
67
153
|
/**
|
68
154
|
|
@@ -76,11 +162,47 @@
|
|
76
162
|
|
77
163
|
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
78
164
|
|
165
|
+
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
ContactPoint contactPoint = new ContactPoint();
|
170
|
+
|
171
|
+
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
172
|
+
|
79
|
-
|
173
|
+
contactPoint.setValue(homePhoneNumber);
|
174
|
+
|
80
|
-
|
175
|
+
|
176
|
+
|
177
|
+
List<ContactPoint> contactPoints = patient.getTelecom();
|
178
|
+
|
179
|
+
if (contactPoints == null) {
|
180
|
+
|
181
|
+
contactPoints = new ArrayList<>();
|
182
|
+
|
81
|
-
}
|
183
|
+
}
|
184
|
+
|
82
|
-
|
185
|
+
else {
|
186
|
+
|
83
|
-
|
187
|
+
contactPoints = contactPoints.stream()
|
188
|
+
|
189
|
+
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
190
|
+
|
191
|
+
.collect(Collectors.toList());
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
contactPoints.add(contactPoint);
|
196
|
+
|
197
|
+
patient.setTelecom(contactPoints);
|
198
|
+
|
199
|
+
return client.update().resource(patient).execute().getId().getIdPart();
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
84
206
|
|
85
207
|
/**
|
86
208
|
|
@@ -94,144 +216,16 @@
|
|
94
216
|
|
95
217
|
public String updateObservationValue(String observationId, double value) {
|
96
218
|
|
219
|
+
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
220
|
+
|
221
|
+
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
222
|
+
|
97
|
-
|
223
|
+
quantity.setValue(value);
|
224
|
+
|
98
|
-
|
225
|
+
return client.update().resource(observation).execute().getId().getIdPart();
|
226
|
+
|
99
|
-
}
|
227
|
+
}
|
228
|
+
|
100
|
-
|
229
|
+
|
101
|
-
|
102
230
|
|
103
231
|
}
|
104
|
-
|
105
|
-
Copy the code and make your edits below.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
**Your Code:**
|
114
|
-
|
115
|
-
import ca.uhn.fhir.context.FhirContext;
|
116
|
-
|
117
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
118
|
-
|
119
|
-
import org.hl7.fhir.r4.model.*;
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
import java.util.ArrayList;
|
124
|
-
|
125
|
-
import java.util.List;
|
126
|
-
|
127
|
-
import java.util.stream.Collectors;
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
/**
|
132
|
-
|
133
|
-
* This class contains methods for updating resources in the FHIR server.
|
134
|
-
|
135
|
-
*/
|
136
|
-
|
137
|
-
public class AdvancedUpdate {
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
FhirContext ctx;
|
142
|
-
|
143
|
-
IGenericClient client;
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
public AdvancedUpdate(String baseUrl) {
|
148
|
-
|
149
|
-
ctx = FhirContext.forR4();
|
150
|
-
|
151
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
/**
|
158
|
-
|
159
|
-
* Find the patient with the given ID and update the home phone number. If the
|
160
|
-
|
161
|
-
* patient does not already have a home phone number, add it. Return the ID
|
162
|
-
|
163
|
-
* of the updated resource.
|
164
|
-
|
165
|
-
*/
|
166
|
-
|
167
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
168
|
-
|
169
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
ContactPoint contactPoint = new ContactPoint();
|
174
|
-
|
175
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
176
|
-
|
177
|
-
contactPoint.setValue(homePhoneNumber);
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
182
|
-
|
183
|
-
if (contactPoints == null) {
|
184
|
-
|
185
|
-
contactPoints = new ArrayList<>();
|
186
|
-
|
187
|
-
}
|
188
|
-
|
189
|
-
else {
|
190
|
-
|
191
|
-
contactPoints = contactPoints.stream()
|
192
|
-
|
193
|
-
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
194
|
-
|
195
|
-
.collect(Collectors.toList());
|
196
|
-
|
197
|
-
}
|
198
|
-
|
199
|
-
contactPoints.add(contactPoint);
|
200
|
-
|
201
|
-
patient.setTelecom(contactPoints);
|
202
|
-
|
203
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
/**
|
212
|
-
|
213
|
-
* Find the observation with the given ID and update the value. Recall that
|
214
|
-
|
215
|
-
* observations have a unit of measure value code, units, and a value - this
|
216
|
-
|
217
|
-
* method only updates the value. Return the ID of the updated resource.
|
218
|
-
|
219
|
-
*/
|
220
|
-
|
221
|
-
public String updateObservationValue(String observationId, double value) {
|
222
|
-
|
223
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
224
|
-
|
225
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
226
|
-
|
227
|
-
quantity.setValue(value);
|
228
|
-
|
229
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
````````````````````````````````````````````````````````````````````````````````````
|
5
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -104,7 +104,11 @@
|
|
104
104
|
|
105
105
|
Copy the code and make your edits below.
|
106
106
|
|
107
|
-
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
108
112
|
|
109
113
|
**Your Code:**
|
110
114
|
|
4
内容修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
````````````````````````````````````````````````````````````````````````````````````
|
18
18
|
|
19
|
-
|
19
|
+
````````````````````````````````````````````````````````````````````````````````````
|
20
20
|
|
21
21
|
package assignment;
|
22
22
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
Copy the code and make your edits below.
|
106
106
|
|
107
|
-
|
107
|
+
````````````````````````````````````````````````````````````````````````````````````
|
108
108
|
|
109
109
|
**Your Code:**
|
110
110
|
|
@@ -230,4 +230,4 @@
|
|
230
230
|
|
231
231
|
}
|
232
232
|
|
233
|
-
|
233
|
+
````````````````````````````````````````````````````````````````````````````````````
|
3
内容追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
下記のコードにて質問があります。。。下記のエラーが出てしまったのですが、これはどこが間違っていますか?
|
2
2
|
|
3
|
+
下記の問題とその答え”Your Code"になります。上記にpackage assignment;と入れるべきなのでしょうか?
|
4
|
+
|
3
5
|
`````````````````````````````````````````````````````````````````````````````````
|
4
6
|
|
5
7
|
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
@@ -10,4 +12,222 @@
|
|
10
12
|
|
11
13
|
1 error
|
12
14
|
|
15
|
+
|
16
|
+
|
13
17
|
````````````````````````````````````````````````````````````````````````````````````
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
package assignment;
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
import ca.uhn.fhir.context.FhirContext;
|
26
|
+
|
27
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
28
|
+
|
29
|
+
import ca.uhn.fhir.rest.api.MethodOutcome;
|
30
|
+
|
31
|
+
import org.hl7.fhir.dstu3.model.Patient;
|
32
|
+
|
33
|
+
import org.hl7.fhir.dstu3.model.ContactPoint;
|
34
|
+
|
35
|
+
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
|
36
|
+
|
37
|
+
import org.hl7.fhir.dstu3.model.Observation;
|
38
|
+
|
39
|
+
import org.hl7.fhir.dstu3.model.Quantity;
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
/**
|
44
|
+
|
45
|
+
* This class contains methods for updating resources in the FHIR server.
|
46
|
+
|
47
|
+
*/
|
48
|
+
|
49
|
+
public class AdvancedUpdate {
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
private IGenericClient client = null;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
public AdvancedUpdate(String baseUrl) {
|
58
|
+
|
59
|
+
FhirContext ctx = FhirContext.forDstu3();
|
60
|
+
|
61
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
/**
|
68
|
+
|
69
|
+
* Find the patient with the given ID and update the home phone number. If the
|
70
|
+
|
71
|
+
* patient does not already have a home phone number, add it. Return the ID
|
72
|
+
|
73
|
+
* of the updated resource.
|
74
|
+
|
75
|
+
*/
|
76
|
+
|
77
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
78
|
+
|
79
|
+
//Place your code here
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
/**
|
86
|
+
|
87
|
+
* Find the observation with the given ID and update the value. Recall that
|
88
|
+
|
89
|
+
* observations have a unit of measure value code, units, and a value - this
|
90
|
+
|
91
|
+
* method only updates the value. Return the ID of the updated resource.
|
92
|
+
|
93
|
+
*/
|
94
|
+
|
95
|
+
public String updateObservationValue(String observationId, double value) {
|
96
|
+
|
97
|
+
//Place your code here
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
Copy the code and make your edits below.
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
**Your Code:**
|
110
|
+
|
111
|
+
import ca.uhn.fhir.context.FhirContext;
|
112
|
+
|
113
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
114
|
+
|
115
|
+
import org.hl7.fhir.r4.model.*;
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
import java.util.ArrayList;
|
120
|
+
|
121
|
+
import java.util.List;
|
122
|
+
|
123
|
+
import java.util.stream.Collectors;
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
/**
|
128
|
+
|
129
|
+
* This class contains methods for updating resources in the FHIR server.
|
130
|
+
|
131
|
+
*/
|
132
|
+
|
133
|
+
public class AdvancedUpdate {
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
FhirContext ctx;
|
138
|
+
|
139
|
+
IGenericClient client;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
public AdvancedUpdate(String baseUrl) {
|
144
|
+
|
145
|
+
ctx = FhirContext.forR4();
|
146
|
+
|
147
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
/**
|
154
|
+
|
155
|
+
* Find the patient with the given ID and update the home phone number. If the
|
156
|
+
|
157
|
+
* patient does not already have a home phone number, add it. Return the ID
|
158
|
+
|
159
|
+
* of the updated resource.
|
160
|
+
|
161
|
+
*/
|
162
|
+
|
163
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
164
|
+
|
165
|
+
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
ContactPoint contactPoint = new ContactPoint();
|
170
|
+
|
171
|
+
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
172
|
+
|
173
|
+
contactPoint.setValue(homePhoneNumber);
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
List<ContactPoint> contactPoints = patient.getTelecom();
|
178
|
+
|
179
|
+
if (contactPoints == null) {
|
180
|
+
|
181
|
+
contactPoints = new ArrayList<>();
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
else {
|
186
|
+
|
187
|
+
contactPoints = contactPoints.stream()
|
188
|
+
|
189
|
+
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
190
|
+
|
191
|
+
.collect(Collectors.toList());
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
contactPoints.add(contactPoint);
|
196
|
+
|
197
|
+
patient.setTelecom(contactPoints);
|
198
|
+
|
199
|
+
return client.update().resource(patient).execute().getId().getIdPart();
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
/**
|
208
|
+
|
209
|
+
* Find the observation with the given ID and update the value. Recall that
|
210
|
+
|
211
|
+
* observations have a unit of measure value code, units, and a value - this
|
212
|
+
|
213
|
+
* method only updates the value. Return the ID of the updated resource.
|
214
|
+
|
215
|
+
*/
|
216
|
+
|
217
|
+
public String updateObservationValue(String observationId, double value) {
|
218
|
+
|
219
|
+
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
220
|
+
|
221
|
+
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
222
|
+
|
223
|
+
quantity.setValue(value);
|
224
|
+
|
225
|
+
return client.update().resource(observation).execute().getId().getIdPart();
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
|
2
内容変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,139 +11,3 @@
|
|
11
11
|
1 error
|
12
12
|
|
13
13
|
````````````````````````````````````````````````````````````````````````````````````
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
下記コードになります。
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
``````````````````````````````````````````````````````````````````
|
24
|
-
|
25
|
-
import ca.uhn.fhir.context.FhirContext;
|
26
|
-
|
27
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
28
|
-
|
29
|
-
import org.hl7.fhir.r4.model.*;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
import java.util.ArrayList;
|
34
|
-
|
35
|
-
import java.util.List;
|
36
|
-
|
37
|
-
import java.util.stream.Collectors;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
/**
|
42
|
-
|
43
|
-
* This class contains methods for updating resources in the FHIR server.
|
44
|
-
|
45
|
-
*/
|
46
|
-
|
47
|
-
public class AdvancedUpdate {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
FhirContext ctx;
|
52
|
-
|
53
|
-
IGenericClient client;
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
public AdvancedUpdate(String baseUrl) {
|
58
|
-
|
59
|
-
ctx = FhirContext.forR4();
|
60
|
-
|
61
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
/**
|
68
|
-
|
69
|
-
* Find the patient with the given ID and update the home phone number. If the
|
70
|
-
|
71
|
-
* patient does not already have a home phone number, add it. Return the ID
|
72
|
-
|
73
|
-
* of the updated resource.
|
74
|
-
|
75
|
-
*/
|
76
|
-
|
77
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
78
|
-
|
79
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
ContactPoint contactPoint = new ContactPoint();
|
84
|
-
|
85
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
86
|
-
|
87
|
-
contactPoint.setValue(homePhoneNumber);
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
92
|
-
|
93
|
-
if (contactPoints == null) {
|
94
|
-
|
95
|
-
contactPoints = new ArrayList<>();
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
else {
|
100
|
-
|
101
|
-
contactPoints = contactPoints.stream()
|
102
|
-
|
103
|
-
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
104
|
-
|
105
|
-
.collect(Collectors.toList());
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
contactPoints.add(contactPoint);
|
110
|
-
|
111
|
-
patient.setTelecom(contactPoints);
|
112
|
-
|
113
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
/**
|
122
|
-
|
123
|
-
* Find the observation with the given ID and update the value. Recall that
|
124
|
-
|
125
|
-
* observations have a unit of measure value code, units, and a value - this
|
126
|
-
|
127
|
-
* method only updates the value. Return the ID of the updated resource.
|
128
|
-
|
129
|
-
*/
|
130
|
-
|
131
|
-
public String updateObservationValue(String observationId, double value) {
|
132
|
-
|
133
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
134
|
-
|
135
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
136
|
-
|
137
|
-
quantity.setValue(value);
|
138
|
-
|
139
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
```````````````````````````````````````````````````````````````````````````
|
1
内容変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
下記のコードにて質問があります。。。下記のエラーが出てしまったのですが、これはどこが間違っていますか?
|
2
|
+
|
3
|
+
`````````````````````````````````````````````````````````````````````````````````
|
2
4
|
|
3
5
|
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
4
6
|
|
@@ -8,7 +10,7 @@
|
|
8
10
|
|
9
11
|
1 error
|
10
12
|
|
11
|
-
|
13
|
+
````````````````````````````````````````````````````````````````````````````````````
|
12
14
|
|
13
15
|
|
14
16
|
|
@@ -18,7 +20,7 @@
|
|
18
20
|
|
19
21
|
|
20
22
|
|
21
|
-
|
23
|
+
``````````````````````````````````````````````````````````````````
|
22
24
|
|
23
25
|
import ca.uhn.fhir.context.FhirContext;
|
24
26
|
|
@@ -141,3 +143,7 @@
|
|
141
143
|
|
142
144
|
|
143
145
|
}
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
```````````````````````````````````````````````````````````````````````````
|