diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 8b28ff4..153ab6d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -11,6 +11,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.RequestParamsUtil; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.http.HttpUtils; @@ -25,11 +26,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; -import sun.misc.BASE64Decoder; import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -501,4 +499,34 @@ public class AppController extends BaseController return jsonObject; } + + /** + * 添加记录 + * + * @param patientId 患者id + * @return {@code AjaxResult} + */ + @ApiOperation("新增预约记录") + @Log(title = "App新增预约记录", businessType = BusinessType.INSERT) + @PostMapping("/record/add/{patientId}") + public AjaxResult addRecord(@PathVariable("patientId") Long patientId) + { + TRecord tRecord = new TRecord(); + tRecord.setHospitalId(SecurityUtils.getLoginUser().getUser().getHospitalId()); + tRecord.setPatientId(patientId); + tRecord.setDoctorId(getUserId()); + tRecord.setStatus("0"); + tRecord.setCreateBy(getUsername()); + tRecordService.insertTRecord(tRecord); + TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); + tPatientHospitalDoctor.setHospitalId(tRecord.getHospitalId()); + tPatientHospitalDoctor.setDoctorId(tRecord.getDoctorId()); + tPatientHospitalDoctor.setPatientId(tRecord.getPatientId()); + List tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); + if (tPHDs.isEmpty()) + { + itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor); + } + return AjaxResult.success("预约成功。"); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index e056f5b..45aa5e5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -20,7 +20,7 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -31,7 +31,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -49,13 +49,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @Autowired private CorsFilter corsFilter; - + /** * 解决 无法直接注入 AuthenticationManager * @@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/login/app","/login/app/fill/info","/register", "/captchaImage").anonymous() + .antMatchers("/login", "/login/app","/login/app/fill/info","/register", "/captchaImage","/common/upload").anonymous() .antMatchers( HttpMethod.GET, "/",