| | |
| | | |
| | | import com.tcm.training.admin.common.ApiResponse; |
| | | import com.tcm.training.admin.common.PageResponse; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import com.tcm.training.admin.member.service.ClinicAppService; |
| | | import com.tcm.training.admin.member.dto.ClinicBankAccountUpdateRequest; |
| | | import com.tcm.training.admin.member.vo.ClinicBoundUserItemVO; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import javax.validation.Valid; |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/clinics") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public ApiResponse<PageResponse<ClinicListItemVO>> page( |
| | | @RequestParam(defaultValue = "1") int page, |
| | | @RequestParam(defaultValue = "10") int pageSize, |
| | | @RequestParam(required = false) String regionCode, |
| | | @RequestParam(required = false) String name, |
| | | @RequestParam(required = false) String phone, |
| | | @RequestParam(required = false) String agentName, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdFrom, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdTo, |
| | | @RequestParam(required = false) Integer status) { |
| | | return ApiResponse.ok(clinicAppService.page(page, pageSize, regionCode, name, phone, createdFrom, createdTo, status)); |
| | | return ApiResponse.ok(clinicAppService.page(page, pageSize, regionCode, name, phone, agentName, createdFrom, createdTo, status)); |
| | | } |
| | | |
| | | @GetMapping("/clinics/clinic-import-template") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public void downloadClinicImportTemplate(HttpServletResponse response) throws IOException { |
| | | clinicAppService.downloadClinicImportTemplate(response); |
| | | } |
| | | |
| | | @PostMapping("/clinics/agent-bindings/import") |
| | | @SaCheckPermission("member:clinic:edit") |
| | | public ApiResponse<Void> importAgentBindings(@RequestParam("file") MultipartFile file) throws IOException { |
| | | clinicAppService.importAgentBindings(file); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | @GetMapping("/clinics/export") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public void export(HttpServletResponse response, |
| | | @RequestParam(required = false) String regionCode, |
| | | @RequestParam(required = false) String name, |
| | | @RequestParam(required = false) String phone, |
| | | @RequestParam(required = false) String agentName, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdFrom, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdTo, |
| | | @RequestParam(required = false) Integer status) throws IOException { |
| | | clinicAppService.export(regionCode, name, phone, createdFrom, createdTo, status, response); |
| | | clinicAppService.export(regionCode, name, phone, agentName, createdFrom, createdTo, status, response); |
| | | } |
| | | |
| | | @GetMapping("/clinics/regions") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public ApiResponse<List<ClinicRegionOptionVO>> regionOptions() { |
| | | return ApiResponse.ok(clinicAppService.regionOptions()); |
| | | } |
| | | |
| | | @GetMapping("/clinics/{id}") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public ApiResponse<ClinicDetailVO> detail(@PathVariable Long id) { |
| | | return ApiResponse.ok(clinicAppService.detail(id)); |
| | | } |
| | | |
| | | @PutMapping("/clinics/{id}") |
| | | @SaCheckPermission("member:clinic:edit") |
| | | public ApiResponse<ClinicDetailVO> update(@PathVariable Long id, |
| | | @Valid @RequestBody ClinicBankAccountUpdateRequest request) { |
| | | return ApiResponse.ok(clinicAppService.updateBankAccount(id, request)); |
| | | } |
| | | @GetMapping("/clinics/{id}/users") |
| | | @SaCheckPermission("member:clinic:view") |
| | | public ApiResponse<PageResponse<ClinicBoundUserItemVO>> clinicUsers( |
| | | @PathVariable Long id, |
| | | @RequestParam(defaultValue = "1") int page, |