Преглед на файлове

添加修改个人信息功能。

lighter преди 4 години
родител
ревизия
6f745a56e0

+ 6 - 0
src/main/java/thyyxxk/wxservice_server/controller/PatientCardsController.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.*;
 import thyyxxk.wxservice_server.pojo.ResultVo;
 import thyyxxk.wxservice_server.pojo.patientcards.BindPatientIdParam;
 import thyyxxk.wxservice_server.pojo.patientcards.ChangeCardParam;
+import thyyxxk.wxservice_server.pojo.patientcards.ModifyBindParam;
 import thyyxxk.wxservice_server.service.PatientCardsService;
 
 import java.util.HashMap;
@@ -44,6 +45,11 @@ public class PatientCardsController {
         return service.setDefaultCard(patientId, openId);
     }
 
+    @PostMapping("/updateBindInfo")
+    public ResultVo<String> updateBindInfo(@RequestBody ModifyBindParam param) {
+        return service.updateBindInfo(param);
+    }
+
     @PostMapping("/relieveBindCard")
     public ResultVo<List<BindPatientIdParam>> relieveBindCard(@RequestBody BindPatientIdParam param) {
         return service.relieveBindCard(param);

+ 8 - 1
src/main/java/thyyxxk/wxservice_server/dao/PatientCardsDao.java

@@ -2,12 +2,13 @@ package thyyxxk.wxservice_server.dao;
 
 import org.apache.ibatis.annotations.*;
 import thyyxxk.wxservice_server.pojo.patientcards.BindPatientIdParam;
+import thyyxxk.wxservice_server.pojo.patientcards.ModifyBindParam;
 
 import java.util.List;
 
 @Mapper
 public interface PatientCardsDao {
-    @Select("select name, patient_id, phone, is_default from t_wechat_patient_bind where open_id=#{openId} and del_flag=0")
+    @Select("select name, patient_id, phone, social_no, is_default from t_wechat_patient_bind where open_id=#{openId} and del_flag=0")
     List<BindPatientIdParam> getBindPatientCard(@Param("openId") String openId);
 
     @Select("select rtrim(name) name, rtrim(patient_id) patientId, rtrim(social_no) socialNo, " +
@@ -43,6 +44,12 @@ public interface PatientCardsDao {
                            @Param("openId") String openId,
                            @Param("isDefault") int isDefault);
 
+    @Update("update mz_patient_mi set phone_no=#{phone},social_no=#{socialNo},name=#{name} where patient_id=#{patientId}")
+    void updateMzPatientMi(ModifyBindParam param);
+
+    @Update("update t_wechat_patient_bind set phone=#{phone},social_no=#{socialNo},name=#{name} where patient_id=#{patientId}")
+    void updateWechatBind(ModifyBindParam param);
+
     @Update("update t_wechat_patient_bind set del_flag=0,name=#{name},phone=#{phone}, " +
             "province=#{province}, city=#{city}, district=#{district}, street=#{street} " +
             "where patient_id=#{patientId} and open_id=#{openId}")

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/pojo/patientcards/ModifyBindParam.java

@@ -0,0 +1,11 @@
+package thyyxxk.wxservice_server.pojo.patientcards;
+
+import lombok.Data;
+
+@Data
+public class ModifyBindParam {
+    private String patientId;
+    private String phone;
+    private String socialNo;
+    private String name;
+}

+ 8 - 0
src/main/java/thyyxxk/wxservice_server/service/PatientCardsService.java

@@ -10,6 +10,7 @@ import thyyxxk.wxservice_server.dao.PatientCardsDao;
 import thyyxxk.wxservice_server.pojo.ResultVo;
 import thyyxxk.wxservice_server.pojo.patientcards.BindPatientIdParam;
 import thyyxxk.wxservice_server.pojo.patientcards.ChangeCardParam;
+import thyyxxk.wxservice_server.pojo.patientcards.ModifyBindParam;
 import thyyxxk.wxservice_server.pojo.wxapi.PushMessageParam;
 import thyyxxk.wxservice_server.utils.DateUtil;
 import thyyxxk.wxservice_server.utils.PropertiesUtil;
@@ -120,6 +121,13 @@ public class PatientCardsService {
         return ResultVoUtil.success();
     }
 
+    public ResultVo<String> updateBindInfo(ModifyBindParam param) {
+        log.info("修改个人信息:{}", param);
+        dao.updateMzPatientMi(param);
+        dao.updateWechatBind(param);
+        return ResultVoUtil.success();
+    }
+
     public ResultVo<List<BindPatientIdParam>> relieveBindCard(BindPatientIdParam param) {
         log.info("解除就诊卡绑定:{}", param);
         dao.unBindPatientCard(param.getPatientId(), param.getOpenId());