就诊人列表-导出
This commit is contained in:
@@ -253,3 +253,37 @@ func (r *Export) UserPatient(c *gin.Context) {
|
||||
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
// PatientFamily 就诊人列表
|
||||
func (r *Export) PatientFamily(c *gin.Context) {
|
||||
userPatientRequest := requests.PatientFamilyRequest{}
|
||||
req := userPatientRequest.PatientFamilyExportList
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
patientFamilys, err := patientFamilyDao.GetPatientFamilyExportListSearch(req)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
exportService := service.ExportService{}
|
||||
ossAddress, err := exportService.PatientFamily(patientFamilys)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
@@ -16,28 +16,29 @@ type PatientFamily struct{}
|
||||
|
||||
// GetPatientFamilyPage 获取就诊人列表-分页
|
||||
func (r *PatientFamily) GetPatientFamilyPage(c *gin.Context) {
|
||||
req := requests.PatientFamilyRequest{}
|
||||
if err := c.ShouldBind(&req.GetPatientFamilyPage); err != nil {
|
||||
patientFamilyRequest := requests.PatientFamilyRequest{}
|
||||
req := patientFamilyRequest.GetPatientFamilyPage
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req.GetPatientFamilyPage); err != nil {
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.GetPatientFamilyPage.Page == 0 {
|
||||
req.GetPatientFamilyPage.Page = 1
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
|
||||
if req.GetPatientFamilyPage.PageSize == 0 {
|
||||
req.GetPatientFamilyPage.PageSize = 20
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 20
|
||||
}
|
||||
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
patientFamily, total, err := patientFamilyDao.GetPatientFamilyPageSearch(req.GetPatientFamilyPage, req.GetPatientFamilyPage.Page, req.GetPatientFamilyPage.PageSize)
|
||||
patientFamily, total, err := patientFamilyDao.GetPatientFamilyPageSearch(req, req.Page, req.PageSize)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
@@ -47,8 +48,8 @@ func (r *PatientFamily) GetPatientFamilyPage(c *gin.Context) {
|
||||
GetPatientFamilyPage := dto.GetPatientFamilyListDto(patientFamily)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.GetPatientFamilyPage.Page
|
||||
result["page_size"] = req.GetPatientFamilyPage.PageSize
|
||||
result["page"] = req.Page
|
||||
result["page_size"] = req.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = GetPatientFamilyPage
|
||||
responses.OkWithData(result, c)
|
||||
|
||||
Reference in New Issue
Block a user