Your Name 4 年前
父节点
当前提交
fcad9746a1

+ 3
- 3
pom.xml 查看文件

@@ -9,9 +9,9 @@
9 9
 		<relativePath/> <!-- lookup parent from repository -->
10 10
 	</parent>
11 11
 	<groupId>com.yunzhi</groupId>
12
-	<artifactId>serivce-template</artifactId>
13
-	<version>0.0.1-SNAPSHOT</version>
14
-	<name>demo</name>
12
+	<artifactId>medical-plat</artifactId>
13
+	<version>0.0.1</version>
14
+	<name>medical-plat</name>
15 15
 	<description>Demo project for Spring Boot</description>
16 16
 
17 17
 	<properties>

+ 21
- 48
src/main/java/com/yunzhi/demo/controller/TaMedicalLogController.java 查看文件

@@ -9,6 +9,7 @@ import com.yunzhi.demo.common.ResponseBean;
9 9
 import com.yunzhi.demo.common.StringUtils;
10 10
 import com.yunzhi.demo.entity.TaPerson;
11 11
 import com.yunzhi.demo.entity.TaStudent;
12
+import com.yunzhi.demo.service.ITaPersonService;
12 13
 import com.yunzhi.demo.service.ITaStudentService;
13 14
 import io.swagger.annotations.Api;
14 15
 import io.swagger.annotations.ApiOperation;
