Your Name 4 years ago
parent
commit
fcad9746a1

+ 3
- 3
pom.xml View File

9
 		<relativePath/> <!-- lookup parent from repository -->
9
 		<relativePath/> <!-- lookup parent from repository -->
10
 	</parent>
10
 	</parent>
11
 	<groupId>com.yunzhi</groupId>
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
 	<description>Demo project for Spring Boot</description>
15
 	<description>Demo project for Spring Boot</description>
16
 
16
 
17
 	<properties>
17
 	<properties>

+ 21
- 48
src/main/java/com/yunzhi/demo/controller/TaMedicalLogController.java View File

9
 import com.yunzhi.demo.common.StringUtils;
9
 import com.yunzhi.demo.common.StringUtils;
10
 import com.yunzhi.demo.entity.TaPerson;
10
 import com.yunzhi.demo.entity.TaPerson;
11
 import com.yunzhi.demo.entity.TaStudent;
11
 import com.yunzhi.demo.entity.TaStudent;
12
+import com.yunzhi.demo.service.ITaPersonService;
12
 import com.yunzhi.demo.service.ITaStudentService;
13
 import com.yunzhi.demo.service.ITaStudentService;
13
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiOperation;
42
     @Autowired
43
     @Autowired
43
     public ITaStudentService iTaStudentService;
44
     public ITaStudentService iTaStudentService;
44
 
45
 
46
+    @Autowired
47
+    public ITaPersonService iTaPersonService;
48
+
45
     @GetMapping("/ma/medical-log")
49
     @GetMapping("/ma/medical-log")
46
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
50
     @ApiOperation(value="我的就诊记录", notes = "我的就诊记录", httpMethod = "GET", response = ResponseBean.class)
47
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
51
     public ResponseBean maMedicalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
84
      * @param taMedicalLog 实体对象
88
      * @param taMedicalLog 实体对象
85
      * @return
89
      * @return
86
      */
90
      */
87
-    @RequestMapping(value="/taMedicalLog",method= RequestMethod.POST)
91
+    @RequestMapping(value="/admin/medicalLog",method= RequestMethod.POST)
88
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
92
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
89
     public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception {
93
     public ResponseBean taMedicalLogAdd(@ApiParam("保存内容") @RequestBody TaMedicalLog taMedicalLog) throws Exception {
90
 
94
 
96
         }
100
         }
97
 
101
 
98
         TaStudent taStudent = iTaStudentService.getByStudentNo(schoolId, studentNo);
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
         if (iTaMedicalLogService.save(taMedicalLog)){
122
         if (iTaMedicalLogService.save(taMedicalLog)){
118
             return ResponseBean.success(taMedicalLog);
123
             return ResponseBean.success(taMedicalLog);
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
      * 根据id查询对象
130
      * 根据id查询对象
158
      * @param id  实体ID
131
      * @param id  实体ID

+ 16
- 0
src/main/java/com/yunzhi/demo/controller/WxMaController.java View File

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

+ 5
- 1
src/main/java/com/yunzhi/demo/entity/TaMedicalLog.java View File

58
 
58
 
59
     @ApiModelProperty(value = "性别")
59
     @ApiModelProperty(value = "性别")
60
     @TableField(exist = false)
60
     @TableField(exist = false)
61
-    private String sex;
61
+    private Integer sex;
62
 
62
 
63
     @ApiModelProperty(value = "学校ID")
63
     @ApiModelProperty(value = "学校ID")
64
     @TableField(exist = false)
64
     @TableField(exist = false)
84
     @TableField(exist = false)
84
     @TableField(exist = false)
85
     private String studentNo;
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 View File

24
     IPage<StatisPerson> getStudentStatis(IPage<StatisPerson> pg, String name, String schoolId, String specialtyId, String asc, String desc);
24
     IPage<StatisPerson> getStudentStatis(IPage<StatisPerson> pg, String name, String schoolId, String specialtyId, String asc, String desc);
25
 
25
 
26
     IPage<TaPerson> getStudentInfoPagedBy(IPage<TaPerson> pg, String name, String schoolId, String specialtyId, String phone, String studentId);
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 View File

55
         return taPersonMapper.getStudentInfoPagedBy(pg, name, schoolId, specialtyId, phone, studentId);
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
     private String getDBFieldBy(String name) {
69
     private String getDBFieldBy(String name) {
59
         if (StringUtils.isEmpty(name)) {
70
         if (StringUtils.isEmpty(name)) {
60
             return null;
71
             return null;

+ 2
- 0
src/main/resources/application-prod.yml View File

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