Commit 2742487db67205f4dc18828fda9e0b142cd0fa7f
1 parent
51bc9e8553
Exists in
master
and in
1 other branch
医院患者信息接口
Showing 3 changed files with 156 additions and 0 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/constants/ErrorCodeConstants.java
View file @
2742487
1 | +package com.lyms.talkonlineweb.constants; | |
2 | + | |
3 | +public class ErrorCodeConstants { | |
4 | + // 成功 | |
5 | + public static final int SUCCESS = 0; | |
6 | + public static final String SUCCESS_DESCRIPTION = "成功"; | |
7 | + | |
8 | + // 发送验证码失败 | |
9 | + public static final int VERIFY_CODE_FAIL = 4001; | |
10 | + | |
11 | + // token过期 | |
12 | + public static final int TOKEN_EXPIRE = 4002; | |
13 | + | |
14 | + // 用户不存在 | |
15 | + public static final int USER_NOT_EXISTS = 4003; | |
16 | + | |
17 | + // 密码错误 | |
18 | + public static final int USER_PASSWORD_ERROR = 4004; | |
19 | + | |
20 | + // 用户关联的医院不存在 | |
21 | + public static final int USER_CONSTAN_HOSPITAL_NOT_EXISTS = 4005; | |
22 | + | |
23 | + // 医院信息不存在 | |
24 | + public static final int HOSPITAL_NOT_EXISTS = 4006; | |
25 | + | |
26 | + // 科室信息不存在 | |
27 | + public static final int DEPT_NOT_EXISTS = 4006; | |
28 | + | |
29 | + // 手机号码过期 | |
30 | + public static final int PHONE_EXPIRE = 4007; | |
31 | + | |
32 | + // 参数错误 | |
33 | + public static final int PARAMETER_ERROR = 4097; | |
34 | + | |
35 | + // 产检劵已使用 | |
36 | + public static final int TICKET_USED = 40971; | |
37 | + | |
38 | + // 系统异常 | |
39 | + public static final int SYSTEM_ERROR = 4099; | |
40 | + public static final String SYSTEM_ERROR_DESCRIPTION = "系统异常"; | |
41 | + | |
42 | + public static final int BUSINESS_ERROR = 4098; | |
43 | + | |
44 | + //验证码已过期 | |
45 | + public static final int VER_CODE_EXPIRE=4008; | |
46 | + | |
47 | + //名称已存在 | |
48 | + public static final int NAME_EXIST=4100; | |
49 | + | |
50 | + | |
51 | + //数据已存在 | |
52 | + public static final int DATA_EXIST=4200; | |
53 | + | |
54 | + //没有数据 | |
55 | + public static final int NO_DATA=4210; | |
56 | + //不能删除 | |
57 | + public static final int DONT_DELETE=4201; | |
58 | + // | |
59 | + public static final int BUSINESS_ERROR1 = 4018; | |
60 | + | |
61 | + //没有权限 | |
62 | + public static final int NO_POWER = 4021; | |
63 | + //区域模式运行 | |
64 | + public static final String RUN_MODE="1"; | |
65 | + | |
66 | + //数据已过期 | |
67 | + public static final int DATA_EXPIRE = 4108; | |
68 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/GetPatientInfoController.java
View file @
2742487
1 | +package com.lyms.talkonlineweb.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
4 | +import com.lyms.talkonlineweb.constants.ErrorCodeConstants; | |
5 | +import com.lyms.talkonlineweb.domain.LymsFavor; | |
6 | +import com.lyms.talkonlineweb.domain.LymsHdepart; | |
7 | +import com.lyms.talkonlineweb.result.BaseResponse; | |
8 | +import com.lyms.talkonlineweb.service.PatientInfoService; | |
9 | +import com.lyms.talkonlineweb.task.GetPatientInfoTask; | |
10 | +import org.springframework.beans.BeanUtils; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.web.bind.annotation.PostMapping; | |
13 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
15 | +import org.springframework.web.bind.annotation.RestController; | |
16 | +import org.w3c.dom.stylesheets.LinkStyle; | |
17 | + | |
18 | +import java.util.List; | |
19 | +import java.util.Map; | |
20 | + | |
21 | +/** | |
22 | + * 医院患者信息接收 | |
23 | + */ | |
24 | +@RestController | |
25 | +@RequestMapping("getPatient") | |
26 | +public class GetPatientInfoController { | |
27 | + | |
28 | + @Autowired | |
29 | + private GetPatientInfoTask getPatientInfoTask; | |
30 | + | |
31 | + /** | |
32 | + * 保存医院患者信息 | |
33 | + * @param param | |
34 | + * @return | |
35 | + */ | |
36 | + @PostMapping("savePatient") | |
37 | + public BaseResponse savePatient(@RequestBody List<Map> param){ | |
38 | + BaseResponse baseResponse=new BaseResponse(); | |
39 | + if(CollectionUtils.isEmpty(param)){ | |
40 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
41 | + baseResponse.setErrormsg("参数为空"); | |
42 | + return baseResponse; | |
43 | + } | |
44 | + | |
45 | + try { | |
46 | + getPatientInfoTask.getPatient(param); | |
47 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
48 | + baseResponse.setErrormsg("成功"); | |
49 | + } catch (Exception e) { | |
50 | + e.printStackTrace(); | |
51 | + baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
52 | + baseResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
53 | + } | |
54 | + return baseResponse; | |
55 | + } | |
56 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java
View file @
2742487
... | ... | @@ -141,5 +141,37 @@ |
141 | 141 | return param; |
142 | 142 | } |
143 | 143 | |
144 | + /** | |
145 | + * 接收医院患者信息 | |
146 | + * @param listMap | |
147 | + * @throws Exception | |
148 | + */ | |
149 | + public void getPatient(List<Map> listMap) throws Exception { | |
150 | + if (CollectionUtils.isNotEmpty(listMap)) { | |
151 | + for (Map<String, Object> map : listMap) { | |
152 | + //添加到数据后续页面处理 | |
153 | + LymsHisInfo hisInfoMap = (LymsHisInfo) BeanUtils.mapToObject(map, LymsHisInfo.class);//map转对象 | |
154 | + if (null != hisInfoMap) { | |
155 | + //今天添加过不需要重复添加 | |
156 | + QueryWrapper qurey = new QueryWrapper(); | |
157 | + qurey.eq("idCard", hisInfoMap.getIdcard()); | |
158 | + qurey.eq("diagnose", hisInfoMap.getDiagnose()); | |
159 | + Calendar calendar = Calendar.getInstance(); | |
160 | + calendar.setTime(new Date()); | |
161 | + calendar.set(Calendar.HOUR_OF_DAY, 00);//时 | |
162 | + calendar.set(Calendar.MINUTE, 00);//分 | |
163 | + calendar.set(Calendar.SECOND, 00);//秒 | |
164 | + qurey.gt("createdtime", calendar.getTime()); | |
165 | + List<LymsHisInfo> list = lymsHisInfoService.list(qurey); | |
166 | + if (CollectionUtils.isEmpty(list)) { | |
167 | + hisInfoMap.setBirthday(StringUtil.isNotEmpty(hisInfoMap.getBirthday()) ? StringUtil.leftTruncate(hisInfoMap.getBirthday(), ' ') : null); | |
168 | + hisInfoMap.setUpType(0);//默认未上传 | |
169 | + lymsHisInfoService.save(hisInfoMap); | |
170 | + } | |
171 | + } | |
172 | + } | |
173 | + } | |
174 | + } | |
175 | + | |
144 | 176 | } |