diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/constants/ErrorCodeConstants.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/constants/ErrorCodeConstants.java new file mode 100644 index 0000000..78ee4c8 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/constants/ErrorCodeConstants.java @@ -0,0 +1,68 @@ +package com.lyms.talkonlineweb.constants; + +public class ErrorCodeConstants { + // 成功 + public static final int SUCCESS = 0; + public static final String SUCCESS_DESCRIPTION = "成功"; + + // 发送验证码失败 + public static final int VERIFY_CODE_FAIL = 4001; + + // token过期 + public static final int TOKEN_EXPIRE = 4002; + + // 用户不存在 + public static final int USER_NOT_EXISTS = 4003; + + // 密码错误 + public static final int USER_PASSWORD_ERROR = 4004; + + // 用户关联的医院不存在 + public static final int USER_CONSTAN_HOSPITAL_NOT_EXISTS = 4005; + + // 医院信息不存在 + public static final int HOSPITAL_NOT_EXISTS = 4006; + + // 科室信息不存在 + public static final int DEPT_NOT_EXISTS = 4006; + + // 手机号码过期 + public static final int PHONE_EXPIRE = 4007; + + // 参数错误 + public static final int PARAMETER_ERROR = 4097; + + // 产检劵已使用 + public static final int TICKET_USED = 40971; + + // 系统异常 + public static final int SYSTEM_ERROR = 4099; + public static final String SYSTEM_ERROR_DESCRIPTION = "系统异常"; + + public static final int BUSINESS_ERROR = 4098; + + //验证码已过期 + public static final int VER_CODE_EXPIRE=4008; + + //名称已存在 + public static final int NAME_EXIST=4100; + + + //数据已存在 + public static final int DATA_EXIST=4200; + + //没有数据 + public static final int NO_DATA=4210; + //不能删除 + public static final int DONT_DELETE=4201; + // + public static final int BUSINESS_ERROR1 = 4018; + + //没有权限 + public static final int NO_POWER = 4021; + //区域模式运行 + public static final String RUN_MODE="1"; + + //数据已过期 + public static final int DATA_EXPIRE = 4108; +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/GetPatientInfoController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/GetPatientInfoController.java new file mode 100644 index 0000000..8546efc --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/GetPatientInfoController.java @@ -0,0 +1,56 @@ +package com.lyms.talkonlineweb.controller; + +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.lyms.talkonlineweb.constants.ErrorCodeConstants; +import com.lyms.talkonlineweb.domain.LymsFavor; +import com.lyms.talkonlineweb.domain.LymsHdepart; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.PatientInfoService; +import com.lyms.talkonlineweb.task.GetPatientInfoTask; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.w3c.dom.stylesheets.LinkStyle; + +import java.util.List; +import java.util.Map; + +/** + * 医院患者信息接收 + */ +@RestController +@RequestMapping("getPatient") +public class GetPatientInfoController { + + @Autowired + private GetPatientInfoTask getPatientInfoTask; + + /** + * 保存医院患者信息 + * @param param + * @return + */ + @PostMapping("savePatient") + public BaseResponse savePatient(@RequestBody List param){ + BaseResponse baseResponse=new BaseResponse(); + if(CollectionUtils.isEmpty(param)){ + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); + baseResponse.setErrormsg("参数为空"); + return baseResponse; + } + + try { + getPatientInfoTask.getPatient(param); + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); + baseResponse.setErrormsg("成功"); + } catch (Exception e) { + e.printStackTrace(); + baseResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); + baseResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); + } + return baseResponse; + } +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java index 0302f3f..5f0a0c8 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java @@ -141,6 +141,38 @@ public class GetPatientInfoTask { return param; } + /** + * 接收医院患者信息 + * @param listMap + * @throws Exception + */ + public void getPatient(List listMap) throws Exception { + if (CollectionUtils.isNotEmpty(listMap)) { + for (Map map : listMap) { + //添加到数据后续页面处理 + LymsHisInfo hisInfoMap = (LymsHisInfo) BeanUtils.mapToObject(map, LymsHisInfo.class);//map转对象 + if (null != hisInfoMap) { + //今天添加过不需要重复添加 + QueryWrapper qurey = new QueryWrapper(); + qurey.eq("idCard", hisInfoMap.getIdcard()); + qurey.eq("diagnose", hisInfoMap.getDiagnose()); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.set(Calendar.HOUR_OF_DAY, 00);//时 + calendar.set(Calendar.MINUTE, 00);//分 + calendar.set(Calendar.SECOND, 00);//秒 + qurey.gt("createdtime", calendar.getTime()); + List list = lymsHisInfoService.list(qurey); + if (CollectionUtils.isEmpty(list)) { + hisInfoMap.setBirthday(StringUtil.isNotEmpty(hisInfoMap.getBirthday()) ? StringUtil.leftTruncate(hisInfoMap.getBirthday(), ' ') : null); + hisInfoMap.setUpType(0);//默认未上传 + lymsHisInfoService.save(hisInfoMap); + } + } + } + } + } + }