Compare commits

...
22 Commits
Author SHA1 Message Date
admin 66121e060f Merge branch 'dev' 2025-07-08 17:34:08 +08:00
admin 1f52e899da 修改了新病例验证2 2025-07-08 17:33:45 +08:00
admin abf19cf89d Merge branch 'dev' 2025-07-08 17:31:15 +08:00
admin fd3b03d7b5 修改了新病例验证1 2025-07-08 17:31:06 +08:00
admin f05576d651 修改了新病例验证 2025-07-08 17:29:00 +08:00
admin 442c0ed73d 1111 2025-06-20 10:38:34 +08:00
admin dc84dbbb44 修改了登录接口 2025-06-18 17:08:12 +08:00
admin ec7df630f8 新增了接口 2025-06-13 18:24:51 +08:00
admin eea64a94fb Merge branch 'dev' 2025-03-17 15:58:12 +08:00
admin 05847c3d76 新增了病例详情13 2025-03-17 15:58:04 +08:00
admin f1a5a71ea7 新增了病例详情1 2025-03-17 15:19:53 +08:00
admin 60acb9aaaa 新增了病例详情 2025-03-17 14:59:10 +08:00
admin 7328f93e20 Merge branch 'dev' 2025-03-14 18:50:09 +08:00
admin 30640e588c 7666 2025-03-14 18:18:07 +08:00
admin 38503334f6 4555 2025-03-14 18:13:39 +08:00
admin 034e51dc47 44444 2025-03-14 18:11:17 +08:00
admin 99ad3da850 3333 2025-03-14 18:03:36 +08:00
admin 101ffabfeb 111111 2025-03-14 17:52:31 +08:00
admin 1b835c09e1 修改是否已参与列表 2025-03-14 17:48:51 +08:00
admin 21895b9059 修正的点赞 2025-03-14 17:34:18 +08:00
admin f6465ad970 1 2025-03-14 15:43:24 +08:00
admin 9d025c5b17 修改了积分发放问题 2025-03-13 16:37:19 +08:00
9 changed files with 234 additions and 55 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ func (b *CaseComment) GetCaseCommentPage(c *gin.Context) {
isLike, _ = caseCommentLikeDao.GetCaseCommentLikeCount(maps)
// 加载数据-点赞
commentDto.LoadIsLike(isLike)
caseCommentDto.LoadIsLike(isLike)
}
// 处理剩余评论数量字段
+72
View File
@@ -97,3 +97,75 @@ func (b *Project) GetProjectPage(c *gin.Context) {
result["data"] = g
responses.OkWithData(result, c)
}
// GetProject 获取详情
func (b *Project) GetProject(c *gin.Context) {
id := c.Param("project_id")
if id == "" {
responses.FailWithMessage("缺少参数", c)
return
}
// 将 id 转换为 int64 类型
projectId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
responses.Fail(c)
return
}
platformId := c.GetInt64("PlatformId") // 平台id
if platformId == 0 {
responses.FailWithMessage("内部错误", c)
return
}
// 获取病例关联平台
projectPlatformDao := dao.ProjectPlatformDao{}
maps := make(map[string]interface{})
maps["project_id"] = projectId
maps["platform_id"] = platformId
projectPlatform, _ := projectPlatformDao.GetProjectPlatform(maps)
if projectPlatform == nil {
responses.FailWithMessage("非法数据", c)
return
}
// 获取病例详情
projectDao := dao.ProjectDao{}
project, err := projectDao.GetProjectPreloadById(projectId)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
g := dto.GetProjectDto(project)
// 加载关联病例数量
g.LoadCaseCount(project.Case)
// 获取最近7天的病例
now := time.Now()
t := now.AddDate(0, 0, -7)
caseDao := dao.CaseDao{}
maps = make(map[string]interface{})
maps["project_id"] = g.ProjectId
result, _ := caseDao.GetCaseFormPastDay(maps, t)
if result != nil {
if result.CaseStatus == 1 {
// 加载最近更新情况
g.LoadIsRecentlyUpdate(result)
}
}
// 获取项目福利存在情况
projectService := service.ProjectService{}
isHaveWelfare := projectService.GetProjectIsHaveWelfare(projectId, platformId)
// 加载是否开启福利
if isHaveWelfare {
g.IsWelfare = 1
}
responses.OkWithData(g, c)
}
+120
View File
@@ -11,6 +11,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)
type Public struct{}
@@ -238,6 +239,125 @@ func (b *Public) Login(c *gin.Context) {
responses.OkWithData(g, c)
}
// LoginProgram Login 登陆-小程序
func (b *Public) LoginProgram(c *gin.Context) {
publicRequest := requests.PublicRequest{}
req := publicRequest.LoginProgram
if err := c.ShouldBind(&req); err != nil {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
// 参数验证
if err := global.Validate.Struct(req); err != nil {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
// 解析token
t, err := utils.ParseJwt(req.Token)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
// 转换类型
userId, err := strconv.ParseInt(t.UserId, 10, 64)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
// 获取用户信息
userDao := dao.UserDao{}
maps := make(map[string]interface{})
maps["user_id"] = userId
user, _ := userDao.GetUser(maps)
if user == nil {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
var platformId int
if user.RegisterSource == 2 {
platformId = 1
} else if user.RegisterSource == 3 {
platformId = 2
}
if platformId == 0 {
c.JSON(http.StatusOK, gin.H{
"message": "登录失败",
"code": -2,
"data": gin.H{
"source": 2,
},
})
return
}
// 下发token
token := &utils.Token{
UserId: fmt.Sprintf("%d", user.UserId),
PlatformId: fmt.Sprintf("%d", platformId),
}
// 生成jwt
jwt, err := token.NewJWT()
if err != nil || jwt == "" {
c.JSON(http.StatusOK, gin.H{
"message": "登陆失败",
"code": -1,
"data": gin.H{
"source": 2,
},
})
return
}
g := dto.UserLoginDto(user)
g.LoadToken(jwt)
responses.OkWithData(g, c)
}
func (b *Public) T(c *gin.Context) {
// 开始事务
tx := global.Db.Begin()
+14 -4
View File
@@ -155,19 +155,29 @@ func (r *CaseDao) GetCasePageSearch(req requests.GetCasePage, page, pageSize int
// 是否已参与(0:全部 1:已参与 2:未参与)
if req.IsTakePart == 1 {
var userIds []int64
global.Db.Model(&model.User{}).
Select("user_id").
Where("mobile_encryption = (SELECT mobile_encryption FROM user WHERE user_id = ?)", req.UserId).
Find(&userIds)
caseUserSubQuery := global.Db.Model(&model.CaseUser{}).
Where("case_user.case_id = case.case_id").
Where("case_user.platform_id = ?", req.PlatformId).
Where("case_user.user_id = ?", req.UserId)
Where("case_user.user_id IN (?)", userIds)
query = query.Where("EXISTS (?)", caseUserSubQuery)
}
if req.IsTakePart == 2 {
var userIds []int64
global.Db.Model(&model.User{}).
Select("user_id").
Where("mobile_encryption = (SELECT mobile_encryption FROM user WHERE user_id = ?)", req.UserId).
Find(&userIds)
caseUserSubQuery := global.Db.Model(&model.CaseUser{}).
Where("case_user.case_id = case.case_id").
Where("case_user.platform_id = ?", req.PlatformId).
Where("case_user.user_id = ?", req.UserId)
Where("case_user.user_id IN (?)", userIds)
query = query.Where("NOT EXISTS (?)", caseUserSubQuery)
}
+2 -2
View File
@@ -84,8 +84,8 @@ func (r *CaseDto) LoadCaseItem(m []*model.CaseItem) *CaseDto {
func (r *CaseDto) LoadIsNew(t model.LocalTime) *CaseDto {
now := time.Now()
createdAt := time.Time(t)
diffTime := createdAt.Sub(now)
if diffTime <= 7*24*time.Hour {
diffTime := now.Sub(createdAt)
if diffTime <= 7*24*time.Hour && diffTime > 0 {
r.IsNew = 1
}
+7 -1
View File
@@ -1,7 +1,8 @@
package requests
type PublicRequest struct {
Login // 登陆
Login // 登陆
LoginProgram // 登陆-小程序
}
// Login 登陆
@@ -21,3 +22,8 @@ type Login struct {
Address string `json:"address" form:"address" label:"地址"`
Title string `json:"title" form:"title" label:"职称"`
}
// LoginProgram 登陆-小程序
type LoginProgram struct {
Token string `json:"token" form:"token" validate:"required" label:"token"`
}
+5
View File
@@ -73,6 +73,8 @@ func Init() *gin.Engine {
// publicRouter 公开路由-不验证权限
func publicRouter(r *gin.Engine, api controller.Api) {
r.POST("/login", api.Public.Login)
r.POST("/login/program", api.Public.LoginProgram)
//r.POST("/t", api.Public.T)
}
@@ -94,6 +96,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
// 获取列表-分页
projectGroup.GET("/page", api.Project.GetProjectPage)
// 获取列表-分页
projectGroup.GET("/:project_id", api.Project.GetProject)
// 平台
projectPlatformGroup := projectGroup.Group("/platform")
{
+13 -13
View File
@@ -105,8 +105,8 @@ func (r *UserService) GetUserInfo(tx *gorm.DB, req requests.Login) (user *model.
// 修改用户
userData := make(map[string]interface{})
if user.UserName != req.DoctorName {
userData["user_name"] = req.HospitalName
user.UserName = req.HospitalName
userData["user_name"] = req.DoctorName
user.UserName = req.DoctorName
}
if user.MobileEncryption != req.MobileEncryption {
@@ -341,6 +341,16 @@ func (r *UserService) ReportUserScore(tx *gorm.DB, projectId, caseId, platformId
return nil
}
// 默认为白名单用户
isWhite := true
if projectPlatform.IsWhite == 1 {
projectPlatformWhiteService := ProjectPlatformWhiteService{}
isWhite, err = projectPlatformWhiteService.CheckProjectPlatformWhiteByUser(user, projectId, platformId)
if err != nil {
return err
}
}
// 获取需发放积分
score := 0
appScoreTypeStr := "" // 积分发放原因-app
@@ -372,16 +382,7 @@ func (r *UserService) ReportUserScore(tx *gorm.DB, projectId, caseId, platformId
nodeName = "优质留言"
}
// 检测白名单-无需检测白名单
var isWhite bool
if projectPlatform.IsWhite == 1 {
projectPlatformWhiteService := ProjectPlatformWhiteService{}
isWhite, err = projectPlatformWhiteService.CheckProjectPlatformWhiteByUser(user, projectId, platformId)
if err != nil {
return err
}
}
// 佳动力需求:非白名单用户也需要请求积分记录
// 当用户为非白名单时,重置积分数
if isWhite == false {
score = 0
@@ -440,7 +441,6 @@ func (r *UserService) ReportUserScore(tx *gorm.DB, projectId, caseId, platformId
NodeName: nodeName,
Score: score,
}
recordScore, err = recordScoreDao.AddRecordScore(tx, recordScore)
if err != nil {
return err
-34
View File
@@ -1,34 +0,0 @@
time="2025-02-25 09:09:44" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1R0hQanJ1dUhIejZJVXFwUk92IiwiZXhwIjoxNzQwODc2OTY0fQ.mC5KJVvi8g0JJMVGxeD0g6KJoOEjOk7S9zLdvdleAbs]" total_time=431.967791ms uri=/login
time="2025-02-25 09:10:31" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1R0hQanJ1dUhIejZJVXFwUk92IiwiZXhwIjoxNzQwODc2OTY0fQ.mC5KJVvi8g0JJMVGxeD0g6KJoOEjOk7S9zLdvdleAbs]" total_time=474.459125ms uri=/login
time="2025-02-25 09:11:31" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1R0hQanJ1dUhIejZJVXFwUk92IiwiZXhwIjoxNzQwODc2OTY0fQ.mC5KJVvi8g0JJMVGxeD0g6KJoOEjOk7S9zLdvdleAbs]" total_time=23.951283209s uri=/login
time="2025-02-25 10:40:28" level=info msg="获取app数据返回" data="{\"code\":81000,\"msg\":\"ip限制\",\"data\":null,\"success\":false,\"message\":\"ip限制\"}"
time="2025-02-25 10:40:28" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1R0hQanJ1dUhIejZJVXFwUk92IiwiZXhwIjoxNzQwODgyOTk4fQ.zpoE12H65ujOAB910QWTyAfdYb63FrCcvTiiNJaXeMQ]" total_time=501.148333ms uri=/login
time="2025-02-25 11:57:21" level=info msg="获取app数据返回" data="{\"code\":80002,\"msg\":\"验证超时\",\"data\":null,\"success\":false,\"message\":\"验证超时\"}"
time="2025-02-25 11:57:21" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1R0hQanJ1dUhIejZJVXFwUk92IiwiZXhwIjoxNzQwODgyOTk4fQ.zpoE12H65ujOAB910QWTyAfdYb63FrCcvTiiNJaXeMQ]" total_time=59m36.556658917s uri=/login
time="2025-02-27 11:21:19" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=55.264667ms uri=/case/1894948884916998144
time="2025-02-27 11:21:36" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=580.622291ms uri=/case/1894948884916998144
time="2025-03-04 15:42:13" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=1.614487708s uri=/case/1895027498773647360
time="2025-03-04 16:50:58" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[page:1 page_size:1 project_id:1896834671677804544]" total_time=295.566833ms uri="/case/page?page=1&page_size=1&project_id=1896834671677804544"
time="2025-03-04 17:37:17" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[project_id:1896842668814635008]" total_time=815.4625ms uri="/project/platform?project_id=1896842668814635008"
time="2025-03-04 17:50:32" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[case_id:1896843204397895680]" total_time=470.990834ms uri="/user/score?case_id=1896843204397895680"
time="2025-03-04 17:50:52" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[case_id:1896843204397895680]" total_time=482.829417ms uri="/user/score?case_id=1896843204397895680"
time="2025-03-04 17:51:13" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[case_id:1896843204397895680]" total_time=487.223667ms uri="/user/score?case_id=1896843204397895680"
time="2025-03-04 18:10:42" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[case_id:1896843204397895680]" total_time=472.00025ms uri="/user/score?case_id=1896843204397895680"
time="2025-03-05 10:30:14" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=1.772195833s uri=/case/1895027498773647360
time="2025-03-05 10:33:10" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[project_id:1896834263270035456]" total_time=1.309672834s uri="/project/platform?project_id=1896834263270035456"
time="2025-03-05 10:40:41" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[project_id:1896834263270035456]" total_time=2m24.264561917s uri="/project/platform?project_id=1896834263270035456"
time="2025-03-05 11:00:30" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[project_id:1896834263270035456]" total_time=19m32.522574583s uri="/project/platform?project_id=1896834263270035456"
time="2025-03-05 11:05:25" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[project_id:1896834263270035456]" total_time=890.848708ms uri="/project/platform?project_id=1896834263270035456"
time="2025-03-05 11:26:05" level=info msg="获取app数据参数" data="{\"token\":\"eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc2MzgzfQ.cg93dMO4USrKMRqLunzEulSO8uzptsJPepneGrf3GUA\",\"platform\":\"h_case\",\"timestamp\":\"1741145165\"}"
time="2025-03-05 11:26:06" level=info msg="获取app数据返回" data="{\"code\":0,\"msg\":\"操作失败\",\"data\":null,\"success\":false,\"message\":\"操作失败\"}"
time="2025-03-05 11:26:06" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc2MzgzfQ.cg93dMO4USrKMRqLunzEulSO8uzptsJPepneGrf3GUA]" total_time=1.199444042s uri=/login
time="2025-03-05 11:33:30" level=info msg="获取app数据参数" data="{\"token\":\"eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc3NTEzfQ.41k4bM3OGxdUAWAfnTjcuFCal9itdzMsHcnUITrw_mg\",\"platform\":\"h_case\",\"timestamp\":\"1741145610\"}"
time="2025-03-05 11:33:30" level=info msg="获取app数据返回" data="{\"code\":0,\"msg\":\"操作失败\",\"data\":null,\"success\":false,\"message\":\"操作失败\"}"
time="2025-03-05 11:33:30" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc3NTEzfQ.41k4bM3OGxdUAWAfnTjcuFCal9itdzMsHcnUITrw_mg]" total_time=677.117916ms uri=/login
time="2025-03-05 11:41:23" level=info msg="获取app数据参数" data="{\"token\":\"eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc3NTEzfQ.41k4bM3OGxdUAWAfnTjcuFCal9itdzMsHcnUITrw_mg\",\"platform\":\"h_case\",\"timestamp\":\"1741146083\"}"
time="2025-03-05 11:41:24" level=info msg="获取app数据返回" data="{\"code\":200,\"msg\":\"操作成功\",\"data\":{\"uuid\":\"uN8U0rU0ci1U5WFUdTh\",\"office_name\":\"传染科\",\"realname\":\"赵医生\",\"hospital_uuid\":\"14c1bd9890c14695ab024982a94f8181\",\"mobile\":\"13071195611\",\"photo\":\"\",\"weight\":\"\",\"position_name\":\"主任中医师\",\"prov_name\":\"北京市\"},\"success\":true,\"message\":\"操作成功\"}"
time="2025-03-05 11:41:25" level=info msg="获取app数据参数" data="{\"hospital_uuid\":\"14c1bd9890c14695ab024982a94f8181\",\"platform\":\"h_case\",\"timestamp\":\"1741146085\"}"
time="2025-03-05 11:41:25" level=info msg="获取app数据返回" data="{\"code\":200,\"msg\":\"操作成功\",\"data\":{\"uuid\":\"14c1bd9890c14695ab024982a94f8181\",\"name\":\"北京和平里医院\",\"level\":\"三级甲等\",\"prov_name\":\"北京市\",\"expert_num\":2},\"success\":true,\"message\":\"操作成功\"}"
time="2025-03-05 11:41:25" level=info msg=access http_status=200 ip=127.0.0.1 method=POST params="map[platform_key:123456 source:2 token:eyJUeXBlIjoiSnd0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJ1c2VyX25hbWUiOiJ1TjhVMHJVMGNpMVU1V0ZVZFRoIiwiZXhwIjoxNzQxNTc3NTEzfQ.41k4bM3OGxdUAWAfnTjcuFCal9itdzMsHcnUITrw_mg]" total_time=1.97384675s uri=/login
time="2025-03-06 11:22:48" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=1.219134833s uri=/case/1897462563885551616
time="2025-03-06 11:45:02" level=info msg=access http_status=200 ip=127.0.0.1 method=GET params="map[]" total_time=1.434719333s uri=/case/1897462563885551616