|
|
@@ -15,6 +15,7 @@ import thyyxxk.wxservice_server.config.auth.PassToken;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.dao.api.PowersiPluginDao;
|
|
|
import thyyxxk.wxservice_server.entity.ResultVo;
|
|
|
+import thyyxxk.wxservice_server.entity.assessment.PushQuestionnaireVisit;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.InsuinfoRequest;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.OrdState;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.CommonRequest;
|
|
|
@@ -27,6 +28,7 @@ import thyyxxk.wxservice_server.factory.thmz.ThmzService;
|
|
|
import thyyxxk.wxservice_server.factory.thmz.model.QueryReceiptRequest;
|
|
|
import thyyxxk.wxservice_server.factory.thmz.model.SaveMzPayRequest;
|
|
|
import thyyxxk.wxservice_server.service.IdCardAnalyzeService;
|
|
|
+import thyyxxk.wxservice_server.service.PushWxMessageService;
|
|
|
import thyyxxk.wxservice_server.utils.DateUtil;
|
|
|
import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
import thyyxxk.wxservice_server.utils.SnowFlakeId;
|
|
|
@@ -44,6 +46,7 @@ public class PowersiMiPayPlugin {
|
|
|
private final PowersiPluginDao dao;
|
|
|
private final IdCardAnalyzeService idCardAnalyzeService;
|
|
|
private final ThmzService thmzService;
|
|
|
+ private final PushWxMessageService messageService;
|
|
|
|
|
|
@Value("${hisMipUrl}")
|
|
|
private String hisMipUrl;
|
|
|
@@ -51,21 +54,23 @@ public class PowersiMiPayPlugin {
|
|
|
private final DataHandler dataHandler = DataHandler.newInstance();
|
|
|
|
|
|
@Autowired
|
|
|
- public PowersiMiPayPlugin(PowersiPluginDao dao, IdCardAnalyzeService idCardAnalyzeService, ThmzService thmzService) throws IOException {
|
|
|
+ public PowersiMiPayPlugin(PowersiPluginDao dao, IdCardAnalyzeService idCardAnalyzeService, ThmzService thmzService, PushWxMessageService messageService) throws IOException {
|
|
|
this.dao = dao;
|
|
|
this.idCardAnalyzeService = idCardAnalyzeService;
|
|
|
this.thmzService = thmzService;
|
|
|
+ this.messageService = messageService;
|
|
|
}
|
|
|
|
|
|
@PostMapping("/lockOrder")
|
|
|
public ResultVo<String> lockOrder(@RequestBody InsuinfoRequest request) {
|
|
|
- dao.lockOrder(request.getHisOrdNum(), 1);
|
|
|
- return ResultVoUtil.success(TokenUtil.getInstance().getUserOpenid());
|
|
|
+ String openid = TokenUtil.getInstance().getUserOpenid();
|
|
|
+ dao.lockOrder(request.getHisOrdNum(), openid,1);
|
|
|
+ return ResultVoUtil.success(openid);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/unlockOrder")
|
|
|
public ResultVo<String> unlockOrder(@RequestBody InsuinfoRequest request) {
|
|
|
- dao.lockOrder(request.getHisOrdNum(), 0);
|
|
|
+ dao.lockOrder(request.getHisOrdNum(), null, 0);
|
|
|
return ResultVoUtil.success("操作成功。");
|
|
|
}
|
|
|
|
|
|
@@ -223,6 +228,30 @@ public class PowersiMiPayPlugin {
|
|
|
if (res.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
dao.updateMzSaved(setlinfo.getPlatformOrderId());
|
|
|
}
|
|
|
+ pushMessage(setlinfo.getMedOrgOrd(), setlinfo.getUserName());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushMessage(String hisOrdNum, String userName) {
|
|
|
+ String[] arr = hisOrdNum.split("_");
|
|
|
+ int times = Integer.parseInt(arr[1]);
|
|
|
+ PushQuestionnaireVisit visit = dao.getVisit(arr[0], times, hisOrdNum);
|
|
|
+ String visitId = hisOrdNum.replaceAll("_", "AND") + "AND" + visit.getDoctorCode() + "AND" + visit.getDeptCode();
|
|
|
+ String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbde6b16acad84204&redirect_uri=" +
|
|
|
+ "https://staticweb.hnthyy.cn/wxserver/redirect/page2?to=doctorGradeByPush_" + visitId +
|
|
|
+ "&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
|
|
|
+
|
|
|
+ String msgContent = "{\"touser\":\"" + visit.getOpenid() + "\",\"data\":" +
|
|
|
+ "{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + userName + "\"}," +
|
|
|
+ "\"keyword2\":{\"color\":\"#173177\",\"value\":\"长沙泰和医院\"}," +
|
|
|
+ "\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + visit.getDeptName() + "\"}," +
|
|
|
+ "\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + visit.getDoctorName() + "\"}," +
|
|
|
+ "\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + visit.getVisitDate() + "\"}," +
|
|
|
+ "\"remark\":{\"color\":\"#FF0000\",\"value\":\"特邀请您对医生服务作出评价。\"}," +
|
|
|
+ "\"first\":{\"color\":\"#FF0000\",\"value\":\"您曾在我院进行诊疗。\"}}," +
|
|
|
+ "\"template_id\":\"G4YAN56RmDjEPpNyP5fpCdr5TghyqspDeWlWaD5Eg2o\"," +
|
|
|
+ "\"url\":\"" + url + "\"}";
|
|
|
+ JSONObject message = JSONObject.parseObject(msgContent);
|
|
|
+ messageService.pushMessage2(message);
|
|
|
}
|
|
|
|
|
|
@PassToken
|