张保健 3 years ago
parent
commit
7c238f2d3b
34 changed files with 1258 additions and 442 deletions
  1. 16 16
      conf/app.conf
  2. 3 3
      controllers/base_api_controller.go
  3. 2 2
      controllers/device_api_controller.go
  4. 19 3
      controllers/dialysis_api_controller.go
  5. 26 21
      controllers/dialysis_record_api_controller.go
  6. 64 11
      controllers/manage_api_controller.go
  7. 6 6
      controllers/mobile_api_controllers/check_weight_api_controller.go
  8. 52 21
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 15 10
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  10. 2 2
      controllers/mobile_api_controllers/login_api_controller.go
  11. 2 0
      controllers/mobile_api_controllers/mobile_api_router_register.go
  12. 10 1
      controllers/mobile_api_controllers/patient_api_controller.go
  13. 99 98
      controllers/new_mobile_api_controllers/common_api_controller.go
  14. 220 144
      controllers/new_mobile_api_controllers/new_common_api_controller.go
  15. 1 0
      controllers/new_mobile_api_controllers/new_common_api_router.go
  16. 5 2
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  17. 218 0
      controllers/new_mobile_api_controllers/new_manage_api_controller.go
  18. 10 0
      controllers/new_mobile_api_controllers/new_manage_api_router.go
  19. 79 80
      controllers/patient_api_controller.go
  20. 102 5
      controllers/schedule_api_controller.go
  21. 12 1
      models/device_models.go
  22. 8 0
      models/dialysis.go
  23. 1 0
      models/patient_models.go
  24. 2 1
      routers/router.go
  25. 4 4
      service/auto_create_week_disinfection.go
  26. 2 2
      service/auto_create_week_plan.go
  27. 93 2
      service/common_service.go
  28. 4 3
      service/device_service.go
  29. 124 0
      service/manage_service.go
  30. 16 0
      service/mobile_dialysis_service.go
  31. 1 1
      service/patient_service.go
  32. 17 0
      service/schedule_service.go
  33. 2 2
      service/stock_service.go
  34. 21 1
      数据变更脚本.sql

+ 16 - 16
conf/app.conf View File

@@ -143,7 +143,7 @@ aliquid = 83
143 143
 [dev]
144 144
 mobile_token_expiration_second = 3600
145 145
 httpdomain = http://new_mobile.xt.api.sgjyun.com
146
-sso_domain = http://testsso.sgjyun.com
146
+sso_domain = http://localhost:8081
147 147
 front_end_domain = "http://xt.test.sgjyun.com/#"
148 148
 
149 149
 readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
@@ -215,26 +215,26 @@ writesgjpatientmysqlname = sgj_patient
215 215
 
216 216
 
217 217
 #redishost = 120.77.235.13
218
-redishost = 112.74.16.180
219
-# redishost = localhost
218
+#redishost = 112.74.16.180
219
+redishost = localhost
220 220
 redisport = 6379
221 221
 redispasswrod = 123456
222 222
 redisdb = 0
223 223
 
224 224
 
225
-        niprocart =  63
226
-        jms = 58
227
-        fistula_needle_set = 65
228
-        fistula_needle_set_16 = 64
229
-        hemoperfusion = 55
230
-        dialyser_sterilised = 12
231
-        filtryzer = 53
232
-                dialyzers = 8
233
-                injector = 81
234
-                bloodlines = 42
235
-        tubingHemodialysis = 30
236
-        package = 82
237
-        aliquid = 83
225
+niprocart =  63
226
+jms = 58
227
+fistula_needle_set = 65
228
+fistula_needle_set_16 = 64
229
+hemoperfusion = 55
230
+dialyser_sterilised = 12
231
+filtryzer = 53
232
+dialyzers = 8
233
+injector = 81
234
+bloodlines = 42
235
+tubingHemodialysis = 30
236
+package = 82
237
+aliquid = 83
238 238
 
239 239
 #niprocart =  83
240 240
 #jms = 80

+ 3 - 3
controllers/base_api_controller.go View File

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 1
84
-		subscibe.OrgId = 12
84
+		subscibe.OrgId = 9841
85 85
 		subscibe.PeriodStart = 1538035409
86 86
 		subscibe.PeriodEnd = 1569571409
87 87
 		subscibe.State = 1
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 12
94
+		adminUserInfo.CurrentOrgId = 9841
95 95
 		adminUserInfo.CurrentAppId = 18
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -336,7 +336,7 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 12
339
+		adminUserInfo.CurrentOrgId = 9841
340 340
 		adminUserInfo.CurrentAppId = 18
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes

+ 2 - 2
controllers/device_api_controller.go View File

@@ -1145,7 +1145,7 @@ func (this *DeviceAPIController) GetAllMachineInfo() {
1145 1145
 	adminUserInfo := this.GetAdminUserInfo()
1146 1146
 	orgid := adminUserInfo.CurrentOrgId
1147 1147
 	addmahcer, total, err := service.GetAllMachineInfo(page, limit, searchKey, zoneid, equipmentid, statusid, orgid)
1148
-	//fmt.Println("err------------------------------------------------------", err)
1148
+
1149 1149
 	if err != nil {
1150 1150
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询设备失败")
1151 1151
 		return
@@ -1194,7 +1194,7 @@ func (this *DeviceAPIController) GetMachineDetail() {
1194 1194
 	orgid := adminUserInfo.CurrentOrgId
1195 1195
 	fmt.Println("orgid", orgid)
1196 1196
 	addmacher, err := service.GetMachineDetail(id, orgid)
1197
-	fmt.Print("err--------------------------------------------", err)
1197
+	fmt.Print("err", err)
1198 1198
 	warning, err := service.GetTimeWarning(id, orgid)
1199 1199
 	germ, err := service.GetTimeLast(id, orgid)
1200 1200
 	clean, err := service.GetTimeLastData(id, orgid)

+ 19 - 3
controllers/dialysis_api_controller.go View File

@@ -137,7 +137,8 @@ func (c *DialysisApiController) PostPrescription() {
137 137
 	tubing_hemodialysis, _ := c.GetInt64("tubing_hemodialysis", 0)
138 138
 	safe_package, _ := c.GetInt64("package", 0)
139 139
 	a_liquid, _ := c.GetInt64("a_liquid", 0)
140
-
140
+	preImpules, _ := c.GetFloat("pre_impulse", 0)
141
+	fmt.Println("========================================================", preImpules)
141 142
 	// var prescription_doctor int64
142 143
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
143 144
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
@@ -214,6 +215,7 @@ func (c *DialysisApiController) PostPrescription() {
214 215
 		TubingHemodialysis:         tubing_hemodialysis,
215 216
 		Package:                    safe_package,
216 217
 		ALiquid:                    a_liquid,
218
+		PreImpulse:                 preImpules,
217 219
 	}
218 220
 
219 221
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -3018,7 +3020,6 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
3018 3020
 	}
3019 3021
 
3020 3022
 	assessment, _ := service.FindAssessmentAfterDislysisById(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3021
-
3022 3023
 	assessment.DialysisOrderId = data.DialysisOrderId
3023 3024
 	assessment.Evaluator = adminUserInfo.AdminUser.Id
3024 3025
 	assessment.Status = 1
@@ -3073,7 +3074,12 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
3073 3074
 	assessment.BloodFlow = data.BloodFlow
3074 3075
 	assessment.SealingFluidDispose = data.SealingFluidDispose
3075 3076
 	assessment.SealingFluidSpecial = data.SealingFluidSpecial
3076
-
3077
+	assessment.DosageOfAnticoagulants = data.DosageOfAnticoagulants
3078
+	assessment.SupineSystolicBloodPressure = data.SupineSystolicBloodPressure
3079
+	assessment.SettingPressure = data.SettingPressure
3080
+	assessment.SupineDiastolicBloodPressure = data.SupineDiastolicBloodPressure
3081
+	assessment.DiastolicPressure = data.DiastolicPressure
3082
+	assessment.AdditionalWeight = data.AdditionalWeight
3077 3083
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3078 3084
 
3079 3085
 	if assessment.ID > 0 {
@@ -3190,6 +3196,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3190 3196
 	machine_type := c.GetString("machine_type")
3191 3197
 	puncture_needle := c.GetString("puncture_needle")
3192 3198
 	humor_excessive_symptom, _ := c.GetInt64("humor_excessive_symptom", 0)
3199
+	phinholing := c.GetString("pinholing")
3193 3200
 
3194 3201
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
3195 3202
 		DialysisCount:                  dialysis_count,
@@ -3241,6 +3248,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3241 3248
 		MachineType:                    machine_type,
3242 3249
 		PunctureNeedle:                 puncture_needle,
3243 3250
 		HumorExcessiveSymptom:          humor_excessive_symptom,
3251
+		Phinholing:                     phinholing,
3244 3252
 	}
3245 3253
 
3246 3254
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -4282,6 +4290,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4282 4290
 	timeLayout := "2006-01-02"
4283 4291
 	loc, _ := time.LoadLocation("Local")
4284 4292
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", xtdate+" 00:00:00", loc)
4293
+
4285 4294
 	if err != nil {
4286 4295
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4287 4296
 		return
@@ -4382,6 +4391,12 @@ func (c *DialysisApiController) GetDialysisOrder() {
4382 4391
 	//operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
4383 4392
 	operators, err := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
4384 4393
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
4394
+
4395
+	//获取当前日期月份的第一天
4396
+	firstmonth := service.GetFirstDateOfMonth(theTime)
4397
+	firstMonthDate := firstmonth.Unix()
4398
+	//获取当前月份的病人透析次数
4399
+	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.CurrentOrgId)
4385 4400
 	c.ServeSuccessJSON(map[string]interface{}{
4386 4401
 		"xtdate":                    xtdate,
4387 4402
 		"users":                     adminUser,
@@ -4411,6 +4426,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4411 4426
 		"predialysName":             predialysName,
4412 4427
 		"FinishNuse":                FinishNuse,
4413 4428
 		"lastPredialysisEvaluation": lastPredialysisEvaluation,
4429
+		"dialysiscount":             dialysiscount,
4414 4430
 	})
4415 4431
 
4416 4432
 }

+ 26 - 21
controllers/dialysis_record_api_controller.go View File

@@ -396,6 +396,8 @@ type EditMonitorParamObject struct {
396 396
 	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
397 397
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
398 398
 	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
399
+	Urr                       string  `gorm:"column:urr" json:"urr" form:"urr"`
400
+	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
399 401
 }
400 402
 
401 403
 // /api/dislysis/monitor/edit [post]
@@ -497,13 +499,15 @@ func (this *DialysisRecordAPIController) EditMonitor() {
497 499
 			MonitoringNurse:           adminUserInfo.AdminUser.Id,
498 500
 			Conductivity:              monitorParam.Conductivity,
499 501
 			DisplacementFlowQuantity:  monitorParam.DisplacementFlowQuantity,
500
-			Status:                1,
501
-			CreatedTime:           time.Now().Unix(),
502
-			UpdatedTime:           time.Now().Unix(),
503
-			BloodOxygenSaturation: monitorParam.BloodOxygenSaturation,
504
-			Creator:               adminUserInfo.AdminUser.Id,
505
-			Heparin:               monitorParam.Heparin,
506
-			DialysateFlow:         monitorParam.DialysateFlow,
502
+			Status:                    1,
503
+			CreatedTime:               time.Now().Unix(),
504
+			UpdatedTime:               time.Now().Unix(),
505
+			BloodOxygenSaturation:     monitorParam.BloodOxygenSaturation,
506
+			Creator:                   adminUserInfo.AdminUser.Id,
507
+			Heparin:                   monitorParam.Heparin,
508
+			DialysateFlow:             monitorParam.DialysateFlow,
509
+			Urr:                       monitorParam.Urr,
510
+			BloodSugar:                monitorParam.BloodSugar,
507 511
 		}
508 512
 		createErr := service.CreateMonitor(&monitor)
509 513
 		if createErr != nil {
@@ -568,6 +572,8 @@ func (this *DialysisRecordAPIController) EditMonitor() {
568 572
 		monitor.BloodOxygenSaturation = monitorParam.BloodOxygenSaturation
569 573
 		monitor.Heparin = monitorParam.Heparin
570 574
 		monitor.DialysateFlow = monitorParam.DialysateFlow
575
+		monitor.Urr = monitorParam.Urr
576
+		monitor.BloodSugar = monitorParam.BloodSugar
571 577
 		updateErr := service.UpdateMonitor(monitor)
572 578
 		if updateErr != nil {
573 579
 			this.ErrorLog("修改透析监测记录失败:%v", updateErr)
@@ -1231,7 +1237,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1231 1237
 				if out.ID > 0 {
1232 1238
 
1233 1239
 					if prescription.Niprocart > 0 {
1234
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, niprocart, prescription.Niprocart, out.WarehouseOutOrderNumber)
1240
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, niprocart, prescription.Niprocart, out.ID)
1235 1241
 
1236 1242
 						if err == gorm.ErrRecordNotFound {
1237 1243
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1291,7 +1297,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1291 1297
 					}
1292 1298
 
1293 1299
 					if prescription.Jms > 0 {
1294
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, jms, prescription.Jms, out.WarehouseOutOrderNumber)
1300
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, jms, prescription.Jms, out.ID)
1295 1301
 
1296 1302
 						if err == gorm.ErrRecordNotFound {
1297 1303
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1353,7 +1359,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1353 1359
 					}
1354 1360
 
1355 1361
 					if prescription.FistulaNeedleSet > 0 {
1356
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, fistula_needle_set, prescription.FistulaNeedleSet, out.WarehouseOutOrderNumber)
1362
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, fistula_needle_set, prescription.FistulaNeedleSet, out.ID)
1357 1363
 
1358 1364
 						if err == gorm.ErrRecordNotFound {
1359 1365
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1415,7 +1421,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1415 1421
 					}
1416 1422
 
1417 1423
 					if prescription.FistulaNeedleSet16 > 0 {
1418
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, fistula_needle_set_16, prescription.FistulaNeedleSet16, out.WarehouseOutOrderNumber)
1424
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, fistula_needle_set_16, prescription.FistulaNeedleSet16, out.ID)
1419 1425
 
1420 1426
 						if err == gorm.ErrRecordNotFound {
1421 1427
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1476,7 +1482,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1476 1482
 					}
1477 1483
 
1478 1484
 					if prescription.Hemoperfusion > 0 {
1479
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, hemoperfusion, prescription.Hemoperfusion, out.WarehouseOutOrderNumber)
1485
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, hemoperfusion, prescription.Hemoperfusion, out.ID)
1480 1486
 
1481 1487
 						if err == gorm.ErrRecordNotFound {
1482 1488
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1537,7 +1543,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1537 1543
 					}
1538 1544
 
1539 1545
 					if prescription.DialyserSterilised > 0 {
1540
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, dialyser_sterilised, prescription.DialyserSterilised, out.WarehouseOutOrderNumber)
1546
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, dialyser_sterilised, prescription.DialyserSterilised, out.ID)
1541 1547
 
1542 1548
 						if err == gorm.ErrRecordNotFound {
1543 1549
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1599,7 +1605,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1599 1605
 					}
1600 1606
 
1601 1607
 					if prescription.Filtryzer > 0 {
1602
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, filtryzer, prescription.Filtryzer, out.WarehouseOutOrderNumber)
1608
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, filtryzer, prescription.Filtryzer, out.ID)
1603 1609
 
1604 1610
 						if err == gorm.ErrRecordNotFound {
1605 1611
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1661,7 +1667,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1661 1667
 					}
1662 1668
 
1663 1669
 					if prescription.Dialyzers > 0 {
1664
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, dialyzers, prescription.Dialyzers, out.WarehouseOutOrderNumber)
1670
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, dialyzers, prescription.Dialyzers, out.ID)
1665 1671
 
1666 1672
 						if err == gorm.ErrRecordNotFound {
1667 1673
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1723,7 +1729,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1723 1729
 					}
1724 1730
 
1725 1731
 					if prescription.Injector > 0 {
1726
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, injector, prescription.Injector, out.WarehouseOutOrderNumber)
1732
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, injector, prescription.Injector, out.ID)
1727 1733
 
1728 1734
 						if err == gorm.ErrRecordNotFound {
1729 1735
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1785,7 +1791,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1785 1791
 					}
1786 1792
 
1787 1793
 					if prescription.Bloodlines > 0 {
1788
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, bloodlines, prescription.Bloodlines, out.WarehouseOutOrderNumber)
1794
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, bloodlines, prescription.Bloodlines, out.ID)
1789 1795
 
1790 1796
 						if err == gorm.ErrRecordNotFound {
1791 1797
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1847,7 +1853,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1847 1853
 					}
1848 1854
 
1849 1855
 					if prescription.TubingHemodialysis > 0 {
1850
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, tubingHemodialysis, prescription.TubingHemodialysis, out.WarehouseOutOrderNumber)
1856
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, tubingHemodialysis, prescription.TubingHemodialysis, out.ID)
1851 1857
 
1852 1858
 						if err == gorm.ErrRecordNotFound {
1853 1859
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1909,7 +1915,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1909 1915
 					}
1910 1916
 
1911 1917
 					if prescription.Package > 0 {
1912
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, safe_package, prescription.Package, out.WarehouseOutOrderNumber)
1918
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, safe_package, prescription.Package, out.ID)
1913 1919
 
1914 1920
 						if err == gorm.ErrRecordNotFound {
1915 1921
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -1971,7 +1977,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1971 1977
 					}
1972 1978
 
1973 1979
 					if prescription.ALiquid > 0 {
1974
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, aliquid, prescription.ALiquid, out.WarehouseOutOrderNumber)
1980
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.CurrentOrgId, aliquid, prescription.ALiquid, out.ID)
1975 1981
 
1976 1982
 						if err == gorm.ErrRecordNotFound {
1977 1983
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -2342,7 +2348,6 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
2342 2348
 		tempassessmentAfterDislysis.InternalFistula = lastAssessmentAfterDislysis.InternalFistula
2343 2349
 		tempassessmentAfterDislysis.Catheter = lastAssessmentAfterDislysis.Catheter
2344 2350
 		tempassessmentAfterDislysis.Complication = lastAssessmentAfterDislysis.Complication
2345
-		tempassessmentAfterDislysis.Remark = lastAssessmentAfterDislysis.Remark
2346 2351
 		tempassessmentAfterDislysis.DialysisIntakes = lastAssessmentAfterDislysis.DialysisIntakes
2347 2352
 		tempassessmentAfterDislysis.DialysisIntakesFeed = lastAssessmentAfterDislysis.DialysisIntakesFeed
2348 2353
 		tempassessmentAfterDislysis.DialysisIntakesTransfusion = lastAssessmentAfterDislysis.DialysisIntakesTransfusion

+ 64 - 11
controllers/manage_api_controller.go View File

@@ -92,6 +92,10 @@ func ManageRouters() {
92 92
 	beego.Router("/api/manage/selectbed", &MachineApiController{}, "get:SelectBed")
93 93
 	beego.Router("/api/manage/getime", &MachineApiController{}, "get:GetTimeData")
94 94
 	beego.Router("/api/manage/deleteimages", &MachineApiController{}, "delete:DeleteImages")
95
+	beego.Router("/api/manage/getusermachtotalcount", &MachineApiController{}, "Get:GetUserMachTotalCount")
96
+	beego.Router("/api/manage/getusertotalcount", &MachineApiController{}, "Get:GetUserTotalCount")
97
+	beego.Router("/api/manage/deletemanagement", &MachineApiController{}, "Get:DeleteManagement")
98
+
95 99
 }
96 100
 
97 101
 func (this *MachineApiController) SaveManageInfo() {
@@ -207,7 +211,7 @@ func (this *MachineApiController) SaveManageInfo() {
207 211
 		DeviceName:          device_name,
208 212
 		ManufactureFactory:  manufacture_factory,
209 213
 		ServiceManufacturer: service_manufacturer,
210
-		UnitType:            unit_type,
214
+		UnitType:            unittype,
211 215
 		UseSection:          use_section,
212 216
 		SectionNumber:       section_number,
213 217
 		BuyDate:             buydate,
@@ -291,8 +295,8 @@ func (this *MachineApiController) UpdateMachineInfo() {
291 295
 	//fmt.Println("生产厂家", manufacture_factory)
292 296
 	service_manufacturer := dataBody["service_manufacturer"].(string)
293 297
 	//fmt.Println("维修厂家", service_manufacturer)
294
-	unittype := int64(dataBody["unit_type"].(float64))
295
-	unit_type := strconv.FormatInt(unittype, 10)
298
+	unit_type := int64(dataBody["unit_type"].(float64))
299
+	//unit_type := strconv.FormatInt(unittype, 10)
296 300
 	fmt.Println("设备型号", unit_type)
297 301
 
298 302
 	use_section := dataBody["use_section"].(string)
@@ -432,8 +436,8 @@ func (this *MachineApiController) UpdateMachinetwo() {
432 436
 	//fmt.Println("生产厂家", manufacture_factory)
433 437
 	service_manufacturer := dataBody["service_manufacturer"].(string)
434 438
 	//fmt.Println("维修厂家", service_manufacturer)
435
-	unittype := int64(dataBody["unit_type"].(float64))
436
-	unit_type := strconv.FormatInt(unittype, 10)
439
+	unit_type := int64(dataBody["unit_type"].(float64))
440
+	//unit_type := strconv.FormatInt(unittype, 10)
437 441
 	//fmt.Println("设备型号", unit_type)
438 442
 	use_section := dataBody["use_section"].(string)
439 443
 	//fmt.Println("使用科室", use_section)
@@ -565,7 +569,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
565 569
 	service_manufacturer := dataBody["service_manufacturer"].(string)
566 570
 	//fmt.Println("维修厂家", service_manufacturer)
567 571
 	unittype := int64(dataBody["unit_type"].(float64))
568
-	unit_type := strconv.FormatInt(unittype, 10)
572
+	//unit_type := strconv.FormatInt(unittype, 10)
569 573
 	//fmt.Println("设备型号", unit_type)
570 574
 	use_section := dataBody["use_section"].(string)
571 575
 	//fmt.Println("使用科室", use_section)
@@ -632,7 +636,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
632 636
 		DeviceName:          device_name,
633 637
 		ManufactureFactory:  manufacture_factory,
634 638
 		ServiceManufacturer: service_manufacturer,
635
-		UnitType:            unit_type,
639
+		UnitType:            unittype,
636 640
 		UseSection:          use_section,
637 641
 		SectionNumber:       section_number,
638 642
 		BuyDate:             buydate,
@@ -2210,10 +2214,15 @@ func (this *MachineApiController) GetRepair() {
2210 2214
 }
2211 2215
 
2212 2216
 func (this *MachineApiController) EditUser() {
2217
+	adminUser := this.GetAdminUserInfo()
2218
+	orgId := adminUser.CurrentOrgId
2213 2219
 	id, _ := this.GetInt64("id")
2214 2220
 	fmt.Println("id", id)
2215 2221
 	patientid, _ := this.GetInt64("patientid")
2216 2222
 	device, err := service.GetUserInformation(id)
2223
+	//获取初次使用记录
2224
+	macher, err := service.GetUserTotalByMacher(device.EquimentId)
2225
+	count, err := service.GetUserTotalCount(orgId, device.BedNumber)
2217 2226
 	patients, err := service.GetPatientInfoMation(patientid)
2218 2227
 	if err != nil {
2219 2228
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
@@ -2222,6 +2231,8 @@ func (this *MachineApiController) EditUser() {
2222 2231
 	this.ServeSuccessJSON(map[string]interface{}{
2223 2232
 		"device":   device,
2224 2233
 		"patients": patients,
2234
+		"count":    count,
2235
+		"macher":   macher,
2225 2236
 	})
2226 2237
 }
2227 2238
 
@@ -2641,9 +2652,9 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2641 2652
 	fmt.Println("生产厂家", manufacture_factory)
2642 2653
 	service_manufacturer := dataBody["service_manufacturer"].(string)
2643 2654
 	fmt.Println("维修厂家", service_manufacturer)
2644
-	unittype := int64(dataBody["unit_type"].(float64))
2645
-	unit_type := strconv.FormatInt(unittype, 10)
2646
-	fmt.Println("设备型号", unit_type)
2655
+	unit_type := int64(dataBody["unit_type"].(float64))
2656
+	//unit_type := strconv.FormatInt(unittype, 10)
2657
+	//fmt.Println("设备型号", unit_type)
2647 2658
 	use_section := dataBody["use_section"].(string)
2648 2659
 	fmt.Println("使用科室", use_section)
2649 2660
 	section_number := dataBody["section_number"].(string)
@@ -3067,7 +3078,49 @@ func (this *MachineApiController) GetTimeData() {
3067 3078
 func (this *MachineApiController) DeleteImages() {
3068 3079
 	id, _ := this.GetInt64("id")
3069 3080
 	err := service.DeleteImages(id)
3070
-	fmt.Print("err========", err)
3081
+	fmt.Print("err", err)
3082
+	if err != nil {
3083
+		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
3084
+		return
3085
+	}
3086
+	returnData := make(map[string]interface{}, 0)
3087
+	returnData["msg"] = "ok"
3088
+	this.ServeSuccessJSON(returnData)
3089
+	return
3090
+}
3091
+
3092
+func (this *MachineApiController) GetUserMachTotalCount() {
3093
+	adminUserInfo := this.GetAdminUserInfo()
3094
+	orgid := adminUserInfo.CurrentOrgId
3095
+	count, err := service.GetUserMachTotalCount(orgid)
3096
+	if err != nil {
3097
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3098
+		return
3099
+	}
3100
+	this.ServeSuccessJSON(map[string]interface{}{
3101
+		"count": count,
3102
+	})
3103
+}
3104
+
3105
+func (this *MachineApiController) GetUserTotalCount() {
3106
+	adminUserInfo := this.GetAdminUserInfo()
3107
+	orgid := adminUserInfo.CurrentOrgId
3108
+	id, _ := this.GetInt64("id")
3109
+	count, err := service.GetUserTotalCount(orgid, id)
3110
+	addmacher, err := service.GetUserTotal(orgid, id)
3111
+	if err != nil {
3112
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3113
+		return
3114
+	}
3115
+	this.ServeSuccessJSON(map[string]interface{}{
3116
+		"count":     count,
3117
+		"addmacher": addmacher,
3118
+	})
3119
+}
3120
+
3121
+func (this *MachineApiController) DeleteManagement() {
3122
+	id, _ := this.GetInt64("id")
3123
+	_, err := service.DeleteEquit(id)
3071 3124
 	if err != nil {
3072 3125
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
3073 3126
 		return

+ 6 - 6
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -332,7 +332,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
332 332
 
333 333
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
334 334
 
335
-	if template.TemplateId == 22 {
335
+	if template.TemplateId == 22 || template.TemplateId == 17 {
336 336
 		dewater_amount = dewater_amount * 1000
337 337
 	}
338 338
 
@@ -949,11 +949,11 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
949 949
 	}
950 950
 
951 951
 	c.ServeSuccessJSON(map[string]interface{}{
952
-		"dialysistype": dialysistype,
953
-		"patient":      dialysisinfo,
954
-		"schedule":     sc,
955
-		"dryweight":    dry_weight,
956
-		"after_dry_weight":    after_dry_weight,
952
+		"dialysistype":     dialysistype,
953
+		"patient":          dialysisinfo,
954
+		"schedule":         sc,
955
+		"dryweight":        dry_weight,
956
+		"after_dry_weight": after_dry_weight,
957 957
 	})
958 958
 	return
959 959
 }

+ 52 - 21
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -806,7 +806,11 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
806 806
 	blood_flow, _ := c.GetInt64("blood_flow", 0)
807 807
 	sealing_fluid_dispose, _ := c.GetInt64("sealing_fluid_dispose", 0)
808 808
 	sealing_fluid_special := c.GetString("sealing_fluid_special")
809
-
809
+	dosage_of_anticoagulants, _ := c.GetFloat("dosage_of_anticoagulants")
810
+	supine_systolic_blood_pressure := c.GetString("supine_systolic_blood_pressure")
811
+	setting_pressure := c.GetString("setting_pressure")
812
+	supine_diastolic_blood_pressure := c.GetString("supine_diastolic_blood_pressure")
813
+	diastolic_pressure := c.GetString("diastolic_pressure")
810 814
 	if id <= 0 {
811 815
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
812 816
 		return
@@ -893,6 +897,11 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
893 897
 		BloodFlow:                    blood_flow,
894 898
 		SealingFluidDispose:          sealing_fluid_dispose,
895 899
 		SealingFluidSpecial:          sealing_fluid_special,
900
+		DosageOfAnticoagulants:       dosage_of_anticoagulants,
901
+		SupineDiastolicBloodPressure: supine_diastolic_blood_pressure,
902
+		SupineSystolicBloodPressure:  supine_systolic_blood_pressure,
903
+		SettingPressure:              setting_pressure,
904
+		DiastolicPressure:            diastolic_pressure,
896 905
 	}
897 906
 
898 907
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
@@ -1022,7 +1031,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1022 1031
 	tubing_hemodialysis, _ := c.GetInt64("tubing_hemodialysis", 0)
1023 1032
 	safe_package, _ := c.GetInt64("package", 0)
1024 1033
 	a_liquid, _ := c.GetInt64("a_liquid", 0)
1025
-
1034
+	pre_impulse, parseDateErr := c.GetFloat("pre_impulse", 0)
1035
+	fmt.Println("预冲量====", pre_impulse)
1026 1036
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1027 1037
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1028 1038
 	//
@@ -1102,6 +1112,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1102 1112
 		Package:                    safe_package,
1103 1113
 		ALiquid:                    a_liquid,
1104 1114
 		TargetKtv:                  target_ktv,
1115
+		PreImpulse:                 pre_impulse,
1105 1116
 	}
1106 1117
 
1107 1118
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2421,7 +2432,6 @@ func (c *DialysisAPIController) Finish() {
2421 2432
 		tempassessmentAfterDislysis.InternalFistula = lastAssessmentAfterDislysis.InternalFistula
2422 2433
 		tempassessmentAfterDislysis.Catheter = lastAssessmentAfterDislysis.Catheter
2423 2434
 		tempassessmentAfterDislysis.Complication = lastAssessmentAfterDislysis.Complication
2424
-		tempassessmentAfterDislysis.Remark = lastAssessmentAfterDislysis.Remark
2425 2435
 		tempassessmentAfterDislysis.DialysisIntakes = lastAssessmentAfterDislysis.DialysisIntakes
2426 2436
 		tempassessmentAfterDislysis.DialysisIntakesFeed = lastAssessmentAfterDislysis.DialysisIntakesFeed
2427 2437
 		tempassessmentAfterDislysis.DialysisIntakesTransfusion = lastAssessmentAfterDislysis.DialysisIntakesTransfusion
@@ -2800,7 +2810,6 @@ func (this *DialysisAPIController) StartDialysis() {
2800 2810
 		hemoperfusion, _ := beego.AppConfig.Int64("hemoperfusion")
2801 2811
 		dialyser_sterilised, _ := beego.AppConfig.Int64("dialyser_sterilised")
2802 2812
 		filtryzer, _ := beego.AppConfig.Int64("filtryzer")
2803
-
2804 2813
 		dialyzers, _ := beego.AppConfig.Int64("dialyzers")
2805 2814
 		injector, _ := beego.AppConfig.Int64("injector")
2806 2815
 		bloodlines, _ := beego.AppConfig.Int64("bloodlines")
@@ -3299,7 +3308,6 @@ func (this *DialysisAPIController) StartDialysis() {
3299 3308
 						}
3300 3309
 
3301 3310
 					}
3302
-
3303 3311
 					if prescription.ALiquid > 0 {
3304 3312
 						warehouseOutInfo := &models.WarehouseOutInfo{
3305 3313
 							WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
@@ -3344,7 +3352,7 @@ func (this *DialysisAPIController) StartDialysis() {
3344 3352
 				if out.ID > 0 {
3345 3353
 
3346 3354
 					if prescription.Niprocart > 0 {
3347
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, niprocart, prescription.Niprocart, out.WarehouseOutOrderNumber)
3355
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, niprocart, prescription.Niprocart, out.ID)
3348 3356
 
3349 3357
 						if err == gorm.ErrRecordNotFound {
3350 3358
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3404,7 +3412,7 @@ func (this *DialysisAPIController) StartDialysis() {
3404 3412
 					}
3405 3413
 
3406 3414
 					if prescription.Jms > 0 {
3407
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, jms, prescription.Jms, out.WarehouseOutOrderNumber)
3415
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, jms, prescription.Jms, out.ID)
3408 3416
 
3409 3417
 						if err == gorm.ErrRecordNotFound {
3410 3418
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3466,7 +3474,7 @@ func (this *DialysisAPIController) StartDialysis() {
3466 3474
 					}
3467 3475
 
3468 3476
 					if prescription.FistulaNeedleSet > 0 {
3469
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, fistula_needle_set, prescription.FistulaNeedleSet, out.WarehouseOutOrderNumber)
3477
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, fistula_needle_set, prescription.FistulaNeedleSet, out.ID)
3470 3478
 
3471 3479
 						if err == gorm.ErrRecordNotFound {
3472 3480
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3528,7 +3536,7 @@ func (this *DialysisAPIController) StartDialysis() {
3528 3536
 					}
3529 3537
 
3530 3538
 					if prescription.FistulaNeedleSet16 > 0 {
3531
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, fistula_needle_set_16, prescription.FistulaNeedleSet16, out.WarehouseOutOrderNumber)
3539
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, fistula_needle_set_16, prescription.FistulaNeedleSet16, out.ID)
3532 3540
 
3533 3541
 						if err == gorm.ErrRecordNotFound {
3534 3542
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3589,7 +3597,7 @@ func (this *DialysisAPIController) StartDialysis() {
3589 3597
 					}
3590 3598
 
3591 3599
 					if prescription.Hemoperfusion > 0 {
3592
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, hemoperfusion, prescription.Hemoperfusion, out.WarehouseOutOrderNumber)
3600
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, hemoperfusion, prescription.Hemoperfusion, out.ID)
3593 3601
 
3594 3602
 						if err == gorm.ErrRecordNotFound {
3595 3603
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3650,7 +3658,7 @@ func (this *DialysisAPIController) StartDialysis() {
3650 3658
 					}
3651 3659
 
3652 3660
 					if prescription.DialyserSterilised > 0 {
3653
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, dialyser_sterilised, prescription.DialyserSterilised, out.WarehouseOutOrderNumber)
3661
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, dialyser_sterilised, prescription.DialyserSterilised, out.ID)
3654 3662
 
3655 3663
 						if err == gorm.ErrRecordNotFound {
3656 3664
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3712,7 +3720,7 @@ func (this *DialysisAPIController) StartDialysis() {
3712 3720
 					}
3713 3721
 
3714 3722
 					if prescription.Filtryzer > 0 {
3715
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, filtryzer, prescription.Filtryzer, out.WarehouseOutOrderNumber)
3723
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, filtryzer, prescription.Filtryzer, out.ID)
3716 3724
 
3717 3725
 						if err == gorm.ErrRecordNotFound {
3718 3726
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3774,7 +3782,7 @@ func (this *DialysisAPIController) StartDialysis() {
3774 3782
 					}
3775 3783
 
3776 3784
 					if prescription.Dialyzers > 0 {
3777
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, dialyzers, prescription.Dialyzers, out.WarehouseOutOrderNumber)
3785
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, dialyzers, prescription.Dialyzers, out.ID)
3778 3786
 
3779 3787
 						if err == gorm.ErrRecordNotFound {
3780 3788
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3836,7 +3844,7 @@ func (this *DialysisAPIController) StartDialysis() {
3836 3844
 					}
3837 3845
 
3838 3846
 					if prescription.Injector > 0 {
3839
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, injector, prescription.Injector, out.WarehouseOutOrderNumber)
3847
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, injector, prescription.Injector, out.ID)
3840 3848
 
3841 3849
 						if err == gorm.ErrRecordNotFound {
3842 3850
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3898,7 +3906,7 @@ func (this *DialysisAPIController) StartDialysis() {
3898 3906
 					}
3899 3907
 
3900 3908
 					if prescription.Bloodlines > 0 {
3901
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, bloodlines, prescription.Bloodlines, out.WarehouseOutOrderNumber)
3909
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, bloodlines, prescription.Bloodlines, out.ID)
3902 3910
 
3903 3911
 						if err == gorm.ErrRecordNotFound {
3904 3912
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -3960,7 +3968,7 @@ func (this *DialysisAPIController) StartDialysis() {
3960 3968
 					}
3961 3969
 
3962 3970
 					if prescription.TubingHemodialysis > 0 {
3963
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, tubingHemodialysis, prescription.TubingHemodialysis, out.WarehouseOutOrderNumber)
3971
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, tubingHemodialysis, prescription.TubingHemodialysis, out.ID)
3964 3972
 
3965 3973
 						if err == gorm.ErrRecordNotFound {
3966 3974
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -4022,7 +4030,7 @@ func (this *DialysisAPIController) StartDialysis() {
4022 4030
 					}
4023 4031
 
4024 4032
 					if prescription.Package > 0 {
4025
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, safe_package, prescription.Package, out.WarehouseOutOrderNumber)
4033
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, safe_package, prescription.Package, out.ID)
4026 4034
 
4027 4035
 						if err == gorm.ErrRecordNotFound {
4028 4036
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -4084,7 +4092,7 @@ func (this *DialysisAPIController) StartDialysis() {
4084 4092
 					}
4085 4093
 
4086 4094
 					if prescription.ALiquid > 0 {
4087
-						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, aliquid, prescription.ALiquid, out.WarehouseOutOrderNumber)
4095
+						outInfo, err := service.FindStockOutInfoByTypeId(adminUserInfo.Org.Id, aliquid, prescription.ALiquid, out.ID)
4088 4096
 
4089 4097
 						if err == gorm.ErrRecordNotFound {
4090 4098
 							warehouseOutInfo := &models.WarehouseOutInfo{
@@ -4381,7 +4389,6 @@ func (c *DialysisAPIController) PostSolution() {
4381 4389
 				if order.ID > 0 {
4382 4390
 					if dialysisPrescription.Niprocart != niprocart {
4383 4391
 						//不一致,先将原有的商品订单数量进行减一的操作,并将原有使用记录进行修改商品信息(根据上机的日期和商品类型id,商品id)
4384
-
4385 4392
 						//1.用上机透析日期查出当天的订单
4386 4393
 						_, out := service.FindStockOutOrderNumberByTime(order.DialysisDate, adminUserInfo.Org.Id)
4387 4394
 						//_, out := service.FindOldOrderInfoByGoodId(order.StartTime, adminUserInfo.Org.Id)
@@ -4811,8 +4818,6 @@ func (c *DialysisAPIController) PostSolution() {
4811 4818
 
4812 4819
 						//不一致,先将原有的商品订单数量进行减一的操作,并将原有使用记录进行修改商品信息(根据上机的日期和商品类型id,商品id)
4813 4820
 						service.UpdateOrderCount(dialyser_sterilised_good_type_id, dialysisPrescription.DialyserSterilised, out.WarehouseOutOrderNumber, adminUserInfo.Org.Id)
4814
-						//_, out := service.FindOrderInfoByGoodId(dialyser_sterilised_good_type_id, dialysisPrescription.DialyserSterilised, order.StartTime, adminUserInfo.Org.Id)
4815
-						//_, out := service.FindOrderInfoByGoodId(order.StartTime, adminUserInfo.Org.Id)
4816 4821
 
4817 4822
 						//判断前端更改后的商品id的出库记录在数据库中是否存在
4818 4823
 						err, newOut := service.FindOrderInfoByGoodId(dialyser_sterilised_good_type_id, dialyser_sterilised, out.WarehouseOutOrderNumber, adminUserInfo.Org.Id)
@@ -6384,3 +6389,29 @@ func (c *DialysisAPIController) GetPatientId() {
6384 6389
 		"patient": patientId,
6385 6390
 	})
6386 6391
 }
6392
+
6393
+func (this *DialysisAPIController) GetDialysisSchedule() {
6394
+	schedualDate := this.GetString("date")
6395
+	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
6396
+	if parseDateErr != nil {
6397
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6398
+		return
6399
+	}
6400
+	adminInfo := this.GetMobileAdminUserInfo()
6401
+	orgID := adminInfo.Org.Id
6402
+	redis := service.RedisClient()
6403
+	defer redis.Close()
6404
+	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
6405
+	scheduals, _ := service.MobileGetDialysisScheduals(orgID, date.Unix(), 0)
6406
+	if len(scheduals) > 0 {
6407
+		//缓存数据
6408
+		scheduals_json, err := json.Marshal(scheduals)
6409
+		if err == nil {
6410
+			redis.Set(key, scheduals_json, time.Second*30)
6411
+		}
6412
+	}
6413
+	this.ServeSuccessJSON(map[string]interface{}{
6414
+		"scheduals": scheduals,
6415
+	})
6416
+
6417
+}

+ 15 - 10
controllers/mobile_api_controllers/dialysis_api_controller_extend.go View File

@@ -67,11 +67,11 @@ func (this *DialysisAPIController) AddMonitorRecord() {
67 67
 	BPType, _ := this.GetInt("bp_type")
68 68
 	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
69 69
 	venousPressure, _ := this.GetFloat("venous_pressure")
70
-	venousPressureType,_ := this.GetInt64("venous_pressure_type",1)
70
+	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
71 71
 	arterialPressure, _ := this.GetFloat("arterial_pressure")
72
-	arterialPressureType, _ := this.GetInt64("arterial_pressure_type",1)
73
-	transmembranePressure, _ := this.GetFloat("transmembrane_pressure",0)
74
-	transmembranePressureType,_ := this.GetInt64("transmembrane_pressure_type",1)
72
+	arterialPressureType, _ := this.GetInt64("arterial_pressure_type", 1)
73
+	transmembranePressure, _ := this.GetFloat("transmembrane_pressure", 0)
74
+	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
75 75
 	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
76 76
 	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
77 77
 	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
@@ -89,7 +89,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
89 89
 	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
90 90
 	heparin, _ := this.GetFloat("heparin")
91 91
 	dialysate_flow, _ := this.GetFloat("dialysate_flow")
92
-
92
+	urr := this.GetString("urr")
93
+	blood_sugar, _ := this.GetFloat("blood_sugar")
93 94
 	adminInfo := this.GetMobileAdminUserInfo()
94 95
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
95 96
 	if getPatientErr != nil {
@@ -142,6 +143,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
142 143
 		Modify:                    0,
143 144
 		Heparin:                   heparin,
144 145
 		DialysateFlow:             dialysate_flow,
146
+		Urr:                       urr,
147
+		BloodSugar:                blood_sugar,
145 148
 	}
146 149
 
147 150
 	err := service.CreateMonitor(&record)
@@ -211,11 +214,11 @@ func (this *DialysisAPIController) EditMonitorRecord() {
211 214
 	BPType, _ := this.GetInt("bp_type")
212 215
 	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
213 216
 	venousPressure, _ := this.GetFloat("venous_pressure")
214
-	venousPressureType,_ := this.GetInt64("venous_pressure_type",1)
217
+	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
215 218
 	arterialPressure, _ := this.GetFloat("arterial_pressure")
216
-	arterialPressureType, _ := this.GetInt64("arterial_pressure",1)
219
+	arterialPressureType, _ := this.GetInt64("arterial_pressure", 1)
217 220
 	transmembranePressure, _ := this.GetFloat("transmembrane_pressure")
218
-	transmembranePressureType,_ := this.GetInt64("transmembrane_pressure_type",1)
221
+	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
219 222
 	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
220 223
 	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
221 224
 	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
@@ -233,7 +236,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
233 236
 	displacement_flow_quantity, _ := this.GetFloat("displacement_flow_quantity")
234 237
 	heparin, _ := this.GetFloat("heparin")
235 238
 	dialysate_flow, _ := this.GetFloat("dialysate_flow")
236
-
239
+	urr := this.GetString("urr")
240
+	blood_sugar, _ := this.GetFloat("blood_sugar")
237 241
 	adminInfo := this.GetMobileAdminUserInfo()
238 242
 
239 243
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
@@ -281,7 +285,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
281 285
 	monitor.Modify = adminInfo.AdminUser.Id
282 286
 	monitor.Heparin = heparin
283 287
 	monitor.DialysateFlow = dialysate_flow
284
-
288
+	monitor.Urr = urr
289
+	monitor.BloodSugar = blood_sugar
285 290
 	err = service.UpdateMonitor(monitor)
286 291
 	if err != nil {
287 292
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorUpdate)

+ 2 - 2
controllers/mobile_api_controllers/login_api_controller.go View File

@@ -32,8 +32,8 @@ func (this *LoginAPIController) LoginByPwd() {
32 32
 		return
33 33
 	}
34 34
 	ip := utils.GetIP(this.Ctx.Request)
35
-	ssoDomain := beego.AppConfig.String("sso_domain")
36
-	//ssoDomain := "http://localhost:8091"
35
+	//ssoDomain := beego.AppConfig.String("sso_domain")
36
+	ssoDomain := "http://localhost:8091"
37 37
 	api := ssoDomain + "/m/login/pwd"
38 38
 	values := make(url.Values)
39 39
 	values.Set("mobile", mobile)

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

@@ -114,4 +114,6 @@ func MobileAPIControllersRegisterRouters() {
114 114
 
115 115
 	beego.Router("/m/api/patient/search", &PatientApiController{}, "Get:GetSearchPatient")
116 116
 
117
+	beego.Router("/m/api/dialysis/schedule", &DialysisAPIController{}, "Get:GetDialysisSchedule")
118
+
117 119
 }

+ 10 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -1660,6 +1660,10 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
1660 1660
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
1661 1661
 	}
1662 1662
 
1663
+	if dataBody["pinholing"] != nil && reflect.TypeOf(dataBody["pinholing"]).String() == "string" {
1664
+		pinholing := dataBody["pinholing"].(string)
1665
+		evaluation.Phinholing = pinholing
1666
+	}
1663 1667
 	return
1664 1668
 }
1665 1669
 
@@ -2098,7 +2102,9 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2098 2102
 		return
2099 2103
 	}
2100 2104
 	xttime := theTime.Unix()
2101
-
2105
+	//获取当前日期月份的第一天
2106
+	firstmonth := service.GetFirstDateOfMonth(theTime)
2107
+	firstMonthDate := firstmonth.Unix()
2102 2108
 	operatorIDs := make([]int64, 0)
2103 2109
 
2104 2110
 	adminUserInfo := c.GetMobileAdminUserInfo()
@@ -2165,6 +2171,8 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2165 2171
 	operators, err := service.GetAllStarfEs(adminUserInfo.Org.Id)
2166 2172
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
2167 2173
 	check, _ := service.FindDoubleCheckById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2174
+
2175
+	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.Org.Id)
2168 2176
 	c.ServeSuccessJSON(map[string]interface{}{
2169 2177
 		"users":                   adminUser,
2170 2178
 		"patientInfo":             patientInfo,
@@ -2179,6 +2187,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2179 2187
 		"operators":               operators,
2180 2188
 		"org_template_info":       templateInfo,
2181 2189
 		"check":                   check,
2190
+		"dialysiscount":           dialysiscount,
2182 2191
 	})
2183 2192
 
2184 2193
 }

+ 99 - 98
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -153,6 +153,7 @@ func (this *CommonApiController) SaveConfiguration() {
153 153
 				RangeType:       checktype,
154 154
 				RangeValue:      rangvalue,
155 155
 				CreatedTime:     time.Now().Unix(),
156
+				IsStatus:        1,
156 157
 			}
157 158
 			fmt.Println(standard)
158 159
 			err = service.SaveInspection(&standard)
@@ -219,7 +220,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
219 220
 		}
220 221
 		this.ServeSuccessJSON(map[string]interface{}{
221 222
 			"configurationdetail": detail,
222
-			"vid": vid,
223
+			"vid":                 vid,
223 224
 		})
224 225
 	} else {
225 226
 		itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
@@ -229,7 +230,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
229 230
 		}
230 231
 		this.ServeSuccessJSON(map[string]interface{}{
231 232
 			"configurationdetail": detail,
232
-			"vid": itemId.ID,
233
+			"vid":                 itemId.ID,
233 234
 		})
234 235
 	}
235 236
 
@@ -1877,156 +1878,156 @@ func (this *CommonApiController) GetMonthBloodList() {
1877 1878
 	//统计收缩压
1878 1879
 	if bloodtype == -1 {
1879 1880
 		//统计收缩压一月总数
1880
-		_, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1881
-		_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1881
+		januarylist, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1882
+		//_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1882 1883
 
1883 1884
 		//二月
1884
-		_, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1885
-		_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1885
+		feblist, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1886
+		//_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1886 1887
 
1887 1888
 		//三月
1888
-		_, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1889
-		_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1889
+		marchlist, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1890
+		//_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1890 1891
 
1891 1892
 		//四月
1892
-		_, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1893
-		_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1893
+		aprlist, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1894
+		//_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1894 1895
 
1895 1896
 		//五月
1896
-		_, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1897
-		_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1897
+		maylist, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1898
+		//_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1898 1899
 
1899 1900
 		//六月
1900
-		_, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1901
-		_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1901
+		junlist, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1902
+		//_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1902 1903
 		//7月
1903
-		_, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1904
-		_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1904
+		jullist, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1905
+		//_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1905 1906
 
1906 1907
 		//8月
1907
-		_, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1908
-		_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1908
+		auglist, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1909
+		//_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1909 1910
 
1910 1911
 		//9月
1911
-		_, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1912
-		_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1912
+		seplist, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1913
+		//_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1913 1914
 		//10月
1914
-		_, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1915
-		_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1915
+		octlist, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1916
+		//_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1916 1917
 		//11月
1917
-		_, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1918
-		_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1918
+		novlist, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1919
+		//_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1919 1920
 		//12月
1920
-		_, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1921
-		_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1921
+		declist, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1922
+		//_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1922 1923
 		if err != nil {
1923 1924
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1924 1925
 			return
1925 1926
 		}
1926 1927
 
1927 1928
 		this.ServeSuccessJSON(map[string]interface{}{
1928
-			"januaryTotal":      januaryTotal,
1929
-			"januaryStandTotal": januaryStandTotal,
1930
-			"febTotal":          febTotal,
1931
-			"febStandTotal":     febStandTotal,
1932
-			"marchTotal":        marchTotal,
1933
-			"marchStandTotal":   marchStandTotal,
1934
-			"aprTotal":          aprTotal,
1935
-			"aprStandTotal":     aprStandTotal,
1936
-			"mayTotal":          mayTotal,
1937
-			"mayStandTotal":     mayStandTotal,
1938
-			"junTotal":          junTotal,
1939
-			"junStandTotal":     junStandTotal,
1940
-			"julTotal":          julTotal,
1941
-			"julStandTotal":     julStandTotal,
1942
-			"augTotal":          augTotal,
1943
-			"augStandTotal":     augStandTotal,
1944
-			"sepTotal":          sepTotal,
1945
-			"sepStandTotal":     sepStandTotal,
1946
-			"octTotal":          octTotal,
1947
-			"octStandTotal":     octStandTotal,
1948
-			"novTotal":          novTotal,
1949
-			"novStandTotal":     novStandTotal,
1950
-			"decTotal":          decTotal,
1951
-			"decStandTotal":     decStandTotal,
1929
+			"januaryTotal": januaryTotal,
1930
+			"januarylist":  januarylist,
1931
+			"febTotal":     febTotal,
1932
+			"feblist":      feblist,
1933
+			"marchTotal":   marchTotal,
1934
+			"marchlist":    marchlist,
1935
+			"aprTotal":     aprTotal,
1936
+			"aprlist":      aprlist,
1937
+			"mayTotal":     mayTotal,
1938
+			"maylist":      maylist,
1939
+			"junTotal":     junTotal,
1940
+			"junlist":      junlist,
1941
+			"julTotal":     julTotal,
1942
+			"jullist":      jullist,
1943
+			"augTotal":     augTotal,
1944
+			"auglist":      auglist,
1945
+			"sepTotal":     sepTotal,
1946
+			"seplist":      seplist,
1947
+			"octTotal":     octTotal,
1948
+			"octlist":      octlist,
1949
+			"novTotal":     novTotal,
1950
+			"novlist":      novlist,
1951
+			"decTotal":     decTotal,
1952
+			"declist":      declist,
1952 1953
 		})
1953 1954
 	}
1954 1955
 
1955 1956
 	//统计舒张压
1956 1957
 	if bloodtype == -2 {
1957 1958
 		//统计收缩压一月总数
1958
-		_, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1959
-		_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1959
+		januarylist, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1960
+		//_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1960 1961
 
1961 1962
 		//二月
1962
-		_, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1963
-		_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1963
+		feblist, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1964
+		//_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1964 1965
 
1965 1966
 		//三月
1966
-		_, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1967
-		_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1967
+		marchlist, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1968
+		//_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1968 1969
 
1969 1970
 		//四月
1970
-		_, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1971
-		_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1971
+		aprlist, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1972
+		//_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1972 1973
 
1973 1974
 		//五月
1974
-		_, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1975
-		_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1975
+		maylist, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1976
+		//_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1976 1977
 
1977 1978
 		//六月
1978
-		_, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1979
-		_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1979
+		junlist, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1980
+		//_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1980 1981
 		//7月
1981
-		_, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1982
-		_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1982
+		jullist, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1983
+		//_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1983 1984
 
1984 1985
 		//8月
1985
-		_, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1986
-		_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1986
+		auglist, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1987
+		//_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1987 1988
 
1988 1989
 		//9月
1989
-		_, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1990
-		_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1990
+		seplist, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1991
+		//_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1991 1992
 		//10月
1992
-		_, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1993
-		_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
1993
+		octlist, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1994
+		//_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
1994 1995
 		//11月
1995
-		_, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1996
-		_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
1996
+		novlist, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1997
+		//_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
1997 1998
 		//12月
1998
-		_, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1999
-		_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
1999
+		declist, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
2000
+		//_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
2000 2001
 		if err != nil {
2001 2002
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2002 2003
 			return
2003 2004
 		}
2004 2005
 
2005 2006
 		this.ServeSuccessJSON(map[string]interface{}{
2006
-			"januaryTotal":      januaryTotal,
2007
-			"januaryStandTotal": januaryStandTotal,
2008
-			"febTotal":          febTotal,
2009
-			"febStandTotal":     febStandTotal,
2010
-			"marchTotal":        marchTotal,
2011
-			"marchStandTotal":   marchStandTotal,
2012
-			"aprTotal":          aprTotal,
2013
-			"aprStandTotal":     aprStandTotal,
2014
-			"mayTotal":          mayTotal,
2015
-			"mayStandTotal":     mayStandTotal,
2016
-			"junTotal":          junTotal,
2017
-			"junStandTotal":     junStandTotal,
2018
-			"julTotal":          julTotal,
2019
-			"julStandTotal":     julStandTotal,
2020
-			"augTotal":          augTotal,
2021
-			"augStandTotal":     augStandTotal,
2022
-			"sepTotal":          sepTotal,
2023
-			"sepStandTotal":     sepStandTotal,
2024
-			"octTotal":          octTotal,
2025
-			"octStandTotal":     octStandTotal,
2026
-			"novTotal":          novTotal,
2027
-			"novStandTotal":     novStandTotal,
2028
-			"decTotal":          decTotal,
2029
-			"decStandTotal":     decStandTotal,
2007
+			"januaryTotal": januaryTotal,
2008
+			"januarylist":  januarylist,
2009
+			"febTotal":     febTotal,
2010
+			"feblist":      feblist,
2011
+			"marchTotal":   marchTotal,
2012
+			"marchlist":    marchlist,
2013
+			"aprTotal":     aprTotal,
2014
+			"aprlist":      aprlist,
2015
+			"mayTotal":     mayTotal,
2016
+			"maylist":      maylist,
2017
+			"junTotal":     junTotal,
2018
+			"junlist":      junlist,
2019
+			"julTotal":     julTotal,
2020
+			"jullist":      jullist,
2021
+			"augTotal":     augTotal,
2022
+			"auglist":      auglist,
2023
+			"sepTotal":     sepTotal,
2024
+			"seplist":      seplist,
2025
+			"octTotal":     octTotal,
2026
+			"octlist":      octlist,
2027
+			"novTotal":     novTotal,
2028
+			"novlist":      novlist,
2029
+			"decTotal":     decTotal,
2030
+			"declist":      declist,
2030 2031
 		})
2031 2032
 	}
2032 2033
 }

+ 220 - 144
controllers/new_mobile_api_controllers/new_common_api_controller.go View File

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/utils"
8 8
 	"encoding/json"
9 9
 	"fmt"
10
+	"strconv"
10 11
 	"time"
11 12
 )
12 13
 
@@ -522,29 +523,27 @@ func (this *NewCommonApiController) GetMobileFirstQuarter() {
522 523
 	count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
523 524
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
524 525
 	//获取收缩压数据
525
-	_, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
526
+	systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
526 527
 	//统计收缩压合格的数据
527
-	systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
528
+	//systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
528 529
 
529 530
 	//获取舒张压数据
530
-	_, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
531
+	diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
531 532
 	//获取合格舒张压数据
532
-	diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
533
-	normData, _ := service.GetNormData(orgid)
533
+	//diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
534
+	normData, _ := service.GetNormDataByOrgId(orgid)
534 535
 	if err != nil {
535 536
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
536 537
 		return
537 538
 	}
538 539
 	this.ServeSuccessJSON(map[string]interface{}{
539
-		"count":          count,
540
-		"countwo":        countwo,
541
-		"systolic":       systolic,
542
-		"systolicTotal":  systolicTotal,
543
-		"sysstandTotal":  sysstandTotal,
544
-		"diastolic":      diastolic,
545
-		"diastotal":      diastotal,
546
-		"diasstandtotal": diasstandtotal,
547
-		"normData":       normData,
540
+		"count":         count,
541
+		"countwo":       countwo,
542
+		"systolic":      systolic,
543
+		"systolicTotal": systolicTotal,
544
+		"diastolic":     diastolic,
545
+		"diastotal":     diastotal,
546
+		"normData":      normData,
548 547
 	})
549 548
 }
550 549
 
@@ -1029,47 +1028,47 @@ func (this *NewCommonApiController) GetMoblieBloodList() {
1029 1028
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1030 1029
 	if bloodType == -1 {
1031 1030
 		//统计收缩压第一季度的总数
1032
-		_, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1031
+		firstlist, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1033 1032
 		//统计收缩压第一季合格的总数
1034
-		_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1033
+		//_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1035 1034
 		//统计第二季收缩压总数
1036
-		_, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1035
+		secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1037 1036
 		//第二季度合格总数
1038
-		_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1037
+		//_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1039 1038
 		//统计第三季收缩压总数
1040
-		_, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1039
+		threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1041 1040
 		//第三季度合格数
1042
-		_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1041
+		//_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1043 1042
 		//第四季度总数
1044
-		_, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1043
+		fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1045 1044
 		//第四季度合格总数
1046
-		_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1045
+		//_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1047 1046
 		if err != nil {
1048 1047
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1049 1048
 			return
1050 1049
 		}
1051 1050
 
1052 1051
 		this.ServeSuccessJSON(map[string]interface{}{
1053
-			"firstTotal":        firstTotal,
1054
-			"firstStandTotal":   firstStandTotal,
1055
-			"secondeTotal":      secondeTotal,
1056
-			"secondeStandTotal": secondeStandTotal,
1057
-			"threeTotal":        threeTotal,
1058
-			"threeStandTotal":   threeStandTotal,
1059
-			"fourTotal":         fourTotal,
1060
-			"fourStandTotal":    fourStandTotal,
1052
+			"firstTotal":   firstTotal,
1053
+			"firstlist":    firstlist,
1054
+			"secondeTotal": secondeTotal,
1055
+			"secondelist":  secondelist,
1056
+			"threeTotal":   threeTotal,
1057
+			"threelist":    threelist,
1058
+			"fourTotal":    fourTotal,
1059
+			"fourlist":     fourlist,
1061 1060
 		})
1062 1061
 	}
1063 1062
 	if bloodType == -2 {
1064 1063
 		//统计舒张压第一季度的总数
1065
-		_, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1066
-		_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1067
-		_, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1068
-		_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1069
-		_, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1070
-		_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1071
-		_, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1072
-		_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1064
+		firstlist, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1065
+		//_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1066
+		secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1067
+		//_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1068
+		threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1069
+		//_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1070
+		fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1071
+		//_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1073 1072
 
1074 1073
 		if err != nil {
1075 1074
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -1077,14 +1076,14 @@ func (this *NewCommonApiController) GetMoblieBloodList() {
1077 1076
 		}
1078 1077
 
1079 1078
 		this.ServeSuccessJSON(map[string]interface{}{
1080
-			"firstTotal":        firstTotal,
1081
-			"firstStandTotal":   firstStandTotal,
1082
-			"secondeTotal":      secondeTotal,
1083
-			"secondeStandTotal": secondeStandTotal,
1084
-			"threeTotal":        threeTotal,
1085
-			"threeStandTotal":   threeStandTotal,
1086
-			"fourTotal":         fourTotal,
1087
-			"fourStandTotal":    fourStandTotal,
1079
+			"firstTotal":   firstTotal,
1080
+			"firstlist":    firstlist,
1081
+			"secondeTotal": secondeTotal,
1082
+			"secondelist":  secondelist,
1083
+			"threeTotal":   threeTotal,
1084
+			"threelist":    threelist,
1085
+			"fourTotal":    fourTotal,
1086
+			"fourlist":     fourlist,
1088 1087
 		})
1089 1088
 	}
1090 1089
 }
@@ -1231,156 +1230,156 @@ func (this *NewCommonApiController) GetBloodMonthList() {
1231 1230
 	//统计收缩压
1232 1231
 	if bloodtype == -1 {
1233 1232
 		//统计收缩压一月总数
1234
-		_, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1235
-		_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1233
+		januarylist, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1234
+		//_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1236 1235
 
1237 1236
 		//二月
1238
-		_, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1239
-		_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1237
+		feblist, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1238
+		//_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1240 1239
 
1241 1240
 		//三月
1242
-		_, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1243
-		_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1241
+		marlist, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1242
+		//_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1244 1243
 
1245 1244
 		//四月
1246
-		_, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1247
-		_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1245
+		aprlist, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1246
+		//_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1248 1247
 
1249 1248
 		//五月
1250
-		_, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1251
-		_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1249
+		maylist, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1250
+		//_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1252 1251
 
1253 1252
 		//六月
1254
-		_, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1255
-		_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1253
+		junlist, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1254
+		//_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1256 1255
 		//7月
1257
-		_, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1258
-		_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1256
+		jullist, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1257
+		//_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1259 1258
 
1260 1259
 		//8月
1261
-		_, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1262
-		_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1260
+		auglist, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1261
+		//_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1263 1262
 
1264 1263
 		//9月
1265
-		_, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1266
-		_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1264
+		seplist, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1265
+		//_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1267 1266
 		//10月
1268
-		_, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1269
-		_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1267
+		octlist, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1268
+		//_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1270 1269
 		//11月
1271
-		_, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1272
-		_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1270
+		novlist, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1271
+		//_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1273 1272
 		//12月
1274
-		_, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1275
-		_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1273
+		declist, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1274
+		//_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1276 1275
 		if err != nil {
1277 1276
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1278 1277
 			return
1279 1278
 		}
1280 1279
 
1281 1280
 		this.ServeSuccessJSON(map[string]interface{}{
1282
-			"januaryTotal":      januaryTotal,
1283
-			"januaryStandTotal": januaryStandTotal,
1284
-			"febTotal":          febTotal,
1285
-			"febStandTotal":     febStandTotal,
1286
-			"marchTotal":        marchTotal,
1287
-			"marchStandTotal":   marchStandTotal,
1288
-			"aprTotal":          aprTotal,
1289
-			"aprStandTotal":     aprStandTotal,
1290
-			"mayTotal":          mayTotal,
1291
-			"mayStandTotal":     mayStandTotal,
1292
-			"junTotal":          junTotal,
1293
-			"junStandTotal":     junStandTotal,
1294
-			"julTotal":          julTotal,
1295
-			"julStandTotal":     julStandTotal,
1296
-			"augTotal":          augTotal,
1297
-			"augStandTotal":     augStandTotal,
1298
-			"sepTotal":          sepTotal,
1299
-			"sepStandTotal":     sepStandTotal,
1300
-			"octTotal":          octTotal,
1301
-			"octStandTotal":     octStandTotal,
1302
-			"novTotal":          novTotal,
1303
-			"novStandTotal":     novStandTotal,
1304
-			"decTotal":          decTotal,
1305
-			"decStandTotal":     decStandTotal,
1281
+			"januaryTotal": januaryTotal,
1282
+			"januarylist":  januarylist,
1283
+			"febTotal":     febTotal,
1284
+			"feblist":      feblist,
1285
+			"marchTotal":   marchTotal,
1286
+			"marlist":      marlist,
1287
+			"aprTotal":     aprTotal,
1288
+			"aprlist":      aprlist,
1289
+			"mayTotal":     mayTotal,
1290
+			"maylist":      maylist,
1291
+			"junTotal":     junTotal,
1292
+			"junlist":      junlist,
1293
+			"julTotal":     julTotal,
1294
+			"jullist":      jullist,
1295
+			"augTotal":     augTotal,
1296
+			"auglist":      auglist,
1297
+			"sepTotal":     sepTotal,
1298
+			"seplist":      seplist,
1299
+			"octTotal":     octTotal,
1300
+			"octlist":      octlist,
1301
+			"novTotal":     novTotal,
1302
+			"novlist":      novlist,
1303
+			"decTotal":     decTotal,
1304
+			"declist":      declist,
1306 1305
 		})
1307 1306
 	}
1308 1307
 
1309 1308
 	//统计舒张压
1310 1309
 	if bloodtype == -2 {
1311 1310
 		//统计收缩压一月总数
1312
-		_, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1313
-		_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1311
+		januarylist, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1312
+		//_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1314 1313
 
1315 1314
 		//二月
1316
-		_, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1317
-		_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1315
+		feblist, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1316
+		//_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1318 1317
 
1319 1318
 		//三月
1320
-		_, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1321
-		_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1319
+		marlist, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1320
+		//_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1322 1321
 
1323 1322
 		//四月
1324
-		_, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1325
-		_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1323
+		aprlist, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1324
+		//_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1326 1325
 
1327 1326
 		//五月
1328
-		_, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1329
-		_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1327
+		maylist, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1328
+		//_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1330 1329
 
1331 1330
 		//六月
1332
-		_, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1333
-		_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1331
+		junlist, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1332
+		//_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1334 1333
 		//7月
1335
-		_, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1336
-		_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1334
+		jullist, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1335
+		//_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1337 1336
 
1338 1337
 		//8月
1339
-		_, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1340
-		_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1338
+		auglist, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1339
+		//_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1341 1340
 
1342 1341
 		//9月
1343
-		_, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1344
-		_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1342
+		seplist, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1343
+		//_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1345 1344
 		//10月
1346
-		_, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1347
-		_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
1345
+		octlist, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1346
+		//_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
1348 1347
 		//11月
1349
-		_, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1350
-		_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
1348
+		novlist, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1349
+		//_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
1351 1350
 		//12月
1352
-		_, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1353
-		_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
1351
+		declist, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1352
+		//_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
1354 1353
 		if err != nil {
1355 1354
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1356 1355
 			return
1357 1356
 		}
1358 1357
 
1359 1358
 		this.ServeSuccessJSON(map[string]interface{}{
1360
-			"januaryTotal":      januaryTotal,
1361
-			"januaryStandTotal": januaryStandTotal,
1362
-			"febTotal":          febTotal,
1363
-			"febStandTotal":     febStandTotal,
1364
-			"marchTotal":        marchTotal,
1365
-			"marchStandTotal":   marchStandTotal,
1366
-			"aprTotal":          aprTotal,
1367
-			"aprStandTotal":     aprStandTotal,
1368
-			"mayTotal":          mayTotal,
1369
-			"mayStandTotal":     mayStandTotal,
1370
-			"junTotal":          junTotal,
1371
-			"junStandTotal":     junStandTotal,
1372
-			"julTotal":          julTotal,
1373
-			"julStandTotal":     julStandTotal,
1374
-			"augTotal":          augTotal,
1375
-			"augStandTotal":     augStandTotal,
1376
-			"sepTotal":          sepTotal,
1377
-			"sepStandTotal":     sepStandTotal,
1378
-			"octTotal":          octTotal,
1379
-			"octStandTotal":     octStandTotal,
1380
-			"novTotal":          novTotal,
1381
-			"novStandTotal":     novStandTotal,
1382
-			"decTotal":          decTotal,
1383
-			"decStandTotal":     decStandTotal,
1359
+			"januaryTotal": januaryTotal,
1360
+			"januarylist":  januarylist,
1361
+			"febTotal":     febTotal,
1362
+			"feblist":      feblist,
1363
+			"marchTotal":   marchTotal,
1364
+			"marlist":      marlist,
1365
+			"aprTotal":     aprTotal,
1366
+			"aprlist":      aprlist,
1367
+			"mayTotal":     mayTotal,
1368
+			"maylist":      maylist,
1369
+			"junTotal":     junTotal,
1370
+			"junlist":      junlist,
1371
+			"julTotal":     julTotal,
1372
+			"jullist":      jullist,
1373
+			"augTotal":     augTotal,
1374
+			"auglist":      auglist,
1375
+			"sepTotal":     sepTotal,
1376
+			"seplist":      seplist,
1377
+			"octTotal":     octTotal,
1378
+			"octlist":      octlist,
1379
+			"novTotal":     novTotal,
1380
+			"novlist":      novlist,
1381
+			"decTotal":     decTotal,
1382
+			"declist":      declist,
1384 1383
 		})
1385 1384
 	}
1386 1385
 }
@@ -1946,15 +1945,37 @@ func (this *NewCommonApiController) GetSystolicBloodStand() {
1946 1945
 	fmt.Println(endtimeUnix)
1947 1946
 
1948 1947
 	//获取数据
1949
-	recordList, err := service.GetDiastolicStand(orgId, startimeUnix, endtimeUnix)
1948
+	//recordList, err := service.GetDiastolicStand(orgId, startimeUnix, endtimeUnix,page,limit)
1950 1949
 	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
1950
+	var sysMin string
1951
+	var sysLarge string
1952
+	var diaMin string
1953
+	var diaLarge string
1954
+	for index, value := range bloodPressure {
1955
+		fmt.Println("index", index)
1956
+		if value.InspectionMajor == 0 && value.InspectionMinor == -1 {
1957
+			sysMin = value.MinRange
1958
+			sysLarge = value.LargeRange
1959
+		}
1960
+		if value.InspectionMajor == 0 && value.InspectionMinor == -2 {
1961
+			diaMin = value.MinRange
1962
+			diaLarge = value.LargeRange
1963
+		}
1964
+	}
1965
+	sysmin, err := strconv.ParseInt(sysMin, 10, 64)
1966
+	syslarge, err := strconv.ParseInt(sysLarge, 10, 64)
1967
+	diamin, err := strconv.ParseInt(diaMin, 10, 64)
1968
+	dialarge, err := strconv.ParseInt(diaLarge, 10, 64)
1969
+	recordtwo, err := service.TotalSysStandCountTwo(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge)
1970
+	record, err := service.TotalSysStandCount(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge, page, limit)
1951 1971
 	if err != nil {
1952 1972
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1953 1973
 		return
1954 1974
 	}
1955 1975
 	this.ServeSuccessJSON(map[string]interface{}{
1956
-		"recordList":    recordList,
1976
+		"record":        record,
1957 1977
 		"bloodPressure": bloodPressure,
1978
+		"recordtwo":     recordtwo,
1958 1979
 	})
1959 1980
 }
1960 1981
 
@@ -1981,3 +2002,58 @@ func (this *NewCommonApiController) GetMobileIdsList() {
1981 2002
 		"vlist": vlist,
1982 2003
 	})
1983 2004
 }
2005
+
2006
+func (this *NewCommonApiController) GetSystolicBloodNoStand() {
2007
+	adminUser := this.GetMobileAdminUserInfo()
2008
+	orgId := adminUser.Org.Id
2009
+	fmt.Println("orgID", orgId)
2010
+	timeLayout := "2006-01-02"
2011
+	loc, _ := time.LoadLocation("Local")
2012
+	startime := this.GetString("startime")
2013
+	endtime := this.GetString("endtime")
2014
+	limit, _ := this.GetInt64("limit")
2015
+	fmt.Println("limit", limit)
2016
+	page, _ := this.GetInt64("page")
2017
+	fmt.Println("page", page)
2018
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
2019
+	startimeUnix := startTimes.Unix()
2020
+	fmt.Println(startimeUnix)
2021
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
2022
+	endtimeUnix := endtimes.Unix()
2023
+	fmt.Println(endtimeUnix)
2024
+
2025
+	//获取数据
2026
+	//recordList, err := service.GetDiastolicStand(orgId, startimeUnix, endtimeUnix,page,limit)
2027
+	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
2028
+	var sysMin string
2029
+	var sysLarge string
2030
+	var diaMin string
2031
+	var diaLarge string
2032
+	for index, value := range bloodPressure {
2033
+		fmt.Println("index", index)
2034
+		if value.InspectionMajor == 0 && value.InspectionMinor == -1 {
2035
+			sysMin = value.MinRange
2036
+			sysLarge = value.LargeRange
2037
+		}
2038
+		if value.InspectionMajor == 0 && value.InspectionMinor == -2 {
2039
+			diaMin = value.MinRange
2040
+			diaLarge = value.LargeRange
2041
+		}
2042
+	}
2043
+	sysmin, err := strconv.ParseInt(sysMin, 10, 64)
2044
+	syslarge, err := strconv.ParseInt(sysLarge, 10, 64)
2045
+	diamin, err := strconv.ParseInt(diaMin, 10, 64)
2046
+	dialarge, err := strconv.ParseInt(diaLarge, 10, 64)
2047
+
2048
+	recoredtwo, err := service.TotalSysNoStandCountTwo(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge)
2049
+	record, err := service.TotalSysNoStandCount(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge, page, limit)
2050
+	if err != nil {
2051
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2052
+		return
2053
+	}
2054
+	this.ServeSuccessJSON(map[string]interface{}{
2055
+		"record":        record,
2056
+		"bloodPressure": bloodPressure,
2057
+		"recoredtwo":    recoredtwo,
2058
+	})
2059
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_common_api_router.go View File

@@ -41,4 +41,5 @@ func NewCommonApiControllersRegisterRouters() {
41 41
 	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
42 42
 	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
43 43
 	beego.Router("/m/api/getmobileidslist", &NewCommonApiController{}, "post:GetMobileIdsList")
44
+	beego.Router("/m/api/getsystolicbloodnostand", &NewCommonApiController{}, "Get:GetSystolicBloodNoStand")
44 45
 }

+ 5 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -578,6 +578,7 @@ func (this *NewDialysisApiController) GetPatientDetail() {
578 578
 	id, _ := this.GetInt64("id")
579 579
 	//获取病人详情信息
580 580
 	detail, err := service.GetPatientDetailTwo(id)
581
+
581 582
 	//获取传染病详情
582 583
 	diseases := service.GetPatientDiseasesTwo(detail.BloodId)
583 584
 	//获取慢病传染病
@@ -1257,8 +1258,8 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1257 1258
 	fmt.Print("透析号", dialysis)
1258 1259
 	patientsoure := int64(dataBody["patientsoure"].(float64))
1259 1260
 	fmt.Print("患者来源", patientsoure)
1260
-	//lapseto := int64(dataBody["lapseto"].(float64))
1261
-	//fmt.Print("留置状态", lapseto)
1261
+	lapseto := int64(dataBody["lapseto"].(float64))
1262
+	fmt.Print("留置状态", lapseto)
1262 1263
 	contagions := dataBody["resultTwo"].([]interface{})
1263 1264
 	fmt.Print("传染病", contagions)
1264 1265
 	ids := make([]int64, 0)
@@ -1372,6 +1373,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1372 1373
 			Avatar:            avatar,
1373 1374
 			IdCardNo:          idCard,
1374 1375
 			IsInfectious:      is_infectious,
1376
+			Lapseto:           lapseto,
1375 1377
 		}
1376 1378
 		err = service.UpdatedPatient(patients, patient.BloodId)
1377 1379
 		//patientLapseto := models.PatientLapseto{
@@ -1399,6 +1401,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1399 1401
 			Avatar:            avatar,
1400 1402
 			IdCardNo:          idCard,
1401 1403
 			IsInfectious:      is_infectious,
1404
+			Lapseto:           lapseto,
1402 1405
 		}
1403 1406
 		err = service.UpdateXtPatientNew(patientsNew, id)
1404 1407
 		if err != nil {

+ 218 - 0
controllers/new_mobile_api_controllers/new_manage_api_controller.go View File

@@ -0,0 +1,218 @@
1
+package new_mobile_api_controllers
2
+
3
+import (
4
+	"XT_New/controllers/mobile_api_controllers"
5
+	"XT_New/enums"
6
+	"XT_New/models"
7
+	"XT_New/service"
8
+	"XT_New/utils"
9
+	"fmt"
10
+	"github.com/jinzhu/gorm"
11
+	"strconv"
12
+	"time"
13
+)
14
+
15
+type NewManageApiController struct {
16
+	mobile_api_controllers.MobileBaseAPIAuthController
17
+}
18
+
19
+func (this *NewManageApiController) GetEquitAutoInfo() {
20
+
21
+	adminUser := this.GetMobileAdminUserInfo()
22
+	orgid := adminUser.Org.Id
23
+	remander, err := service.GetRemanderData(orgid)
24
+	if err != nil {
25
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
26
+		return
27
+	}
28
+	this.ServeSuccessJSON(map[string]interface{}{
29
+		"remander": remander,
30
+	})
31
+}
32
+
33
+func (this *NewManageApiController) GetDisInfectionTime() {
34
+	adminUser := this.GetMobileAdminUserInfo()
35
+	orgid := adminUser.Org.Id
36
+	bedid, _ := this.GetInt64("bed_id")
37
+	scheduletype, _ := this.GetInt64("schedule_type")
38
+	scheduleweek, _ := this.GetInt64("schedule_week")
39
+	fmt.Println(scheduleweek)
40
+	scheduledate, _ := this.GetInt64("schedule_date")
41
+
42
+	//根据床位号获取设备型号
43
+	unitType, _ := service.GetUnitType(bedid, orgid)
44
+	//查询使用登记最后一条消毒记录
45
+	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid, scheduledate, scheduletype)
46
+	fmt.Println("infomation========", infomation)
47
+	fmt.Println("err-------", err)
48
+	if err == gorm.ErrRecordNotFound {
49
+		//查询改设备是否有消毒计划
50
+		plan, errcode := service.GetDisInfectionTime(orgid, unitType.UnitType, scheduletype, scheduleweek)
51
+		//如果没有消毒计划,去查询该设备的上次消毒时间
52
+		if errcode == gorm.ErrRecordNotFound {
53
+			infor, errco := service.GetLaseDeviceInfomationTwo(orgid, bedid, scheduletype)
54
+			if errco != nil {
55
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
56
+				return
57
+			}
58
+			this.ServeSuccessJSON(map[string]interface{}{
59
+				"plan": infor.LongTime,
60
+			})
61
+		} else if errcode == nil {
62
+			this.ServeSuccessJSON(map[string]interface{}{
63
+				"plan": plan.DisinfecTime,
64
+			})
65
+		}
66
+	} else if err == nil {
67
+		this.ServeSuccessJSON(map[string]interface{}{
68
+			"plan":       infomation.LongTime,
69
+			"infomation": infomation,
70
+		})
71
+	}
72
+	//查询改设备是否有消毒计划
73
+	//plan, err := service.GetDisInfectionTime(orgid, bedid, scheduletype, scheduleweek)
74
+	//if err == gorm.ErrRecordNotFound {
75
+	//	//去查询使用登记最后一条数据
76
+	//	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid)
77
+	//	if err != nil {
78
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
79
+	//		return
80
+	//	}
81
+	//	this.ServeSuccessJSON(map[string]interface{}{
82
+	//		"plan": infomation.LongTime,
83
+	//	})
84
+	//} else if err == nil {
85
+	//	if err != nil {
86
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
87
+	//		return
88
+	//	}
89
+	//	this.ServeSuccessJSON(map[string]interface{}{
90
+	//		"plan": plan.DisinfecTime,
91
+	//	})
92
+	//} else {
93
+	//
94
+	//}
95
+
96
+}
97
+
98
+func (this *NewManageApiController) SaveDisInfectionInfo() {
99
+	adminUser := this.GetMobileAdminUserInfo()
100
+	orgid := adminUser.Org.Id
101
+	bedid, _ := this.GetInt64("bed_id")
102
+	start_time := this.GetString("start_time")
103
+	startdate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", start_time)
104
+	startdateunix := startdate.Unix()
105
+	disinfectime, _ := this.GetInt64("disinfec_time")
106
+	endtime := this.GetString("end_time")
107
+	enddate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endtime)
108
+	enddateunix := enddate.Unix()
109
+	scheduledate, _ := this.GetInt64("schedule_date")
110
+	zoneid, _ := this.GetInt64("zone_id")
111
+	patientid, _ := this.GetInt64("patient_id")
112
+	modeid, _ := this.GetInt64("mode_id")
113
+	scheduletype, _ := this.GetInt64("schedule_type")
114
+
115
+	//查询病人信息
116
+	patients, _ := service.GetPatientInfoMation(patientid)
117
+	var con = ""
118
+	if patients.IsInfectious == 0 {
119
+		con = ""
120
+	}
121
+	if patients.IsInfectious == 1 {
122
+		con = "无"
123
+	}
124
+	if patients.IsInfectious == 2 {
125
+		con = "有"
126
+	}
127
+	//查询病人上机信息
128
+	order, _ := service.GetPatientOrderInfo(scheduledate, patientid, orgid)
129
+	//查询病人今日透后评估数据
130
+	dislysis, _ := service.GetAssessmentAfterDissDataTwo(patientid, orgid, scheduledate)
131
+	fmt.Println("透析减少", dislysis.WeightLoss)
132
+	//			//根据床位号获取设备id
133
+	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
134
+	//unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
135
+	//fmt.Println(unitype)
136
+	plan, errplan := service.GetDisinfectionTwo(addmacher.UnitType, scheduletype, orgid)
137
+	//counts, errplan := service.GetUserTotalCount(orgid, bedid)
138
+	//var usertoal  int64
139
+	//fmt.Println(usertoal)
140
+	//for index, count := range counts {
141
+	//   if(index == 0){
142
+	//      usertoal = count.Total
143
+	//   }
144
+	//}
145
+	//usertotalint, errplan := strconv.ParseInt(addmacher.UserTotal, 10, 64)
146
+	//var total = usertoal + usertotalint
147
+	//totals := strconv.FormatInt(total, 10)
148
+	if errplan == gorm.ErrRecordNotFound {
149
+		returnData := make(map[string]interface{}, 0)
150
+		returnData["msstatus"] = "2"
151
+		this.ServeSuccessJSON(returnData)
152
+		return
153
+	} else {
154
+		_, errcode := service.GetInforTwo(patientid, scheduledate, orgid, scheduletype)
155
+		if errcode == gorm.ErrRecordNotFound {
156
+			information := models.DeviceInformation{
157
+				Date:                  scheduledate,
158
+				Zone:                  zoneid,
159
+				Class:                 scheduletype,
160
+				BedNumber:             bedid,
161
+				PatientId:             patientid,
162
+				DialysisMode:          modeid,
163
+				LongTime:              strconv.FormatInt(disinfectime, 10),
164
+				Disinfection:          1,
165
+				DialysisConcentration: 1,
166
+				DisinfectionStatus:    1,
167
+				Move:                  1,
168
+				UserOrgId:             orgid,
169
+				DisinfectType:         plan.Way,
170
+				DisinfectantType:      plan.MachineDisinfectant,
171
+				FluidPath:             plan.DisinfectanWay, //液路消毒方式
172
+				Disinfectant:          plan.Disinfectant,
173
+				Ctime:                 time.Now().Unix(),
174
+				Status:                1,
175
+				SignName:              order.FinishNurse,
176
+				EquimentId:            addmacher.ID,
177
+				DisinfectionResidue:   2,
178
+				Bed:                   addmacher.BedNumber,
179
+				StartTime:             order.StartTime,
180
+				EndTime:               order.EndTime,
181
+				Contagion:             con,
182
+				WeightLoss:            dislysis.WeightLoss,
183
+				Hyperfiltratio:        dislysis.ActualUltrafiltration,
184
+				DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
185
+				MachineRun:            1,
186
+				DisinfecStartime:      startdateunix,
187
+				DisinfecEndtime:       enddateunix,
188
+			}
189
+			err := service.CreateInformationTwo(&information)
190
+			fmt.Println("报错", err)
191
+			if err != nil {
192
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
193
+				return
194
+			}
195
+			this.ServeSuccessJSON(map[string]interface{}{
196
+				"information": information,
197
+			})
198
+		} else if errcode == nil {
199
+			information := models.DeviceInformation{
200
+				DisinfecStartime: startdateunix,
201
+				DisinfecEndtime:  enddateunix,
202
+				LongTime:         strconv.FormatInt(disinfectime, 10),
203
+			}
204
+
205
+			errcode := service.UpdateInformation(&information, scheduledate, bedid, scheduletype)
206
+			if errcode != nil {
207
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
208
+				return
209
+			}
210
+			this.ServeSuccessJSON(map[string]interface{}{
211
+				"information": information,
212
+			})
213
+		} else {
214
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
215
+			return
216
+		}
217
+	}
218
+}

+ 10 - 0
controllers/new_mobile_api_controllers/new_manage_api_router.go View File

@@ -0,0 +1,10 @@
1
+package new_mobile_api_controllers
2
+
3
+import "github.com/astaxie/beego"
4
+
5
+func NewManageApiControllersRegisterRouters() {
6
+
7
+	beego.Router("m/api/getequitautoinfo", &NewManageApiController{}, "Get:GetEquitAutoInfo")
8
+	beego.Router("m/api/getdisinfection", &NewManageApiController{}, "Get:GetDisInfectionTime")
9
+	beego.Router("/m/api/savedisinfectioninfo", &NewManageApiController{}, "Get:SaveDisInfectionInfo")
10
+}

+ 79 - 80
controllers/patient_api_controller.go View File

@@ -252,29 +252,29 @@ func (c *PatientApiController) CreatePatient() {
252 252
 	//获取老表的最后一条数据
253 253
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
254 254
 	patientsNew := models.XtPatientsNew{
255
-		UserOrgId:          adminUserInfo.CurrentOrgId,
256
-		UserId:             0,
257
-		Avatar:             patients.Avatar,
258
-		PatientType:        patients.PatientType,
259
-		DialysisNo:         patients.DialysisNo,
260
-		AdmissionNumber:    patients.AdmissionNumber,
261
-		Source:             patients.Source,
262
-		Lapseto:            patients.Lapseto,
263
-		PartitionId:        patients.PartitionId,
264
-		BedId:              patients.BedId,
265
-		Name:               patients.Name,
266
-		Alias:              patients.Alias,
267
-		Gender:             patients.Gender,
268
-		MaritalStatus:      patients.MaritalStatus,
269
-		IdCardNo:           patients.IdCardNo,
270
-		Birthday:           patients.Birthday,
271
-		ReimbursementWayId: patients.ReimbursementWayId,
272
-		HealthCareType:     patients.HealthCareType,
273
-		HealthCareNo:       patients.HealthCareNo,
274
-		HealthCareDueDate:  patients.HealthCareDueDate,
275
-		Height:             patients.Height,
276
-		BloodType:          patients.BloodType,
277
-		Rh:                 patients.Rh,
255
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
256
+		UserId:                       0,
257
+		Avatar:                       patients.Avatar,
258
+		PatientType:                  patients.PatientType,
259
+		DialysisNo:                   patients.DialysisNo,
260
+		AdmissionNumber:              patients.AdmissionNumber,
261
+		Source:                       patients.Source,
262
+		Lapseto:                      patients.Lapseto,
263
+		PartitionId:                  patients.PartitionId,
264
+		BedId:                        patients.BedId,
265
+		Name:                         patients.Name,
266
+		Alias:                        patients.Alias,
267
+		Gender:                       patients.Gender,
268
+		MaritalStatus:                patients.MaritalStatus,
269
+		IdCardNo:                     patients.IdCardNo,
270
+		Birthday:                     patients.Birthday,
271
+		ReimbursementWayId:           patients.ReimbursementWayId,
272
+		HealthCareType:               patients.HealthCareType,
273
+		HealthCareNo:                 patients.HealthCareNo,
274
+		HealthCareDueDate:            patients.HealthCareDueDate,
275
+		Height:                       patients.Height,
276
+		BloodType:                    patients.BloodType,
277
+		Rh:                           patients.Rh,
278 278
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
279 279
 		EducationLevel:               patients.EducationLevel,
280 280
 		Profession:                   patients.Profession,
@@ -320,28 +320,28 @@ func (c *PatientApiController) CreatePatient() {
320 320
 		Nation:                       patients.Nation,
321 321
 		NativePlace:                  patients.NativePlace,
322 322
 		Age:                          patients.Age,
323
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
324
-		IsInfectious:             patients.IsInfectious,
325
-		RemindCycle:              patients.RemindCycle,
326
-		ResponseResult:           patients.ResponseResult,
327
-		IsOpenRemind:             patients.IsOpenRemind,
328
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
329
-		DialysisAge:              patients.DialysisAge,
330
-		ExpenseKind:              patients.ExpenseKind,
331
-		TellPhone:                patients.TellPhone,
332
-		ContactName:              patients.ContactName,
333
-		BloodPatients:            1,
334
-		SlowPatients:             0,
335
-		MemberPatients:           0,
336
-		EcommerPatients:          "",
337
-		BloodId:                  patients.ID,
338
-		SlowId:                   0,
339
-		MemberId:                 0,
340
-		MemberFistdate:           0,
341
-		MemberPatienttype:        0,
342
-		MemberTreatement:         0,
343
-		EquitmentId:              "",
344
-		UserSysBeforeCount:       patient.UserSysBeforeCount,
323
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
324
+		IsInfectious:                 patients.IsInfectious,
325
+		RemindCycle:                  patients.RemindCycle,
326
+		ResponseResult:               patients.ResponseResult,
327
+		IsOpenRemind:                 patients.IsOpenRemind,
328
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
329
+		DialysisAge:                  patients.DialysisAge,
330
+		ExpenseKind:                  patients.ExpenseKind,
331
+		TellPhone:                    patients.TellPhone,
332
+		ContactName:                  patients.ContactName,
333
+		BloodPatients:                1,
334
+		SlowPatients:                 0,
335
+		MemberPatients:               0,
336
+		EcommerPatients:              "",
337
+		BloodId:                      patients.ID,
338
+		SlowId:                       0,
339
+		MemberId:                     0,
340
+		MemberFistdate:               0,
341
+		MemberPatienttype:            0,
342
+		MemberTreatement:             0,
343
+		EquitmentId:                  "",
344
+		UserSysBeforeCount:           patient.UserSysBeforeCount,
345 345
 	}
346 346
 
347 347
 	err = service.CreatePatientsNew(&patientsNew)
@@ -461,7 +461,6 @@ func (c *PatientApiController) EditPatient() {
461 461
 	patient.UpdatedTime = time.Now().Unix()
462 462
 	patient.IsInfectious = is_infectious
463 463
 	patient.RemindCycle = remind_cycle
464
-
465 464
 	err := service.UpdatePatient(&patient, contagions, diseases)
466 465
 	if err != nil {
467 466
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdatePatient)
@@ -480,28 +479,28 @@ func (c *PatientApiController) EditPatient() {
480 479
 		return
481 480
 	}
482 481
 	patientsNew := models.XtPatientsNew{
483
-		UserOrgId:          patient.UserOrgId,
484
-		UserId:             patient.UserId,
485
-		Avatar:             patient.Avatar,
486
-		PatientType:        patient.PatientType,
487
-		DialysisNo:         patient.DialysisNo,
488
-		AdmissionNumber:    patient.AdmissionNumber,
489
-		Source:             patient.Source,
490
-		PartitionId:        patient.PartitionId,
491
-		BedId:              patient.BedId,
492
-		Name:               patient.Name,
493
-		Alias:              patient.Alias,
494
-		Gender:             patient.Gender,
495
-		MaritalStatus:      patient.MaritalStatus,
496
-		IdCardNo:           patient.IdCardNo,
497
-		Birthday:           patient.Birthday,
498
-		ReimbursementWayId: patient.ReimbursementWayId,
499
-		HealthCareType:     patient.HealthCareType,
500
-		HealthCareNo:       patient.HealthCareNo,
501
-		HealthCareDueDate:  patient.HealthCareDueDate,
502
-		Height:             patient.Height,
503
-		BloodType:          patient.BloodType,
504
-		Rh:                 patient.Rh,
482
+		UserOrgId:                 patient.UserOrgId,
483
+		UserId:                    patient.UserId,
484
+		Avatar:                    patient.Avatar,
485
+		PatientType:               patient.PatientType,
486
+		DialysisNo:                patient.DialysisNo,
487
+		AdmissionNumber:           patient.AdmissionNumber,
488
+		Source:                    patient.Source,
489
+		PartitionId:               patient.PartitionId,
490
+		BedId:                     patient.BedId,
491
+		Name:                      patient.Name,
492
+		Alias:                     patient.Alias,
493
+		Gender:                    patient.Gender,
494
+		MaritalStatus:             patient.MaritalStatus,
495
+		IdCardNo:                  patient.IdCardNo,
496
+		Birthday:                  patient.Birthday,
497
+		ReimbursementWayId:        patient.ReimbursementWayId,
498
+		HealthCareType:            patient.HealthCareType,
499
+		HealthCareNo:              patient.HealthCareNo,
500
+		HealthCareDueDate:         patient.HealthCareDueDate,
501
+		Height:                    patient.Height,
502
+		BloodType:                 patient.BloodType,
503
+		Rh:                        patient.Rh,
505 504
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
506 505
 		EducationLevel:            patient.EducationLevel,
507 506
 		Profession:                patient.Profession,
@@ -543,17 +542,18 @@ func (c *PatientApiController) EditPatient() {
543 542
 		Nation:                    patient.Nation,
544 543
 		NativePlace:               patient.NativePlace,
545 544
 		Age:                       patient.Age,
546
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
547
-		IsInfectious:             patient.IsInfectious,
548
-		RemindCycle:              patient.RemindCycle,
549
-		ResponseResult:           patient.ResponseResult,
550
-		IsOpenRemind:             patient.IsOpenRemind,
551
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
552
-		DialysisAge:              patient.DialysisAge,
553
-		ExpenseKind:              patient.ExpenseKind,
554
-		TellPhone:                patient.TellPhone,
555
-		ContactName:              patient.ContactName,
556
-		UpdatedTime:              time.Now().Unix(),
545
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
546
+		IsInfectious:              patient.IsInfectious,
547
+		RemindCycle:               patient.RemindCycle,
548
+		ResponseResult:            patient.ResponseResult,
549
+		IsOpenRemind:              patient.IsOpenRemind,
550
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
551
+		DialysisAge:               patient.DialysisAge,
552
+		ExpenseKind:               patient.ExpenseKind,
553
+		TellPhone:                 patient.TellPhone,
554
+		ContactName:               patient.ContactName,
555
+		UpdatedTime:               time.Now().Unix(),
556
+		BloodPatients:             1,
557 557
 	}
558 558
 	//	//更新病人ID获取新表病人ID
559 559
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -3801,7 +3801,6 @@ func (c *PatientApiController) ExportPatients() {
3801 3801
 				patient.DryWeight = dry_weights
3802 3802
 
3803 3803
 			}
3804
-
3805 3804
 			patient.CreatedTime = time.Now().Unix()
3806 3805
 			patient.UpdatedTime = time.Now().Unix()
3807 3806
 			patient.Status = 1

+ 102 - 5
controllers/schedule_api_controller.go View File

@@ -645,11 +645,108 @@ func (this *ScheduleApiController) UrgentScheduleData() {
645 645
 
646 646
 func (this *ScheduleApiController) SearchSchedulePatients() {
647 647
 	keywords := this.GetString("keywords")
648
-	adminUserInfo := this.GetAdminUserInfo()
649
-	list, _ := service.GetSchedualPatientsByKeywords(keywords, adminUserInfo.CurrentOrgId)
650
-	this.ServeSuccessJSON(map[string]interface{}{
651
-		"schdules": list,
652
-	})
648
+	week_type, _ := this.GetInt64("week_type", 0)
649
+
650
+	thisTime1 := time.Now()
651
+	thisTime2 := time.Now()
652
+
653
+	thisTime1 = thisTime1.AddDate(0, 0, 7)
654
+	thisTime2 = thisTime2.AddDate(0, 0, 14)
655
+
656
+	var start_time string
657
+	var end_time string
658
+
659
+	switch week_type {
660
+	case 1:
661
+
662
+		adminUserInfo := this.GetAdminUserInfo()
663
+		list, _ := service.GetSchedualPatientsByKeywords(keywords, adminUserInfo.CurrentOrgId)
664
+		this.ServeSuccessJSON(map[string]interface{}{
665
+			"schdules": list,
666
+		})
667
+
668
+		break
669
+	case 2:
670
+		days := make([]string, 0)
671
+
672
+		weekDay1 := int(thisTime1.Weekday())
673
+		if weekDay1 == 0 {
674
+			weekDay1 = 7
675
+		}
676
+		weekEnd1 := 7 - weekDay1
677
+		weekStart1 := weekEnd1 - 6
678
+		for index := weekStart1; index <= weekEnd1; index++ {
679
+			theDay := thisTime1.AddDate(0, 0, index)
680
+			days = append(days, theDay.Format("2006-01-02"))
681
+			if index == 0 {
682
+				start_time = theDay.Format("2006-01-02")
683
+			}
684
+
685
+			end_time = theDay.Format("2006-01-02")
686
+		}
687
+
688
+		timeLayout := "2006-01-02"
689
+		loc, _ := time.LoadLocation("Local")
690
+
691
+		var theStartTime int64
692
+		if len(start_time) > 0 {
693
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
694
+			theStartTime = theTime.Unix()
695
+		}
696
+		var theEndtTime int64
697
+		if len(end_time) > 0 {
698
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
699
+			theEndtTime = theTime.Unix()
700
+		}
701
+
702
+		adminUserInfo := this.GetAdminUserInfo()
703
+		list, _ := service.GetSchedualPatientsByKeywordsAndWeek(keywords, adminUserInfo.CurrentOrgId, theStartTime, theEndtTime)
704
+		this.ServeSuccessJSON(map[string]interface{}{
705
+			"schdules": list,
706
+		})
707
+
708
+		break
709
+	case 3:
710
+		days := make([]string, 0)
711
+
712
+		weekDay2 := int(thisTime2.Weekday())
713
+		if weekDay2 == 0 {
714
+			weekDay2 = 7
715
+		}
716
+		weekEnd2 := 7 - weekDay2
717
+		weekStart2 := weekEnd2 - 6
718
+		for index := weekStart2; index <= weekEnd2; index++ {
719
+			theDay := thisTime2.AddDate(0, 0, index)
720
+			days = append(days, theDay.Format("2006-01-02"))
721
+			if index == 0 {
722
+				start_time = theDay.Format("2006-01-02")
723
+			}
724
+
725
+			end_time = theDay.Format("2006-01-02")
726
+		}
727
+
728
+		timeLayout := "2006-01-02"
729
+		loc, _ := time.LoadLocation("Local")
730
+
731
+		var theStartTime int64
732
+		if len(start_time) > 0 {
733
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
734
+			theStartTime = theTime.Unix()
735
+		}
736
+		var theEndtTime int64
737
+		if len(end_time) > 0 {
738
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
739
+			theEndtTime = theTime.Unix()
740
+		}
741
+
742
+		adminUserInfo := this.GetAdminUserInfo()
743
+		list, _ := service.GetSchedualPatientsByKeywordsAndWeek(keywords, adminUserInfo.CurrentOrgId, theStartTime, theEndtTime)
744
+		this.ServeSuccessJSON(map[string]interface{}{
745
+			"schdules": list,
746
+		})
747
+
748
+		break
749
+	}
653 750
 
654 751
 }
655 752
 

+ 12 - 1
models/device_models.go View File

@@ -205,6 +205,7 @@ type DeviceAddmachers struct {
205 205
 	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
206 206
 	DeviceMode          string `gorm:"column:device_mode" json:"device_mode" form:"device_mode"`
207 207
 	Number              string `gorm:"column:number" json:"number" form:"number"`
208
+	EquimentId          int64  `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
208 209
 }
209 210
 
210 211
 type DeviceAddmacher struct {
@@ -215,7 +216,7 @@ type DeviceAddmacher struct {
215 216
 	DeviceName          string `gorm:"column:device_name" json:"device_name" form:"device_name"`
216 217
 	ManufactureFactory  string `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
217 218
 	ServiceManufacturer string `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
218
-	UnitType            string `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
219
+	UnitType            int64  `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
219 220
 	UseSection          string `gorm:"column:use_section" json:"use_section" form:"use_section"`
220 221
 	SectionNumber       string `gorm:"column:section_number" json:"section_number" form:"section_number"`
221 222
 	BuyDate             int64  `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`
@@ -869,3 +870,13 @@ func (DeviceMode) TableName() string {
869 870
 
870 871
 	return "xt_device_mode"
871 872
 }
873
+
874
+type VmDeviceInformation struct {
875
+	Total     int64
876
+	BedNumber int64 `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
877
+}
878
+
879
+func (VmDeviceInformation) TableName() string {
880
+
881
+	return "xt_device_information"
882
+}

+ 8 - 0
models/dialysis.go View File

@@ -267,6 +267,7 @@ type PredialysisEvaluation struct {
267 267
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
268 268
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
269 269
 	HumorExcessiveSymptom          int64   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
270
+	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
270 271
 }
271 272
 
272 273
 func (PredialysisEvaluation) TableName() string {
@@ -555,6 +556,11 @@ type AssessmentAfterDislysis struct {
555 556
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
556 557
 	SealingFluidDispose             int64   `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`
557 558
 	SealingFluidSpecial             string  `gorm:"column:sealing_fluid_special" json:"sealing_fluid_special" form:"sealing_fluid_special"`
559
+	DosageOfAnticoagulants          float64 `gorm:"column:dosage_of_anticoagulants" json:"dosage_of_anticoagulants" form:"dosage_of_anticoagulants"`
560
+	SupineSystolicBloodPressure     string  `gorm:"column:supine_systolic_blood_pressure" json:"supine_systolic_blood_pressure" form:"supine_systolic_blood_pressure"`
561
+	SettingPressure                 string  `gorm:"column:setting_pressure" json:"setting_pressure" form:"setting_pressure"`
562
+	SupineDiastolicBloodPressure    string  `gorm:"column:supine_diastolic_blood_pressure" json:"supine_diastolic_blood_pressure" form:"supine_diastolic_blood_pressure"`
563
+	DiastolicPressure               string  `gorm:"column:diastolic_pressure" json:"diastolic_pressure" form:"diastolic_pressure"`
558 564
 }
559 565
 
560 566
 func (AssessmentAfterDislysis) TableName() string {
@@ -653,6 +659,8 @@ type MonitoringRecord struct {
653 659
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
654 660
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
655 661
 	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
662
+	Urr                       string  `gorm:"column:urr" json:"urr"`
663
+	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
656 664
 }
657 665
 
658 666
 func (MonitoringRecord) TableName() string {

+ 1 - 0
models/patient_models.go View File

@@ -220,6 +220,7 @@ type DialysisPrescription struct {
220 220
 	Package                    int64         `gorm:"column:package" json:"package"`
221 221
 	ALiquid                    int64         `gorm:"column:a_liquid" json:"a_liquid"`
222 222
 	UserAdminRole              UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:Creater;"`
223
+	PreImpulse                 float64       `gorm:"column:pre_impulse" json:"pre_impulse" form:"pre_impulse"`
223 224
 }
224 225
 
225 226
 func (DialysisPrescription) TableName() string {

+ 2 - 1
routers/router.go View File

@@ -35,7 +35,7 @@ func init() {
35 35
 	controllers.ScheduleApiRegistRouters()
36 36
 	controllers.SignWeighAPIControllerRegistRouters()
37 37
 	controllers.InvoiceApiRegistRouters()
38
-	//controllers.StockApiRegistRouters()
38
+	controllers.StockApiRegistRouters()
39 39
 	controllers.StockGoodApiRegistRouters()
40 40
 	controllers.StockManagerApiRegistRouters()
41 41
 	controllers.PatientScheduleTemplateAPIControllerRegistRouters()
@@ -59,6 +59,7 @@ func init() {
59 59
 	//admin_api.AdminAPIControllersRegisterRouters()
60 60
 	new_m_api.CommonApiControllersRegisterRouters()
61 61
 	new_m_api.NewCommonApiControllersRegisterRouters()
62
+	new_m_api.NewManageApiControllersRegisterRouters()
62 63
 	controllers.ManageRouters()
63 64
 	//controllers.PatientRouters()
64 65
 }

+ 4 - 4
service/auto_create_week_disinfection.go View File

@@ -82,14 +82,14 @@ func AutoCreateWeekDisinfectionJob() {
82 82
 				fmt.Print("透析时长", dislysis.ActualTreatmentHour+'h'+dislysis.ActualTreatmentMinute+'m'+'i'+'n')
83 83
 				//			//根据床位号获取设备id
84 84
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
85
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
85
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
86 86
 				fmt.Println(" 设备id", addmacher.ID)
87 87
 				//根据设备id获取设备类型
88 88
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
89 89
 
90 90
 				fmt.Println("班次", it.SchedualType)
91 91
 				//查看该设备是否有消毒计划,无怎返回,有则添加
92
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
92
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
93 93
 				fmt.Print("plan", plan)
94 94
 				fmt.Println("错误是什么", errplan)
95 95
 				if errplan == gorm.ErrRecordNotFound {
@@ -211,10 +211,10 @@ func GetInfor(patientid int64, timenow int64, orgid int64, class int64) (*models
211 211
 	return &pre, nil
212 212
 }
213 213
 
214
-func GetDisinfection(equitType int64, enquitType int64, orgID int64) (*models.DevicePlan, error) {
214
+func GetDisinfection(equitType int64, scheduleType int64, orgID int64) (*models.DevicePlan, error) {
215 215
 	var plan models.DevicePlan
216 216
 	var err error
217
-	err = readUserDb.Model(&plan).Where("device_type = ? AND classtime = ? AND user_org_id = ? AND status = 1", equitType, enquitType, orgID).Find(&plan).Error
217
+	err = readUserDb.Model(&plan).Where("device_type = ? AND classtime = ? AND user_org_id = ? AND status = 1", equitType, scheduleType, orgID).Find(&plan).Error
218 218
 	if err == gorm.ErrRecordNotFound {
219 219
 		return nil, err
220 220
 	}

+ 2 - 2
service/auto_create_week_plan.go View File

@@ -77,14 +77,14 @@ func AutoCreateWeekPlanJob() {
77 77
 				fmt.Println("透后", err)
78 78
 				//			//根据床位号获取设备id
79 79
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
80
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
80
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
81 81
 				fmt.Println(" 设备id", addmacher.ID)
82 82
 				//根据设备id获取设备类型
83 83
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
84 84
 
85 85
 				fmt.Println("班次", it.SchedualType)
86 86
 				//查看该设备是否有消毒计划,无怎返回,有则添加
87
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
87
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
88 88
 				fmt.Print("plan", plan)
89 89
 				fmt.Println("错误", errplan)
90 90
 				if errplan == gorm.ErrRecordNotFound {

+ 93 - 2
service/common_service.go View File

@@ -3214,10 +3214,11 @@ func GetStandList(orgid int64, startime int64, endtime int64, limit int64, page
3214 3214
 	return inspection, err
3215 3215
 }
3216 3216
 
3217
-func GetDiastolicStand(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecords, err error) {
3217
+func GetDiastolicStand(orgid int64, startime int64, endtime int64, page int64, limit int64) (record []*models.XTMonitoringRecords, err error) {
3218 3218
 
3219 3219
 	db := XTReadDB().Table("xt_monitoring_record as x")
3220
-	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and (x.systolic_blood_pressure <> 0 or x.diastolic_blood_pressure)", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3220
+	offset := (page - 1) * limit
3221
+	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0 and x.diastolic_blood_pressure <> 0)", orgid, startime, endtime).Offset(offset).Limit(limit).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3221 3222
 	return record, err
3222 3223
 }
3223 3224
 
@@ -3226,3 +3227,93 @@ func GetInspectionMoninList(id int64, orgid int64, patientid int64) (models.XtIn
3226 3227
 	err = XTReadDB().Model(&inspection).Where("item_id=? and org_id = ? and status = 1 and patient_id = ?", id, orgid, patientid).Last(&inspection).Error
3227 3228
 	return inspection, err
3228 3229
 }
3230
+
3231
+func TotalSysStandCountTwo(orgid int64, startime int64, endtime int64, sysmin int64, syslarge int64, diamin int64, dialarge int64) (record []*models.XTMonitoringRecords, err error) {
3232
+
3233
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
3234
+	if orgid > 0 {
3235
+		db = db.Where("x.user_org_id = ? and x.systolic_blood_pressure<>0 and x.diastolic_blood_pressure<>0 ", orgid)
3236
+	}
3237
+	if startime > 0 {
3238
+		db = db.Where("x.monitoring_date>=?", startime)
3239
+	}
3240
+	if endtime > 0 {
3241
+		db = db.Where("x.monitoring_date<=?", endtime)
3242
+	}
3243
+	if sysmin > 0 {
3244
+		db = db.Where(" x.systolic_blood_pressure>=?", sysmin)
3245
+	}
3246
+	if syslarge > 0 {
3247
+		db = db.Where("x.systolic_blood_pressure<=?", syslarge)
3248
+	}
3249
+	if diamin > 0 {
3250
+		db = db.Where(" x.diastolic_blood_pressure>=?", diamin)
3251
+	}
3252
+	if dialarge > 0 {
3253
+		db = db.Where("x.diastolic_blood_pressure<=?", dialarge)
3254
+	}
3255
+	err = db.Select("x.id,x.user_org_id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.status = 1").Group("x.monitoring_date,x.patient_id").Order("x.monitoring_date desc").Scan(&record).Error
3256
+	return record, err
3257
+}
3258
+
3259
+func TotalSysStandCount(orgid int64, startime int64, endtime int64, sysmin int64, syslarge int64, diamin int64, dialarge int64, page int64, limit int64) (record []*models.XTMonitoringRecords, err error) {
3260
+
3261
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
3262
+	if orgid > 0 {
3263
+		db = db.Where("x.user_org_id = ? and x.systolic_blood_pressure<>0 and x.diastolic_blood_pressure<>0 ", orgid)
3264
+	}
3265
+	if startime > 0 {
3266
+		db = db.Where("x.monitoring_date>=?", startime)
3267
+	}
3268
+	if endtime > 0 {
3269
+		db = db.Where("x.monitoring_date<=?", endtime)
3270
+	}
3271
+	if sysmin > 0 {
3272
+		db = db.Where(" x.systolic_blood_pressure>=?", sysmin)
3273
+	}
3274
+	if syslarge > 0 {
3275
+		db = db.Where("x.systolic_blood_pressure<=?", syslarge)
3276
+	}
3277
+	if diamin > 0 {
3278
+		db = db.Where(" x.diastolic_blood_pressure>=?", diamin)
3279
+	}
3280
+	if dialarge > 0 {
3281
+		db = db.Where("x.diastolic_blood_pressure<=?", dialarge)
3282
+	}
3283
+	offset := (page - 1) * limit
3284
+	err = db.Select("x.id,x.user_org_id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.status = 1").Group("x.monitoring_date,x.patient_id").Offset(offset).Limit(limit).Order("x.monitoring_date desc").Scan(&record).Error
3285
+	return record, err
3286
+}
3287
+
3288
+func TotalSysNoStandCountTwo(orgid int64, startime int64, endtime int64, sysmin int64, syslarge int64, diamin int64, dialarge int64) (record []*models.XTMonitoringRecords, err error) {
3289
+
3290
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
3291
+	if orgid > 0 {
3292
+		db = db.Where("x.user_org_id = ? and x.systolic_blood_pressure<>0 and x.diastolic_blood_pressure<>0 ", orgid)
3293
+	}
3294
+	if startime > 0 {
3295
+		db = db.Where("x.monitoring_date>=?", startime)
3296
+	}
3297
+	if endtime > 0 {
3298
+		db = db.Where("x.monitoring_date<=?", endtime)
3299
+	}
3300
+	err = db.Select("x.id,x.user_org_id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.status = 1 and(x.systolic_blood_pressure<=? or x.systolic_blood_pressure>=?) or (x.diastolic_blood_pressure<=? or x.diastolic_blood_pressure>=?)", sysmin, syslarge, diamin, dialarge).Group("x.monitoring_date,x.patient_id").Order("x.monitoring_date desc").Scan(&record).Error
3301
+	return record, err
3302
+}
3303
+
3304
+func TotalSysNoStandCount(orgid int64, startime int64, endtime int64, sysmin int64, syslarge int64, diamin int64, dialarge int64, page int64, limit int64) (record []*models.XTMonitoringRecords, err error) {
3305
+
3306
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
3307
+	if orgid > 0 {
3308
+		db = db.Where("x.user_org_id = ? and x.systolic_blood_pressure<>0 and x.diastolic_blood_pressure<>0 ", orgid)
3309
+	}
3310
+	if startime > 0 {
3311
+		db = db.Where("x.monitoring_date>=?", startime)
3312
+	}
3313
+	if endtime > 0 {
3314
+		db = db.Where("x.monitoring_date<=?", endtime)
3315
+	}
3316
+	offset := (page - 1) * limit
3317
+	err = db.Select("x.id,x.user_org_id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.status = 1 and(x.systolic_blood_pressure<=? or x.systolic_blood_pressure>=?) or (x.diastolic_blood_pressure<=? or x.diastolic_blood_pressure>=?)", sysmin, syslarge, diamin, dialarge).Group("x.monitoring_date,x.patient_id").Offset(offset).Limit(limit).Order("x.monitoring_date desc").Scan(&record).Error
3318
+	return record, err
3319
+}

+ 4 - 3
service/device_service.go View File

@@ -623,9 +623,10 @@ func GetAllMachineInfo(page int64, limit int64, keyword string, zoneid int64, eq
623 623
 	table := XTReadDB().Table("xt_device_zone as x")
624 624
 	d := readUserDb.Table("xt_device_mode as m")
625 625
 	d2 := XTReadDB().Table("xt_device_number as n")
626
+	d3 := XTReadDB().Table("xt_device_information as i")
626 627
 	fmt.Print("d", d)
627 628
 	fmt.Println("table", table)
628
-	fmt.Print("d2", d2)
629
+	fmt.Print("d2", d2, d3)
629 630
 	if orgid > 0 {
630 631
 		db = db.Where("a.user_org_id = ?", orgid)
631 632
 	}
@@ -646,8 +647,8 @@ func GetAllMachineInfo(page int64, limit int64, keyword string, zoneid int64, eq
646 647
 
647 648
 	offset := (page - 1) * limit
648 649
 
649
-	err = db.Order("a.ctime asc").Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.bed_id,x.name,m.device_mode,n.number").Count(&total).
650
-		Joins("Left JOIN xt_device_mode as m on m.id = a.unit_type ").Joins("left join sgj_xt.xt_device_number as n on n.id = a.bed_id").Joins("Left JOIN sgj_xt.xt_device_zone as x On x.id = n.zone_id").Offset(offset).Limit(limit).Scan(&addmahcer).Error
650
+	err = db.Group("a.id").Order("a.ctime asc").Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.bed_id,x.name,m.device_mode,n.number,i.equiment_id").Count(&total).
651
+		Joins("Left JOIN xt_device_mode as m on m.id = a.unit_type ").Joins("left join sgj_xt.xt_device_number as n on n.id = a.bed_id").Joins("Left JOIN sgj_xt.xt_device_zone as x On x.id = n.zone_id").Joins("left join xt_device_information as i on i.bed_number = a.bed_id").Offset(offset).Limit(limit).Scan(&addmahcer).Error
651 652
 
652 653
 	if err != nil {
653 654
 

+ 124 - 0
service/manage_service.go View File

@@ -1112,3 +1112,127 @@ func GetOrgs(id int64) (roles []*models.SgjUserAdminRole, err error) {
1112 1112
 
1113 1113
 	return roles, err
1114 1114
 }
1115
+
1116
+func GetUserMachTotalCount(orgid int64) (vm []*models.VmDeviceInformation, err error) {
1117
+
1118
+	err = UserReadDB().Raw("SELECT x.bed_number,count(*) as total  FROM xt_device_information  as x WHERE user_org_id = ? and `status` = 1 GROUP BY x.bed_number ", orgid).Scan(&vm).Error
1119
+	return vm, err
1120
+}
1121
+
1122
+func GetUserTotalByMacher(id int64) (models.DeviceAddmacher, error) {
1123
+	addmacher := models.DeviceAddmacher{}
1124
+	err := UserReadDB().Model(&addmacher).Where("id=? and status = 1", id).Find(&addmacher).Error
1125
+	return addmacher, err
1126
+}
1127
+
1128
+func GetUserTotalCount(orgid int64, bedid int64) (vm []*models.VmDeviceInformation, err error) {
1129
+
1130
+	err = UserReadDB().Raw("SELECT x.bed_number,count(*) as total  FROM xt_device_information  as x WHERE user_org_id = ? and `status` = 1 and bed_number= ? GROUP BY x.bed_number ", orgid, bedid).Scan(&vm).Error
1131
+	return vm, err
1132
+
1133
+}
1134
+
1135
+func GetUserTotal(orgid int64, id int64) (models.DeviceAddmacher, error) {
1136
+	addmacher := models.DeviceAddmacher{}
1137
+	err := UserReadDB().Model(&addmacher).Where("user_org_id = ? and bed_id = ? and status = 1", orgid, id).Find(&addmacher).Error
1138
+	return addmacher, err
1139
+}
1140
+
1141
+func GetDisInfectionTime(orgid int64, unitype int64, scheduletype int64, scheduleweek int64) (*models.DevicePlan, error) {
1142
+	plan := models.DevicePlan{}
1143
+	err = UserReadDB().Model(&plan).Where("user_org_id = ? and device_type = ? and classtime = ? and time = ? and status = 1", orgid, unitype, scheduletype, scheduleweek).Find(&plan).Error
1144
+	if err == gorm.ErrRecordNotFound {
1145
+		return nil, err
1146
+	}
1147
+	if err != nil {
1148
+		return nil, err
1149
+	}
1150
+	return &plan, nil
1151
+}
1152
+
1153
+func GetUnitType(bedid int64, orgid int64) (models.DeviceAddmacher, error) {
1154
+
1155
+	addmacher := models.DeviceAddmacher{}
1156
+	err := UserReadDB().Model(&addmacher).Where("bed_id = ? and user_org_id = ? and status = 1", bedid, orgid).Find(&addmacher).Error
1157
+	return addmacher, err
1158
+}
1159
+
1160
+func GetLaseDeviceInfomation(orgid int64, bedid int64, date int64, scheduletype int64) (*models.DeviceInformation, error) {
1161
+
1162
+	information := models.DeviceInformation{}
1163
+	err := UserReadDB().Model(&information).Where("bed_number = ? and user_org_id =? and status = 1 and date = ? and class = ? ", bedid, orgid, date, scheduletype).Find(&information).Error
1164
+	if err == gorm.ErrRecordNotFound {
1165
+		return nil, err
1166
+	}
1167
+	if err != nil {
1168
+		return nil, err
1169
+	}
1170
+	return &information, nil
1171
+}
1172
+
1173
+func GetLaseDeviceInfomationTwo(orgid int64, bedid int64, scheduletype int64) (models.DeviceInformation, error) {
1174
+	information := models.DeviceInformation{}
1175
+	err = UserReadDB().Model(&information).Where("bed_number= ? and user_org_id = ? and status = 1 and class = ?", bedid, orgid, scheduletype).Last(&information).Error
1176
+	return information, err
1177
+}
1178
+
1179
+func GetAssessmentAfterDissDataTwo(patientid int64, orgID int64, timenow int64) (models.XtAssessmentAfterDislysis, error) {
1180
+	dislysis := models.XtAssessmentAfterDislysis{}
1181
+	err := XTReadDB().Where("patient_id = ? AND user_org_id = ? AND assessment_date = ?", patientid, orgID, timenow).Find(&dislysis).Error
1182
+	return dislysis, err
1183
+}
1184
+
1185
+func GetEquimentIDTwo(bedId int64, orgID int64) (models.DeviceAddmacher, error) {
1186
+	addmacher := models.DeviceAddmacher{}
1187
+	err := readUserDb.Model(&addmacher).Where("bed_id = ? AND user_org_id = ? AND status = ?", bedId, orgID, 1).Find(&addmacher).Error
1188
+	return addmacher, err
1189
+}
1190
+
1191
+func GetDisinfectionTwo(equitType int64, enquitType int64, orgID int64) (*models.DevicePlan, error) {
1192
+	var plan models.DevicePlan
1193
+	var err error
1194
+	err = readUserDb.Model(&plan).Where("device_type = ? AND classtime = ? AND user_org_id = ? AND status = 1", equitType, enquitType, orgID).Find(&plan).Error
1195
+	if err == gorm.ErrRecordNotFound {
1196
+		return nil, err
1197
+	}
1198
+	if err != nil {
1199
+		return nil, err
1200
+	}
1201
+	return &plan, nil
1202
+}
1203
+
1204
+func GetInforTwo(patientid int64, timenow int64, orgid int64, class int64) (*models.DeviceInformation, error) {
1205
+	var pre models.DeviceInformation
1206
+	var err error
1207
+	err = readUserDb.Model(&pre).Where("patient_id = ? AND date = ? AND user_org_id = ? AND class = ? AND status = 1", patientid, timenow, orgid, class).Find(&pre).Error
1208
+	if err == gorm.ErrRecordNotFound {
1209
+		return nil, err
1210
+	}
1211
+	if err != nil {
1212
+		return nil, err
1213
+	}
1214
+	return &pre, nil
1215
+}
1216
+
1217
+func GetPatientOrderInfo(schduledate int64, patientid int64, orgid int64) (models.XtDialysisOrder, error) {
1218
+	order := models.XtDialysisOrder{}
1219
+	err := XTReadDB().Model(&order).Where("dialysis_date = ? and patient_id = ? and user_org_id = ? and status = 1", schduledate, patientid, orgid).Find(&order).Error
1220
+	return order, err
1221
+}
1222
+
1223
+func CreateInformationTwo(information *models.DeviceInformation) error {
1224
+	err := UserWriteDB().Create(&information).Error
1225
+	return err
1226
+}
1227
+
1228
+func UpdateInformation(information *models.DeviceInformation, scheduledate int64, bedid int64, scheduletype int64) error {
1229
+
1230
+	err := UserWriteDB().Model(&information).Where("date = ? and bed_number = ? and class = ?", scheduledate, bedid, scheduletype).Updates(map[string]interface{}{"long_time": information.LongTime, "disinfec_startime": information.DisinfecStartime, "disinfec_endtime": information.DisinfecEndtime}).Error
1231
+	return err
1232
+}
1233
+
1234
+func DeleteEquit(id int64) (models.DeviceAddmacher, error) {
1235
+	addmacher := models.DeviceAddmacher{}
1236
+	err := UserWriteDB().Model(&addmacher).Where("id=?", id).Updates(map[string]interface{}{"status": 0}).Error
1237
+	return addmacher, err
1238
+}

+ 16 - 0
service/mobile_dialysis_service.go View File

@@ -94,6 +94,7 @@ type MDialysisScheduleVM struct {
94 94
 	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
95 95
 	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
96 96
 	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
97
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week"`
97 98
 	ModeId       int64 `gorm:"column:mode_id" json:"mode_id"`
98 99
 	Status       int64 `gorm:"column:status" json:"status"`
99 100
 
@@ -1264,3 +1265,18 @@ func GetDialysisOrderCount(orgID int64, patient_id int64, recordDate int64) (cou
1264 1265
 	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
1265 1266
 	return
1266 1267
 }
1268
+
1269
+func GetFirstDateOfMonth(d time.Time) time.Time {
1270
+	d = d.AddDate(0, 0, -d.Day()+1)
1271
+	return GetZeroTime(d)
1272
+}
1273
+
1274
+func GetZeroTime(d time.Time) time.Time {
1275
+	return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location())
1276
+}
1277
+
1278
+func GetDialysisCountByPatientId(startime int64, endtime int64, patientid int64, orgid int64) (order []*models.BloodDialysisOrderCount, err error) {
1279
+	db := XTReadDB().Table("xt_dialysis_order as o")
1280
+	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule AS x ON x.patient_id = o.patient_id   where o.status = 1 and o.dialysis_date>=? and o.dialysis_date<=? and o.user_org_id = ? and x.schedule_date = o.dialysis_date and x.status = 1 and o.patient_id = ?", startime, endtime, orgid, patientid).Scan(&order).Group("o.patient_id").Error
1281
+	return order, err
1282
+}

+ 1 - 1
service/patient_service.go View File

@@ -291,7 +291,7 @@ func CreatePatientsNew(patientsNew *models.XtPatientsNew) error {
291 291
 
292 292
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
293 293
 	utx := writeDb.Begin()
294
-	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"Lapseto": patient.Lapseto}).Error
294
+	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto}).Error
295 295
 	//err = utx.Model(&models.PatientLapseto{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto_type": patient.Lapseto, "lapseto_time": time.Now().Unix(), "updated_time": time.Now().Unix()}).Error
296 296
 	if err != nil {
297 297
 		utx.Rollback()

+ 17 - 0
service/schedule_service.go View File

@@ -213,6 +213,23 @@ func GetPrinitWeekSchedules(orgID int64, start, end int64) ([]*WeekSchedulePrint
213 213
 // 	return nil
214 214
 // }
215 215
 
216
+func GetSchedualPatientsByKeywordsAndWeek(keywords string, org_id int64, start_time int64, end_time int64) (schedule []*models.Schedule, err error) {
217
+	likeKey := "%" + keywords + "%"
218
+	err = readDb.
219
+		Table("xt_schedule as s").
220
+		Preload("PatientInfectiousDiseases", "status = 1 ").
221
+		Preload("DeviceZone", "status = 1 ").
222
+		Preload("DeviceNumber", "status = 1 ").
223
+		Preload("TreatmentMode", "status = 1 ").
224
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id AND (p.name LIKE ? OR p.dialysis_no LIKE ?)", likeKey, likeKey).
225
+		Where("s.user_org_id=? and s.schedule_date >= ? and s.schedule_date <= ? and s.status=1", org_id, start_time, end_time).
226
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
227
+		Order("schedule_date asc").
228
+		Find(&schedule).Error
229
+	return
230
+
231
+}
232
+
216 233
 func GetSchedualPatientsByKeywords(keywords string, org_id int64) (schedule []*models.Schedule, err error) {
217 234
 	likeKey := "%" + keywords + "%"
218 235
 

+ 2 - 2
service/stock_service.go View File

@@ -1215,8 +1215,8 @@ func AddSigleAutoReduceRecordInfo(detail *models.AutomaticReduceDetail) error {
1215 1215
 
1216 1216
 }
1217 1217
 
1218
-func FindStockOutInfoByTypeId(org_id int64, good_type_id int64, good_id int64, number string) (out models.WarehouseOutInfo, err error) {
1219
-	err = readDb.Model(&models.WarehouseOutInfo{}).Where("status = 1 AND org_id = ? AND good_type_id = ? AND good_id = ? AND is_sys = 1 AND  warehouse_out_order_number = ?", org_id, good_type_id, good_id, number).First(&out).Error
1218
+func FindStockOutInfoByTypeId(org_id int64, good_type_id int64, good_id int64, out_id int64) (out models.WarehouseOutInfo, err error) {
1219
+	err = readDb.Model(&models.WarehouseOutInfo{}).Where("status = 1 AND org_id = ? AND good_type_id = ? AND good_id = ? AND is_sys = 1 AND  warehouse_out_id = ?", org_id, good_type_id, good_id, out_id).First(&out).Error
1220 1220
 	return
1221 1221
 }
1222 1222
 

+ 21 - 1
数据变更脚本.sql View File

@@ -96,6 +96,26 @@ ALTER TABLE `sgj_xt`.`xt_monitoring_record`     CHANGE `transmembrane_pressure_u
96 96
 --检验检查添加结果提示字段--
97 97
 ALTER TABLE `test_xt`.`xt_inspection`     ADD COLUMN `inspect_tips` VARCHAR(255) NULL COMMENT '结果提示' AFTER `inspect_value`;
98 98
 
99
-
99
+--2020-08-15 author 马文强 --
100
+--数据字典表里添加针眼--
101
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '0','hemodialysis','0','针眼','pinholing','0','2020-08-15 16:56:00','2020-08-15 16:56:00','0','1',NULL,'0',NULL,NULL,'0');
102
+--显示配置中添加针眼字段 --
103
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','3','pinholing','针眼','1',NULL,NULL,'0');
104
+--显示配置中添加预冲量字段 --
105
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','1','pre_impulse','预冲量','1',NULL,NULL,'0');
106
+--显示配置中添加实际抗凝用量 --
107
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','dosage_of_ anticoagulants','实际抗凝剂用量','1',NULL,NULL,'0');
108
+--显示配置中添加卧位收缩压 --
109
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','supine_systolic_blood_pressure','卧位收缩压','1',NULL,NULL,'0');
110
+--显示配置中添加坐位收缩压 --
111
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','setting_pressure','坐位收缩压','1',NULL,NULL,'0');
112
+--显示配置中添加卧位舒张压 --
113
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','supine_diastolic_blood_pressure','卧位舒张压','1',NULL,NULL,'0');
114
+--显示配置中添加坐位舒张压 --
115
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','diastolic_pressure','坐位舒张压','1',NULL,NULL,'0');
116
+--显示配置中添加urr--
117
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','4','URR','URR','1',NULL,NULL,'0');
118
+--显示配置中添加血糖 --
119
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','4','blood_sugar','血糖','1',NULL,NULL,'0');
100 120
 
101 121