From c00d5336825accc63c8b016545fc853eab3fdda0 Mon Sep 17 00:00:00 2001 From: changpengfei Date: Thu, 16 Sep 2021 09:40:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=82=A3=E8=80=85=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BE=AE=E4=BF=A1=E7=99=BB=E5=BD=95openid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/controller/PatientController.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index fa8e7b3..a015956 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -15,6 +15,7 @@ import com.lyms.talkonlineweb.service.*; import com.lyms.talkonlineweb.util.*; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -162,7 +163,7 @@ public class PatientController { log.info(ness.toString()); } - Date instDate=new Date(); + Date instDate = new Date(); //需要添加医院购买卡记录 for (int i = 0; i < patient.getCcnt(); i++) { LymsTcard tcard = new LymsTcard(); @@ -215,7 +216,7 @@ public class PatientController { * @return */ @PostMapping("loginPatient") - public BaseResponse loginPatient(@RequestBody LymsPatient patient) { + public BaseResponse loginPatient(@RequestBody LymsPatient patient, String code) { BaseResponse baseResponse = new BaseResponse(); List dLst = lymsPatientService.list(Wrappers.query(patient)); baseResponse.setErrorcode(1); @@ -227,11 +228,17 @@ public class PatientController { patient.setIslogin(1); - if (patient.getHxid() == null) { - JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); - JSONArray rArr = json.getJSONArray("entities"); - if (rArr.size() > 0) { - patient.setHxid(rArr.getJSONObject(0).getString("uuid")); + if (StringUtils.isEmpty(patient.getHxid()) || StringUtils.isEmpty(patient.getOpenid())) { + + if (patient.getHxid() == null) { + JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); + JSONArray rArr = json.getJSONArray("entities"); + if (rArr.size() > 0) { + patient.setHxid(rArr.getJSONObject(0).getString("uuid")); + } + } + if (StringUtils.isEmpty(patient.getOpenid())) { + patient.setOpenid(WeiXinUtil.getWxOpenId(code)); } lymsPatientService.saveOrUpdate(patient); } -- 1.8.3.1