|
@@ -1,32 +1,49 @@
|
|
|
import com.github.yxyl120.sdk.DefaultYxClient;
|
|
|
+import com.github.yxyl120.sdk.YxClient;
|
|
|
import com.github.yxyl120.sdk.YxException;
|
|
|
import com.github.yxyl120.sdk.domain.DrugInfo;
|
|
|
import com.github.yxyl120.sdk.domain.PatientInfo;
|
|
|
-import com.github.yxyl120.sdk.request.PushOrderRequest;
|
|
|
+import com.github.yxyl120.sdk.domain.RoomInfo;
|
|
|
+import com.github.yxyl120.sdk.request.*;
|
|
|
+import com.github.yxyl120.sdk.response.EmptyResponse;
|
|
|
import com.github.yxyl120.sdk.response.PushOrderResponse;
|
|
|
+import com.github.yxyl120.sdk.response.SyncPharmacistResponse;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
|
|
|
public class APITest {
|
|
|
|
|
|
- public static void main(String[] args) throws YxException {
|
|
|
+ private YxClient yxClient;
|
|
|
|
|
|
+ public APITest() {
|
|
|
String serverUrl = "http://localhost:8515";
|
|
|
+ String appId = "440004901";
|
|
|
String secret = "DB957E8E2F41AB28B65840BD47A76AF2";
|
|
|
+ yxClient = new DefaultYxClient(serverUrl, appId, secret);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws YxException {
|
|
|
+ new APITest().pushOrderTest();
|
|
|
+ }
|
|
|
|
|
|
- DefaultYxClient yxClient = new DefaultYxClient(serverUrl, "440004901", secret);
|
|
|
+ /**
|
|
|
+ * 推送一张视频单或图文单
|
|
|
+ */
|
|
|
+ private void pushOrderTest() {
|
|
|
PushOrderRequest orderRequest = new PushOrderRequest();
|
|
|
|
|
|
orderRequest.setOrderIdThird("C2021232657");
|
|
|
orderRequest.setDiagnosisSnThird("C2021232657");
|
|
|
orderRequest.setStoreName("一线大药房");
|
|
|
orderRequest.setCreateTime(new Date());
|
|
|
+ // 1图文 2为视频
|
|
|
orderRequest.setType(2);
|
|
|
+
|
|
|
PatientInfo patientInfo = new PatientInfo();
|
|
|
orderRequest.setPatientInfo(patientInfo);
|
|
|
patientInfo.setName("张三");
|
|
|
- patientInfo.setAge(80);
|
|
|
+ patientInfo.setAge(1);
|
|
|
patientInfo.setSex(1);
|
|
|
patientInfo.setKidney(0);
|
|
|
patientInfo.setLiver(0);
|
|
@@ -35,7 +52,7 @@ public class APITest {
|
|
|
patientInfo.setBirthday("2021-12-29");
|
|
|
|
|
|
patientInfo.setMainSuit("咳嗽");
|
|
|
- patientInfo.setAllergyDesc("无");
|
|
|
+ patientInfo.setAllergyDesc("");
|
|
|
|
|
|
DrugInfo drugInfo = new DrugInfo();
|
|
|
drugInfo.setDrugIdThird(669);
|
|
@@ -43,12 +60,78 @@ public class APITest {
|
|
|
drugInfo.setDrugSpecification("0.1g*12片*2板");
|
|
|
drugInfo.setSaleAmount(3);
|
|
|
drugInfo.setSaleUnit("盒");
|
|
|
+ drugInfo.setInstructions("药品说明书");
|
|
|
|
|
|
orderRequest.setDrugList(Collections.singletonList(drugInfo));
|
|
|
orderRequest.setRpType("01");
|
|
|
|
|
|
PushOrderResponse response = yxClient.execute(orderRequest);
|
|
|
System.out.println(response);
|
|
|
+ // 房间进行视频通话的相关的信息
|
|
|
+ RoomInfo data = response.getData();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据处方号发送文本消息
|
|
|
+ */
|
|
|
+ private void sendTextMsg() {
|
|
|
+ TextChatRequest request = new TextChatRequest("C2201121686180076", "医生你好");
|
|
|
+ EmptyResponse response = yxClient.execute(request);
|
|
|
+ // 后续需要合作方的接口等待接收回调
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据处方号发送图片消息
|
|
|
+ */
|
|
|
+ private void sendImageMsg() {
|
|
|
+ ImageChatRequest request = new ImageChatRequest("C2201121686180076",
|
|
|
+ "https://asset.nxk520.com/abc.png");
|
|
|
+ request.setImgWidth(60);
|
|
|
+ request.setImgHeight(110);
|
|
|
+ EmptyResponse response = yxClient.execute(request);
|
|
|
+ // 后续需要合作方的接口等待接收回调
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据处方号发起视频聊天
|
|
|
+ */
|
|
|
+ private void sendLiveMsg() {
|
|
|
+ LiveChatRequest request = new LiveChatRequest("C2201121686180076");
|
|
|
+ EmptyResponse response = yxClient.execute(request);
|
|
|
+ // 后续需要合作方的接口等待接收回调
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步药师资料到一线
|
|
|
+ */
|
|
|
+ private void syncPharmacistInfoTest() {
|
|
|
+ SyncPharmacistInfoRequest request = new SyncPharmacistInfoRequest();
|
|
|
+ request.setPharmacistId(764);
|
|
|
+ request.setPharmacistName("张三");
|
|
|
+ request.setSex(1);
|
|
|
+ request.setRole(2);
|
|
|
+ request.setMobile("16666666666");
|
|
|
+ request.setIdNumber("632323190605260586");
|
|
|
+ request.setAvatar("https://asset.nxk520.com/abc.png");
|
|
|
+ request.setIdFrontImg("https://asset.nxk520.com/abc.png");
|
|
|
+ request.setIdEmblemImg("https://asset.nxk520.com/abc.png");
|
|
|
+ request.setCertificateImg("https://asset.nxk520.com/abc.png");
|
|
|
+ request.setPractitionerCertificateImg("https://asset.nxk520.com/abc.png");
|
|
|
+ request.setIntroduction("药师简介……");
|
|
|
+ SyncPharmacistResponse response = yxClient.execute(request);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 注销药师,或启用药师
|
|
|
+ */
|
|
|
+ private void SyncPharmacistStatusTest(){
|
|
|
+
|
|
|
+// SyncPharmacistStatusRequest request = new SyncPharmacistStatusRequest();
|
|
|
+// request.setPharmacistId(764);
|
|
|
+// request.setStatus(0);
|
|
|
+ SyncPharmacistStatusRequest request = new SyncPharmacistStatusRequest(764,0);
|
|
|
+ SyncPharmacistResponse response = yxClient.execute(request);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|