|
@@ -11,6 +11,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import thyyxxk.wxservice_server.config.auth.PassToken;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.constant.AppletOrderType;
|
|
|
import thyyxxk.wxservice_server.dao.*;
|
|
@@ -19,7 +20,6 @@ import thyyxxk.wxservice_server.entity.ResultVo;
|
|
|
import thyyxxk.wxservice_server.entity.analyzeidcard.IdCardAnalyzeResult;
|
|
|
import thyyxxk.wxservice_server.entity.appointment.DoctorInfo;
|
|
|
import thyyxxk.wxservice_server.entity.appointment.MzyReqrec;
|
|
|
-import thyyxxk.wxservice_server.entity.appointment.PatientBriefInfo;
|
|
|
import thyyxxk.wxservice_server.entity.collections.CollectDoctorParam;
|
|
|
import thyyxxk.wxservice_server.entity.electronichealthcard.ElectronicHealthCard;
|
|
|
import thyyxxk.wxservice_server.entity.hrgresponse.HrgCommonResponse;
|
|
@@ -87,8 +87,9 @@ public class WxAppletApi {
|
|
|
this.wxApiDao = wxApiDao;
|
|
|
}
|
|
|
|
|
|
+ @PassToken
|
|
|
@PostMapping("/getAppletUserInfo")
|
|
|
- public ResultVo<JSONObject> getAppletUserInfo(@RequestBody AppletUserInquiry inquiry) {
|
|
|
+ public ResultVo<String> getAppletUserInfo(@RequestBody AppletUserInquiry inquiry) {
|
|
|
AppletType appletType = inquiry.getAppletType();
|
|
|
if (null == appletType) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "小程序类别不能为空。");
|
|
@@ -111,7 +112,12 @@ public class WxAppletApi {
|
|
|
.replace("JSCODE", jscode);
|
|
|
String response = new RestTemplate().getForObject(url, String.class);
|
|
|
log.info("小程序登录:{}\n参数:{}\n结果:{}", url, JSONObject.toJSON(inquiry), response);
|
|
|
- return ResultVoUtil.success(JSONObject.parseObject(response));
|
|
|
+ JSONObject obj = JSONObject.parseObject(response);
|
|
|
+ String openid = obj.getString("openid");
|
|
|
+ if (null == openid) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response);
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(TokenUtil.getInstance().createToken(openid));
|
|
|
}
|
|
|
|
|
|
@PostMapping("/createOrder")
|
|
@@ -409,13 +415,9 @@ public class WxAppletApi {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/getBoundCards")
|
|
|
- public ResultVo<List<PatientBriefInfo>> getBoundCards(@RequestBody CardInquiry inquiry) {
|
|
|
- AppletType appletType = inquiry.getAppletType();
|
|
|
- if (null == appletType) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "小程序类别不能为空。");
|
|
|
- }
|
|
|
- String openid = makeSpecialOpenid(appletType, inquiry.getOpenid());
|
|
|
+ @GetMapping("/getBoundCards")
|
|
|
+ public ResultVo<List<OutpatientCard>> getBoundCards(@RequestParam("appletType") AppletType appletType) {
|
|
|
+ String openid = makeSpecialOpenid(appletType);
|
|
|
log.info("查询小程序绑卡:{}", openid);
|
|
|
return ResultVoUtil.success(appletDao.getBindPatientCard(openid));
|
|
|
}
|
|
@@ -429,7 +431,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
param.setSocialNo(param.getCardNo());
|
|
|
log.info("绑定就诊卡:{}", JSONObject.toJSON(param));
|
|
|
String column = param.getCardType() == 0 ? "patient_id" : "social_no";
|
|
@@ -476,7 +478,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
log.info("解除就诊卡绑定:{}", JSONObject.toJSON(param));
|
|
|
cardsDao.frozenPatientCard(param.getPatientId(), param.getOpenid());
|
|
|
return ResultVoUtil.success(cardsDao.getBindPatientCard(param.getOpenid()));
|
|
@@ -527,8 +529,8 @@ public class WxAppletApi {
|
|
|
return ResultVoUtil.success(path);
|
|
|
}
|
|
|
|
|
|
- private String makeSpecialOpenid(AppletType appletType, String openid) {
|
|
|
- return appletType + "@" + openid;
|
|
|
+ private String makeSpecialOpenid(AppletType appletType) {
|
|
|
+ return appletType + "@" + TokenUtil.getInstance().getUserOpenid();
|
|
|
}
|
|
|
|
|
|
@PostMapping("/linkHealthCard")
|
|
@@ -540,7 +542,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(inquiry.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- inquiry.setOpenid(makeSpecialOpenid(appletType, inquiry.getOpenid()));
|
|
|
+ inquiry.setOpenid(makeSpecialOpenid(appletType));
|
|
|
log.info("小程序关联健康卡:{}", JSONObject.toJSON(inquiry));
|
|
|
return electronicHealthCardService.linkHealthCard(inquiry.getHealthCode(), inquiry.getOpenid());
|
|
|
}
|
|
@@ -557,7 +559,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(inquiry.getPatientId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "patientId不能为空。");
|
|
|
}
|
|
|
- String openid = makeSpecialOpenid(appletType, inquiry.getOpenid());
|
|
|
+ String openid = makeSpecialOpenid(appletType);
|
|
|
log.info("设置默认就诊卡:{}", JSONObject.toJSON(inquiry));
|
|
|
appletDao.updateDefaultCard(inquiry.getPatientId(), openid);
|
|
|
return ResultVoUtil.success();
|
|
@@ -618,7 +620,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(inquiry.getDoctorCode())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "医生编码不能为空。");
|
|
|
}
|
|
|
- String openid = makeSpecialOpenid(appletType, inquiry.getOpenid());
|
|
|
+ String openid = makeSpecialOpenid(appletType);
|
|
|
DoctorInfo doctor = appointmentDao.selectDoctorInfo(inquiry.getDoctorCode(), openid);
|
|
|
if (null == doctor) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "未找到医生信息!");
|
|
@@ -641,7 +643,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getDeptCode())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "科室编码不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
return collectionsService.collectDoctor(param);
|
|
|
}
|
|
|
|
|
@@ -657,7 +659,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getDoctorCode())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "医生编码不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
return collectionsService.disCollectDoctor(param);
|
|
|
}
|
|
|
|
|
@@ -670,7 +672,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- String openid = makeSpecialOpenid(appletType, param.getOpenid());
|
|
|
+ String openid = makeSpecialOpenid(appletType);
|
|
|
return collectionsService.getMyCollections2(openid);
|
|
|
}
|
|
|
|
|
@@ -683,7 +685,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
return inspectionsService.getExamIndex(param);
|
|
|
}
|
|
|
|
|
@@ -696,7 +698,7 @@ public class WxAppletApi {
|
|
|
if (StringUtil.isBlank(param.getOpenid())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "openid不能为空。");
|
|
|
}
|
|
|
- param.setOpenid(makeSpecialOpenid(appletType, param.getOpenid()));
|
|
|
+ param.setOpenid(makeSpecialOpenid(appletType));
|
|
|
return inspectionsService.checkExamDetail(param);
|
|
|
}
|
|
|
|