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); }