質問編集履歴
11
内容訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
下記のコードにて質問があります。。。下記のエラーが出てしまったのですが、これはどこが間違っていますか?
|
2
2
|
下記の問題とその答え”Your Code"になります。上記にpackage assignment;と入れるべきなのでしょうか?
|
3
3
|
`````````````````````````````````````````````````````````````````````````````````
|
4
|
-
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
5
|
-
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
6
|
-
^
|
7
|
-
1 error
|
8
|
-
|
9
|
-
```````````````````````````````````````
|
4
|
+
```````````````````````````````````````
|
10
5
|
````````````````````````````````````````````````````````````````````````````````````
|
10
内容訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,111 +7,4 @@
|
|
7
7
|
1 error
|
8
8
|
|
9
9
|
````````````````````````````````````````````````````````````````````````````````````
|
10
|
-
````````````````````````````````````````````````````````````````````````````````````
|
11
|
-
package assignment;
|
12
|
-
import ca.uhn.fhir.context.FhirContext;
|
13
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
14
|
-
import ca.uhn.fhir.rest.api.MethodOutcome;
|
15
|
-
import org.hl7.fhir.dstu3.model.Patient;
|
16
|
-
import org.hl7.fhir.dstu3.model.ContactPoint;
|
17
|
-
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
|
18
|
-
import org.hl7.fhir.dstu3.model.Observation;
|
19
|
-
import org.hl7.fhir.dstu3.model.Quantity;
|
20
|
-
|
21
|
-
/**
|
22
|
-
* This class contains methods for updating resources in the FHIR server.
|
23
|
-
*/
|
24
|
-
public class AdvancedUpdate {
|
25
|
-
|
26
|
-
private IGenericClient client = null;
|
27
|
-
|
28
|
-
public AdvancedUpdate(String baseUrl) {
|
29
|
-
FhirContext ctx = FhirContext.forDstu3();
|
30
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Find the patient with the given ID and update the home phone number. If the
|
35
|
-
* patient does not already have a home phone number, add it. Return the ID
|
36
|
-
* of the updated resource.
|
37
|
-
*/
|
38
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
39
|
-
//Place your code here
|
40
|
-
}
|
41
|
-
|
42
|
-
/**
|
43
|
-
* Find the observation with the given ID and update the value. Recall that
|
44
|
-
* observations have a unit of measure value code, units, and a value - this
|
45
|
-
* method only updates the value. Return the ID of the updated resource.
|
46
|
-
*/
|
47
|
-
public String updateObservationValue(String observationId, double value) {
|
48
|
-
//Place your code here
|
49
|
-
}
|
50
|
-
|
51
|
-
}
|
52
|
-
Copy the code and make your edits below.
|
53
|
-
|
54
|
-
|
55
|
-
**Your Code:**
|
56
|
-
import ca.uhn.fhir.context.FhirContext;
|
57
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
58
|
-
import org.hl7.fhir.r4.model.*;
|
59
|
-
|
60
|
-
import java.util.ArrayList;
|
61
|
-
import java.util.List;
|
62
|
-
import java.util.stream.Collectors;
|
63
|
-
|
64
|
-
/**
|
65
|
-
* This class contains methods for updating resources in the FHIR server.
|
66
|
-
*/
|
67
|
-
public class AdvancedUpdate {
|
68
|
-
|
69
|
-
FhirContext ctx;
|
70
|
-
IGenericClient client;
|
71
|
-
|
72
|
-
public AdvancedUpdate(String baseUrl) {
|
73
|
-
ctx = FhirContext.forR4();
|
74
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
75
|
-
}
|
76
|
-
|
77
|
-
/**
|
78
|
-
* Find the patient with the given ID and update the home phone number. If the
|
79
|
-
* patient does not already have a home phone number, add it. Return the ID
|
80
|
-
* of the updated resource.
|
81
|
-
*/
|
82
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
83
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
84
|
-
|
85
|
-
ContactPoint contactPoint = new ContactPoint();
|
86
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
87
|
-
contactPoint.setValue(homePhoneNumber);
|
88
|
-
|
89
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
90
|
-
if (contactPoints == null) {
|
91
|
-
contactPoints = new ArrayList<>();
|
92
|
-
}
|
93
|
-
else {
|
94
|
-
contactPoints = contactPoints.stream()
|
95
|
-
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
96
|
-
.collect(Collectors.toList());
|
97
|
-
}
|
98
|
-
contactPoints.add(contactPoint);
|
99
|
-
patient.setTelecom(contactPoints);
|
100
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
101
|
-
|
102
|
-
}
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Find the observation with the given ID and update the value. Recall that
|
106
|
-
* observations have a unit of measure value code, units, and a value - this
|
107
|
-
* method only updates the value. Return the ID of the updated resource.
|
108
|
-
*/
|
109
|
-
public String updateObservationValue(String observationId, double value) {
|
110
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
111
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
112
|
-
quantity.setValue(value);
|
113
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
114
|
-
}
|
115
|
-
|
116
|
-
}
|
117
10
|
````````````````````````````````````````````````````````````````````````````````````
|
9
内容変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
Javaコードで下記のようなエラーが出ます。どこが間違っているか教えてください。
|
body
CHANGED
File without changes
|
8
package assignment; 追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
````````````````````````````````````````````````````````````````````````````````````
|
10
10
|
````````````````````````````````````````````````````````````````````````````````````
|
11
|
+
package assignment;
|
11
12
|
import ca.uhn.fhir.context.FhirContext;
|
12
13
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
13
14
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
7
内容変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
1 error
|
8
8
|
|
9
9
|
````````````````````````````````````````````````````````````````````````````````````
|
10
|
-
|
10
|
+
````````````````````````````````````````````````````````````````````````````````````
|
11
11
|
import ca.uhn.fhir.context.FhirContext;
|
12
12
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
13
13
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
@@ -50,7 +50,6 @@
|
|
50
50
|
}
|
51
51
|
Copy the code and make your edits below.
|
52
52
|
|
53
|
-
````````````````````````````````````````````````````````````````````````````````````
|
54
53
|
|
55
54
|
**Your Code:**
|
56
55
|
import ca.uhn.fhir.context.FhirContext;
|
@@ -113,4 +112,5 @@
|
|
113
112
|
return client.update().resource(observation).execute().getId().getIdPart();
|
114
113
|
}
|
115
114
|
|
116
|
-
}
|
115
|
+
}
|
116
|
+
````````````````````````````````````````````````````````````````````````````````````
|
6
変更追記
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Java コードどこが間違っているか教えてください。
|
1
|
+
えJava コードどこが間違っているか教えてください。
|
body
CHANGED
@@ -7,8 +7,6 @@
|
|
7
7
|
1 error
|
8
8
|
|
9
9
|
````````````````````````````````````````````````````````````````````````````````````
|
10
|
-
````````````````````````````````````````````````````````````````````````````````````
|
11
|
-
package assignment;
|
12
10
|
|
13
11
|
import ca.uhn.fhir.context.FhirContext;
|
14
12
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
@@ -52,8 +50,8 @@
|
|
52
50
|
}
|
53
51
|
Copy the code and make your edits below.
|
54
52
|
|
53
|
+
````````````````````````````````````````````````````````````````````````````````````
|
55
54
|
|
56
|
-
|
57
55
|
**Your Code:**
|
58
56
|
import ca.uhn.fhir.context.FhirContext;
|
59
57
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
@@ -115,5 +113,4 @@
|
|
115
113
|
return client.update().resource(observation).execute().getId().getIdPart();
|
116
114
|
}
|
117
115
|
|
118
|
-
}
|
116
|
+
}
|
119
|
-
````````````````````````````````````````````````````````````````````````````````````
|
5
変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,7 +51,9 @@
|
|
51
51
|
|
52
52
|
}
|
53
53
|
Copy the code and make your edits below.
|
54
|
-
|
54
|
+
|
55
|
+
|
56
|
+
|
55
57
|
**Your Code:**
|
56
58
|
import ca.uhn.fhir.context.FhirContext;
|
57
59
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
4
内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
1 error
|
8
8
|
|
9
9
|
````````````````````````````````````````````````````````````````````````````````````
|
10
|
-
|
10
|
+
````````````````````````````````````````````````````````````````````````````````````
|
11
11
|
package assignment;
|
12
12
|
|
13
13
|
import ca.uhn.fhir.context.FhirContext;
|
@@ -51,7 +51,7 @@
|
|
51
51
|
|
52
52
|
}
|
53
53
|
Copy the code and make your edits below.
|
54
|
-
|
54
|
+
````````````````````````````````````````````````````````````````````````````````````
|
55
55
|
**Your Code:**
|
56
56
|
import ca.uhn.fhir.context.FhirContext;
|
57
57
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
@@ -114,4 +114,4 @@
|
|
114
114
|
}
|
115
115
|
|
116
116
|
}
|
117
|
-
|
117
|
+
````````````````````````````````````````````````````````````````````````````````````
|
3
内容追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,117 @@
|
|
1
1
|
下記のコードにて質問があります。。。下記のエラーが出てしまったのですが、これはどこが間違っていますか?
|
2
|
+
下記の問題とその答え”Your Code"になります。上記にpackage assignment;と入れるべきなのでしょうか?
|
2
3
|
`````````````````````````````````````````````````````````````````````````````````
|
3
4
|
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
4
5
|
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
5
6
|
^
|
6
7
|
1 error
|
8
|
+
|
7
|
-
````````````````````````````````````````````````````````````````````````````````````
|
9
|
+
````````````````````````````````````````````````````````````````````````````````````
|
10
|
+
|
11
|
+
package assignment;
|
12
|
+
|
13
|
+
import ca.uhn.fhir.context.FhirContext;
|
14
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
15
|
+
import ca.uhn.fhir.rest.api.MethodOutcome;
|
16
|
+
import org.hl7.fhir.dstu3.model.Patient;
|
17
|
+
import org.hl7.fhir.dstu3.model.ContactPoint;
|
18
|
+
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
|
19
|
+
import org.hl7.fhir.dstu3.model.Observation;
|
20
|
+
import org.hl7.fhir.dstu3.model.Quantity;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* This class contains methods for updating resources in the FHIR server.
|
24
|
+
*/
|
25
|
+
public class AdvancedUpdate {
|
26
|
+
|
27
|
+
private IGenericClient client = null;
|
28
|
+
|
29
|
+
public AdvancedUpdate(String baseUrl) {
|
30
|
+
FhirContext ctx = FhirContext.forDstu3();
|
31
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Find the patient with the given ID and update the home phone number. If the
|
36
|
+
* patient does not already have a home phone number, add it. Return the ID
|
37
|
+
* of the updated resource.
|
38
|
+
*/
|
39
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
40
|
+
//Place your code here
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Find the observation with the given ID and update the value. Recall that
|
45
|
+
* observations have a unit of measure value code, units, and a value - this
|
46
|
+
* method only updates the value. Return the ID of the updated resource.
|
47
|
+
*/
|
48
|
+
public String updateObservationValue(String observationId, double value) {
|
49
|
+
//Place your code here
|
50
|
+
}
|
51
|
+
|
52
|
+
}
|
53
|
+
Copy the code and make your edits below.
|
54
|
+
|
55
|
+
**Your Code:**
|
56
|
+
import ca.uhn.fhir.context.FhirContext;
|
57
|
+
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
58
|
+
import org.hl7.fhir.r4.model.*;
|
59
|
+
|
60
|
+
import java.util.ArrayList;
|
61
|
+
import java.util.List;
|
62
|
+
import java.util.stream.Collectors;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* This class contains methods for updating resources in the FHIR server.
|
66
|
+
*/
|
67
|
+
public class AdvancedUpdate {
|
68
|
+
|
69
|
+
FhirContext ctx;
|
70
|
+
IGenericClient client;
|
71
|
+
|
72
|
+
public AdvancedUpdate(String baseUrl) {
|
73
|
+
ctx = FhirContext.forR4();
|
74
|
+
client = ctx.newRestfulGenericClient(baseUrl);
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Find the patient with the given ID and update the home phone number. If the
|
79
|
+
* patient does not already have a home phone number, add it. Return the ID
|
80
|
+
* of the updated resource.
|
81
|
+
*/
|
82
|
+
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
83
|
+
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
84
|
+
|
85
|
+
ContactPoint contactPoint = new ContactPoint();
|
86
|
+
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
87
|
+
contactPoint.setValue(homePhoneNumber);
|
88
|
+
|
89
|
+
List<ContactPoint> contactPoints = patient.getTelecom();
|
90
|
+
if (contactPoints == null) {
|
91
|
+
contactPoints = new ArrayList<>();
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
contactPoints = contactPoints.stream()
|
95
|
+
.filter(cp => cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
96
|
+
.collect(Collectors.toList());
|
97
|
+
}
|
98
|
+
contactPoints.add(contactPoint);
|
99
|
+
patient.setTelecom(contactPoints);
|
100
|
+
return client.update().resource(patient).execute().getId().getIdPart();
|
101
|
+
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Find the observation with the given ID and update the value. Recall that
|
106
|
+
* observations have a unit of measure value code, units, and a value - this
|
107
|
+
* method only updates the value. Return the ID of the updated resource.
|
108
|
+
*/
|
109
|
+
public String updateObservationValue(String observationId, double value) {
|
110
|
+
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
111
|
+
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
112
|
+
quantity.setValue(value);
|
113
|
+
return client.update().resource(observation).execute().getId().getIdPart();
|
114
|
+
}
|
115
|
+
|
116
|
+
}
|
117
|
+
|
2
内容変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,72 +4,4 @@
|
|
4
4
|
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
5
5
|
^
|
6
6
|
1 error
|
7
|
-
````````````````````````````````````````````````````````````````````````````````````
|
7
|
+
````````````````````````````````````````````````````````````````````````````````````
|
8
|
-
|
9
|
-
|
10
|
-
下記コードになります。
|
11
|
-
|
12
|
-
``````````````````````````````````````````````````````````````````
|
13
|
-
import ca.uhn.fhir.context.FhirContext;
|
14
|
-
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
15
|
-
import org.hl7.fhir.r4.model.*;
|
16
|
-
|
17
|
-
import java.util.ArrayList;
|
18
|
-
import java.util.List;
|
19
|
-
import java.util.stream.Collectors;
|
20
|
-
|
21
|
-
/**
|
22
|
-
* This class contains methods for updating resources in the FHIR server.
|
23
|
-
*/
|
24
|
-
public class AdvancedUpdate {
|
25
|
-
|
26
|
-
FhirContext ctx;
|
27
|
-
IGenericClient client;
|
28
|
-
|
29
|
-
public AdvancedUpdate(String baseUrl) {
|
30
|
-
ctx = FhirContext.forR4();
|
31
|
-
client = ctx.newRestfulGenericClient(baseUrl);
|
32
|
-
}
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Find the patient with the given ID and update the home phone number. If the
|
36
|
-
* patient does not already have a home phone number, add it. Return the ID
|
37
|
-
* of the updated resource.
|
38
|
-
*/
|
39
|
-
public String updatePatientHomePhone(String patientId, String homePhoneNumber) {
|
40
|
-
Patient patient = client.read().resource(Patient.class).withId(patientId).execute();
|
41
|
-
|
42
|
-
ContactPoint contactPoint = new ContactPoint();
|
43
|
-
contactPoint.setSystem(ContactPoint.ContactPointSystem.PHONE);
|
44
|
-
contactPoint.setValue(homePhoneNumber);
|
45
|
-
|
46
|
-
List<ContactPoint> contactPoints = patient.getTelecom();
|
47
|
-
if (contactPoints == null) {
|
48
|
-
contactPoints = new ArrayList<>();
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
contactPoints = contactPoints.stream()
|
52
|
-
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
53
|
-
.collect(Collectors.toList());
|
54
|
-
}
|
55
|
-
contactPoints.add(contactPoint);
|
56
|
-
patient.setTelecom(contactPoints);
|
57
|
-
return client.update().resource(patient).execute().getId().getIdPart();
|
58
|
-
|
59
|
-
}
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Find the observation with the given ID and update the value. Recall that
|
63
|
-
* observations have a unit of measure value code, units, and a value - this
|
64
|
-
* method only updates the value. Return the ID of the updated resource.
|
65
|
-
*/
|
66
|
-
public String updateObservationValue(String observationId, double value) {
|
67
|
-
Observation observation = client.read().resource(Observation.class).withId(observationId).execute();
|
68
|
-
Quantity quantity = observation.getValue().castToQuantity(observation.getValue());
|
69
|
-
quantity.setValue(value);
|
70
|
-
return client.update().resource(observation).execute().getId().getIdPart();
|
71
|
-
}
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
```````````````````````````````````````````````````````````````````````````
|
1
内容変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
下記のコードにて質問があります。。。下記のエラーが出てしまったのですが、これはどこが間違っていますか?
|
2
|
+
`````````````````````````````````````````````````````````````````````````````````
|
2
3
|
student/assignment/AdvancedUpdate.java:40: error: illegal start of expression
|
3
4
|
.filter(cp -> cp.getSystem() != ContactPoint.ContactPointSystem.PHONE)
|
4
5
|
^
|
5
6
|
1 error
|
7
|
+
````````````````````````````````````````````````````````````````````````````````````
|
6
8
|
|
7
9
|
|
8
|
-
|
9
10
|
下記コードになります。
|
10
11
|
|
11
|
-
|
12
|
+
``````````````````````````````````````````````````````````````````
|
12
13
|
import ca.uhn.fhir.context.FhirContext;
|
13
14
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
14
15
|
import org.hl7.fhir.r4.model.*;
|
@@ -69,4 +70,6 @@
|
|
69
70
|
return client.update().resource(observation).execute().getId().getIdPart();
|
70
71
|
}
|
71
72
|
|
72
|
-
}
|
73
|
+
}
|
74
|
+
|
75
|
+
```````````````````````````````````````````````````````````````````````````
|