@@ -42,6 +43,9 @@ public class TaMedicalLogController extends BaseController {
42 43
     @Autowired
43 44
     public ITaStudentService iTaStudentService;
44 45
 
46
+    @Autowired
47
+    public ITaPersonService iTaPersonService;
48
+
45 49
     @GetMapping("/ma/medical-log")
46 50
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
47 51
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
@@ -84,7 +88,7 @@ public class TaMedicalLogController extends BaseController {
84 88
      * @param taMedicalLog 实体对象
85 89
      * @return
86 90
      */
87
-    @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
91
+    @RequestMapping(value="/admin/medicalLog",method= RequestMethod.POST)
88 92
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
89 93
     public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception {
90 94
 
@@ -96,23 +100,24 @@ public class TaMedicalLogController extends BaseController {
96 100
         }
97 101
 
98 102
         TaStudent taStudent = iTaStudentService.getByStudentNo(schoolId, studentNo);
99
-
100
-
101
-        if (iTaMedicalLogService.save(taMedicalLog)){
102
-            return ResponseBean.success(taMedicalLog);
103
-        }else {
104
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
103
+        if (null == taStudent) {
104
+            taStudent = new TaStudent();
105
+            taStudent.setStudentNo(studentNo);
106
+            taStudent.setSchoolId(schoolId);
107
+            taStudent.setSpecialtyId(taMedicalLog.getSpecialtyId());
108
+            taStudent.setName(taMedicalLog.getName());
109
+            taStudent.setSex(taMedicalLog.getSex());
110
+            taStudent.setPhone(taMedicalLog.getPhone());
111
+            // 映射人员
112
+            TaPerson taPerson = iTaPersonService.getByPhone(taStudent.getPhone());
113
+            if (null != taPerson) {
114
+                taStudent.setPersonId(taPerson.getPersonId());
115
+            }
116
+
117
+            iTaStudentService.save(taStudent);
105 118
         }
106
-    }
107 119
 
108
-    /**
109
-     * 保存对象
110
-     * @param taMedicalLog 实体对象
111
-     * @return
112
-     */
113
-    @RequestMapping(value="/admin/medicalLog",method= RequestMethod.POST)
114
-    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
115
-    public ResponseBean medicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception{
120
+        taMedicalLog.setStudentId(taStudent.getStudentId());
116 121
 
117 122
         if (iTaMedicalLogService.save(taMedicalLog)){
118 123
             return ResponseBean.success(taMedicalLog);
@@ -121,38 +126,6 @@ public class TaMedicalLogController extends BaseController {
121 126
         }
122 127
     }
123 128
 
124
-    /**
125
-     * 根据id删除对象
126
-     * @param id  实体ID
127
-     */
128
-    @RequestMapping(value="/taMedicalLog/{id}", method= RequestMethod.DELETE)
129
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
130
-    public ResponseBean taMedicalLogDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
131
-        if(iTaMedicalLogService.removeById(id)){
132
-            return ResponseBean.success("success");
133
-        }else {
134
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
135
-        }
136
-    }
137
-
138
-    /**
139
-     * 修改对象
140
-     * @param id  实体ID
141
-     * @param taMedicalLog 实体对象
142
-     * @return
143
-     */
144
-    @RequestMapping(value="/taMedicalLog/{id}",method= RequestMethod.PUT)
145
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
146
-    public ResponseBean taMedicalLogUpdate(@ApiParam("对象ID") @PathVariable Integer id,
147
-                                        @ApiParam("更新内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception{
148
-
149
-        if (iTaMedicalLogService.updateById(taMedicalLog)){
150
-            return ResponseBean.success(iTaMedicalLogService.getById(id));
151
-        }else {
152
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
153
-        }
154
-    }
155
-
156 129
     /**
157 130
      * 根据id查询对象
158 131
      * @param id  实体ID

+ 16
- 0
src/main/java/com/yunzhi/demo/controller/WxMaController.java 查看文件

@@ -6,8 +6,10 @@ import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
6 6
 import com.yunzhi.demo.common.*;
7 7
 import com.yunzhi.demo.entity.TaPerson;
8 8
 import com.yunzhi.demo.entity.TaPersonData;
9
+import com.yunzhi.demo.entity.TaStudent;
9 10
 import com.yunzhi.demo.service.ITaPersonDataService;
10 11
 import com.yunzhi.demo.service.ITaPersonService;
12
+import com.yunzhi.demo.service.ITaStudentService;
11 13
 import com.yunzhi.demo.vo.WxMaAuthParam;
12 14
 import io.swagger.annotations.Api;
13 15
 import io.swagger.annotations.ApiOperation;
@@ -33,6 +35,9 @@ public class WxMaController extends BaseController {
33 35
     @Autowired
34 36
     ITaPersonDataService iTaPersonDataService;
35 37
 
38
+    @Autowired
39
+    ITaStudentService iTaStudentService;
40
+
36 41
     @PostMapping("/login")
37 42
     @ApiOperation(value="登录", notes = "登录", httpMethod = "POST", response = ResponseBean.class)
38 43
     public ResponseBean login(@ApiParam("登录参数") @RequestParam String code) throws Exception {
@@ -50,6 +55,10 @@ public class WxMaController extends BaseController {
50 55
             iTaPersonDataService.save(taPersonData);
51 56
         }
52 57
 
58
+        // 查询学生
59
+        TaStudent taStudent = iTaStudentService.getByPersonId(taPerson.getPersonId());
60
+        taPerson.setStudent(taStudent);
61
+
53 62
         Map<String, Object> tokenClaims = new HashMap<>();
54 63
         tokenClaims.put("userId", taPerson.getPersonId());
55 64
 //        tokenClaims.put("sessionKey", info.getSessionKey());
@@ -102,6 +111,13 @@ public class WxMaController extends BaseController {
102 111
         taPerson.setPhone(phoneNoInfo.getPhoneNumber());
103 112
         iTaPersonService.updateById(taPerson);
104 113
 
114
+        // 查询学生
115
+        TaStudent taStudent = iTaStudentService.getByPhone(taPerson.getPhone());
116
+        if (null != taStudent) {
117
+            taStudent.setPersonId(taPerson.getPersonId());
118
+            iTaStudentService.updateById(taStudent);
119
+        }
120
+
105 121
         return ResponseBean.success(taPerson);
106 122
     }
107 123
 

+ 5
- 1
src/main/java/com/yunzhi/demo/entity/TaMedicalLog.java 查看文件

@@ -58,7 +58,7 @@ public class TaMedicalLog implements Serializable {
58 58
 
59 59
     @ApiModelProperty(value = "性别")
60 60
     @TableField(exist = false)
61
-    private String sex;
61
+    private Integer sex;
62 62
 
63 63
     @ApiModelProperty(value = "学校ID")
64 64
     @TableField(exist = false)
@@ -84,4 +84,8 @@ public class TaMedicalLog implements Serializable {
84 84
     @TableField(exist = false)
85 85
     private String studentNo;
86 86
 
87
+    @ApiModelProperty(value = "手机号")
88
+    @TableField(exist = false)
89
+    private String phone;
90
+
87 91
 }

+ 2
- 0
src/main/java/com/yunzhi/demo/service/ITaPersonService.java 查看文件

@@ -24,4 +24,6 @@ public interface ITaPersonService extends IService<TaPerson> {
24 24
     IPage<StatisPerson> getStudentStatis(IPage<StatisPerson> pg, String name, String schoolId, String specialtyId, String asc, String desc);
25 25
 
26 26
     IPage<TaPerson> getStudentInfoPagedBy(IPage<TaPerson> pg, String name, String schoolId, String specialtyId, String phone, String studentId);
27
+
28
+    TaPerson getByPhone(String phone);
27 29
 }

+ 11
- 0
src/main/java/com/yunzhi/demo/service/impl/TaPersonServiceImpl.java 查看文件

@@ -55,6 +55,17 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
55 55
         return taPersonMapper.getStudentInfoPagedBy(pg, name, schoolId, specialtyId, phone, studentId);
56 56
     }
57 57
 
58
+    @Override
59
+    public TaPerson getByPhone(String phone) {
60
+        if (StringUtils.isEmpty(phone)) {
61
+            return null;
62
+        }
63
+        QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<TaPerson>()
64
+                .eq("phone", phone)
65
+                .gt("status", Constants.STATUS_DELETED);
66
+        return getOne(queryWrapper);
67
+    }
68
+
58 69
     private String getDBFieldBy(String name) {
59 70
         if (StringUtils.isEmpty(name)) {
60 71
             return null;

+ 2
- 0
src/main/resources/application-prod.yml 查看文件

@@ -1,3 +1,5 @@
1
+server:
2
+  port: 8822
1 3
 ###
2 4
 spring:
3 5
   servlet: