See999 4 年之前
父節點
當前提交
c81025369b
共有 45 個文件被更改,包括 811 次插入396 次删除
  1. 2 0
      .idea/.gitignore
  2. 8 0
      .idea/XT_New.iml
  3. 4 0
      .idea/encodings.xml
  4. 6 0
      .idea/misc.xml
  5. 8 0
      .idea/modules.xml
  6. 6 0
      .idea/vcs.xml
  7. 二進制
      XT_New
  8. 2 2
      conf/app.conf
  9. 33 33
      controllers/base_api_controller.go
  10. 8 5
      controllers/data_api_controller.go
  11. 19 6
      controllers/device_api_controller.go
  12. 6 15
      controllers/dialysis_api_controller.go
  13. 3 0
      controllers/dialysis_record_api_controller.go
  14. 4 1
      controllers/gobal_config_api_controller.go
  15. 10 10
      controllers/manage_api_controller.go
  16. 14 12
      controllers/mobile_api_controllers/dialysis_api_controller.go
  17. 4 0
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  18. 2 0
      controllers/mobile_api_controllers/mobile_api_router_register.go
  19. 4 8
      controllers/mobile_api_controllers/patient_api_controller.go
  20. 87 36
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  21. 116 79
      controllers/patient_api_controller.go
  22. 2 0
      controllers/public_api_controller.go
  23. 24 0
      models/admin_user_models.go
  24. 1 0
      models/board_models.go
  25. 95 95
      models/device_models.go
  26. 27 0
      models/dialysis.go
  27. 26 25
      models/intergration_models.go
  28. 1 0
      models/monitor_models.go
  29. 42 38
      models/patient_models.go
  30. 1 0
      models/vm_models.go
  31. 8 0
      service/app_version.go
  32. 2 2
      service/auto_create_week_disinfection.go
  33. 2 2
      service/auto_create_week_plan.go
  34. 1 1
      service/data.go
  35. 26 0
      service/device_service.go
  36. 28 1
      service/dialysis_service.go
  37. 1 1
      service/gobal_config_service.go
  38. 6 0
      service/home_service.go
  39. 7 7
      service/manage_service.go
  40. 13 9
      service/mobile_dialysis_service.go
  41. 93 6
      service/patient_service.go
  42. 53 1
      service/patientmanage_service.go
  43. 2 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  44. 1 1
      service/schedule_service.go
  45. 3 0
      service/user_service.go

+ 2 - 0
.idea/.gitignore 查看文件

@@ -0,0 +1,2 @@
1
+# Default ignored files
2
+/workspace.xml

+ 8 - 0
.idea/XT_New.iml 查看文件

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="WEB_MODULE" version="4">
3
+  <component name="NewModuleRootManager">
4
+    <content url="file://$MODULE_DIR$" />
5
+    <orderEntry type="inheritedJdk" />
6
+    <orderEntry type="sourceFolder" forTests="false" />
7
+  </component>
8
+</module>

+ 4 - 0
.idea/encodings.xml 查看文件

@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+</project>

+ 6 - 0
.idea/misc.xml 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+</project>

+ 8 - 0
.idea/modules.xml 查看文件

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/XT_New.iml" filepath="$PROJECT_DIR$/.idea/XT_New.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6 - 0
.idea/vcs.xml 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

二進制
XT_New 查看文件


+ 2 - 2
conf/app.conf 查看文件

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 # 1
@@ -141,7 +141,7 @@ aliquid = 83
141 141
 
142 142
 [dev]
143 143
 mobile_token_expiration_second = 3600
144
-httpdomain = http://api.xt.test.sgjyun.com
144
+httpdomain = http://new_mobile.xt.api.sgjyun.com
145 145
 sso_domain = https://testsso.sgjyun.com
146 146
 front_end_domain = "http://xt.test.sgjyun.com/#"
147 147
 

+ 33 - 33
controllers/base_api_controller.go 查看文件

@@ -2,7 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
5
+	//"XT_New/models"
6 6
 	"XT_New/service"
7 7
 	"fmt"
8 8
 	"strconv"
@@ -65,10 +65,10 @@ type BaseAuthAPIController struct {
65 65
 func (this *BaseAuthAPIController) Prepare() {
66 66
 	this.BaseAPIController.Prepare()
67 67
 	if this.GetAdminUserInfo() == nil {
68
-		var userAdmin models.AdminUser
69
-		userAdmin.Id = 400
70
-		userAdmin.Mobile = "13535547901"
71
-
68
+		//var userAdmin models.AdminUser
69
+		//userAdmin.Id = 400
70
+		//userAdmin.Mobile = "13535547901"
71
+		//
72 72
 		//userAdmin.Id = 597
73 73
 		//userAdmin.Mobile = "19874122664"
74 74
 		//userAdmin.IsSuperAdmin = false
@@ -77,7 +77,7 @@ func (this *BaseAuthAPIController) Prepare() {
77 77
 		//userAdmin.ModifyTime = 1530786071
78 78
 		//var subscibe models.ServeSubscibe
79 79
 		//subscibe.ID = 1
80
-		//subscibe.OrgId = 12
80
+		//subscibe.OrgId = 9538
81 81
 		//subscibe.PeriodStart = 1538035409
82 82
 		//subscibe.PeriodEnd = 1569571409
83 83
 		//subscibe.State = 1
@@ -87,7 +87,7 @@ func (this *BaseAuthAPIController) Prepare() {
87 87
 		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
88 88
 		//subscibes[4] = &subscibe
89 89
 		//var adminUserInfo service.AdminUserInfo
90
-		//adminUserInfo.CurrentOrgId = 12
90
+		//adminUserInfo.CurrentOrgId = 9538
91 91
 		//adminUserInfo.CurrentAppId = 18
92 92
 		//adminUserInfo.AdminUser = &userAdmin
93 93
 		//adminUserInfo.Subscibes = subscibes
@@ -316,32 +316,32 @@ type BaseServeAPIController struct {
316 316
 func (this *BaseServeAPIController) Prepare() {
317 317
 	this.BaseAPIController.Prepare()
318 318
 	if this.GetAdminUserInfo() == nil {
319
-		// var userAdmin models.AdminUser
320
-		// userAdmin.Id = 400
321
-		// userAdmin.Mobile = "13535547901"
322
-		// //userAdmin.Id = 597
323
-		// //userAdmin.Mobile = "19874122664"
324
-		// userAdmin.IsSuperAdmin = false
325
-		// userAdmin.Status = 1
326
-		// userAdmin.CreateTime = 1530786071
327
-		// userAdmin.ModifyTime = 1530786071
328
-		// var subscibe models.ServeSubscibe
329
-		// subscibe.ID = 1
330
-		// subscibe.OrgId = 12
331
-		// subscibe.PeriodStart = 1538035409
332
-		// subscibe.PeriodEnd = 1569571409
333
-		// subscibe.State = 1
334
-		// subscibe.Status = 1
335
-		// subscibe.CreatedTime = 1538035409
336
-		// subscibe.UpdatedTime = 1538035409
337
-		// subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		// subscibes[4] = &subscibe
339
-		// var adminUserInfo service.AdminUserInfo
340
-		// adminUserInfo.CurrentOrgId = 12
341
-		// adminUserInfo.CurrentAppId = 18
342
-		// adminUserInfo.AdminUser = &userAdmin
343
-		// adminUserInfo.Subscibes = subscibes
344
-		// this.SetSession("admin_user_info", &adminUserInfo)
319
+		//var userAdmin models.AdminUser
320
+		//userAdmin.Id = 400
321
+		//userAdmin.Mobile = "13535547901"
322
+		////userAdmin.Id = 597
323
+		////userAdmin.Mobile = "19874122664"
324
+		//userAdmin.IsSuperAdmin = false
325
+		//userAdmin.Status = 1
326
+		//userAdmin.CreateTime = 1530786071
327
+		//userAdmin.ModifyTime = 1530786071
328
+		//var subscibe models.ServeSubscibe
329
+		//subscibe.ID = 1
330
+		//subscibe.OrgId = 9538
331
+		//subscibe.PeriodStart = 1538035409
332
+		//subscibe.PeriodEnd = 1569571409
333
+		//subscibe.State = 1
334
+		//subscibe.Status = 1
335
+		//subscibe.CreatedTime = 1538035409
336
+		//subscibe.UpdatedTime = 1538035409
337
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
+		//subscibes[4] = &subscibe
339
+		//var adminUserInfo service.AdminUserInfo
340
+		//adminUserInfo.CurrentOrgId = 9538
341
+		//adminUserInfo.CurrentAppId = 18
342
+		//adminUserInfo.AdminUser = &userAdmin
343
+		//adminUserInfo.Subscibes = subscibes
344
+		//this.SetSession("admin_user_info", &adminUserInfo)
345 345
 
346 346
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347 347
 		this.StopRun()

+ 8 - 5
controllers/data_api_controller.go 查看文件

@@ -220,11 +220,14 @@ func (c *DataApiController) UpdateChildConfig() {
220 220
 	dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
221 221
 	dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
222 222
 	dataconfig.Remark = string(dataBody["remark"].(string))
223
-	if dataBody["order"] != nil {
224
-		dataconfig.Order = int64(dataBody["order"].(float64))
225
-	} else {
226
-		dataconfig.Order = 0
227
-	}
223
+	dataconfig.Order = int64(dataBody["orders"].(float64))
224
+	fmt.Println("dataconfitg------", dataconfig.Order)
225
+	//if dataBody["orders"] != nil {
226
+	//	dataconfig.Order = int64(dataBody["orders"].(float64))
227
+	//	fmt.Println("dataconfig",dataconfig.Order)
228
+	//} else {
229
+	//	dataconfig.Order = 0
230
+	//}
228 231
 	configOrgId := int64(dataBody["org_id"].(float64))
229 232
 
230 233
 	// 验证关键字段的值是否重复

+ 19 - 6
controllers/device_api_controller.go 查看文件

@@ -2,6 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/utils"
5
+	"github.com/jinzhu/gorm"
5 6
 	"time"
6 7
 
7 8
 	"XT_New/enums"
@@ -525,15 +526,22 @@ func (this *DeviceAPIController) CreateZone() {
525 526
 	}
526 527
 
527 528
 	adminInfo := this.GetAdminUserInfo()
528
-	zone, createErr := service.CreateDeviceZone(adminInfo.CurrentOrgId, name, type_)
529
-	if createErr != nil {
530
-		this.ErrorLog("创建设备分区失败:%v", createErr)
529
+	_, errcode := service.GetZoneByName(name, adminInfo.CurrentOrgId)
530
+	fmt.Println("errcode=----------", errcode)
531
+	if errcode == gorm.ErrRecordNotFound {
532
+		zone, createErr := service.CreateDeviceZone(adminInfo.CurrentOrgId, name, type_)
533
+		if createErr != nil {
534
+			this.ErrorLog("创建设备分区失败:%v", createErr)
535
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
536
+			return
537
+		}
538
+		this.ServeSuccessJSON(map[string]interface{}{
539
+			"zone": zone,
540
+		})
541
+	} else if errcode == nil {
531 542
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
532 543
 		return
533 544
 	}
534
-	this.ServeSuccessJSON(map[string]interface{}{
535
-		"zone": zone,
536
-	})
537 545
 }
538 546
 
539 547
 // /api/device/zone/modify [post] ModifyZone
@@ -564,6 +572,11 @@ func (this *DeviceAPIController) ModifyZone() {
564 572
 	zone.Type = type_
565 573
 	zone.ModifyTime = time.Now().Unix()
566 574
 
575
+	byName, _ := service.GetZoneByNameOne(name, adminInfo.CurrentOrgId)
576
+	if byName.ID > 0 && byName.ID != id {
577
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
578
+		return
579
+	}
567 580
 	updateErr := service.UpdateDeviceZone(zone)
568 581
 	if updateErr != nil {
569 582
 		this.ErrorLog("修改设备分区失败:%v", updateErr)

+ 6 - 15
controllers/dialysis_api_controller.go 查看文件

@@ -3072,18 +3072,6 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
3072 3072
 
3073 3073
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3074 3074
 
3075
-	_, evaluation := service.FindPredialysisEvaluationByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
3076
-
3077
-	if evaluation.ID > 0 {
3078
-		if evaluation.WeightBefore > 0 && assessment.WeightAfter > 0 {
3079
-			if (evaluation.WeightBefore-evaluation.AdditionalWeight)-(assessment.WeightAfter-assessment.AdditionalWeight) > 0 {
3080
-				assessment.WeightLoss = (evaluation.WeightBefore - evaluation.AdditionalWeight) - (assessment.WeightAfter - assessment.AdditionalWeight)
3081
-			} else {
3082
-				assessment.WeightLoss = 0
3083
-			}
3084
-		}
3085
-	}
3086
-
3087 3075
 	if assessment.ID > 0 {
3088 3076
 
3089 3077
 		if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -3955,6 +3943,8 @@ func (c *DialysisApiController) CreateMonitor() {
3955 3943
 
3956 3944
 	displacement_flow_quantity, _ := c.GetFloat("displacement_flow_quantity", 0)
3957 3945
 
3946
+	heparin, _ := c.GetFloat("heparin", 0)
3947
+
3958 3948
 	ktv, _ := c.GetFloat("ktv", 0)
3959 3949
 	symptom := c.GetString("symptom")
3960 3950
 	dispose := c.GetString("dispose")
@@ -4010,6 +4000,7 @@ func (c *DialysisApiController) CreateMonitor() {
4010 4000
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
4011 4001
 		Conductivity:              conductivity,
4012 4002
 		DisplacementFlowQuantity:  displacement_flow_quantity,
4003
+		Heparin:                   heparin,
4013 4004
 	}
4014 4005
 
4015 4006
 	err := service.CreateMonitor(&monitorRecord)
@@ -4323,7 +4314,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4323 4314
 	//获取医嘱内容
4324 4315
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4325 4316
 	DoctorName, err := service.FindDoctorName(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4326
-	fmt.Print("err-----------------------------------------------------------------", err)
4317
+	//fmt.Print("err-----------------------------------------------------------------", err)
4327 4318
 	DoctorAdvice, _ := service.FindDoctorAdviceOrderById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4328 4319
 	doctorAdevieInfo, err := service.FindDoctorAdviceByInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4329 4320
 	//获取上次的透后体重
@@ -4359,8 +4350,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
4359 4350
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4360 4351
 
4361 4352
 	//相关操作对应的操作人
4362
-	operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
4363
-
4353
+	//operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
4354
+	operators, err := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
4364 4355
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
4365 4356
 	c.ServeSuccessJSON(map[string]interface{}{
4366 4357
 		"xtdate":                  xtdate,

+ 3 - 0
controllers/dialysis_record_api_controller.go 查看文件

@@ -391,6 +391,7 @@ type EditMonitorParamObject struct {
391 391
 	Conductivity             float64 `json:"conductivity"`
392 392
 	DisplacementFlowQuantity float64 `json:"displacement_flow_quantity"`
393 393
 	BloodOxygenSaturation    string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
394
+	Heparin                  float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
394 395
 }
395 396
 
396 397
 // /api/dislysis/monitor/edit [post]
@@ -494,6 +495,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
494 495
 			UpdatedTime:           time.Now().Unix(),
495 496
 			BloodOxygenSaturation: monitorParam.BloodOxygenSaturation,
496 497
 			Creator:               adminUserInfo.AdminUser.Id,
498
+			Heparin:               monitorParam.Heparin,
497 499
 		}
498 500
 		createErr := service.CreateMonitor(&monitor)
499 501
 		if createErr != nil {
@@ -553,6 +555,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
553 555
 		monitor.UpdatedTime = time.Now().Unix()
554 556
 		monitor.Modify = adminUserInfo.AdminUser.Id
555 557
 		monitor.BloodOxygenSaturation = monitorParam.BloodOxygenSaturation
558
+		monitor.Heparin = monitorParam.Heparin
556 559
 		updateErr := service.UpdateMonitor(monitor)
557 560
 		if updateErr != nil {
558 561
 			this.ErrorLog("修改透析监测记录失败:%v", updateErr)

+ 4 - 1
controllers/gobal_config_api_controller.go 查看文件

@@ -31,7 +31,8 @@ func GobalConfigRegistRouters() {
31 31
 	beego.Router("/api/stock/automaticreduce/isopen", &GobalConfigApiController{}, "post:PostStockConfig")
32 32
 	beego.Router("/api/automaticreduce/get", &GobalConfigApiController{}, "get:GetConfig")
33 33
 
34
-	beego.Router("/api/print/template/commit", &GobalConfigApiController{}, "post:PostPrintTemplate")
34
+	beego.Router("/api/print/template/commit", &GobalConfigApiController{}, "post:PostPrintTemplateTwo")
35
+
35 36
 	beego.Router("/api/print/template/get", &GobalConfigApiController{}, "get:GetPrintTemplate")
36 37
 
37 38
 	beego.Router("/api/dataupload/config/commit", &GobalConfigApiController{}, "post:PostConfig")
@@ -952,6 +953,7 @@ func (c *GobalConfigApiController) GetOrgs() {
952 953
 	var orgs []*models.Org
953 954
 	adminUser, err := service.GetHomeData(adminUserInfo.AdminUser.Id)
954 955
 	creator, err := service.GetCreator(id, orgId)
956
+	admin, err := service.GetSuperAdmin(id)
955 957
 	if err != nil {
956 958
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
957 959
 		return
@@ -970,6 +972,7 @@ func (c *GobalConfigApiController) GetOrgs() {
970 972
 		"orgs":      orgs,
971 973
 		"adminUser": adminUser,
972 974
 		"creator":   creator,
975
+		"admin":     admin,
973 976
 	})
974 977
 
975 978
 }

+ 10 - 10
controllers/manage_api_controller.go 查看文件

@@ -1058,14 +1058,14 @@ func (this *MachineApiController) SaveInformation() {
1058 1058
 	//fmt.Println("透析时长", dialysis_time)
1059 1059
 
1060 1060
 	//hyperfiletration := dataBody["hyperfiltratio"].(string)
1061
-	hyperfiltratios := int64(dataBody["hyperfiltratio"].(float64))
1062
-	hyperfiletration := strconv.FormatInt(hyperfiltratios, 10)
1063
-	//fmt.Println("实际超滤量", hyperfiletration)
1061
+	hyperfiletration := dataBody["hyperfiltratio"].(float64)
1062
+	//hyperfiletration := strconv.FormatInt(hyperfiltratios, 10)
1063
+	fmt.Println("实际超滤量", hyperfiletration)
1064 1064
 
1065 1065
 	//weight_loss := dataBody["weight_loss"].(string)
1066
-	weightloss := int64(dataBody["weight_loss"].(float64))
1067
-	weight_loss := strconv.FormatInt(weightloss, 10)
1068
-	//fmt.Println("体重减少", weight_loss)
1066
+	weight_loss := dataBody["weight_loss"].(float64)
1067
+	//weight_loss := strconv.FormatInt(weightloss, 10)
1068
+	fmt.Println("体重减少", weight_loss)
1069 1069
 
1070 1070
 	warining_value := dataBody["warning_value"].(string)
1071 1071
 	fmt.Println("预警值", warining_value)
@@ -2303,9 +2303,9 @@ func (this *MachineApiController) UpdateForm() {
2303 2303
 	dialysis_time := dataBody["dialysis_time"].(string)
2304 2304
 	fmt.Println("透析时长", dialysis_time)
2305 2305
 
2306
-	hyperfiletration := dataBody["hyperfiltratio"].(string)
2306
+	hyperfiletration := dataBody["hyperfiltratio"].(float64)
2307 2307
 	fmt.Println("实际超滤量", hyperfiletration)
2308
-	weight_loss := dataBody["weight_loss"].(string)
2308
+	weight_loss := dataBody["weight_loss"].(float64)
2309 2309
 	fmt.Println("体重减少", weight_loss)
2310 2310
 	warining_value := dataBody["warning_value"].(string)
2311 2311
 	fmt.Println("预警值", warining_value)
@@ -2470,7 +2470,7 @@ func (this *MachineApiController) QueryInfo() {
2470 2470
 	fmt.Println("page", page)
2471 2471
 	adminUser := this.GetAdminUserInfo()
2472 2472
 	orgId := adminUser.CurrentOrgId
2473
-	infor, total, err := service.QueryInfo(zone, bed, startdate, endtimes, orgId, limit, page)
2473
+	infor, total, err := service.QueryInfo(bed, startdate, endtimes, orgId, limit, page)
2474 2474
 	if err != nil {
2475 2475
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
2476 2476
 		return
@@ -2553,7 +2553,7 @@ func (this *MachineApiController) GetBedForm() {
2553 2553
 	fmt.Println("id", id)
2554 2554
 	addmacher, err := service.GetZoneForm(id)
2555 2555
 	bed, err := service.GetZoneId(addmacher.BedId, orgId)
2556
-
2556
+	fmt.Println("bed--------------------", bed.ZoneID)
2557 2557
 	number, err := service.GetBedForm(bed.ZoneID)
2558 2558
 	if err != nil {
2559 2559
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")

+ 14 - 12
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -366,7 +366,7 @@ func (this *DialysisAPIController) DialysisRecord() {
366 366
 
367 367
 	//dialysisSolution, getDialysisSolutionErr := service.MobileGetDialysisSolution(adminInfo.Org.Id, patientID)
368 368
 
369
-	operators, _ := service.GetAllAdminUserES(adminInfo.Org.Id, adminInfo.App.Id)
369
+	//operators, _ := service.GetAllAdminUserES(adminInfo.Org.Id, adminInfo.App.Id)
370 370
 
371 371
 	if getLPEErr != nil {
372 372
 		this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
@@ -387,6 +387,10 @@ func (this *DialysisAPIController) DialysisRecord() {
387 387
 	goodTypes, _ := service.FindAllGoodTypeByType(1)          //查出所有库存配置的系统类型
388 388
 	goodInfos, _ := service.FindAllGoodInfo(adminInfo.Org.Id) //查出所有库存配置的系统类型
389 389
 
390
+	operators, err := service.GetAllStarfEs(adminInfo.Org.Id)
391
+	fmt.Println("报错-------", err)
392
+	fmt.Println("op----------------------------------------------------------", operators)
393
+
390 394
 	returnData := map[string]interface{}{
391 395
 		"patient":                        patient,
392 396
 		"schedual":                       schedual,
@@ -816,17 +820,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
816 820
 	//today_time := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
817 821
 	//todayTimeStamp := today_time.Unix()
818 822
 
819
-	_, evaluation := service.FindPredialysisEvaluationByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
820
-
821
-	if evaluation.ID > 0 {
822
-		if evaluation.WeightBefore > 0 && weightAfter > 0 {
823
-			if (evaluation.WeightBefore-evaluation.AdditionalWeight)-(weightAfter-additionalWeight) > 0 {
824
-				weightReduce = (evaluation.WeightBefore - evaluation.AdditionalWeight) - (weightAfter - additionalWeight)
825
-			} else {
826
-				weightReduce = 0
827
-			}
828
-		}
829
-	}
823
+	//_, evaluation := service.FindPredialysisEvaluationByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
830 824
 
831 825
 	assessmentAfterDislysis := models.AssessmentAfterDislysis{
832 826
 		UserOrgId:                    adminUserInfo.Org.Id,
@@ -6257,3 +6251,11 @@ func (c *DialysisAPIController) GetSchedule() {
6257 6251
 	})
6258 6252
 
6259 6253
 }
6254
+
6255
+func (c *DialysisAPIController) GetPatientId() {
6256
+	id, _ := c.GetInt64("id")
6257
+	patientId, _ := service.GetPatientId(id)
6258
+	c.ServeSuccessJSON(map[string]interface{}{
6259
+		"patient": patientId,
6260
+	})
6261
+}

+ 4 - 0
controllers/mobile_api_controllers/dialysis_api_controller_extend.go 查看文件

@@ -86,6 +86,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
86 86
 	blood_oxygen_saturation := this.GetString("blood_oxygen_saturation")
87 87
 	result := this.GetString("result")
88 88
 	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
89
+	heparin, _ := this.GetFloat("heparin")
89 90
 
90 91
 	adminInfo := this.GetMobileAdminUserInfo()
91 92
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
@@ -136,6 +137,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
136 137
 		BloodOxygenSaturation:     blood_oxygen_saturation,
137 138
 		Creator:                   adminInfo.AdminUser.Id,
138 139
 		Modify:                    0,
140
+		Heparin:                   heparin,
139 141
 	}
140 142
 
141 143
 	err := service.CreateMonitor(&record)
@@ -224,6 +226,7 @@ func (this *DialysisAPIController) EditMonitorRecord() {
224 226
 	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
225 227
 	conductivity, _ := this.GetFloat("conductivity")
226 228
 	displacement_flow_quantity, _ := this.GetFloat("displacement_flow_quantity")
229
+	heparin, _ := this.GetFloat("heparin")
227 230
 
228 231
 	adminInfo := this.GetMobileAdminUserInfo()
229 232
 
@@ -279,6 +282,7 @@ func (this *DialysisAPIController) EditMonitorRecord() {
279 282
 	monitor.DisplacementFlowQuantity = displacement_flow_quantity
280 283
 	monitor.BloodOxygenSaturation = blood_oxygen_saturation
281 284
 	monitor.Modify = adminInfo.AdminUser.Id
285
+	monitor.Heparin = heparin
282 286
 
283 287
 	err = service.UpdateMonitor(monitor)
284 288
 	if err != nil {

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go 查看文件

@@ -108,4 +108,6 @@ func MobileAPIControllersRegisterRouters() {
108 108
 
109 109
 	beego.Router("/m/api/schedule/get", &DialysisAPIController{}, "Get:GetSchedule")
110 110
 
111
+	beego.Router("/m/api/getPatientid", &DialysisAPIController{}, "Get:GetPatientId")
112
+
111 113
 }

+ 4 - 8
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -2080,7 +2080,6 @@ func (c *PatientApiController) GetDoctorAdvices() {
2080 2080
 }
2081 2081
 
2082 2082
 func (c *PatientApiController) GetPrintDialysisOrder() {
2083
-	fmt.Println("触发-------------------------")
2084 2083
 	xtno := c.GetString("xtno")
2085 2084
 	xtdate := c.GetString("xtdate")
2086 2085
 
@@ -2152,7 +2151,8 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2152 2151
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2153 2152
 
2154 2153
 	//相关操作对应的操作人
2155
-	operators, _ := service.GetAdminUserES(adminUserInfo.Org.Id, adminUserInfo.App.Id, operatorIDs)
2154
+	//operators, _ := service.GetAdminUserES(adminUserInfo.Org.Id, adminUserInfo.App.Id, operatorIDs)
2155
+	operators, err := service.GetAllStarfEs(adminUserInfo.Org.Id)
2156 2156
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
2157 2157
 	check, _ := service.FindDoubleCheckById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2158 2158
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -2513,11 +2513,6 @@ func (c *PatientApiController) DelDoctorAdvice() {
2513 2513
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
2514 2514
 			return
2515 2515
 		}
2516
-		//TODO 根据路由来做权限
2517
-		//if !adminUserInfo.AdminUser.IsSuperAdmin && advice.AdviceDoctor != adminUserInfo.AdminUser.Id {
2518
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
2519
-		//	return
2520
-		//}
2521 2516
 
2522 2517
 		advice.Status = 0
2523 2518
 		advice.UpdatedTime = time.Now().Unix()
@@ -2572,12 +2567,13 @@ func (c *PatientApiController) DelDoctorAdvice() {
2572 2567
 		advice.UpdatedTime = time.Now().Unix()
2573 2568
 		advice.Status = 0
2574 2569
 		advice.GroupNo = groupno
2570
+		advice.Modifier = adminUserInfo.AdminUser.Id
2575 2571
 
2576 2572
 		var err error
2577 2573
 		if groupno > 0 {
2578 2574
 			err = service.DeleteDoctorAdviceByGroupNo(&advice)
2579 2575
 		} else {
2580
-			err = service.BatchDeleteDoctorAdvice(ids)
2576
+			err = service.BatchDeleteDoctorAdvice(ids, adminUserInfo.AdminUser.Id)
2581 2577
 		}
2582 2578
 
2583 2579
 		if err != nil {

+ 87 - 36
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 查看文件

@@ -555,6 +555,13 @@ func (this *NewDialysisApiController) SavePatient() {
555 555
 }
556 556
 
557 557
 func (this *NewDialysisApiController) GetPatientDetail() {
558
+	nowDateTime := time.Now()
559
+	nowDate := nowDateTime.Format("2006-01-02")
560
+	nowDate += " 00:00:00"
561
+	timeLayout := "2006-01-02"
562
+	loc, _ := time.LoadLocation("Local")
563
+	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", nowDate, loc)
564
+	nowdate := theTime.Unix()
558 565
 	id, _ := this.GetInt64("id")
559 566
 	//获取病人详情信息
560 567
 	detail, err := service.GetPatientDetailTwo(id)
@@ -574,6 +581,7 @@ func (this *NewDialysisApiController) GetPatientDetail() {
574 581
 		"diseases":       diseases,
575 582
 		"slowDiseases":   slowDiseases,
576 583
 		"cronicDiseases": cronicDiseases,
584
+		"nowdate":        nowdate,
577 585
 	})
578 586
 }
579 587
 
@@ -1837,21 +1845,28 @@ func (this *NewDialysisApiController) SavePartition() {
1837 1845
 	fmt.Println("分区型号", zonetype)
1838 1846
 	strInt64 := strconv.FormatInt(zonetype, 10)
1839 1847
 	typeid, _ := strconv.Atoi(strInt64)
1840
-	zone := models.DeviceZone{
1841
-		Name:       name,
1842
-		Type:       typeid,
1843
-		OrgID:      adminInfo.Org.Id,
1844
-		Status:     1,
1845
-		CreateTime: time.Now().Unix(),
1846
-	}
1847
-	err := service.CreatedZone(&zone)
1848
-	if err != nil {
1848
+	_, errcode := service.GetPartitionByName(name, adminInfo.Org.Id)
1849
+	fmt.Println("errcode-------", errcode)
1850
+	if errcode == gorm.ErrRecordNotFound {
1851
+		zone := models.DeviceZone{
1852
+			Name:       name,
1853
+			Type:       typeid,
1854
+			OrgID:      adminInfo.Org.Id,
1855
+			Status:     1,
1856
+			CreateTime: time.Now().Unix(),
1857
+		}
1858
+		err := service.CreatedZone(&zone)
1859
+		if err != nil {
1860
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1861
+			return
1862
+		}
1863
+		this.ServeSuccessJSON(map[string]interface{}{
1864
+			"zone": zone,
1865
+		})
1866
+	} else if errcode == nil {
1849 1867
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1850 1868
 		return
1851 1869
 	}
1852
-	this.ServeSuccessJSON(map[string]interface{}{
1853
-		"zone": zone,
1854
-	})
1855 1870
 }
1856 1871
 
1857 1872
 func (this *NewDialysisApiController) GetAllZone() {
@@ -1886,20 +1901,27 @@ func (this *NewDialysisApiController) SaveGroup() {
1886 1901
 	orgid := adminUser.Org.Id
1887 1902
 	name := this.GetString("name")
1888 1903
 	fmt.Println("name", name)
1889
-	group := models.DeviceGroup{
1890
-		Name:       name,
1891
-		Status:     1,
1892
-		CreateTime: time.Now().Unix(),
1893
-		OrgID:      orgid,
1894
-	}
1895
-	err := service.SaveGroup(&group)
1896
-	if err != nil {
1904
+	_, errcode := service.GetGroupByName(name, orgid)
1905
+	if errcode == gorm.ErrRecordNotFound {
1906
+		group := models.DeviceGroup{
1907
+			Name:       name,
1908
+			Status:     1,
1909
+			CreateTime: time.Now().Unix(),
1910
+			OrgID:      orgid,
1911
+		}
1912
+		err := service.SaveGroup(&group)
1913
+		if err != nil {
1914
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1915
+			return
1916
+		}
1917
+		this.ServeSuccessJSON(map[string]interface{}{
1918
+			"group": group,
1919
+		})
1920
+	} else if errcode == nil {
1897 1921
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1898 1922
 		return
1899 1923
 	}
1900
-	this.ServeSuccessJSON(map[string]interface{}{
1901
-		"group": group,
1902
-	})
1924
+
1903 1925
 }
1904 1926
 
1905 1927
 func (this *NewDialysisApiController) GetAllGroup() {
@@ -1955,22 +1977,29 @@ func (this *NewDialysisApiController) SaveBed() {
1955 1977
 	fmt.Print("zone", zone)
1956 1978
 	group, _ := this.GetInt64("group")
1957 1979
 	fmt.Println("group", group)
1958
-	number := models.DeviceNumber{
1959
-		Number:     name,
1960
-		ZoneID:     zone,
1961
-		GroupID:    group,
1962
-		OrgID:      orgid,
1963
-		Status:     1,
1964
-		CreateTime: time.Now().Unix(),
1965
-	}
1966
-	err := service.CreateNumber(&number)
1967
-	if err != nil {
1980
+	_, errcode := service.GetBedByName(name, orgid)
1981
+	if errcode == gorm.ErrRecordNotFound {
1982
+		number := models.DeviceNumber{
1983
+			Number:     name,
1984
+			ZoneID:     zone,
1985
+			GroupID:    group,
1986
+			OrgID:      orgid,
1987
+			Status:     1,
1988
+			CreateTime: time.Now().Unix(),
1989
+		}
1990
+		err := service.CreateNumber(&number)
1991
+		if err != nil {
1992
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1993
+			return
1994
+		}
1995
+		this.ServeSuccessJSON(map[string]interface{}{
1996
+			"number": number,
1997
+		})
1998
+	} else if errcode == nil {
1968 1999
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1969 2000
 		return
1970 2001
 	}
1971
-	this.ServeSuccessJSON(map[string]interface{}{
1972
-		"number": number,
1973
-	})
2002
+
1974 2003
 }
1975 2004
 
1976 2005
 func (this *NewDialysisApiController) GetAllNumber() {
@@ -2278,11 +2307,18 @@ func (this *NewDialysisApiController) GetPartionDetail() {
2278 2307
 }
2279 2308
 
2280 2309
 func (this *NewDialysisApiController) UpdatePartition() {
2310
+	adminUser := this.GetMobileAdminUserInfo()
2311
+	orgid := adminUser.Org.Id
2281 2312
 	id, _ := this.GetInt64("id")
2282 2313
 	name := this.GetString("name")
2283 2314
 	zoneType, _ := this.GetInt64("type")
2284 2315
 	strInt64 := strconv.FormatInt(zoneType, 10)
2285 2316
 	typeid, _ := strconv.Atoi(strInt64)
2317
+	byName, _ := service.GetPartitionByNameOne(name, orgid)
2318
+	if byName.ID > 0 && byName.ID != id {
2319
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2320
+		return
2321
+	}
2286 2322
 	zone := models.DeviceZone{
2287 2323
 		Name: name,
2288 2324
 		Type: typeid,
@@ -2311,8 +2347,15 @@ func (this *NewDialysisApiController) GetGroupDetail() {
2311 2347
 }
2312 2348
 
2313 2349
 func (this *NewDialysisApiController) UpdateGroup() {
2350
+	adminUser := this.GetMobileAdminUserInfo()
2351
+	orgid := adminUser.Org.Id
2314 2352
 	id, _ := this.GetInt64("id")
2315 2353
 	name := this.GetString("name")
2354
+	byName, _ := service.GetGroupByNameOne(name, orgid)
2355
+	if byName.ID > 0 && byName.ID != id {
2356
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2357
+		return
2358
+	}
2316 2359
 	group := models.DeviceGroup{Name: name}
2317 2360
 	err := service.UpdateGroup(id, &group)
2318 2361
 	if err != nil {
@@ -2343,6 +2386,8 @@ func (this *NewDialysisApiController) GetBedDetail() {
2343 2386
 }
2344 2387
 
2345 2388
 func (this *NewDialysisApiController) UpdatedBed() {
2389
+	adminUser := this.GetMobileAdminUserInfo()
2390
+	orgId := adminUser.Org.Id
2346 2391
 	id, _ := this.GetInt64("id")
2347 2392
 	name := this.GetString("name")
2348 2393
 	fmt.Println("name", name)
@@ -2350,6 +2395,12 @@ func (this *NewDialysisApiController) UpdatedBed() {
2350 2395
 	fmt.Println("zone", zone)
2351 2396
 	group, _ := this.GetInt64("group")
2352 2397
 	fmt.Println("group", group)
2398
+	BedName, _ := service.GetBedByNameOne(name, orgId)
2399
+	fmt.Println("-----", BedName.ID)
2400
+	if BedName.ID > 0 && BedName.ID != id {
2401
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2402
+		return
2403
+	}
2353 2404
 	number := models.DeviceNumber{
2354 2405
 		Number:  name,
2355 2406
 		ZoneID:  zone,

+ 116 - 79
controllers/patient_api_controller.go 查看文件

@@ -62,6 +62,7 @@ func PatientApiRegistRouters() {
62 62
 	beego.Router("/api/infectious/remind", &PatientApiController{}, "Get:GetRemindPatientList")
63 63
 
64 64
 	beego.Router("/api/remind/is_open", &PatientApiController{}, "Post:PostIsOpenRemind")
65
+	beego.Router("/api/patients/advices/getpatientschedules", &PatientApiController{}, "Get:GetPatientScheduleOne")
65 66
 
66 67
 }
67 68
 
@@ -243,29 +244,29 @@ func (c *PatientApiController) CreatePatient() {
243 244
 	//获取老表的最后一条数据
244 245
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
245 246
 	patientsNew := models.XtPatientsNew{
246
-		UserOrgId:          adminUserInfo.CurrentOrgId,
247
-		UserId:             0,
248
-		Avatar:             patients.Avatar,
249
-		PatientType:        patients.PatientType,
250
-		DialysisNo:         patients.DialysisNo,
251
-		AdmissionNumber:    patients.AdmissionNumber,
252
-		Source:             patients.Source,
253
-		Lapseto:            patients.Lapseto,
254
-		PartitionId:        patients.PartitionId,
255
-		BedId:              patients.BedId,
256
-		Name:               patients.Name,
257
-		Alias:              patients.Alias,
258
-		Gender:             patients.Gender,
259
-		MaritalStatus:      patients.MaritalStatus,
260
-		IdCardNo:           patients.IdCardNo,
261
-		Birthday:           patients.Birthday,
262
-		ReimbursementWayId: patients.ReimbursementWayId,
263
-		HealthCareType:     patients.HealthCareType,
264
-		HealthCareNo:       patients.HealthCareNo,
265
-		HealthCareDueDate:  patients.HealthCareDueDate,
266
-		Height:             patients.Height,
267
-		BloodType:          patients.BloodType,
268
-		Rh:                 patients.Rh,
247
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
248
+		UserId:                       0,
249
+		Avatar:                       patients.Avatar,
250
+		PatientType:                  patients.PatientType,
251
+		DialysisNo:                   patients.DialysisNo,
252
+		AdmissionNumber:              patients.AdmissionNumber,
253
+		Source:                       patients.Source,
254
+		Lapseto:                      patients.Lapseto,
255
+		PartitionId:                  patients.PartitionId,
256
+		BedId:                        patients.BedId,
257
+		Name:                         patients.Name,
258
+		Alias:                        patients.Alias,
259
+		Gender:                       patients.Gender,
260
+		MaritalStatus:                patients.MaritalStatus,
261
+		IdCardNo:                     patients.IdCardNo,
262
+		Birthday:                     patients.Birthday,
263
+		ReimbursementWayId:           patients.ReimbursementWayId,
264
+		HealthCareType:               patients.HealthCareType,
265
+		HealthCareNo:                 patients.HealthCareNo,
266
+		HealthCareDueDate:            patients.HealthCareDueDate,
267
+		Height:                       patients.Height,
268
+		BloodType:                    patients.BloodType,
269
+		Rh:                           patients.Rh,
269 270
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
270 271
 		EducationLevel:               patients.EducationLevel,
271 272
 		Profession:                   patients.Profession,
@@ -311,27 +312,27 @@ func (c *PatientApiController) CreatePatient() {
311 312
 		Nation:                       patients.Nation,
312 313
 		NativePlace:                  patients.NativePlace,
313 314
 		Age:                          patients.Age,
314
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
315
-		IsInfectious:             patients.IsInfectious,
316
-		RemindCycle:              patients.RemindCycle,
317
-		ResponseResult:           patients.ResponseResult,
318
-		IsOpenRemind:             patients.IsOpenRemind,
319
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
320
-		DialysisAge:              patients.DialysisAge,
321
-		ExpenseKind:              patients.ExpenseKind,
322
-		TellPhone:                patients.TellPhone,
323
-		ContactName:              patients.ContactName,
324
-		BloodPatients:            1,
325
-		SlowPatients:             0,
326
-		MemberPatients:           0,
327
-		EcommerPatients:          "",
328
-		BloodId:                  patients.ID,
329
-		SlowId:                   0,
330
-		MemberId:                 0,
331
-		MemberFistdate:           0,
332
-		MemberPatienttype:        0,
333
-		MemberTreatement:         0,
334
-		EquitmentId:              "",
315
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
316
+		IsInfectious:                 patients.IsInfectious,
317
+		RemindCycle:                  patients.RemindCycle,
318
+		ResponseResult:               patients.ResponseResult,
319
+		IsOpenRemind:                 patients.IsOpenRemind,
320
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
321
+		DialysisAge:                  patients.DialysisAge,
322
+		ExpenseKind:                  patients.ExpenseKind,
323
+		TellPhone:                    patients.TellPhone,
324
+		ContactName:                  patients.ContactName,
325
+		BloodPatients:                1,
326
+		SlowPatients:                 0,
327
+		MemberPatients:               0,
328
+		EcommerPatients:              "",
329
+		BloodId:                      patients.ID,
330
+		SlowId:                       0,
331
+		MemberId:                     0,
332
+		MemberFistdate:               0,
333
+		MemberPatienttype:            0,
334
+		MemberTreatement:             0,
335
+		EquitmentId:                  "",
335 336
 	}
336 337
 
337 338
 	err = service.CreatePatientsNew(&patientsNew)
@@ -459,29 +460,29 @@ func (c *PatientApiController) EditPatient() {
459 460
 	}
460 461
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
461 462
 	patientsNew := models.XtPatientsNew{
462
-		UserOrgId:          patient.UserOrgId,
463
-		UserId:             patient.UserId,
464
-		Avatar:             patient.Avatar,
465
-		PatientType:        patient.PatientType,
466
-		DialysisNo:         patient.DialysisNo,
467
-		AdmissionNumber:    patient.AdmissionNumber,
468
-		Source:             patient.Source,
469
-		Lapseto:            patient.Lapseto,
470
-		PartitionId:        patient.PartitionId,
471
-		BedId:              patient.BedId,
472
-		Name:               patient.Name,
473
-		Alias:              patient.Alias,
474
-		Gender:             patient.Gender,
475
-		MaritalStatus:      patient.MaritalStatus,
476
-		IdCardNo:           patient.IdCardNo,
477
-		Birthday:           patient.Birthday,
478
-		ReimbursementWayId: patient.ReimbursementWayId,
479
-		HealthCareType:     patient.HealthCareType,
480
-		HealthCareNo:       patient.HealthCareNo,
481
-		HealthCareDueDate:  patient.HealthCareDueDate,
482
-		Height:             patient.Height,
483
-		BloodType:          patient.BloodType,
484
-		Rh:                 patient.Rh,
463
+		UserOrgId:                 patient.UserOrgId,
464
+		UserId:                    patient.UserId,
465
+		Avatar:                    patient.Avatar,
466
+		PatientType:               patient.PatientType,
467
+		DialysisNo:                patient.DialysisNo,
468
+		AdmissionNumber:           patient.AdmissionNumber,
469
+		Source:                    patient.Source,
470
+		Lapseto:                   patient.Lapseto,
471
+		PartitionId:               patient.PartitionId,
472
+		BedId:                     patient.BedId,
473
+		Name:                      patient.Name,
474
+		Alias:                     patient.Alias,
475
+		Gender:                    patient.Gender,
476
+		MaritalStatus:             patient.MaritalStatus,
477
+		IdCardNo:                  patient.IdCardNo,
478
+		Birthday:                  patient.Birthday,
479
+		ReimbursementWayId:        patient.ReimbursementWayId,
480
+		HealthCareType:            patient.HealthCareType,
481
+		HealthCareNo:              patient.HealthCareNo,
482
+		HealthCareDueDate:         patient.HealthCareDueDate,
483
+		Height:                    patient.Height,
484
+		BloodType:                 patient.BloodType,
485
+		Rh:                        patient.Rh,
485 486
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
486 487
 		EducationLevel:            patient.EducationLevel,
487 488
 		Profession:                patient.Profession,
@@ -523,17 +524,17 @@ func (c *PatientApiController) EditPatient() {
523 524
 		Nation:                    patient.Nation,
524 525
 		NativePlace:               patient.NativePlace,
525 526
 		Age:                       patient.Age,
526
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
527
-		IsInfectious:             patient.IsInfectious,
528
-		RemindCycle:              patient.RemindCycle,
529
-		ResponseResult:           patient.ResponseResult,
530
-		IsOpenRemind:             patient.IsOpenRemind,
531
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
532
-		DialysisAge:              patient.DialysisAge,
533
-		ExpenseKind:              patient.ExpenseKind,
534
-		TellPhone:                patient.TellPhone,
535
-		ContactName:              patient.ContactName,
536
-		UpdatedTime:              time.Now().Unix(),
527
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
528
+		IsInfectious:              patient.IsInfectious,
529
+		RemindCycle:               patient.RemindCycle,
530
+		ResponseResult:            patient.ResponseResult,
531
+		IsOpenRemind:              patient.IsOpenRemind,
532
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
533
+		DialysisAge:               patient.DialysisAge,
534
+		ExpenseKind:               patient.ExpenseKind,
535
+		TellPhone:                 patient.TellPhone,
536
+		ContactName:               patient.ContactName,
537
+		UpdatedTime:               time.Now().Unix(),
537 538
 	}
538 539
 	//	//更新病人ID获取新表病人ID
539 540
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -1990,7 +1991,10 @@ func (c *PatientApiController) GetDoctorAdvices() {
1990 1991
 	startTime := c.GetString("start_time", "")
1991 1992
 	endTime := c.GetString("end_time", "")
1992 1993
 	keywords := c.GetString("keywords", "")
1993
-
1994
+	page, _ := c.GetInt64("page")
1995
+	fmt.Println("page", page)
1996
+	limit, _ := c.GetInt64("limit")
1997
+	fmt.Println("limit", limit)
1994 1998
 	adminUserInfo := c.GetAdminUserInfo()
1995 1999
 
1996 2000
 	operatorIDs := make([]int64, 0)
@@ -2020,6 +2024,8 @@ func (c *PatientApiController) GetDoctorAdvices() {
2020 2024
 	}
2021 2025
 
2022 2026
 	advices, total, _ := service.GetDoctorAdviceList(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2027
+	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2028
+
2023 2029
 	if len(advices) > 0 {
2024 2030
 		for _, item := range advices {
2025 2031
 			if item.AdviceDoctor > 0 {
@@ -2044,6 +2050,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
2044 2050
 		"advices":   advices,
2045 2051
 		"operators": operators,
2046 2052
 		"total":     total,
2053
+		"advicetwo": advicestwo,
2047 2054
 	})
2048 2055
 	return
2049 2056
 
@@ -2916,6 +2923,12 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
2916 2923
 	age := int64(patientBody["age"].(float64))
2917 2924
 	patient.Age = age
2918 2925
 
2926
+	if patientBody["user_sys_before_count"] != nil || reflect.TypeOf(patientBody["user_sys_before_count"]).String() == "string" {
2927
+		user_sys_before_count := patientBody["user_sys_before_count"].(string)
2928
+		count, _ := strconv.ParseInt(user_sys_before_count, 10, 64)
2929
+		patient.UserSysBeforeCount = count
2930
+	}
2931
+
2919 2932
 	timeLayout := "2006-01-02"
2920 2933
 	loc, _ := time.LoadLocation("Local")
2921 2934
 
@@ -3337,3 +3350,27 @@ func (c *PatientApiController) PostIsOpenRemind() {
3337 3350
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3338 3351
 	}
3339 3352
 }
3353
+
3354
+func (c *PatientApiController) GetPatientScheduleOne() {
3355
+	id, _ := c.GetInt64("id")
3356
+	//查询该病人是否当天是排班
3357
+	nowDateTime := time.Now()
3358
+	nowDate := nowDateTime.Format("2006-01-02")
3359
+	nowDate += " 00:00:00"
3360
+	timeLayout := "2006-01-02"
3361
+	loc, _ := time.LoadLocation("Local")
3362
+	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", nowDate, loc)
3363
+	nowdate := theTime.Unix()
3364
+	fmt.Println("nowdate", nowdate)
3365
+	adminUser := c.GetAdminUserInfo()
3366
+	orgId := adminUser.CurrentOrgId
3367
+	fmt.Println("orgid", orgId)
3368
+	scheduls, err := service.GetPatientScheduleOne(id, nowdate, orgId)
3369
+	if err != nil {
3370
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3371
+		return
3372
+	}
3373
+	c.ServeSuccessJSON(map[string]interface{}{
3374
+		"scheduls": scheduls,
3375
+	})
3376
+}

+ 2 - 0
controllers/public_api_controller.go 查看文件

@@ -163,6 +163,8 @@ func (this *PublicApiController) GetJson() {
163 163
 }
164 164
 
165 165
 func (c *PublicApiController) HandleData() {
166
+	service.HandleData()
167
+
166 168
 	//org_app, _ := service.GetAllAppOrg()
167 169
 	//org_role, _ := service.GetAllRole()
168 170
 	//

+ 24 - 0
models/admin_user_models.go 查看文件

@@ -71,6 +71,30 @@ func (AdminUserElectronicSignature) TableName() string {
71 71
 	return "sgj_user_admin_electronic_signature"
72 72
 }
73 73
 
74
+type SgjUserAdminRoles struct {
75
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
76
+	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
77
+	OrgId         int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
78
+	AppId         int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
79
+	RoleId        int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
80
+	UserName      string `gorm:"column:user_name" json:"user_name" form:"user_name"`
81
+	Avatar        string `gorm:"column:avatar" json:"avatar" form:"avatar"`
82
+	UserType      int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
83
+	UserTitle     int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
84
+	Intro         string `gorm:"column:intro" json:"intro" form:"intro"`
85
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
86
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
87
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
88
+	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
89
+	RoleIds       string `gorm:"column:role_ids" json:"role_ids" form:"role_ids"`
90
+	Message       string `gorm:"column:message" json:"message" form:"message"`
91
+	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
92
+	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
93
+	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
94
+	Url           string `gorm:"column:url" json:"url" form:"url"`
95
+	Hash          string `gorm:"column:hash" json:"hash" form:"hash"`
96
+}
97
+
74 98
 // 管理员用户特殊权限,详见表注释
75 99
 type AdminUserSpecialPermission struct {
76 100
 	ID          int64 `gorm:"column:id" json:"id"`

+ 1 - 0
models/board_models.go 查看文件

@@ -76,6 +76,7 @@ type BoardPatients struct {
76 76
 	TellPhone                    string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
77 77
 	FirstTreatmentDate           int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
78 78
 	ContactName                  string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
79
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
79 80
 }
80 81
 
81 82
 func (BoardPatients) TableName() string {

+ 95 - 95
models/device_models.go 查看文件

@@ -459,103 +459,103 @@ type DeviceInformationss struct {
459 459
 }
460 460
 
461 461
 type DeviceInformations struct {
462
-	ID                    int64  `gorm:"column:id" json:"id" form:"id"`
463
-	Date                  int64  `gorm:"column:date" json:"date" form:"date"`
464
-	Class                 int64  `gorm:"column:class" json:"class" form:"class"`
465
-	Zone                  int64  `gorm:"column:zone" json:"zone" form:"zone"`
466
-	BedNumber             int64  `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
467
-	PatientId             int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
468
-	Contagion             string `gorm:"column:contagion" json:"contagion" form:"contagion"`
469
-	DialysisMode          int64  `gorm:"column:dialysis_mode" json:"dialysis_mode" form:"dialysis_mode"`
470
-	StartTime             int64  `gorm:"column:start_time" json:"start_time" form:"start_time"`
471
-	EndTime               int64  `gorm:"column:end_time" json:"end_time" form:"end_time"`
472
-	DialysisHour          string `gorm:"column:dialysis_hour" json:"dialysis_hour" form:"dialysis_hour"`
473
-	Hyperfiltratio        string `gorm:"column:hyperfiltratio" json:"hyperfiltratio" form:"hyperfiltratio"`
474
-	WeightLoss            string `gorm:"column:weight_loss" json:"weight_loss" form:"weight_loss"`
475
-	WarningValue          string `gorm:"column:warning_value" json:"warning_value" form:"warning_value"`
476
-	UserTotal             string `gorm:"column:user_total" json:"user_total" form:"user_total"`
477
-	Move                  int64  `gorm:"column:move" json:"move" form:"move"`
478
-	FailureStage          int64  `gorm:"column:failure_stage" json:"failure_stage" form:"failure_stage"`
479
-	FaultDescription      string `gorm:"column:fault_description" json:"fault_description" form:"fault_description"`
480
-	CodeInformation       string `gorm:"column:code_information" json:"code_information" form:"code_information"`
481
-	DisinfectType         int64  `gorm:"column:disinfect_type" json:"disinfect_type" form:"disinfect_type"`
482
-	DisinfectantType      int64  `gorm:"column:disinfectant_type" json:"disinfectant_type" form:"disinfectant_type"`
483
-	Disinfection          int64  `gorm:"column:disinfection" json:"disinfection" form:"disinfection"`
484
-	MachineRun            int64  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
485
-	FluidPath             int64  `gorm:"column:fluid_path" json:"fluid_path" form:"fluid_path"`
486
-	Disinfectant          int64  `gorm:"column:disinfectant" json:"disinfectant" form:"disinfectant"`
487
-	DisinfectionStatus    int64  `gorm:"column:disinfection_status" json:"disinfection_status" form:"disinfection_status"`
488
-	DisinfectionResidue   int64  `gorm:"column:disinfection_residue" json:"disinfection_residue" form:"disinfection_residue"`
489
-	LongTime              string `gorm:"column:long_time" json:"long_time" form:"long_time"`
490
-	DisinfecStartime      int64  `gorm:"column:disinfec_startime" json:"disinfec_startime" form:"disinfec_startime"`
491
-	DisinfecEndtime       int64  `gorm:"column:disinfec_endtime" json:"disinfec_endtime" form:"disinfec_endtime"`
492
-	DialysisChecked       int64  `gorm:"column:dialysis_checked" json:"dialysis_checked" form:"dialysis_checked"`
493
-	DialysisName          int64  `gorm:"column:dialysis_name" json:"dialysis_name" form:"dialysis_name"`
494
-	Norms                 string `gorm:"column:norms" json:"norms" form:"norms"`
495
-	DialysisConcentration int64  `gorm:"column:dialysis_concentration" json:"dialysis_concentration" form:"dialysis_concentration"`
496
-	GermChecked           int64  `gorm:"column:germ_checked" json:"germ_checked" form:"germ_checked"`
497
-	GermName              int64  `gorm:"column:germ_name" json:"germ_name" form:"germ_name"`
498
-	GermNumber            string `gorm:"column:germ_number" json:"germ_number" form:"germ_number"`
499
-	Clean                 int64  `gorm:"column:clean" json:"clean" form:"clean"`
500
-	SignName              int64  `gorm:"column:sign_name" json:"sign_name" form:"sign_name"`
501
-	Status                int64  `gorm:"column:status" json:"status" form:"status"`
502
-	Ctime                 int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
503
-	Mtime                 int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
504
-	UserOrgId             int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
505
-	EquimentId            int64  `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
506
-	Bed                   string `gorm:"column:bed" json:"bed" form:"bed"`
507
-	Name                  string `gorm:"column:name" json:"name" form:"name"`
508
-	UserName              string `gorm:"column:user_name" json:"user_name" form:"user_name"`
509
-	AdminUserId           int64  `gorm:"column:admin_user_id" json:"admin_user_id"`
462
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
463
+	Date                  int64   `gorm:"column:date" json:"date" form:"date"`
464
+	Class                 int64   `gorm:"column:class" json:"class" form:"class"`
465
+	Zone                  int64   `gorm:"column:zone" json:"zone" form:"zone"`
466
+	BedNumber             int64   `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
467
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
468
+	Contagion             string  `gorm:"column:contagion" json:"contagion" form:"contagion"`
469
+	DialysisMode          int64   `gorm:"column:dialysis_mode" json:"dialysis_mode" form:"dialysis_mode"`
470
+	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
471
+	EndTime               int64   `gorm:"column:end_time" json:"end_time" form:"end_time"`
472
+	DialysisHour          string  `gorm:"column:dialysis_hour" json:"dialysis_hour" form:"dialysis_hour"`
473
+	Hyperfiltratio        float64 `gorm:"column:hyperfiltratio" json:"hyperfiltratio" form:"hyperfiltratio"`
474
+	WeightLoss            float64 `gorm:"column:weight_loss" json:"weight_loss" form:"weight_loss"`
475
+	WarningValue          string  `gorm:"column:warning_value" json:"warning_value" form:"warning_value"`
476
+	UserTotal             string  `gorm:"column:user_total" json:"user_total" form:"user_total"`
477
+	Move                  int64   `gorm:"column:move" json:"move" form:"move"`
478
+	FailureStage          int64   `gorm:"column:failure_stage" json:"failure_stage" form:"failure_stage"`
479
+	FaultDescription      string  `gorm:"column:fault_description" json:"fault_description" form:"fault_description"`
480
+	CodeInformation       string  `gorm:"column:code_information" json:"code_information" form:"code_information"`
481
+	DisinfectType         int64   `gorm:"column:disinfect_type" json:"disinfect_type" form:"disinfect_type"`
482
+	DisinfectantType      int64   `gorm:"column:disinfectant_type" json:"disinfectant_type" form:"disinfectant_type"`
483
+	Disinfection          int64   `gorm:"column:disinfection" json:"disinfection" form:"disinfection"`
484
+	MachineRun            int64   `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
485
+	FluidPath             int64   `gorm:"column:fluid_path" json:"fluid_path" form:"fluid_path"`
486
+	Disinfectant          int64   `gorm:"column:disinfectant" json:"disinfectant" form:"disinfectant"`
487
+	DisinfectionStatus    int64   `gorm:"column:disinfection_status" json:"disinfection_status" form:"disinfection_status"`
488
+	DisinfectionResidue   int64   `gorm:"column:disinfection_residue" json:"disinfection_residue" form:"disinfection_residue"`
489
+	LongTime              string  `gorm:"column:long_time" json:"long_time" form:"long_time"`
490
+	DisinfecStartime      int64   `gorm:"column:disinfec_startime" json:"disinfec_startime" form:"disinfec_startime"`
491
+	DisinfecEndtime       int64   `gorm:"column:disinfec_endtime" json:"disinfec_endtime" form:"disinfec_endtime"`
492
+	DialysisChecked       int64   `gorm:"column:dialysis_checked" json:"dialysis_checked" form:"dialysis_checked"`
493
+	DialysisName          int64   `gorm:"column:dialysis_name" json:"dialysis_name" form:"dialysis_name"`
494
+	Norms                 string  `gorm:"column:norms" json:"norms" form:"norms"`
495
+	DialysisConcentration int64   `gorm:"column:dialysis_concentration" json:"dialysis_concentration" form:"dialysis_concentration"`
496
+	GermChecked           int64   `gorm:"column:germ_checked" json:"germ_checked" form:"germ_checked"`
497
+	GermName              int64   `gorm:"column:germ_name" json:"germ_name" form:"germ_name"`
498
+	GermNumber            string  `gorm:"column:germ_number" json:"germ_number" form:"germ_number"`
499
+	Clean                 int64   `gorm:"column:clean" json:"clean" form:"clean"`
500
+	SignName              int64   `gorm:"column:sign_name" json:"sign_name" form:"sign_name"`
501
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
502
+	Ctime                 int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
503
+	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
504
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
505
+	EquimentId            int64   `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
506
+	Bed                   string  `gorm:"column:bed" json:"bed" form:"bed"`
507
+	Name                  string  `gorm:"column:name" json:"name" form:"name"`
508
+	UserName              string  `gorm:"column:user_name" json:"user_name" form:"user_name"`
509
+	AdminUserId           int64   `gorm:"column:admin_user_id" json:"admin_user_id"`
510 510
 }
511 511
 
512 512
 type DeviceInformation struct {
513
-	ID                    int64  `gorm:"column:id" json:"id" form:"id"`
514
-	Date                  int64  `gorm:"column:date" json:"date" form:"date"`
515
-	Class                 int64  `gorm:"column:class" json:"class" form:"class"`
516
-	Zone                  int64  `gorm:"column:zone" json:"zone" form:"zone"`
517
-	BedNumber             int64  `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
518
-	PatientId             int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
519
-	Contagion             string `gorm:"column:contagion" json:"contagion" form:"contagion"`
520
-	DialysisMode          int64  `gorm:"column:dialysis_mode" json:"dialysis_mode" form:"dialysis_mode"`
521
-	StartTime             int64  `gorm:"column:start_time" json:"start_time" form:"start_time"`
522
-	EndTime               int64  `gorm:"column:end_time" json:"end_time" form:"end_time"`
523
-	DialysisHour          string `gorm:"column:dialysis_hour" json:"dialysis_hour" form:"dialysis_hour"`
524
-	Hyperfiltratio        string `gorm:"column:hyperfiltratio" json:"hyperfiltratio" form:"hyperfiltratio"`
525
-	WeightLoss            string `gorm:"column:weight_loss" json:"weight_loss" form:"weight_loss"`
526
-	WarningValue          string `gorm:"column:warning_value" json:"warning_value" form:"warning_value"`
527
-	UserTotal             string `gorm:"column:user_total" json:"user_total" form:"user_total"`
528
-	Move                  int64  `gorm:"column:move" json:"move" form:"move"`
529
-	FailureStage          int64  `gorm:"column:failure_stage" json:"failure_stage" form:"failure_stage"`
530
-	FaultDescription      string `gorm:"column:fault_description" json:"fault_description" form:"fault_description"`
531
-	CodeInformation       string `gorm:"column:code_information" json:"code_information" form:"code_information"`
532
-	DisinfectType         int64  `gorm:"column:disinfect_type" json:"disinfect_type" form:"disinfect_type"`
533
-	DisinfectantType      int64  `gorm:"column:disinfectant_type" json:"disinfectant_type" form:"disinfectant_type"`
534
-	Disinfection          int64  `gorm:"column:disinfection" json:"disinfection" form:"disinfection"`
535
-	MachineRun            int64  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
536
-	FluidPath             int64  `gorm:"column:fluid_path" json:"fluid_path" form:"fluid_path"`
537
-	Disinfectant          int64  `gorm:"column:disinfectant" json:"disinfectant" form:"disinfectant"`
538
-	DisinfectionStatus    int64  `gorm:"column:disinfection_status" json:"disinfection_status" form:"disinfection_status"`
539
-	DisinfectionResidue   int64  `gorm:"column:disinfection_residue" json:"disinfection_residue" form:"disinfection_residue"`
540
-	LongTime              string `gorm:"column:long_time" json:"long_time" form:"long_time"`
541
-	DisinfecStartime      int64  `gorm:"column:disinfec_startime" json:"disinfec_startime" form:"disinfec_startime"`
542
-	DisinfecEndtime       int64  `gorm:"column:disinfec_endtime" json:"disinfec_endtime" form:"disinfec_endtime"`
543
-	DialysisChecked       int64  `gorm:"column:dialysis_checked" json:"dialysis_checked" form:"dialysis_checked"`
544
-	DialysisName          int64  `gorm:"column:dialysis_name" json:"dialysis_name" form:"dialysis_name"`
545
-	Norms                 string `gorm:"column:norms" json:"norms" form:"norms"`
546
-	DialysisConcentration int64  `gorm:"column:dialysis_concentration" json:"dialysis_concentration" form:"dialysis_concentration"`
547
-	GermChecked           int64  `gorm:"column:germ_checked" json:"germ_checked" form:"germ_checked"`
548
-	GermName              int64  `gorm:"column:germ_name" json:"germ_name" form:"germ_name"`
549
-	GermNumber            string `gorm:"column:germ_number" json:"germ_number" form:"germ_number"`
550
-	Clean                 int64  `gorm:"column:clean" json:"clean" form:"clean"`
551
-	SignName              int64  `gorm:"column:sign_name" json:"sign_name" form:"sign_name"`
552
-	Status                int64  `gorm:"column:status" json:"status" form:"status"`
553
-	Ctime                 int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
554
-	Mtime                 int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
555
-	UserOrgId             int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
556
-	EquimentId            int64  `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
557
-	Bed                   string `gorm:"column:bed" json:"bed" form:"bed"`
558
-	Stime                 int64  `gorm:"column:stime" json:"stime" form:"stime"`
513
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
514
+	Date                  int64   `gorm:"column:date" json:"date" form:"date"`
515
+	Class                 int64   `gorm:"column:class" json:"class" form:"class"`
516
+	Zone                  int64   `gorm:"column:zone" json:"zone" form:"zone"`
517
+	BedNumber             int64   `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
518
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
519
+	Contagion             string  `gorm:"column:contagion" json:"contagion" form:"contagion"`
520
+	DialysisMode          int64   `gorm:"column:dialysis_mode" json:"dialysis_mode" form:"dialysis_mode"`
521
+	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
522
+	EndTime               int64   `gorm:"column:end_time" json:"end_time" form:"end_time"`
523
+	DialysisHour          string  `gorm:"column:dialysis_hour" json:"dialysis_hour" form:"dialysis_hour"`
524
+	Hyperfiltratio        float64 `gorm:"column:hyperfiltratio" json:"hyperfiltratio" form:"hyperfiltratio"`
525
+	WeightLoss            float64 `gorm:"column:weight_loss" json:"weight_loss" form:"weight_loss"`
526
+	WarningValue          string  `gorm:"column:warning_value" json:"warning_value" form:"warning_value"`
527
+	UserTotal             string  `gorm:"column:user_total" json:"user_total" form:"user_total"`
528
+	Move                  int64   `gorm:"column:move" json:"move" form:"move"`
529
+	FailureStage          int64   `gorm:"column:failure_stage" json:"failure_stage" form:"failure_stage"`
530
+	FaultDescription      string  `gorm:"column:fault_description" json:"fault_description" form:"fault_description"`
531
+	CodeInformation       string  `gorm:"column:code_information" json:"code_information" form:"code_information"`
532
+	DisinfectType         int64   `gorm:"column:disinfect_type" json:"disinfect_type" form:"disinfect_type"`
533
+	DisinfectantType      int64   `gorm:"column:disinfectant_type" json:"disinfectant_type" form:"disinfectant_type"`
534
+	Disinfection          int64   `gorm:"column:disinfection" json:"disinfection" form:"disinfection"`
535
+	MachineRun            int64   `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
536
+	FluidPath             int64   `gorm:"column:fluid_path" json:"fluid_path" form:"fluid_path"`
537
+	Disinfectant          int64   `gorm:"column:disinfectant" json:"disinfectant" form:"disinfectant"`
538
+	DisinfectionStatus    int64   `gorm:"column:disinfection_status" json:"disinfection_status" form:"disinfection_status"`
539
+	DisinfectionResidue   int64   `gorm:"column:disinfection_residue" json:"disinfection_residue" form:"disinfection_residue"`
540
+	LongTime              string  `gorm:"column:long_time" json:"long_time" form:"long_time"`
541
+	DisinfecStartime      int64   `gorm:"column:disinfec_startime" json:"disinfec_startime" form:"disinfec_startime"`
542
+	DisinfecEndtime       int64   `gorm:"column:disinfec_endtime" json:"disinfec_endtime" form:"disinfec_endtime"`
543
+	DialysisChecked       int64   `gorm:"column:dialysis_checked" json:"dialysis_checked" form:"dialysis_checked"`
544
+	DialysisName          int64   `gorm:"column:dialysis_name" json:"dialysis_name" form:"dialysis_name"`
545
+	Norms                 string  `gorm:"column:norms" json:"norms" form:"norms"`
546
+	DialysisConcentration int64   `gorm:"column:dialysis_concentration" json:"dialysis_concentration" form:"dialysis_concentration"`
547
+	GermChecked           int64   `gorm:"column:germ_checked" json:"germ_checked" form:"germ_checked"`
548
+	GermName              int64   `gorm:"column:germ_name" json:"germ_name" form:"germ_name"`
549
+	GermNumber            string  `gorm:"column:germ_number" json:"germ_number" form:"germ_number"`
550
+	Clean                 int64   `gorm:"column:clean" json:"clean" form:"clean"`
551
+	SignName              int64   `gorm:"column:sign_name" json:"sign_name" form:"sign_name"`
552
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
553
+	Ctime                 int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
554
+	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
555
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
556
+	EquimentId            int64   `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
557
+	Bed                   string  `gorm:"column:bed" json:"bed" form:"bed"`
558
+	Stime                 int64   `gorm:"column:stime" json:"stime" form:"stime"`
559 559
 }
560 560
 
561 561
 func (DeviceInformation) TableName() string {
@@ -737,7 +737,7 @@ type DeviceRepairs struct {
737 737
 	BedId            int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
738 738
 	EquitmentId      int64  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
739 739
 	CodeInformation  string `gorm:"column:code_information" json:"code_information" form:"code_information"`
740
-	BedNumber        string `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
740
+	Number           string `gorm:"column:number" json:"bed_number" form:"number"`
741 741
 }
742 742
 
743 743
 type DeviceRepair struct {

+ 27 - 0
models/dialysis.go 查看文件

@@ -75,6 +75,7 @@ type SchedualPatient struct {
75 75
 	TellPhone               string                  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
76 76
 	FirstTreatmentDate      int64                   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
77 77
 	ContactName             string                  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
78
+	UserSysBeforeCount      int64                   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
78 79
 }
79 80
 
80 81
 func (SchedualPatient) TableName() string {
@@ -154,6 +155,7 @@ type SchedualPatient2 struct {
154 155
 	TellPhone               string           `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
155 156
 	FirstTreatmentDate      int64            `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
156 157
 	ContactName             string           `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
158
+	UserSysBeforeCount      int64            `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
157 159
 }
158 160
 
159 161
 func (SchedualPatient2) TableName() string {
@@ -642,6 +644,7 @@ type MonitoringRecord struct {
642 644
 	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
643 645
 	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
644 646
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
647
+	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
645 648
 }
646 649
 
647 650
 func (MonitoringRecord) TableName() string {
@@ -853,3 +856,27 @@ type SgjUserAdmin struct {
853 856
 func (SgjUserAdmin) TableName() string {
854 857
 	return "sgj_user_admin"
855 858
 }
859
+
860
+type UserAdminRoles struct {
861
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
862
+	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
863
+	OrgId         int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
864
+	AppId         int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
865
+	RoleId        int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
866
+	UserName      string `gorm:"column:user_name" json:"user_name" form:"user_name"`
867
+	Avatar        string `gorm:"column:avatar" json:"avatar" form:"avatar"`
868
+	UserType      int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
869
+	UserTitle     int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
870
+	Intro         string `gorm:"column:intro" json:"intro" form:"intro"`
871
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
872
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
873
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
874
+	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
875
+	RoleIds       string `gorm:"column:role_ids" json:"role_ids" form:"role_ids"`
876
+	Message       string `gorm:"column:message" json:"message" form:"message"`
877
+	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
878
+	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
879
+	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
880
+	Url           string `gorm:"column:url" json:"url" form:"url"`
881
+	Hash          string `gorm:"column:hash" json:"hash" form:"hash"`
882
+}

+ 26 - 25
models/intergration_models.go 查看文件

@@ -1,16 +1,16 @@
1 1
 package models
2 2
 
3 3
 type MiddleSyncInfo struct {
4
-	ID             	int64 `gorm:"column:id" json:"id" form:"id"`
5
-	OrgId       	int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
6
-	SyncTime       int64 `gorm:"column:sync_time" json:"sync_time" form:"sync_time"`
7
-	SyncResultType  int	  `gorm:"column:sync_result_type" json:"sync_result_type" form:"sync_result_type"`
4
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
5
+	OrgId           int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
6
+	SyncTime        int64  `gorm:"column:sync_time" json:"sync_time" form:"sync_time"`
7
+	SyncResultType  int    `gorm:"column:sync_result_type" json:"sync_result_type" form:"sync_result_type"`
8 8
 	SyncRsultRemark string `gorm:"column:sync_result_remark" json:"sync_result_remark" form:"sync_result_remark"`
9
-	SyncTotalNum    int64 `gorm:"column:sync_total_num" json:"sync_total_num" form:"sync_total_num"`
10
-	SyncSuccessNum  int64 `gorm:"column:sync_success_num" json:"sync_success_num" form:"sync_success_num"`
11
-	SyncInfo      	string `gorm:"column:sync_info" json:"sync_info" form:"sync_info"`
12
-	CreateTime      int64 `gorm:"column:create_time" json:"create_time" form:"create_time"`
13
-	UpdateTime    	int64 `gorm:"column:update_time" json:"update_time" form:"update_time"`
9
+	SyncTotalNum    int64  `gorm:"column:sync_total_num" json:"sync_total_num" form:"sync_total_num"`
10
+	SyncSuccessNum  int64  `gorm:"column:sync_success_num" json:"sync_success_num" form:"sync_success_num"`
11
+	SyncInfo        string `gorm:"column:sync_info" json:"sync_info" form:"sync_info"`
12
+	CreateTime      int64  `gorm:"column:create_time" json:"create_time" form:"create_time"`
13
+	UpdateTime      int64  `gorm:"column:update_time" json:"update_time" form:"update_time"`
14 14
 }
15 15
 
16 16
 func (MiddleSyncInfo) TableName() string {
@@ -18,22 +18,22 @@ func (MiddleSyncInfo) TableName() string {
18 18
 }
19 19
 
20 20
 type MiddleInterface struct {
21
-	ID          	int64  `gorm:"column:id" json:"id" form:"id"`
22
-	OrgId   		int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
23
-	Creater   		int64 `gorm:"column:creater" json:"creater" form:"creater"`
24
-	Pattern 		int  `gorm:"column:pattern" json:"pattern" form:"pattern"`
25
-	Dbhost 			string  `gorm:"column:dbhost" json:"dbhost" form:"dbhost"`
26
-	Dbuser 			string  `gorm:"column:dbuser" json:"dbuser" form:"dbuser"`
27
-	Dbpassword 		string  `gorm:"column:dbpassword" json:"dbpassword" form:"dbpassword"`
28
-	Dbname 			string  `gorm:"column:dbname" json:"dbname" form:"dbname"`
29
-	InterfaceUrl 	string  `gorm:"column:interface_url" json:"interface_url" form:"interface_url"`
30
-	InterFaceToken 	string  `gorm:"column:interface_token" json:"interface_token" form:"interface_token"`
31
-	AllowIp 		string  `gorm:"column:allow_ip" json:"allow_ip" form:"allow_ip"`
32
-	AllowToken 		string  `gorm:"column:allow_token" json:"allow_token" form:"allow_token"`
33
-	SyncFrequency 	int  `gorm:"column:sync_frequency" json:"sync_frequency" form:"sync_frequency"`
34
-	Status			int  `gorm:"column:status" json:"status" form:"status"`
35
-	CreatedTime     int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
36
-	UpdatedTime     int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
21
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
22
+	OrgId          int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
23
+	Creater        int64  `gorm:"column:creater" json:"creater" form:"creater"`
24
+	Pattern        int    `gorm:"column:pattern" json:"pattern" form:"pattern"`
25
+	Dbhost         string `gorm:"column:dbhost" json:"dbhost" form:"dbhost"`
26
+	Dbuser         string `gorm:"column:dbuser" json:"dbuser" form:"dbuser"`
27
+	Dbpassword     string `gorm:"column:dbpassword" json:"dbpassword" form:"dbpassword"`
28
+	Dbname         string `gorm:"column:dbname" json:"dbname" form:"dbname"`
29
+	InterfaceUrl   string `gorm:"column:interface_url" json:"interface_url" form:"interface_url"`
30
+	InterFaceToken string `gorm:"column:interface_token" json:"interface_token" form:"interface_token"`
31
+	AllowIp        string `gorm:"column:allow_ip" json:"allow_ip" form:"allow_ip"`
32
+	AllowToken     string `gorm:"column:allow_token" json:"allow_token" form:"allow_token"`
33
+	SyncFrequency  int    `gorm:"column:sync_frequency" json:"sync_frequency" form:"sync_frequency"`
34
+	Status         int    `gorm:"column:status" json:"status" form:"status"`
35
+	CreatedTime    int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
36
+	UpdatedTime    int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
37 37
 }
38 38
 
39 39
 func (MiddleInterface) TableName() string {
@@ -126,6 +126,7 @@ type VMPatients struct {
126 126
 	FirstTreatmentDate       int64         `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
127 127
 	ContactName              string        `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
128 128
 	VMHisPatients            VMHisPatients `gorm:"ForeignKey:XtPatientId;AssociationForeignKey:ID" json:"his_patient"`
129
+	UserSysBeforeCount       int64         `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
129 130
 }
130 131
 
131 132
 func (VMPatients) TableName() string {

+ 1 - 0
models/monitor_models.go 查看文件

@@ -103,6 +103,7 @@ type MonitorPatients struct {
103 103
 	TellPhone                    string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
104 104
 	FirstTreatmentDate           int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
105 105
 	ContactName                  string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
106
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
106 107
 }
107 108
 
108 109
 func (MonitorPatients) TableName() string {

+ 42 - 38
models/patient_models.go 查看文件

@@ -85,6 +85,7 @@ type Patients struct {
85 85
 	TellPhone                string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
86 86
 	FirstTreatmentDate       int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
87 87
 	ContactName              string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
88
+	UserSysBeforeCount       int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
88 89
 }
89 90
 
90 91
 func (Patients) TableName() string {
@@ -483,6 +484,7 @@ type XtPatientsNew struct {
483 484
 	MemberPatienttype            int64   `gorm:"column:member_patienttype" json:"member_patienttype" form:"member_patienttype"`
484 485
 	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
485 486
 	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
487
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
486 488
 }
487 489
 
488 490
 func (XtPatientsNew) TableName() string {
@@ -495,44 +497,45 @@ type PatientsNew struct {
495 497
 }
496 498
 
497 499
 type CdmPatients struct {
498
-	ID                int64  `gorm:"column:id" json:"id" form:"id"`
499
-	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
500
-	UserId            int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
501
-	Avatar            string `gorm:"column:avatar" json:"avatar" form:"avatar"`
502
-	PatientType       int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
503
-	Source            int64  `gorm:"column:source" json:"source" form:"source"`
504
-	Name              string `gorm:"column:name" json:"name" form:"name"`
505
-	Alias             string `gorm:"column:alias" json:"alias" form:"alias"`
506
-	Gender            int64  `gorm:"column:gender" json:"gender" form:"gender"`
507
-	MaritalStatus     int64  `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
508
-	IdCardNo          string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
509
-	Birthday          int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
510
-	HealthCareType    int64  `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
511
-	HealthCareNo      string `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
512
-	Height            int64  `gorm:"column:height" json:"height" form:"height"`
513
-	BloodType         int64  `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
514
-	Rh                int64  `gorm:"column:rh" json:"rh" form:"rh"`
515
-	EducationLevel    int64  `gorm:"column:education_level" json:"education_level" form:"education_level"`
516
-	Profession        int64  `gorm:"column:profession" json:"profession" form:"profession"`
517
-	Phone             string `gorm:"column:phone" json:"phone" form:"phone"`
518
-	HomeTelephone     string `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
519
-	RelativePhone     string `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
520
-	RelativeRelations string `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
521
-	HomeAddress       string `gorm:"column:home_address" json:"home_address" form:"home_address"`
522
-	WorkUnit          string `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
523
-	UnitAddress       string `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
524
-	Children          int64  `gorm:"column:children" json:"children" form:"children"`
525
-	AttendingDoctorId int64  `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
526
-	HeadNurseId       int64  `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
527
-	Diagnose          string `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
528
-	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
529
-	RegistrarsId      int64  `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
530
-	Registrars        string `gorm:"column:registrars" json:"registrars" form:"registrars"`
531
-	QrCode            string `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
532
-	BindingState      int64  `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
533
-	Status            int64  `gorm:"column:status" json:"status" form:"status"`
534
-	CreatedTime       int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
535
-	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
500
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
501
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
502
+	UserId             int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
503
+	Avatar             string `gorm:"column:avatar" json:"avatar" form:"avatar"`
504
+	PatientType        int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
505
+	Source             int64  `gorm:"column:source" json:"source" form:"source"`
506
+	Name               string `gorm:"column:name" json:"name" form:"name"`
507
+	Alias              string `gorm:"column:alias" json:"alias" form:"alias"`
508
+	Gender             int64  `gorm:"column:gender" json:"gender" form:"gender"`
509
+	MaritalStatus      int64  `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
510
+	IdCardNo           string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
511
+	Birthday           int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
512
+	HealthCareType     int64  `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
513
+	HealthCareNo       string `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
514
+	Height             int64  `gorm:"column:height" json:"height" form:"height"`
515
+	BloodType          int64  `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
516
+	Rh                 int64  `gorm:"column:rh" json:"rh" form:"rh"`
517
+	EducationLevel     int64  `gorm:"column:education_level" json:"education_level" form:"education_level"`
518
+	Profession         int64  `gorm:"column:profession" json:"profession" form:"profession"`
519
+	Phone              string `gorm:"column:phone" json:"phone" form:"phone"`
520
+	HomeTelephone      string `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
521
+	RelativePhone      string `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
522
+	RelativeRelations  string `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
523
+	HomeAddress        string `gorm:"column:home_address" json:"home_address" form:"home_address"`
524
+	WorkUnit           string `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
525
+	UnitAddress        string `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
526
+	Children           int64  `gorm:"column:children" json:"children" form:"children"`
527
+	AttendingDoctorId  int64  `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
528
+	HeadNurseId        int64  `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
529
+	Diagnose           string `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
530
+	Remark             string `gorm:"column:remark" json:"remark" form:"remark"`
531
+	RegistrarsId       int64  `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
532
+	Registrars         string `gorm:"column:registrars" json:"registrars" form:"registrars"`
533
+	QrCode             string `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
534
+	BindingState       int64  `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
535
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
536
+	CreatedTime        int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
537
+	UpdatedTime        int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
538
+	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
536 539
 }
537 540
 
538 541
 func (CdmPatients) TableName() string {
@@ -791,6 +794,7 @@ type XtPatients struct {
791 794
 	ExpenseKind                  int64   `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
792 795
 	TellPhone                    string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
793 796
 	ContactName                  string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
797
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
794 798
 }
795 799
 
796 800
 func (XtPatients) TableName() string {

+ 1 - 0
models/vm_models.go 查看文件

@@ -85,6 +85,7 @@ type VMOrgPatients struct {
85 85
 	TellPhone                string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
86 86
 	FirstTreatmentDate       int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
87 87
 	ContactName              string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
88
+	UserSysBeforeCount       int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
88 89
 }
89 90
 
90 91
 func (VMOrgPatients) TableName() string {

+ 8 - 0
service/app_version.go 查看文件

@@ -182,3 +182,11 @@ func GetSystemRole(orgID int64) ([]*models.Role, error) {
182 182
 	}
183 183
 	return roles, nil
184 184
 }
185
+
186
+func HandleData() {
187
+	var prescription []*models.DialysisPrescription
188
+	readDb.Model(&models.DialysisPrescription{}).Where("user_org_id = 12 AND record_date <= 1587571200").Find(&prescription)
189
+	for _, item := range prescription {
190
+		writeDb.Model(&models.AssessmentAfterDislysis{}).Where("user_org_id =12 AND assessment_date = ?", item.RecordDate).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "actual_ultrafiltration": item.Ultrafiltration})
191
+	}
192
+}

+ 2 - 2
service/auto_create_week_disinfection.go 查看文件

@@ -138,8 +138,8 @@ func AutoCreateWeekDisinfectionJob() {
138 138
 							StartTime:             it.StartTime,
139 139
 							EndTime:               it.EndTime,
140 140
 							Contagion:             con,
141
-							WeightLoss:            strconv.FormatFloat(dislysis.WeightLoss, 'f', -1, 64),
142
-							Hyperfiltratio:        strconv.FormatFloat(dislysis.ActualUltrafiltration, 'f', -1, 64),
141
+							WeightLoss:            dislysis.WeightLoss,
142
+							Hyperfiltratio:        dislysis.ActualUltrafiltration,
143 143
 							DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
144 144
 							MachineRun:            1,
145 145
 						}

+ 2 - 2
service/auto_create_week_plan.go 查看文件

@@ -122,8 +122,8 @@ func AutoCreateWeekPlanJob() {
122 122
 							StartTime:             it.StartTime,
123 123
 							EndTime:               it.EndTime,
124 124
 							Contagion:             con,
125
-							WeightLoss:            strconv.FormatFloat(dislysis.WeightLoss, 'f', -1, 64),
126
-							Hyperfiltratio:        strconv.FormatFloat(dislysis.ActualUltrafiltration, 'f', -1, 64),
125
+							WeightLoss:            dislysis.WeightLoss,
126
+							Hyperfiltratio:        dislysis.ActualUltrafiltration,
127 127
 							DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
128 128
 							MachineRun:            1,
129 129
 						}

+ 1 - 1
service/data.go 查看文件

@@ -141,7 +141,7 @@ func FindConfigByTitleForUpdate(module string, title string, org_id int64, id in
141 141
 }
142 142
 
143 143
 func UpdateChildConfig(dataconfig *models.Dataconfig) (err error) {
144
-	err = readDb.Model(&models.Dataconfig{}).Where("id =?", dataconfig.ID).Update(map[string]interface{}{"name": dataconfig.Name, "update_time": dataconfig.UpdatedTime, "remark": dataconfig.Remark}).Error
144
+	err = readDb.Model(&models.Dataconfig{}).Where("id =?", dataconfig.ID).Update(map[string]interface{}{"name": dataconfig.Name, "update_time": dataconfig.UpdatedTime, "remark": dataconfig.Remark, "orders": dataconfig.Order}).Error
145 145
 	return
146 146
 }
147 147
 

+ 26 - 0
service/device_service.go 查看文件

@@ -272,6 +272,25 @@ func GetDeviceZoneByID(orgID int64, zoneID int64) (*models.DeviceZone, error) {
272 272
 	return &zone, nil
273 273
 }
274 274
 
275
+func GetZoneByName(name string, orgid int64) (*models.DeviceZone, error) {
276
+	zones := models.DeviceZone{}
277
+	err := XTReadDB().Model(&zones).Where("name = ? and org_id = ? and status = 1", name, orgid).Find(&zones).Error
278
+	if err == gorm.ErrRecordNotFound {
279
+		return nil, err
280
+	}
281
+	if err != nil {
282
+		return nil, err
283
+	}
284
+
285
+	return &zones, nil
286
+}
287
+
288
+func GetZoneByNameOne(name string, orgid int64) (zone models.DeviceZone, err error) {
289
+
290
+	err = XTReadDB().Model(&zone).Where("name = ? and org_id=? and status = 1", name, orgid).First(&zone).Error
291
+	return zone, err
292
+}
293
+
275 294
 func CreateDeviceZone(orgID int64, name string, type_ int) (*models.DeviceZone, error) {
276 295
 	now := time.Now().Unix()
277 296
 	zone := models.DeviceZone{
@@ -648,3 +667,10 @@ func GetTreatModel(id int64, orgid int64) (mode []*models.DeviceTreatmentmode, e
648 667
 
649 668
 	return mode, err
650 669
 }
670
+
671
+func GetPatientId(id int64) (models.XtPatientsNew, error) {
672
+
673
+	patientsNew := models.XtPatientsNew{}
674
+	err := XTReadDB().Model(&patientsNew).Where("blood_id = ? and status = 1", id).Find(&patientsNew).Error
675
+	return patientsNew, err
676
+}

+ 28 - 1
service/dialysis_service.go 查看文件

@@ -695,6 +695,24 @@ func GetAdminUserES(orgID int64, appID int64, ids []int64) (es []*models.AdminUs
695 695
 	return
696 696
 }
697 697
 
698
+//
699
+//func GetAdminUserEsOne(orgid int64) (admin []*models.UserAdminRoles, err error) {
700
+//
701
+//	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
702
+//	table := readUserDb.Table("sgj_user_admin_electronic_signature as s")
703
+//	fmt.Println("table", table)
704
+//	err = db.Select("x.id,x.admin_user_id,x.user_name,x.org_id,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id").Where("x.org_id = ?", orgid).Scan(&admin).Error
705
+//	return admin, err
706
+//}
707
+
708
+func GetAdminUserEsOne(orgid int64) (admin []*models.UserAdminRoles, err error) {
709
+	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status =1")
710
+	table := readUserDb.Table("sgj_user_admin_electronic_signature as s")
711
+	fmt.Println("table", table)
712
+	err = db.Select("x.id,x.admin_user_id,x.user_name,x.org_id,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id").Where("x.org_id = ?", orgid).Scan(&admin).Error
713
+	return admin, err
714
+}
715
+
698 716
 func UpDateDialysisPrescriptionDoctorSign(patient int64, date int64, orgId int64, doctor_id int64) (err error) {
699 717
 	err = writeDb.Model(&models.DialysisPrescription{}).Where("user_org_id = ? AND patient_id = ? AND record_date = ? ", orgId, patient, date).Updates(map[string]interface{}{"prescription_doctor": doctor_id}).Error
700 718
 	return
@@ -705,6 +723,15 @@ func GetAllAdminUserES(orgID int64, appId int64) (es []*models.AdminUserElectron
705 723
 	return
706 724
 }
707 725
 
726
+func GetAllStarfEs(orgid int64) (es []*models.SgjUserAdminRoles, err error) {
727
+
728
+	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
729
+	table := readUserDb.Table("sgj_user_admin_electronic_signature as s")
730
+	fmt.Println("table", table)
731
+	err = db.Select("x.id,x.admin_user_id,x.org_id,x.app_id,x.role_id,x.user_name,x.avatar,x.user_type,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id and s.status = 1").Where("x.org_id = ?", orgid).Scan(&es).Error
732
+	return es, err
733
+}
734
+
708 735
 func FindLastMonitorRecord(patient_id int64, org_id int64) (record models.MonitoringRecord, err error) {
709 736
 	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? AND status = 1 AND user_org_id = ?", patient_id, org_id).Last(&record).Error
710 737
 	return
@@ -780,7 +807,7 @@ func CheckOldDoctorAdvice(m *models.DoctorAdvice, advice_id int64) (err error) {
780 807
 
781 808
 func DeleteDoctorAdviceByGroupNo(m *models.DoctorAdvice) (err error) {
782 809
 	ut := writeDb.Begin()
783
-	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?", m.GroupNo).Update(map[string]interface{}{"UpdatedTime": m.UpdatedTime, "Status": 0}).Error
810
+	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ? AND user_org_id =  ?", m.GroupNo, m.UserOrgId).Update(map[string]interface{}{"UpdatedTime": m.UpdatedTime, "Status": 0, "modifier": m.Modifier}).Error
784 811
 	if err != nil {
785 812
 		ut.Rollback()
786 813
 		return

+ 1 - 1
service/gobal_config_service.go 查看文件

@@ -76,7 +76,7 @@ func UpdateDoctorAdviceRecord(config *models.DoctorAdviceConfig) (err error) {
76 76
 }
77 77
 
78 78
 func UpdateFiledConfig(org_id int64) (err error) {
79
-	err = writeDb.Model(&models.FiledConfig{}).Where("org_id = ?", org_id).Updates(map[string]interface{}{"is_show": 1}).Error
79
+	err = writeDb.Model(&models.FiledConfig{}).Where("org_id = ? AND sys_module = 0", org_id).Updates(map[string]interface{}{"is_show": 1}).Error
80 80
 	return
81 81
 }
82 82
 

+ 6 - 0
service/home_service.go 查看文件

@@ -20,6 +20,12 @@ func GetCreator(id int64, orgid int64) (models.SgjUserAdminRole, error) {
20 20
 	return role, err
21 21
 }
22 22
 
23
+func GetSuperAdmin(id int64) (models.SgjUserAdmin, error) {
24
+	admin := models.SgjUserAdmin{}
25
+	err := UserReadDB().Model(&admin).Where("id=? and status =1", id).Find(&admin).Error
26
+	return admin, err
27
+}
28
+
23 29
 func GetAllApp(org_id int64) (apps []*models.OrgApp, err error) {
24 30
 	err = readUserDb.Model(&models.OrgApp{}).Where("status = 1 AND pid > 0 AND org_id = ?", org_id).Order("number asc").Find(&apps).Error
25 31
 	return

+ 7 - 7
service/manage_service.go 查看文件

@@ -639,13 +639,13 @@ func CreateRepair(repair *models.DeviceRepair) error {
639 639
 func GetAllRepair(orgid int64, limit int64, page int64) (repair []*models.DeviceRepairs, total int64, err error) {
640 640
 
641 641
 	db := UserReadDB().Table("xt_device_repair as r").Where("r.status = ?", 1)
642
-	table := XTReadDB().Table("xt_device_addmacher as x")
642
+	table := XTReadDB().Table("xt_device_number as x")
643 643
 	offset := (page - 1) * limit
644 644
 	fmt.Print("table", table)
645 645
 	if orgid > 0 {
646 646
 		db = db.Where("r.user_org_id = ?", orgid)
647 647
 	}
648
-	err = db.Count(&total).Select("r.id,r.guarantee_date,r.start_time,r.arrive_time,r.finish_time,r.total_distance,r.failure_stage,r.fault_description,r.cause_analysis,r.treatment_process,r.images,r.exclude,r.reason,r.ctime,r.mtime,r.status,r.user_org_id,r.bed_id,r.equitment_id,r.code_information,x.bed_number").Joins("Left join xt_device_addmacher as x on x.id = r.equitment_id").Offset(offset).Limit(limit).Scan(&repair).Error
648
+	err = db.Count(&total).Select("r.id,r.guarantee_date,r.start_time,r.arrive_time,r.finish_time,r.total_distance,r.failure_stage,r.fault_description,r.cause_analysis,r.treatment_process,r.images,r.exclude,r.reason,r.ctime,r.mtime,r.status,r.user_org_id,r.bed_id,r.equitment_id,r.code_information,x.number").Joins("Left join sgj_xt.xt_device_number as x on x.id = r.bed_id").Offset(offset).Limit(limit).Scan(&repair).Error
649 649
 
650 650
 	//	err = UserReadDB().Where("user_org_id = ? AND status = 1", orgid).Find(&repair).Error
651 651
 	return repair, total, err
@@ -699,7 +699,7 @@ func GetRepair(bedid int64, start int64, end int64, orgid int64) (repair []*mode
699 699
 		db = db.Where("r.guarantee_date <= ?", end)
700 700
 	}
701 701
 	//err = db.Model(&repair).Find(&repair).Error
702
-	err = db.Select("r.id,r.guarantee_date,r.start_time,r.arrive_time,r.finish_time,r.total_distance,r.failure_stage,r.fault_description,r.cause_analysis,r.treatment_process,r.images,r.exclude,r.reason,r.ctime,r.mtime,r.status,r.user_org_id,r.bed_id,r.equitment_id,r.code_information,x.bed_number").Joins("Left join xt_device_addmacher as x on x.id = r.equitment_id").Scan(&repair).Error
702
+	err = db.Select("r.id,r.guarantee_date,r.start_time,r.arrive_time,r.finish_time,r.total_distance,r.failure_stage,r.fault_description,r.cause_analysis,r.treatment_process,r.images,r.exclude,r.reason,r.ctime,r.mtime,r.status,r.user_org_id,r.bed_id,r.equitment_id,r.code_information,x.number").Joins("Left join sgj_xt.xt_device_number as x on x.id = r.bed_id").Scan(&repair).Error
703 703
 
704 704
 	return repair, err
705 705
 }
@@ -757,7 +757,7 @@ func UpadateForm(id int64, orgid int64, infor *models.DeviceInformation) error {
757 757
 	return err
758 758
 }
759 759
 
760
-func QueryInfo(zone int64, bed int64, start int64, end int64, orgId int64, limit int64, page int64) (infor []*models.DeviceInformations, total int64, err error) {
760
+func QueryInfo(bed int64, start int64, end int64, orgId int64, limit int64, page int64) (infor []*models.DeviceInformations, total int64, err error) {
761 761
 	db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
762 762
 	table := XTReadDB().Table("xt_patients as p")
763 763
 	fmt.Println("table", table)
@@ -766,9 +766,9 @@ func QueryInfo(zone int64, bed int64, start int64, end int64, orgId int64, limit
766 766
 	if orgId > 0 {
767 767
 		db = db.Where("x.user_org_id = ?", orgId)
768 768
 	}
769
-	if zone > 0 {
770
-		db = db.Where("x.zone = ?", zone)
771
-	}
769
+	//if zone > 0 {
770
+	//	db = db.Where("x.zone = ?", zone)
771
+	//}
772 772
 	if bed > 0 {
773 773
 		db = db.Where("x.bed_number = ?", bed)
774 774
 	}

+ 13 - 9
service/mobile_dialysis_service.go 查看文件

@@ -109,15 +109,17 @@ func (MDeviceNumberVM) TableName() string {
109 109
 }
110 110
 
111 111
 type MSchedualPatientVMList struct {
112
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
113
-	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
114
-	UserId      int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
115
-	PatientType int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
116
-	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
117
-	Gender      int64  `gorm:"column:gender" json:"gender" form:"gender"`
118
-	Birthday    int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
119
-	Age         int64  `gorm:"column:age" json:"age"`
120
-	Name        string `gorm:"column:name" json:"name" form:"name"`
112
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
113
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
114
+	UserId             int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
115
+	PatientType        int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
116
+	Avatar             string `gorm:"column:avatar" json:"avatar" form:"avatar"`
117
+	Gender             int64  `gorm:"column:gender" json:"gender" form:"gender"`
118
+	Birthday           int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
119
+	Age                int64  `gorm:"column:age" json:"age"`
120
+	Name               string `gorm:"column:name" json:"name" form:"name"`
121
+	IdCardNo           string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
122
+	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
121 123
 }
122 124
 
123 125
 func (MSchedualPatientVMList) TableName() string {
@@ -194,6 +196,7 @@ type MSchedualPatientVM struct {
194 196
 	TellPhone               string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
195 197
 	FirstTreatmentDate      int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
196 198
 	ContactName             string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
199
+	UserSysBeforeCount      int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
197 200
 }
198 201
 
199 202
 func (MSchedualPatientVM) TableName() string {
@@ -386,6 +389,7 @@ type MPatient struct {
386 389
 	TellPhone               string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
387 390
 	FirstTreatmentDate      int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
388 391
 	ContactName             string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
392
+	UserSysBeforeCount      int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
389 393
 }
390 394
 
391 395
 func (MPatient) TableName() string {

+ 93 - 6
service/patient_service.go 查看文件

@@ -67,7 +67,7 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
67 67
 
68 68
 	offset := (page - 1) * limit
69 69
 
70
-	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
70
+	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71 71
 	return
72 72
 }
73 73
 
@@ -666,7 +666,7 @@ func DeleteDoctorAdvice(m *models.DoctorAdvice) (err error) {
666 666
 	return
667 667
 }
668 668
 func DeleteGroupAdvice(orgId int64, groupNo int64, admin_user_id int64) (err error) {
669
-	err = writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id=? and groupno=?", orgId, groupNo).Update(map[string]interface{}{"UpdatedTime": time.Now().Unix(), "Status": 0, "Modifier": admin_user_id}).Error
669
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? and groupno = ?", orgId, groupNo).Update(map[string]interface{}{"UpdatedTime": time.Now().Unix(), "Status": 0, "Modifier": admin_user_id}).Error
670 670
 	if err != nil {
671 671
 		return
672 672
 	}
@@ -682,7 +682,7 @@ func FindDoctorAdviceByGroupNo(orgID, groupNo int64) (advice models.DoctorAdvice
682 682
 	return
683 683
 }
684 684
 func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
685
-	//db := readDb.Model(&models.DoctorAdvice{}).Where("status=1")
685
+
686 686
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
687 687
 	table := UserReadDB().Table("sgj_user_admin_role as r")
688 688
 	fmt.Print("table", table)
@@ -697,6 +697,7 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
697 697
 	} else if advice_type == 0 {
698 698
 		db = db.Where("x.advice_type in (?)", []int{1, 3})
699 699
 	}
700
+
700 701
 	if stop == 1 {
701 702
 		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
702 703
 	} else if stop == 2 {
@@ -717,6 +718,86 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
717 718
 	fmt.Print("err", err)
718 719
 	return
719 720
 }
721
+
722
+func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
723
+
724
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725
+	table := UserReadDB().Table("sgj_user_admin_role as r")
726
+	fmt.Print("table", table)
727
+	if orgID > 0 {
728
+		db = db.Where("x.user_org_id=?", orgID)
729
+	}
730
+	if patientID > 0 {
731
+		db = db.Where("x.patient_id = ?", patientID)
732
+	}
733
+	if advice_type == 1 && advice_type > 0 {
734
+		db = db.Where("x.advice_type = ?", advice_type)
735
+	}
736
+	if advice_type == 3 && advice_type > 0 {
737
+		db = db.Where("x.advice_type = 2 or x.advice_type = 3")
738
+	}
739
+	if stop == 1 {
740
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
741
+	} else if stop == 2 {
742
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
743
+	}
744
+
745
+	if start != 0 {
746
+		db = db.Where("x.start_time>=?", start)
747
+	}
748
+	if end != 0 {
749
+		db = db.Where("start_time<=?", end)
750
+	}
751
+	if len(keywords) > 0 {
752
+		likeKey := "%" + keywords + "%"
753
+		db = db.Where("x.advice_name LIKE ?", likeKey)
754
+	}
755
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
756
+	fmt.Print("err", err)
757
+	return
758
+}
759
+
760
+func GetDoctorAdviceListTwo(orgID int64, patientID int64, advice_type int64, stop int64, start int64, end int64, keywords string, limit int64, page int64) (advices []*models.DoctorAdvices, total int64, err error) {
761
+
762
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
763
+	table := UserReadDB().Table("sgj_user_admin_role as r")
764
+	fmt.Println(table)
765
+	if orgID > 0 {
766
+		db = db.Where("x.user_org_id=?", orgID)
767
+	}
768
+	if patientID > 0 {
769
+		db = db.Where("x.patient_id = ?", patientID)
770
+	}
771
+	if advice_type == 1 {
772
+		db = db.Where("x.advice_type = ?", advice_type)
773
+	}
774
+	if advice_type == 3 {
775
+		db = db.Where("x.advice_type <> 1")
776
+	}
777
+
778
+	if stop == 1 {
779
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
780
+	} else if stop == 2 {
781
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
782
+	}
783
+
784
+	if start != 0 {
785
+		db = db.Where("x.start_time>=?", start)
786
+	}
787
+	if end != 0 {
788
+		db = db.Where("start_time<=?", end)
789
+	}
790
+	if len(keywords) > 0 {
791
+		likeKey := "%" + keywords + "%"
792
+		db = db.Where("x.advice_name LIKE ?", likeKey)
793
+	}
794
+	offset := (page - 1) * limit
795
+	err = db.Order("x.start_time desc").Group("x.start_time").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Scan(&advices).Error
796
+	fmt.Print("错误是什么", err)
797
+	return
798
+
799
+}
800
+
720 801
 func GetDoctorAdvicePageList(orgID, patientID, advice_type, stop, start, end int64, keywords string, page, limit int64) (advices []*models.DoctorAdvice, total int64, err error) {
721 802
 
722 803
 	offset := (page - 1) * limit
@@ -996,14 +1077,14 @@ func FindDoctorAdviceByIds(orgID int64, ids []string) (advice []models.DoctorAdv
996 1077
 	return
997 1078
 }
998 1079
 
999
-func BatchDeleteDoctorAdvice(ids []string) (err error) {
1080
+func BatchDeleteDoctorAdvice(ids []string, user_id int64) (err error) {
1000 1081
 	ut := writeDb.Begin()
1001
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
1082
+	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix(), "modifier": user_id}).Error
1002 1083
 	if err != nil {
1003 1084
 		ut.Rollback()
1004 1085
 		return
1005 1086
 	}
1006
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
1087
+	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix(), "modifier": user_id}).Error
1007 1088
 	if err != nil {
1008 1089
 		ut.Rollback()
1009 1090
 		return
@@ -1073,3 +1154,9 @@ func GetSchedualPatientByKeyWord(orgID int64, keywords string, date int64) (pati
1073 1154
 	}
1074 1155
 	return
1075 1156
 }
1157
+
1158
+func GetPatientScheduleOne(patientid int64, nowdate int64, orgid int64) (models.XtSchedule, error) {
1159
+	schedule := models.XtSchedule{}
1160
+	err := XTReadDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status =1", patientid, nowdate, orgid).Find(&schedule).Error
1161
+	return schedule, err
1162
+}

+ 53 - 1
service/patientmanage_service.go 查看文件

@@ -524,7 +524,6 @@ func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int
524 524
 }
525 525
 
526 526
 func GetNewDoctorAdviceOne(patientID int64, advice_type int64, start int64, end int64, limit int64, page int64, orgID int64) (doctoradvice []*models.DoctorAdvice, total int64, err error) {
527
-	fmt.Println("advicetype------------------------------", advice_type)
528 527
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
529 528
 	table := UserReadDB().Table("sgj_user_admin_role as r")
530 529
 	fmt.Println("table", table)
@@ -1077,6 +1076,24 @@ func SaveBirthday(id int64, role *models.SgjUserAdminRole) error {
1077 1076
 	return err
1078 1077
 }
1079 1078
 
1079
+func GetPartitionByName(name string, orgid int64) (*models.DeviceZone, error) {
1080
+	zone := models.DeviceZone{}
1081
+	err := XTReadDB().Model(&zone).Where("name = ? and org_id = ? and status = 1", name, orgid).Find(&zone).Error
1082
+	if err == gorm.ErrRecordNotFound {
1083
+		return nil, err
1084
+	}
1085
+	if err != nil {
1086
+		return nil, err
1087
+	}
1088
+	return &zone, nil
1089
+}
1090
+
1091
+func GetPartitionByNameOne(name string, orgid int64) (zone models.DeviceZone, err error) {
1092
+
1093
+	err = XTReadDB().Model(&zone).Where("name = ? and org_id = ? and status = 1", name, orgid).First(&zone).Error
1094
+	return zone, err
1095
+}
1096
+
1080 1097
 func CreatedZone(zone *models.DeviceZone) error {
1081 1098
 
1082 1099
 	err := XTWriteDB().Model(&zone).Create(&zone).Error
@@ -1102,6 +1119,23 @@ func DeleteZoneById(id int64) error {
1102 1119
 	return err
1103 1120
 }
1104 1121
 
1122
+func GetGroupByName(name string, orgid int64) (*models.DeviceGroup, error) {
1123
+	group := models.DeviceGroup{}
1124
+	err := XTReadDB().Model(&group).Where("name = ? and org_id = ? and status = 1", name, orgid).Find(&group).Error
1125
+	if err == gorm.ErrRecordNotFound {
1126
+		return nil, err
1127
+	}
1128
+	if err != nil {
1129
+		return nil, err
1130
+	}
1131
+	return &group, nil
1132
+}
1133
+
1134
+func GetGroupByNameOne(name string, orgid int64) (group models.DeviceGroup, err error) {
1135
+	err = XTReadDB().Model(&group).Where("name = ? and org_id = ? and status =1", name, orgid).First(&group).Error
1136
+	return group, err
1137
+}
1138
+
1105 1139
 func SaveGroup(group *models.DeviceGroup) error {
1106 1140
 	err := XTWriteDB().Model(&group).Create(&group).Error
1107 1141
 	return err
@@ -1136,6 +1170,24 @@ func GetAllGroupOne(orgid int64) (group []*models.DeviceGroup, err error) {
1136 1170
 	return group, err
1137 1171
 }
1138 1172
 
1173
+func GetBedByName(name string, orgid int64) (*models.DeviceNumber, error) {
1174
+	number := models.DeviceNumber{}
1175
+	err := XTReadDB().Model(&number).Where("number=? and org_id = ? and status =1", name, orgid).Find(&number).Error
1176
+	if err == gorm.ErrRecordNotFound {
1177
+		return nil, err
1178
+	}
1179
+	if err != nil {
1180
+		return nil, err
1181
+	}
1182
+	return &number, nil
1183
+}
1184
+
1185
+func GetBedByNameOne(name string, orgid int64) (number models.DeviceNumber, err error) {
1186
+
1187
+	err = XTReadDB().Model(&number).Where("number=? and org_id = ? and status = 1", name, orgid).First(&number).Error
1188
+	return number, err
1189
+}
1190
+
1139 1191
 func CreateNumber(number *models.DeviceNumber) error {
1140 1192
 
1141 1193
 	err := XTWriteDB().Model(&number).Create(&number).Error

+ 2 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go 查看文件

@@ -75,6 +75,7 @@ type PatientVM struct {
75 75
 	ExpenseKind                  int64   `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
76 76
 	TellPhone                    string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
77 77
 	FirstTreatmentDate           int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
78
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
78 79
 }
79 80
 
80 81
 func (PatientVM) TableName() string {
@@ -489,6 +490,7 @@ type MonitoringRecordVM struct {
489 490
 	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
490 491
 	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
491 492
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
493
+	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
492 494
 }
493 495
 
494 496
 func (MonitoringRecordVM) TableName() string {

+ 1 - 1
service/schedule_service.go 查看文件

@@ -238,7 +238,7 @@ func GetWeekDaySchedule(orgID int64, scheduleDate int64, scheduleDates *time.Tim
238 238
 		Preload("DeviceZone", "status = 1 ").
239 239
 		Preload("DeviceNumber", "status = 1 ").
240 240
 		Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
241
-			return db.Where("status = 1").Order("id desc")
241
+			return db.Where("status = 1").Order("id asc")
242 242
 		}).
243 243
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
244 244
 		Where("s.user_org_id=? and s.schedule_date = ? and s.status=1", orgID, scheduleDate).

+ 3 - 0
service/user_service.go 查看文件

@@ -48,7 +48,10 @@ func GetAllDoctorAndNurse(orgId, appid int64) (doctors []AdminUserList, nurses [
48 48
 }
49 49
 
50 50
 func GetAllAdminUsers(orgId, appid int64) (list []*AdminUserList, err error) {
51
+	//fmt.Println("orgid", orgId)
52
+	//fmt.Println("appid", appid)
51 53
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
54
+	//err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1  and ua.status=1").Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
52 55
 	return
53 56
 }
54 57