Browse Source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx 4 years ago
parent
commit
c1588438e3

+ 1 - 0
conf/app.conf View File

122
 
122
 
123
 
123
 
124
 
124
 
125
+
125
 niprocart =  63
126
 niprocart =  63
126
 jms = 58
127
 jms = 58
127
 fistula_needle_set = 65
128
 fistula_needle_set = 65

+ 11 - 1
controllers/dialysis_api_controller.go View File

1369
 			}
1369
 			}
1370
 		}
1370
 		}
1371
 
1371
 
1372
-		prescription.Creater = adminUserInfo.AdminUser.Id
1372
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1373
+			prescription_doctor := adminUserInfo.AdminUser.Id
1374
+			prescription.PrescriptionDoctor = prescription_doctor
1375
+		}
1376
+		if dialysisPrescription.Creater == 0 { //体重称
1377
+			prescription.Creater = adminUserInfo.AdminUser.Id
1378
+
1379
+		} else {
1380
+			prescription.Creater = dialysisPrescription.Creater
1381
+		}
1382
+
1373
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1383
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1374
 		prescription.UpdatedTime = time.Now().Unix()
1384
 		prescription.UpdatedTime = time.Now().Unix()
1375
 		prescription.Modifier = adminUserInfo.AdminUser.Id
1385
 		prescription.Modifier = adminUserInfo.AdminUser.Id

+ 2 - 3
controllers/mobile_api_controllers/admin_user_api_controller.go View File

18
 func (c *AdminUserApiController) GetAdminUserElectronicSignature() {
18
 func (c *AdminUserApiController) GetAdminUserElectronicSignature() {
19
 
19
 
20
 	adminUserInfo := c.GetMobileAdminUserInfo()
20
 	adminUserInfo := c.GetMobileAdminUserInfo()
21
-
22
-	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
23
-
21
+	orgId, _ := service.GetCreatByOrgId(adminUserInfo.Org.Id)
22
+	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, orgId.Creator)
24
 	if es != nil {
23
 	if es != nil {
25
 		c.ServeSuccessJSON(map[string]interface{}{
24
 		c.ServeSuccessJSON(map[string]interface{}{
26
 			"state":                1,
25
 			"state":                1,

+ 6 - 7
controllers/mobile_api_controllers/dialysis_api_controller.go View File

2236
 
2236
 
2237
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2237
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2238
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2238
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2239
-		if dialysisPrescription.Creater == 0 {
2239
+		if appRole.UserType == 2 || appRole.UserType == 1 {
2240
+			prescription_doctor := adminUserInfo.AdminUser.Id
2241
+			prescription.PrescriptionDoctor = prescription_doctor
2242
+		}
2243
+		if dialysisPrescription.Creater == 0 { //体重称
2240
 			prescription.Creater = adminUserInfo.AdminUser.Id
2244
 			prescription.Creater = adminUserInfo.AdminUser.Id
2241
-			if appRole.UserType == 2 || appRole.UserType == 1 {
2242
-				prescription_doctor = adminUserInfo.AdminUser.Id
2243
-				prescription.PrescriptionDoctor = dialysisPrescription.PrescriptionDoctor
2244
-			} else {
2245
-				prescription_doctor = 0
2246
-			}
2245
+
2247
 		} else {
2246
 		} else {
2248
 			prescription.Creater = dialysisPrescription.Creater
2247
 			prescription.Creater = dialysisPrescription.Creater
2249
 		}
2248
 		}

+ 12 - 20
controllers/mobile_api_controllers/patient_api_controller.go View File

2186
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2186
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2187
 		return
2187
 		return
2188
 	}
2188
 	}
2189
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2190
-
2191
-	//if appRole.UserType == 3{
2192
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdvicePermissionDeniedModify)
2193
-	//	return
2194
-	//}
2195
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2196
-
2197
-	//if appRole.UserType == 3 {
2198
-	//	headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
2199
-	//	if getPermissionErr != nil {
2200
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2201
-	//		return
2202
-	//	} else if headNursePermission == nil {
2203
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
2204
-	//		return
2205
-	//	}
2206
-	//}
2207
-	//TODO根据路由做权限
2208
 
2189
 
2209
 	group_no, _ := c.GetInt64("group_no")
2190
 	group_no, _ := c.GetInt64("group_no")
2210
 	if group_no <= 0 {
2191
 	if group_no <= 0 {
2234
 		return
2215
 		return
2235
 	}
2216
 	}
2236
 
2217
 
2218
+	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
2219
+		utils.ErrorLog("start_time")
2220
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2221
+		return
2222
+	}
2223
+
2224
+	startTime2, _ := dataBody["start_time"].(string)
2225
+	time_arr := strings.Split(startTime2, " ")
2226
+	if len(time_arr) > 0 {
2227
+		startTime2 = time_arr[0]
2228
+	}
2237
 	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2229
 	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2238
 		utils.ErrorLog("advice_date")
2230
 		utils.ErrorLog("advice_date")
2239
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2231
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2240
 		return
2232
 		return
2241
 	}
2233
 	}
2242
-	adviceDate, _ := dataBody["advice_date"].(string)
2234
+	adviceDate := startTime2
2243
 	if len(adviceDate) == 0 {
2235
 	if len(adviceDate) == 0 {
2244
 		utils.ErrorLog("len(adviceDate) == 0")
2236
 		utils.ErrorLog("len(adviceDate) == 0")
2245
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2237
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 106 - 8
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

1496
 	})
1496
 	})
1497
 }
1497
 }
1498
 
1498
 
1499
+func (this *NewDialysisApiController) GetAllProjectName() {
1500
+	id := this.GetString("date")
1501
+	fmt.Println("id是", id)
1502
+	ids, _ := strconv.ParseInt(id, 10, 64)
1503
+	patientid := this.GetString("patientid")
1504
+	fmt.Println("patient", patientid)
1505
+	paientids, _ := strconv.ParseInt(patientid, 10, 64)
1506
+	patient, _ := service.GetNewPatient(paientids)
1507
+	orgid := this.GetMobileAdminUserInfo().Org.Id
1508
+	projectName, err := service.GetAllProjectName(ids, orgid, patient.BloodId)
1509
+	fmt.Println("projectname----------------------------------", err)
1510
+	if err != nil {
1511
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1512
+		return
1513
+	}
1514
+	this.ServeSuccessJSON(map[string]interface{}{
1515
+		"projectName": projectName,
1516
+	})
1517
+}
1518
+
1499
 func (this *NewDialysisApiController) GetAllInspection() {
1519
 func (this *NewDialysisApiController) GetAllInspection() {
1500
 
1520
 
1501
 	//查询该机构是否存在检验检测项目
1521
 	//查询该机构是否存在检验检测项目
1701
 	fmt.Println("id", id)
1721
 	fmt.Println("id", id)
1702
 	message := this.GetString("message")
1722
 	message := this.GetString("message")
1703
 	fmt.Println("message", message)
1723
 	fmt.Println("message", message)
1724
+	orgid, _ := this.GetInt64("orgid")
1704
 	role := models.SgjUserAdminRole{
1725
 	role := models.SgjUserAdminRole{
1705
 		Message: message,
1726
 		Message: message,
1706
 	}
1727
 	}
1707
-	err := service.SaveMessage(id, &role)
1728
+	err := service.SaveMessage(id, orgid, &role)
1708
 	if err != nil {
1729
 	if err != nil {
1709
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1730
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1710
 		return
1731
 		return
1719
 	fmt.Println("sex", sex)
1740
 	fmt.Println("sex", sex)
1720
 	id, _ := this.GetInt64("id")
1741
 	id, _ := this.GetInt64("id")
1721
 	fmt.Println("id", id)
1742
 	fmt.Println("id", id)
1743
+	orgid, _ := this.GetInt64("orgid")
1722
 	role := models.SgjUserAdminRole{
1744
 	role := models.SgjUserAdminRole{
1723
-		Sex: sex,
1745
+		Sex:   sex,
1746
+		OrgId: orgid,
1724
 	}
1747
 	}
1725
 	err := service.SaveSex(id, &role)
1748
 	err := service.SaveSex(id, &role)
1726
 	if err != nil {
1749
 	if err != nil {
1743
 	timeLayout := "2006-01-02 15:04:05"
1766
 	timeLayout := "2006-01-02 15:04:05"
1744
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
1767
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
1745
 	birth := theTime.Unix()
1768
 	birth := theTime.Unix()
1769
+	orgid := dataBody["orgid"].(string)
1770
+	orgids, err := strconv.ParseInt(orgid, 10, 64)
1746
 	role := models.SgjUserAdminRole{
1771
 	role := models.SgjUserAdminRole{
1747
 		Birthday: birth,
1772
 		Birthday: birth,
1773
+		OrgId:    orgids,
1748
 	}
1774
 	}
1749
 	err = service.SaveBirthday(ids, &role)
1775
 	err = service.SaveBirthday(ids, &role)
1750
 	if err != nil {
1776
 	if err != nil {
2205
 
2231
 
2206
 func (this *NewDialysisApiController) GetMyInforName() {
2232
 func (this *NewDialysisApiController) GetMyInforName() {
2207
 	id, _ := this.GetInt64("id")
2233
 	id, _ := this.GetInt64("id")
2208
-	Username, err := service.GetAdminName(id)
2234
+	orgid, _ := this.GetInt64("orgid")
2235
+	Username, err := service.GetAdminName(id, orgid)
2209
 	if err != nil {
2236
 	if err != nil {
2210
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2237
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2211
 		return
2238
 		return
2217
 
2244
 
2218
 func (this *NewDialysisApiController) GetMyInformationFour() {
2245
 func (this *NewDialysisApiController) GetMyInformationFour() {
2219
 	adminUserInfo := this.GetMobileAdminUserInfo()
2246
 	adminUserInfo := this.GetMobileAdminUserInfo()
2220
-	creatId := adminUserInfo.AdminUser.Id
2221
-	fmt.Println("创建者ID", creatId)
2247
+	//creatId := adminUserInfo.AdminUser.Id
2248
+	//fmt.Println("创建者ID", creatId)
2222
 	orgid := adminUserInfo.Org.Id
2249
 	orgid := adminUserInfo.Org.Id
2250
+	//跟剧机构ID获取创建者ID
2223
 	fmt.Println("orgid", orgid)
2251
 	fmt.Println("orgid", orgid)
2252
+	//OrgId, _ := service.GetCreatByOrgId(orgid)
2253
+	//fmt.Println("创建者ID", OrgId.Creator)
2254
+	creatId := adminUserInfo.AdminUser.Id
2255
+	fmt.Println("creatid", creatId)
2256
+	fmt.Println("当前机构ID信息", orgid)
2224
 	Username, err := service.GetMyOrgInformationFour(creatId, orgid)
2257
 	Username, err := service.GetMyOrgInformationFour(creatId, orgid)
2225
 	if err != nil {
2258
 	if err != nil {
2226
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2259
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2336
 	fmt.Println("cretor", creator)
2369
 	fmt.Println("cretor", creator)
2337
 	adminInfo := this.GetMobileAdminUserInfo()
2370
 	adminInfo := this.GetMobileAdminUserInfo()
2338
 	appId := adminInfo.App.Id
2371
 	appId := adminInfo.App.Id
2339
-	//fmt.Println("appid------------------------------------",appId)
2340
 	information, err := service.GetMyOrgInformation(creator, appId)
2372
 	information, err := service.GetMyOrgInformation(creator, appId)
2341
 	if err != nil {
2373
 	if err != nil {
2342
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2374
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2350
 func (this *NewDialysisApiController) SaveNameTwo() {
2382
 func (this *NewDialysisApiController) SaveNameTwo() {
2351
 	id, _ := this.GetInt64("id")
2383
 	id, _ := this.GetInt64("id")
2352
 	name := this.GetString("name")
2384
 	name := this.GetString("name")
2353
-	fmt.Println("name------------------", name)
2385
+	orgid, _ := this.GetInt64("orgid")
2354
 	role := models.SgjUserAdminRole{
2386
 	role := models.SgjUserAdminRole{
2355
 		UserName: name,
2387
 		UserName: name,
2356
 	}
2388
 	}
2357
-	err := service.SaveNameTwo(id, &role)
2389
+	err := service.SaveNameTwo(id, orgid, &role)
2390
+	fmt.Println("err", err)
2358
 	if err != nil {
2391
 	if err != nil {
2359
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2392
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2360
 		return
2393
 		return
2403
 		"mobile": mobile,
2436
 		"mobile": mobile,
2404
 	})
2437
 	})
2405
 }
2438
 }
2439
+
2440
+func (this *NewDialysisApiController) SumitForm() {
2441
+
2442
+	name := this.GetString("name")
2443
+	fmt.Println("姓名", name)
2444
+	mobile := this.GetString("mobile")
2445
+	fmt.Println("mobile", mobile)
2446
+	address := this.GetString("address")
2447
+	fmt.Println("address", address)
2448
+	positon := this.GetString("position")
2449
+	fmt.Println("职位", positon)
2450
+	hospitalName := this.GetString("hospitalName")
2451
+	fmt.Println("医院名称", hospitalName)
2452
+	systemName := this.GetString("systemName")
2453
+	fmt.Println("系统名称", systemName)
2454
+	isUser, _ := this.GetInt64("isUser")
2455
+	fmt.Println("是否使用", isUser)
2456
+	isThink, _ := this.GetInt64("isThink")
2457
+	fmt.Println("是否考虑", isThink)
2458
+	result := this.GetString("result")
2459
+	fmt.Println("result", result)
2460
+	otherRemark := this.GetString("otherRemark")
2461
+	fmt.Println("result", otherRemark)
2462
+	otherMessage := this.GetString("otherMessage")
2463
+	fmt.Println("otherMessage", otherMessage)
2464
+	gift, _ := this.GetInt64("gift")
2465
+	fmt.Println("gift", gift)
2466
+	admininfo := this.GetMobileAdminUserInfo()
2467
+	creator := admininfo.AdminUser.Id
2468
+	fmt.Println("创建者", creator)
2469
+	_, errcode := service.GetActivtyCreator(creator)
2470
+	if errcode == gorm.ErrRecordNotFound {
2471
+		table := models.KyActivityTable{
2472
+			Name:         name,
2473
+			Phone:        mobile,
2474
+			Address:      address,
2475
+			Position:     positon,
2476
+			HospitalName: hospitalName,
2477
+			SystemName:   systemName,
2478
+			IsUser:       isUser,
2479
+			IsThink:      isThink,
2480
+			OtherMode:    result,
2481
+			OtherRemark:  otherRemark,
2482
+			OtherMessage: otherMessage,
2483
+			Gift:         gift,
2484
+			AdminUserId:  creator,
2485
+			Status:       1,
2486
+			Ctime:        time.Now().Unix(),
2487
+		}
2488
+		err := service.CreateTable(&table)
2489
+		if err != nil {
2490
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2491
+			return
2492
+		}
2493
+		this.ServeSuccessJSON(map[string]interface{}{
2494
+			"table": table,
2495
+		})
2496
+	} else if errcode == nil {
2497
+		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2498
+		this.ServeJSON()
2499
+		return
2500
+	} else {
2501
+		return
2502
+	}
2503
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go View File

101
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
101
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
102
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
102
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
103
 	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
103
 	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
104
+	beego.Router("/m/api/patient/getallprojectname", &NewDialysisApiController{}, "Get:GetAllProjectName")
104
 	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
105
 	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
105
 	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
106
 	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
106
 	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
107
 	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
149
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
151
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
151
 	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
152
 	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
153
+	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
152
 }
154
 }

+ 21 - 1
controllers/patient_api_controller.go View File

1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1061
 		return
1061
 		return
1062
 	}
1062
 	}
1063
-	adviceDate, _ := dataBody["advice_date"].(string)
1063
+
1064
+	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
1065
+		utils.ErrorLog("start_time")
1066
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1067
+		return
1068
+	}
1069
+
1070
+	startTime2, _ := dataBody["start_time"].(string)
1071
+
1072
+	time_arr := strings.Split(startTime2, " ")
1073
+
1074
+	if len(time_arr) > 0 {
1075
+		startTime2 = time_arr[0]
1076
+	}
1077
+
1078
+	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
1079
+		utils.ErrorLog("advice_date")
1080
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1081
+		return
1082
+	}
1083
+	adviceDate := startTime2
1064
 	if len(adviceDate) == 0 {
1084
 	if len(adviceDate) == 0 {
1065
 		utils.ErrorLog("len(adviceDate) == 0")
1085
 		utils.ErrorLog("len(adviceDate) == 0")
1066
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 1 - 1
controllers/public_api_controller.go View File

486
 	//
486
 	//
487
 	//
487
 	//
488
 	////创建内置角色
488
 	////创建内置角色
489
-	InitRoleAndPurviews(org_ids)
489
+	//InitRoleAndPurviews(org_ids)
490
 
490
 
491
 	//var org_id int = 0
491
 	//var org_id int = 0
492
 	//管理员
492
 	//管理员

+ 26 - 0
models/patient_models.go View File

813
 
813
 
814
 	return "sgj_user_admin_login_log"
814
 	return "sgj_user_admin_login_log"
815
 }
815
 }
816
+
817
+type KyActivityTable struct {
818
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
819
+	Name         string `gorm:"column:name" json:"name" form:"name"`
820
+	Phone        string `gorm:"column:phone" json:"phone" form:"phone"`
821
+	Address      string `gorm:"column:address" json:"address" form:"address"`
822
+	Position     string `gorm:"column:position" json:"position" form:"position"`
823
+	HospitalName string `gorm:"column:hospital_name" json:"hospital_name" form:"hospital_name"`
824
+	IsUser       int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
825
+	IsThink      int64  `gorm:"column:is_think" json:"is_think" form:"is_think"`
826
+	OtherMode    string `gorm:"column:other_mode" json:"other_mode" form:"other_mode"`
827
+	OtherRemark  string `gorm:"column:other_remark" json:"other_remark" form:"other_remark"`
828
+	Gift         int64  `gorm:"column:gift" json:"gift" form:"gift"`
829
+	OtherMessage string `gorm:"column:other_message" json:"other_message" form:"other_message"`
830
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
831
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
832
+	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
833
+	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
834
+	SystemName   string `gorm:"column:system_name" json:"system_name" form:"system_name"`
835
+	AdminUserId  int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
836
+}
837
+
838
+func (KyActivityTable) TableName() string {
839
+
840
+	return "ky_activity_table"
841
+}

+ 18 - 0
service/manage_service.go View File

1068
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1068
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1069
 	return err
1069
 	return err
1070
 }
1070
 }
1071
+
1072
+func GetActivtyCreator(creator int64) (*models.KyActivityTable, error) {
1073
+	table := models.KyActivityTable{}
1074
+	err := UserReadDB().Model(&table).Where("admin_user_id = ? and status =1", creator).Find(&table).Error
1075
+	if err == gorm.ErrRecordNotFound {
1076
+		return nil, err
1077
+	}
1078
+	if err != nil {
1079
+		return nil, err
1080
+	}
1081
+	return &table, nil
1082
+}
1083
+
1084
+func CreateTable(table *models.KyActivityTable) error {
1085
+
1086
+	err := UserWriteDB().Model(&table).Create(&table).Error
1087
+	return err
1088
+}

+ 19 - 6
service/patientmanage_service.go View File

983
 
983
 
984
 }
984
 }
985
 
985
 
986
+func GetAllProjectName(date int64, orgid int64, patientid int64) (inspection []*models.XtInspection, err error) {
987
+
988
+	err = XTReadDB().Model(&inspection).Where("inspect_date = ? and org_id = ? and patient_id = ? and status = 1", date, orgid, patientid).Order("inspect_date desc").Group("project_name").Find(&inspection).Error
989
+
990
+	return inspection, err
991
+}
992
+
986
 func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
993
 func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
987
 
994
 
988
 	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
995
 	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
1053
 	return err
1060
 	return err
1054
 }
1061
 }
1055
 
1062
 
1056
-func SaveMessage(id int64, role *models.SgjUserAdminRole) error {
1063
+func SaveMessage(id int64, orgid int64, role *models.SgjUserAdminRole) error {
1057
 
1064
 
1058
-	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id = ?", id).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
1065
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id = ? and org_id = ?", id, orgid).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
1059
 	return err
1066
 	return err
1060
 }
1067
 }
1061
 
1068
 
1250
 	return role, err
1257
 	return role, err
1251
 }
1258
 }
1252
 
1259
 
1253
-func GetAdminName(id int64) (models.AdminUsers, error) {
1260
+func GetAdminName(id int64, orgid int64) (models.AdminUsers, error) {
1254
 	user := models.AdminUsers{}
1261
 	user := models.AdminUsers{}
1255
 	//err := UserReadDB().Model(&user).Where("id=? and status =1", id).Find(&user).Error
1262
 	//err := UserReadDB().Model(&user).Where("id=? and status =1", id).Find(&user).Error
1256
 	//return user, err
1263
 	//return user, err
1257
 	db := UserReadDB().Table("sgj_user_admin as x").Where("x.status = 1")
1264
 	db := UserReadDB().Table("sgj_user_admin as x").Where("x.status = 1")
1258
 	table := UserReadDB().Table("sgj_user_admin_role as r")
1265
 	table := UserReadDB().Table("sgj_user_admin_role as r")
1259
 	fmt.Println("table", table)
1266
 	fmt.Println("table", table)
1260
-	err := db.Group("x.id").Select("x.id,x.mobile,x.password,x.is_super_admin,x.source,x.name,r.admin_user_id,r.org_id,r.app_id,r.role_id,r.user_name,r.avatar,r.message,r.sex,r.birthday").Where("x.id = ?", id).Joins("left join sgj_user_admin_role as r on r.admin_user_id = x.id").Scan(&user).Error
1267
+	err := db.Group("x.id").Select("x.id,x.mobile,x.password,x.is_super_admin,x.source,x.name,r.admin_user_id,r.org_id,r.app_id,r.role_id,r.user_name,r.avatar,r.message,r.sex,r.birthday").Where("x.id = ?", id).Joins("left join sgj_user_admin_role as r on r.admin_user_id = x.id and r.org_id = ?", orgid).Scan(&user).Error
1261
 	return user, err
1268
 	return user, err
1262
 }
1269
 }
1263
 
1270
 
1271
+func GetCreatByOrgId(orgid int64) (models.SgjUserOrg, error) {
1272
+	org := models.SgjUserOrg{}
1273
+	err := UserReadDB().Model(&org).Where("id=? and status = 1", orgid).Find(&org).Error
1274
+	return org, err
1275
+}
1276
+
1264
 func GetMyOrgInformationFour(creator int64, orgid int64) (models.SgjUserAdminRole, error) {
1277
 func GetMyOrgInformationFour(creator int64, orgid int64) (models.SgjUserAdminRole, error) {
1265
 	role := models.SgjUserAdminRole{}
1278
 	role := models.SgjUserAdminRole{}
1266
 	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and status = 1", creator, orgid).Find(&role).Error
1279
 	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and status = 1", creator, orgid).Find(&role).Error
1361
 	return admin, err
1374
 	return admin, err
1362
 }
1375
 }
1363
 
1376
 
1364
-func SaveNameTwo(id int64, role *models.SgjUserAdminRole) error {
1377
+func SaveNameTwo(id int64, orgid int64, role *models.SgjUserAdminRole) error {
1365
 
1378
 
1366
-	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id =?", id).Update(map[string]interface{}{"user_name": role.UserName, "mtime": time.Now().Unix()}).Error
1379
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id =? and org_id = ?", id, orgid).Update(map[string]interface{}{"user_name": role.UserName, "mtime": time.Now().Unix()}).Error
1367
 	return err
1380
 	return err
1368
 }
1381
 }