|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.app.controller;
|
|
package com.fs.app.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.param.DoctorEditParam;
|
|
import com.fs.app.param.DoctorEditParam;
|
|
@@ -20,13 +21,17 @@ import com.fs.his.param.FsDoctorExtractListSParam;
|
|
|
import com.fs.his.service.*;
|
|
import com.fs.his.service.*;
|
|
|
import com.fs.his.vo.FsDoctorBillListSVO;
|
|
import com.fs.his.vo.FsDoctorBillListSVO;
|
|
|
import com.fs.his.vo.FsDoctorExtractListSVO;
|
|
import com.fs.his.vo.FsDoctorExtractListSVO;
|
|
|
|
|
+import com.fs.im.service.OpenIMService;
|
|
|
import com.fs.sms.service.SmsService;
|
|
import com.fs.sms.service.SmsService;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
+import com.github.pagehelper.util.StringUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.json.JSONArray;
|
|
|
|
|
+import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -34,10 +39,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -59,7 +61,8 @@ public class DoctorController extends AppBaseController {
|
|
|
private IFsDoctorExtractService doctorExtractService;
|
|
private IFsDoctorExtractService doctorExtractService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
private ISysConfigService configService;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private OpenIMService openIMService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SmsService smsService;
|
|
private SmsService smsService;
|
|
|
@ApiOperation("登录")
|
|
@ApiOperation("登录")
|
|
@@ -100,7 +103,72 @@ public class DoctorController extends AppBaseController {
|
|
|
return R.ok(map);
|
|
return R.ok(map);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ @ApiOperation("校验医生是否注册新的im")
|
|
|
|
|
+ @PostMapping("/accountCheck")
|
|
|
|
|
+ public R accountCheck(@RequestBody Map<String, String> userIdMap){
|
|
|
|
|
+ //获取管理员token
|
|
|
|
|
+ String userId = userIdMap.get("userId");
|
|
|
|
|
+ String adminToken = openIMService.getAdminToken();
|
|
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
|
|
+ // 解析响应
|
|
|
|
|
+ if (StringUtil.isNotEmpty(adminToken)) {
|
|
|
|
|
+ //查询用户是否注册
|
|
|
|
|
+ ArrayList<String> userIds = new ArrayList<>();
|
|
|
|
|
+ requestBody = new JSONObject();
|
|
|
|
|
+ userIds.add(userId);
|
|
|
|
|
+ requestBody.put("checkUserIDs", userIds);
|
|
|
|
|
+ String body = HttpRequest.post("https://web.im.cdwjyyh.com/api/user/account_check")
|
|
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
|
|
+ .header("token", adminToken)
|
|
|
|
|
+ .body(requestBody.toString())
|
|
|
|
|
+ .execute()
|
|
|
|
|
+ .body();
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject(body);
|
|
|
|
|
+ JSONArray results = jsonObject.getJSONObject("data").getJSONArray("results");
|
|
|
|
|
+ if (results != null && results.length() > 0) {
|
|
|
|
|
+ JSONObject resultObj = results.getJSONObject(0);
|
|
|
|
|
+ int accountStatus = resultObj.getInt("accountStatus");
|
|
|
|
|
+ //未注册自动注册
|
|
|
|
|
+ if (accountStatus==0){
|
|
|
|
|
+ String s = userId.replaceFirst("^D", "");
|
|
|
|
|
+ FsDoctor fsDoctor = doctorService.selectFsDoctorByDoctorId(Long.parseLong(s));
|
|
|
|
|
+ if (null==fsDoctor){
|
|
|
|
|
+ return R.error("用户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ ArrayList<Object> users = new ArrayList<>();
|
|
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
+ map.put("userID",userId);
|
|
|
|
|
+ map.put("nickname",fsDoctor.getDoctorName());
|
|
|
|
|
+ map.put("faceURL",fsDoctor.getAvatar());
|
|
|
|
|
+ users.add(map);
|
|
|
|
|
+ requestBody = new JSONObject();
|
|
|
|
|
+ userIds.add(userId);
|
|
|
|
|
+ requestBody.put("users", users);
|
|
|
|
|
+ HttpRequest.post("https://web.im.cdwjyyh.com/api/user/user_register")
|
|
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
|
|
+ .header("token", adminToken).body(requestBody.toString()).execute().body();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return R.error("返回结果为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ /* HashMap<String, String> tokenMap = new HashMap<>();
|
|
|
|
|
+ tokenMap.put("platformID","1");
|
|
|
|
|
+ tokenMap.put("userID",userId);*/
|
|
|
|
|
+ requestBody = new JSONObject();
|
|
|
|
|
+ requestBody.put("platformID",5);
|
|
|
|
|
+ requestBody.put("userID",userId);
|
|
|
|
|
+ String body1 = HttpRequest.post("https://web.im.cdwjyyh.com/api/auth/get_user_token")
|
|
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
|
|
+ .header("token", adminToken)
|
|
|
|
|
+ .body(requestBody.toString()).execute().body();
|
|
|
|
|
+ JSONObject userJson = new JSONObject(body1);
|
|
|
|
|
+ JSONObject userData = userJson.getJSONObject("data");
|
|
|
|
|
+ String userToken = userData.getString("token");
|
|
|
|
|
+ return R.ok().put("token", userToken);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return R.error("获取管理员token失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
@ApiOperation("登录")
|
|
@ApiOperation("登录")
|
|
|
@PostMapping("/loginByWeb")
|
|
@PostMapping("/loginByWeb")
|
|
|
public R loginByWeb(@Validated @RequestBody DoctorLoginParam param) {
|
|
public R loginByWeb(@Validated @RequestBody DoctorLoginParam param) {
|