csx 4 lat temu
rodzic
commit
f45f1650c8

+ 3 - 5
conf/app.conf Wyświetl plik

@@ -123,7 +123,8 @@ redisdb = 0
123 123
 
124 124
 
125 125
 
126
-niprocart =  63
126
+
127
+                niprocart =  63
127 128
 jms = 58
128 129
 fistula_needle_set = 65
129 130
 fistula_needle_set_16 = 64
@@ -213,14 +214,11 @@ writesgjpatientmysqlname = sgj_patient
213 214
 
214 215
 
215 216
 
216
-
217
-
218
-
219 217
 #redishost = 120.77.235.13
220 218
 #redishost = 112.74.16.180
221 219
 redishost = localhost
222 220
 redisport = 6379
223
-redispasswrod = syh@#$%123456!
221
+redispasswrod = 123456
224 222
 redisdb = 0
225 223
 
226 224
 niprocart =  83

+ 7 - 3
controllers/dialysis_api_controller.go Wyświetl plik

@@ -4370,6 +4370,10 @@ func (c *DialysisApiController) GetDialysisOrder() {
4370 4370
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4371 4371
 
4372 4372
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4373
+	dialysis_count, _ := service.GetDialysisOrderCount(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4374
+	fmt.Println(dialysis_count)
4375
+	patientInfo.TotalDialysis = dialysis_count
4376
+	fmt.Println(patientInfo.TotalDialysis)
4373 4377
 
4374 4378
 	//相关操作对应的操作人
4375 4379
 	//operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
@@ -4852,7 +4856,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
4852 4856
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4853 4857
 
4854 4858
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4855
-			if template.TemplateId == 6 { //adminInfo.CurrentOrgId == 9538
4859
+			if template.TemplateId == 6 || template.TemplateId == 20 { //adminInfo.CurrentOrgId == 9538
4856 4860
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4857 4861
 				record.UltrafiltrationRate = ultrafiltration_rate
4858 4862
 			}
@@ -4873,8 +4877,8 @@ func (this *DialysisApiController) GetTodayMonitor() {
4873 4877
 		}
4874 4878
 	}
4875 4879
 
4876
-	if template.TemplateId == 6 {
4877
-		if ultrafiltration_rate > 0 {
4880
+	if template.TemplateId == 6 || template.TemplateId == 20 {
4881
+		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
4878 4882
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4879 4883
 			record.UltrafiltrationVolume = ultrafiltration_volume
4880 4884
 		}

+ 65 - 1
controllers/dialysis_record_api_controller.go Wyświetl plik

@@ -2146,7 +2146,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
2146 2146
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2147 2147
 
2148 2148
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2149
-				if template.TemplateId == 6 {
2149
+				if template.TemplateId == 6 || template.TemplateId == 20 {
2150 2150
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2151 2151
 				}
2152 2152
 				// 只针对方济医院
@@ -2281,6 +2281,8 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
2281 2281
 		return
2282 2282
 	}
2283 2283
 
2284
+	lastAssessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
2285
+
2284 2286
 	var tempassessmentAfterDislysis models.AssessmentAfterDislysis
2285 2287
 
2286 2288
 	if assessmentAfterDislysis != nil {
@@ -2318,6 +2320,68 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
2318 2320
 		tempassessmentAfterDislysis.ActualDisplacement = endmonitorRecords.DisplacementQuantity
2319 2321
 	}
2320 2322
 
2323
+	if lastAssessmentAfterDislysis != nil {
2324
+		tempassessmentAfterDislysis.BloodPressureType = lastAssessmentAfterDislysis.BloodPressureType
2325
+
2326
+		tempassessmentAfterDislysis.WeighingWay = lastAssessmentAfterDislysis.WeighingWay
2327
+
2328
+		tempassessmentAfterDislysis.Cruor = lastAssessmentAfterDislysis.Cruor
2329
+		tempassessmentAfterDislysis.SymptomAfterDialysis = lastAssessmentAfterDislysis.SymptomAfterDialysis
2330
+		tempassessmentAfterDislysis.InternalFistula = lastAssessmentAfterDislysis.InternalFistula
2331
+		tempassessmentAfterDislysis.Catheter = lastAssessmentAfterDislysis.Catheter
2332
+		tempassessmentAfterDislysis.Complication = lastAssessmentAfterDislysis.Complication
2333
+		tempassessmentAfterDislysis.Remark = lastAssessmentAfterDislysis.Remark
2334
+		tempassessmentAfterDislysis.DialysisIntakes = lastAssessmentAfterDislysis.DialysisIntakes
2335
+		tempassessmentAfterDislysis.DialysisIntakesFeed = lastAssessmentAfterDislysis.DialysisIntakesFeed
2336
+		tempassessmentAfterDislysis.DialysisIntakesTransfusion = lastAssessmentAfterDislysis.DialysisIntakesTransfusion
2337
+		tempassessmentAfterDislysis.DialysisIntakesBloodTransfusion = lastAssessmentAfterDislysis.DialysisIntakesBloodTransfusion
2338
+
2339
+		tempassessmentAfterDislysis.DialysisIntakesWashpipe = lastAssessmentAfterDislysis.DialysisIntakesWashpipe
2340
+
2341
+		tempassessmentAfterDislysis.BloodAccessPartId = lastAssessmentAfterDislysis.BloodAccessPartId
2342
+		tempassessmentAfterDislysis.BloodAccessPartOperaId = lastAssessmentAfterDislysis.BloodAccessPartOperaId
2343
+
2344
+		tempassessmentAfterDislysis.PuncturePointOozingBlood = lastAssessmentAfterDislysis.PuncturePointOozingBlood
2345
+		tempassessmentAfterDislysis.PuncturePointHaematoma = lastAssessmentAfterDislysis.PuncturePointHaematoma
2346
+		tempassessmentAfterDislysis.InternalFistulaTremorAc = lastAssessmentAfterDislysis.InternalFistulaTremorAc
2347
+		tempassessmentAfterDislysis.PatientGose = lastAssessmentAfterDislysis.PatientGose
2348
+
2349
+		tempassessmentAfterDislysis.InpatientDepartment = lastAssessmentAfterDislysis.InpatientDepartment
2350
+		tempassessmentAfterDislysis.ObservationContent = lastAssessmentAfterDislysis.ObservationContent
2351
+		tempassessmentAfterDislysis.ObservationContentOther = lastAssessmentAfterDislysis.ObservationContentOther
2352
+		tempassessmentAfterDislysis.DryWeight = lastAssessmentAfterDislysis.DryWeight
2353
+
2354
+		tempassessmentAfterDislysis.DialysisProcess = lastAssessmentAfterDislysis.DialysisProcess
2355
+		tempassessmentAfterDislysis.InAdvanceMinute = lastAssessmentAfterDislysis.InAdvanceMinute
2356
+		tempassessmentAfterDislysis.InAdvanceReason = lastAssessmentAfterDislysis.InAdvanceReason
2357
+
2358
+		tempassessmentAfterDislysis.HemostasisMinute = lastAssessmentAfterDislysis.HemostasisMinute
2359
+		tempassessmentAfterDislysis.HemostasisOpera = lastAssessmentAfterDislysis.HemostasisOpera
2360
+		tempassessmentAfterDislysis.TremorNoise = lastAssessmentAfterDislysis.TremorNoise
2361
+
2362
+		tempassessmentAfterDislysis.DisequilibriumSyndrome = lastAssessmentAfterDislysis.DisequilibriumSyndrome
2363
+		tempassessmentAfterDislysis.DisequilibriumSyndromeOption = lastAssessmentAfterDislysis.DisequilibriumSyndromeOption
2364
+		tempassessmentAfterDislysis.ArterialTube = lastAssessmentAfterDislysis.ArterialTube
2365
+
2366
+		tempassessmentAfterDislysis.IntravenousTube = lastAssessmentAfterDislysis.IntravenousTube
2367
+		tempassessmentAfterDislysis.Dialyzer = lastAssessmentAfterDislysis.Dialyzer
2368
+		tempassessmentAfterDislysis.InAdvanceReasonOther = lastAssessmentAfterDislysis.InAdvanceReasonOther
2369
+		tempassessmentAfterDislysis.IsEat = lastAssessmentAfterDislysis.IsEat
2370
+
2371
+		tempassessmentAfterDislysis.DialysisIntakesUnit = lastAssessmentAfterDislysis.DialysisIntakesUnit
2372
+		tempassessmentAfterDislysis.CvcA = lastAssessmentAfterDislysis.CvcA
2373
+		tempassessmentAfterDislysis.CvcV = lastAssessmentAfterDislysis.CvcV
2374
+		tempassessmentAfterDislysis.Channel = lastAssessmentAfterDislysis.Channel
2375
+		tempassessmentAfterDislysis.ReturnBlood = lastAssessmentAfterDislysis.ReturnBlood
2376
+		tempassessmentAfterDislysis.RehydrationVolume = lastAssessmentAfterDislysis.RehydrationVolume
2377
+		tempassessmentAfterDislysis.DialysisDuring = lastAssessmentAfterDislysis.DialysisDuring
2378
+		tempassessmentAfterDislysis.StrokeVolume = lastAssessmentAfterDislysis.StrokeVolume
2379
+		tempassessmentAfterDislysis.BloodFlow = lastAssessmentAfterDislysis.BloodFlow
2380
+		tempassessmentAfterDislysis.SealingFluidDispose = lastAssessmentAfterDislysis.SealingFluidDispose
2381
+		tempassessmentAfterDislysis.SealingFluidSpecial = lastAssessmentAfterDislysis.SealingFluidSpecial
2382
+
2383
+	}
2384
+
2321 2385
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
2322 2386
 	if err != nil {
2323 2387
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 67 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -2360,6 +2360,8 @@ func (c *DialysisAPIController) Finish() {
2360 2360
 		return
2361 2361
 	}
2362 2362
 
2363
+	lastAssessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.Org.Id, id, recordDate.Unix())
2364
+
2363 2365
 	_, dialysisOrder := service.FindDialysisRecordById(adminUserInfo.Org.Id, id, recordDate.Unix())
2364 2366
 
2365 2367
 	var tempassessmentAfterDislysis models.AssessmentAfterDislysis
@@ -2409,6 +2411,68 @@ func (c *DialysisAPIController) Finish() {
2409 2411
 
2410 2412
 	}
2411 2413
 
2414
+	if lastAssessmentAfterDislysis != nil {
2415
+		tempassessmentAfterDislysis.BloodPressureType = lastAssessmentAfterDislysis.BloodPressureType
2416
+
2417
+		tempassessmentAfterDislysis.WeighingWay = lastAssessmentAfterDislysis.WeighingWay
2418
+
2419
+		tempassessmentAfterDislysis.Cruor = lastAssessmentAfterDislysis.Cruor
2420
+		tempassessmentAfterDislysis.SymptomAfterDialysis = lastAssessmentAfterDislysis.SymptomAfterDialysis
2421
+		tempassessmentAfterDislysis.InternalFistula = lastAssessmentAfterDislysis.InternalFistula
2422
+		tempassessmentAfterDislysis.Catheter = lastAssessmentAfterDislysis.Catheter
2423
+		tempassessmentAfterDislysis.Complication = lastAssessmentAfterDislysis.Complication
2424
+		tempassessmentAfterDislysis.Remark = lastAssessmentAfterDislysis.Remark
2425
+		tempassessmentAfterDislysis.DialysisIntakes = lastAssessmentAfterDislysis.DialysisIntakes
2426
+		tempassessmentAfterDislysis.DialysisIntakesFeed = lastAssessmentAfterDislysis.DialysisIntakesFeed
2427
+		tempassessmentAfterDislysis.DialysisIntakesTransfusion = lastAssessmentAfterDislysis.DialysisIntakesTransfusion
2428
+		tempassessmentAfterDislysis.DialysisIntakesBloodTransfusion = lastAssessmentAfterDislysis.DialysisIntakesBloodTransfusion
2429
+
2430
+		tempassessmentAfterDislysis.DialysisIntakesWashpipe = lastAssessmentAfterDislysis.DialysisIntakesWashpipe
2431
+
2432
+		tempassessmentAfterDislysis.BloodAccessPartId = lastAssessmentAfterDislysis.BloodAccessPartId
2433
+		tempassessmentAfterDislysis.BloodAccessPartOperaId = lastAssessmentAfterDislysis.BloodAccessPartOperaId
2434
+
2435
+		tempassessmentAfterDislysis.PuncturePointOozingBlood = lastAssessmentAfterDislysis.PuncturePointOozingBlood
2436
+		tempassessmentAfterDislysis.PuncturePointHaematoma = lastAssessmentAfterDislysis.PuncturePointHaematoma
2437
+		tempassessmentAfterDislysis.InternalFistulaTremorAc = lastAssessmentAfterDislysis.InternalFistulaTremorAc
2438
+		tempassessmentAfterDislysis.PatientGose = lastAssessmentAfterDislysis.PatientGose
2439
+
2440
+		tempassessmentAfterDislysis.InpatientDepartment = lastAssessmentAfterDislysis.InpatientDepartment
2441
+		tempassessmentAfterDislysis.ObservationContent = lastAssessmentAfterDislysis.ObservationContent
2442
+		tempassessmentAfterDislysis.ObservationContentOther = lastAssessmentAfterDislysis.ObservationContentOther
2443
+		tempassessmentAfterDislysis.DryWeight = lastAssessmentAfterDislysis.DryWeight
2444
+
2445
+		tempassessmentAfterDislysis.DialysisProcess = lastAssessmentAfterDislysis.DialysisProcess
2446
+		tempassessmentAfterDislysis.InAdvanceMinute = lastAssessmentAfterDislysis.InAdvanceMinute
2447
+		tempassessmentAfterDislysis.InAdvanceReason = lastAssessmentAfterDislysis.InAdvanceReason
2448
+
2449
+		tempassessmentAfterDislysis.HemostasisMinute = lastAssessmentAfterDislysis.HemostasisMinute
2450
+		tempassessmentAfterDislysis.HemostasisOpera = lastAssessmentAfterDislysis.HemostasisOpera
2451
+		tempassessmentAfterDislysis.TremorNoise = lastAssessmentAfterDislysis.TremorNoise
2452
+
2453
+		tempassessmentAfterDislysis.DisequilibriumSyndrome = lastAssessmentAfterDislysis.DisequilibriumSyndrome
2454
+		tempassessmentAfterDislysis.DisequilibriumSyndromeOption = lastAssessmentAfterDislysis.DisequilibriumSyndromeOption
2455
+		tempassessmentAfterDislysis.ArterialTube = lastAssessmentAfterDislysis.ArterialTube
2456
+
2457
+		tempassessmentAfterDislysis.IntravenousTube = lastAssessmentAfterDislysis.IntravenousTube
2458
+		tempassessmentAfterDislysis.Dialyzer = lastAssessmentAfterDislysis.Dialyzer
2459
+		tempassessmentAfterDislysis.InAdvanceReasonOther = lastAssessmentAfterDislysis.InAdvanceReasonOther
2460
+		tempassessmentAfterDislysis.IsEat = lastAssessmentAfterDislysis.IsEat
2461
+
2462
+		tempassessmentAfterDislysis.DialysisIntakesUnit = lastAssessmentAfterDislysis.DialysisIntakesUnit
2463
+		tempassessmentAfterDislysis.CvcA = lastAssessmentAfterDislysis.CvcA
2464
+		tempassessmentAfterDislysis.CvcV = lastAssessmentAfterDislysis.CvcV
2465
+		tempassessmentAfterDislysis.Channel = lastAssessmentAfterDislysis.Channel
2466
+		tempassessmentAfterDislysis.ReturnBlood = lastAssessmentAfterDislysis.ReturnBlood
2467
+		tempassessmentAfterDislysis.RehydrationVolume = lastAssessmentAfterDislysis.RehydrationVolume
2468
+		tempassessmentAfterDislysis.DialysisDuring = lastAssessmentAfterDislysis.DialysisDuring
2469
+		tempassessmentAfterDislysis.StrokeVolume = lastAssessmentAfterDislysis.StrokeVolume
2470
+		tempassessmentAfterDislysis.BloodFlow = lastAssessmentAfterDislysis.BloodFlow
2471
+		tempassessmentAfterDislysis.SealingFluidDispose = lastAssessmentAfterDislysis.SealingFluidDispose
2472
+		tempassessmentAfterDislysis.SealingFluidSpecial = lastAssessmentAfterDislysis.SealingFluidSpecial
2473
+
2474
+	}
2475
+
2412 2476
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
2413 2477
 	if err != nil {
2414 2478
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -2683,7 +2747,7 @@ func (this *DialysisAPIController) StartDialysis() {
2683 2747
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2684 2748
 
2685 2749
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2686
-			if template.TemplateId == 6 { //adminUserInfo.Org.Id == 9538
2750
+			if template.TemplateId == 6 || template.TemplateId == 20 { //adminUserInfo.Org.Id == 9538
2687 2751
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2688 2752
 			}
2689 2753
 			// 只针对方济医院
@@ -5532,7 +5596,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5532 5596
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
5533 5597
 
5534 5598
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5535
-			if template.TemplateId == 6 {
5599
+			if template.TemplateId == 6 || template.TemplateId == 20 {
5536 5600
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5537 5601
 				record.UltrafiltrationRate = ultrafiltration_rate
5538 5602
 			}
@@ -5553,7 +5617,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5553 5617
 		}
5554 5618
 	}
5555 5619
 
5556
-	if template.TemplateId == 6 { //adminInfo.Org.Id == 9538
5620
+	if template.TemplateId == 6 || template.TemplateId == 20 { //adminInfo.Org.Id == 9538
5557 5621
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5558 5622
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5559 5623
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 5 - 28
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Wyświetl plik

@@ -238,21 +238,11 @@ func (this *DialysisAPIController) EditMonitorRecord() {
238 238
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
239 239
 		return
240 240
 	}
241
-	//if monitor == nil {
242
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorNotExist)
243
-	//	return
244
-	//} else {
245
-	//	if monitor.MonitoringNurse != adminInfo.AdminUser.Id {
246
-	//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminInfo.Org.Id, adminInfo.App.Id, adminInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
247
-	//		if getPermissionErr != nil {
248
-	//			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
249
-	//			return
250
-	//		} else if headNursePermission == nil {
251
-	//			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
252
-	//			return
253
-	//		}
254
-	//	}
255
-	//}
241
+	if monitor == nil {
242
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorNotExist)
243
+		return
244
+	}
245
+
256 246
 	monitor.Conductivity = conductivity
257 247
 	monitor.DialysisOrderId = orderID
258 248
 	monitor.MonitoringDate = date
@@ -325,19 +315,6 @@ func (this *DialysisAPIController) DeleteMonitor() {
325 315
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
326 316
 		return
327 317
 	}
328
-	//if monitor != nil {
329
-	//	if monitor.MonitoringNurse != adminInfo.AdminUser.Id {
330
-	//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminInfo.Org.Id, adminInfo.App.Id, adminInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
331
-	//		if getPermissionErr != nil {
332
-	//			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
333
-	//			return
334
-	//		} else if headNursePermission == nil {
335
-	//			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
336
-	//			return
337
-	//		}
338
-	//	}
339
-	//}
340
-
341 318
 	err := service.DisableMonitor(adminInfo.Org.Id, patientID, recordID, adminInfo.AdminUser.Id)
342 319
 	if err != nil {
343 320
 		this.ErrorLog("删除透析监测记录失败:%v", err)

+ 0 - 1
controllers/new_mobile_api_controllers/home_api_controller.go Wyświetl plik

@@ -21,7 +21,6 @@ type HomeController struct {
21 21
 }
22 22
 
23 23
 func (this *HomeController) GetHomeData() {
24
-
25 24
 	adminUserInfo := this.GetMobileAdminUserInfo()
26 25
 	if adminUserInfo.Org != nil && adminUserInfo.Org.Id != 0 {
27 26
 		//获取该管理员所有机构列表

+ 136 - 0
controllers/new_mobile_api_controllers/management_analyse_api_controller.go Wyświetl plik

@@ -0,0 +1,136 @@
1
+package new_mobile_api_controllers
2
+
3
+import (
4
+	"XT_New/enums"
5
+	"XT_New/service/management_service"
6
+	service "XT_New/service/print_data_service/schedule_dialysis"
7
+	"XT_New/utils"
8
+	"time"
9
+)
10
+
11
+type ManagementAnalyseApiController struct {
12
+	NewMobileBaseAPIAuthController
13
+}
14
+
15
+func (this *ManagementAnalyseApiController) StockRecordPrintData() {
16
+	types, _ := this.GetInt("type", 0)
17
+	start_time := this.GetString("start_time")
18
+	end_time := this.GetString("end_time")
19
+	adminUserInfo := this.GetMobileAdminUserInfo()
20
+
21
+	timeLayout := "2006-01-02"
22
+	loc, _ := time.LoadLocation("Local")
23
+	var startTime int64
24
+	if len(start_time) > 0 {
25
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
26
+		if err != nil {
27
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
28
+			return
29
+		}
30
+		startTime = theTime.Unix()
31
+	}
32
+	var endTime int64
33
+	if len(end_time) > 0 {
34
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
35
+		if err != nil {
36
+			utils.ErrorLog(err.Error())
37
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
38
+			return
39
+		}
40
+		endTime = theTime.Unix()
41
+	}
42
+
43
+	list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, adminUserInfo.Org.Id)
44
+
45
+	if err != nil {
46
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
47
+	} else {
48
+		this.ServeSuccessJSON(map[string]interface{}{
49
+			"list": list,
50
+			"type": types,
51
+		})
52
+	}
53
+}
54
+func (this *ManagementAnalyseApiController) StatisticsPatientChart() {
55
+	start_time := this.GetString("start_time")
56
+	end_time := this.GetString("end_time")
57
+	statistics_type, _ := this.GetInt("type", 0)
58
+
59
+	adminUserInfo := this.GetMobileAdminUserInfo()
60
+
61
+	timeLayout := "2006-01-02"
62
+	loc, _ := time.LoadLocation("Local")
63
+	var startTime int64
64
+	if len(start_time) > 0 {
65
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
66
+		if err != nil {
67
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
68
+			return
69
+		}
70
+		startTime = theTime.Unix()
71
+	}
72
+	var endTime int64
73
+	if len(end_time) > 0 {
74
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
75
+		if err != nil {
76
+			utils.ErrorLog(err.Error())
77
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
78
+			return
79
+		}
80
+		endTime = theTime.Unix()
81
+	}
82
+	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
83
+	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
84
+
85
+	this.ServeSuccessJSON(map[string]interface{}{
86
+		"chart_data": data,
87
+		"total_one":  total_one,
88
+		"total":      total,
89
+	})
90
+
91
+}
92
+func (this *ManagementAnalyseApiController) StatisticsPatientTable() {
93
+	start_time := this.GetString("start_time")
94
+	end_time := this.GetString("end_time")
95
+	statistics_type, _ := this.GetInt("type", 0)
96
+	page, _ := this.GetInt64("page", 0)
97
+	limit, _ := this.GetInt64("limit", 0)
98
+
99
+	if page == 0 {
100
+		page = 1
101
+	}
102
+	if limit == 0 {
103
+		limit = 20
104
+	}
105
+
106
+	adminUserInfo := this.GetMobileAdminUserInfo()
107
+
108
+	timeLayout := "2006-01-02"
109
+	loc, _ := time.LoadLocation("Local")
110
+	var startTime int64
111
+	if len(start_time) > 0 {
112
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
113
+		if err != nil {
114
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
115
+			return
116
+		}
117
+		startTime = theTime.Unix()
118
+	}
119
+	var endTime int64
120
+	if len(end_time) > 0 {
121
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
122
+		if err != nil {
123
+			utils.ErrorLog(err.Error())
124
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
125
+			return
126
+		}
127
+		endTime = theTime.Unix()
128
+	}
129
+	data, total, _ := management_service.GetPatientTableData(adminUserInfo.Org.Id, page, limit, startTime, endTime, statistics_type)
130
+
131
+	this.ServeSuccessJSON(map[string]interface{}{
132
+		"data":  data,
133
+		"total": total,
134
+	})
135
+
136
+}

+ 9 - 0
controllers/new_mobile_api_controllers/new_role_api_controller.go Wyświetl plik

@@ -551,6 +551,15 @@ func (this *NewRoleApiController) EditFunctionPermission() {
551 551
 	func_permissions, err := service.GetRoleFuncPurviewIds(role_id)
552 552
 	permissions, _ := service.GetRolePurviewIds(role_id)
553 553
 
554
+	redis := service.RedisClient()
555
+	defer redis.Close()
556
+
557
+	users := service.GetAllUserRole(adminUser.Org.Id)
558
+	for _, item := range users {
559
+		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
560
+		redis.Set(key, "", time.Second)
561
+	}
562
+
554 563
 	if err != nil {
555 564
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
556 565
 		return

+ 6 - 2
controllers/new_mobile_api_controllers/patient.json Wyświetl plik

@@ -78,7 +78,10 @@
78 78
       "tell_phone": "21212",
79 79
       "first_treatment_date": 1582560000,
80 80
       "contact_name": "21221",
81
-      "is_infectious":1
81
+      "is_infectious":1,
82
+      "contagion_ids": ""
83
+
84
+
82 85
     },
83 86
     {
84 87
       "avatar": "https://images.shengws.com/201809182128111.png",
@@ -158,7 +161,8 @@
158 161
       "tell_phone": "21212",
159 162
       "first_treatment_date": 1582560000,
160 163
       "contact_name": "21221",
161
-      "is_infectious":2
164
+      "is_infectious":2,
165
+      "contagion_ids": "2"
162 166
 
163 167
     }
164 168
   ]

+ 4 - 0
controllers/new_mobile_api_controllers/statistics_api_controllers.go Wyświetl plik

@@ -37,4 +37,8 @@ func StatisticsAPIControllersRegisterRouters() {
37 37
 
38 38
 	beego.Router("/m/api/patients/get", &IndexEvaluationApiController{}, "Get:GetAllPatients")
39 39
 
40
+	beego.Router("/m/api/stock/get", &ManagementAnalyseApiController{}, "Get:StockRecordPrintData")
41
+	beego.Router("/m/api/patientlapseto/chart", &ManagementAnalyseApiController{}, "Get:StatisticsPatientChart")
42
+	beego.Router("/m/api/patientlapseto/table", &ManagementAnalyseApiController{}, "Get:StatisticsPatientTable")
43
+
40 44
 }

+ 1 - 0
controllers/print_data_api_controller.go Wyświetl plik

@@ -26,6 +26,7 @@ type PrintDataAPIController struct {
26 26
 // @param ids:string 排班 id,以逗号隔开 ("1,2,3")
27 27
 func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
28 28
 	schIDStr := this.GetString("ids")
29
+
29 30
 	if len(schIDStr) == 0 {
30 31
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
31 32
 		return

+ 330 - 312
controllers/public_api_controller.go Wyświetl plik

@@ -165,322 +165,340 @@ func (this *PublicApiController) GetJson() {
165 165
 func (c *PublicApiController) HandleData() {
166 166
 	//service.HandleData()
167 167
 
168
-	//org_app, _ := service.GetAllAppOrg()
168
+	org_app, _ := service.GetAllAppOrg()
169 169
 	//org_role, _ := service.GetAllRole()
170 170
 	//
171 171
 	//var org_ids []int64
172 172
 
173
-	//for _, apps := range org_app {
174
-	//	xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
175
-	//	scrm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 1)
176
-	//	cdm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 4)
177
-	//	mall_org_app, _ := service.GetAppByType(int64(apps.OrgId), 5)
178
-	//	org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
179
-	//	org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
180
-	//	org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
181
-	//	org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
182
-	//	org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
183
-	//	org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
184
-	//	org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
185
-	//	org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
186
-	//	org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
187
-	//	org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
188
-	//
189
-	//	var xt_temp_org_app *models.OrgApp
190
-	//	var mall_temp_org_app *models.OrgApp
191
-	//
192
-	//	if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
193
-	//
194
-	//		app, _ := service.GetOrgAppA(0, 3)
195
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
196
-	//		if org == nil || org.Id == 0 {
197
-	//			continue
198
-	//		}
199
-	//
200
-	//		app.Id = 0
201
-	//		app.OrgId = apps.OrgId
202
-	//		app.Creator = int(org.Creator)
203
-	//		app.Number = 0
204
-	//		app.Status = 1
205
-	//		app.ModifyTime = time.Now().Unix()
206
-	//		app.CreateTime = time.Now().Unix()
207
-	//		service.CreateOrgApp(app)
208
-	//		xt_temp_org_app = app
209
-	//	} else {
210
-	//
211
-	//		xt_temp_org_app = xt_org_app
212
-	//
213
-	//	}
214
-	//
215
-	//	if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
216
-	//
217
-	//		app, _ := service.GetOrgAppA(0, 1)
218
-	//		//org, _ := service.GetOrgById(int64(12))
219
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
220
-	//		if org == nil || org.Id == 0 {
221
-	//			continue
222
-	//		}
223
-	//
224
-	//
225
-	//		app.OrgId = apps.OrgId
226
-	//		app.Id = 0
227
-	//
228
-	//		app.Creator = int(org.Creator)
229
-	//		app.Number = 0
230
-	//		app.Status = 1
231
-	//		app.ModifyTime = time.Now().Unix()
232
-	//		app.CreateTime = time.Now().Unix()
233
-	//		service.CreateOrgApp(app)
234
-	//
235
-	//	}
236
-	//
237
-	//	if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
238
-	//		app, _ := service.GetOrgAppA(0, 4)
239
-	//		//org, _ := service.GetOrgById(int64(12))
240
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
241
-	//		if org == nil || org.Id == 0 {
242
-	//			continue
243
-	//		}
244
-	//
245
-	//
246
-	//		app.OrgId = apps.OrgId
247
-	//		app.Creator = int(org.Creator)
248
-	//		app.Number = 0
249
-	//		app.Id = 0
250
-	//
251
-	//		app.Status = 1
252
-	//		app.ModifyTime = time.Now().Unix()
253
-	//		app.CreateTime = time.Now().Unix()
254
-	//		service.CreateOrgApp(app)
255
-	//	}
256
-	//
257
-	//	if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
258
-	//		app, _ := service.GetOrgAppA(0, 5)
259
-	//		//org, _ := service.GetOrgById(int64(12))
260
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
261
-	//
262
-	//		if org == nil || org.Id == 0 {
263
-	//			continue
264
-	//		}
265
-	//
266
-	//		app.OrgId = apps.OrgId
267
-	//		app.Creator = int(org.Creator)
268
-	//		app.Number = 0
269
-	//		app.Id = 0
270
-	//
271
-	//		app.Status = 1
272
-	//		app.ModifyTime = time.Now().Unix()
273
-	//		app.CreateTime = time.Now().Unix()
274
-	//		service.CreateOrgApp(app)
275
-	//		mall_temp_org_app = app
276
-	//	} else {
277
-	//		mall_temp_org_app = mall_org_app
278
-	//	}
279
-	//
280
-	//	if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
281
-	//		app, _ := service.GetOrgAppA(0, 6)
282
-	//		//org, _ := service.GetOrgById(int64(12))
283
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
284
-	//		if org == nil || org.Id == 0 {
285
-	//			continue
286
-	//		}
287
-	//
288
-	//
289
-	//		app.OrgId = apps.OrgId
290
-	//		app.Creator = int(org.Creator)
291
-	//		app.Number = 1
292
-	//		app.Id = 0
293
-	//
294
-	//		app.Status = 1
295
-	//		app.ModifyTime = time.Now().Unix()
296
-	//		app.CreateTime = time.Now().Unix()
297
-	//		app.Pid = xt_temp_org_app.Id
298
-	//		service.CreateOrgApp(app)
299
-	//
300
-	//	}
301
-	//	if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
302
-	//		app, _ := service.GetOrgAppA(0, 7)
303
-	//		//org, _ := service.GetOrgById(int64(12))
304
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
305
-	//		if org == nil || org.Id == 0 {
306
-	//			continue
307
-	//		}
308
-	//
309
-	//
310
-	//		app.OrgId = apps.OrgId
311
-	//		app.Creator = int(org.Creator)
312
-	//		app.Number = 2
313
-	//		app.Status = 2
314
-	//		app.Id = 0
315
-	//
316
-	//		app.ModifyTime = time.Now().Unix()
317
-	//		app.CreateTime = time.Now().Unix()
318
-	//		app.Pid = xt_temp_org_app.Id
319
-	//
320
-	//		service.CreateOrgApp(app)
321
-	//	}
322
-	//	if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
323
-	//		app, _ := service.GetOrgAppA(0, 8)
324
-	//		//org, _ := service.GetOrgById(int64(12))
325
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
326
-	//		if org == nil || org.Id == 0 {
327
-	//			continue
328
-	//		}
329
-	//
330
-	//
331
-	//		app.OrgId = apps.OrgId
332
-	//		app.Creator = int(org.Creator)
333
-	//		app.Number = 3
334
-	//		app.Id = 0
335
-	//
336
-	//		app.Pid = mall_temp_org_app.Id
337
-	//
338
-	//		app.Status = 1
339
-	//		app.ModifyTime = time.Now().Unix()
340
-	//		app.CreateTime = time.Now().Unix()
341
-	//		service.CreateOrgApp(app)
342
-	//	}
343
-	//	if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
344
-	//		app, _ := service.GetOrgAppA(0, 9)
345
-	//		//org, _ := service.GetOrgById(int64(12))
346
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
347
-	//		if org == nil || org.Id == 0 {
348
-	//			continue
349
-	//		}
350
-	//
351
-	//
352
-	//		app.OrgId = apps.OrgId
353
-	//		app.Pid = xt_temp_org_app.Id
354
-	//
355
-	//		app.Creator = int(org.Creator)
356
-	//		app.Number = 4
357
-	//		app.Id = 0
358
-	//
359
-	//		app.Status = 1
360
-	//		app.ModifyTime = time.Now().Unix()
361
-	//		app.CreateTime = time.Now().Unix()
362
-	//		service.CreateOrgApp(app)
363
-	//
364
-	//	}
365
-	//	if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
366
-	//		app, _ := service.GetOrgAppA(0, 10)
367
-	//		//org, _ := service.GetOrgById(int64(12))
368
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
369
-	//		if org == nil || org.Id == 0 {
370
-	//			continue
371
-	//		}
372
-	//
373
-	//
374
-	//		app.OrgId = apps.OrgId
375
-	//		app.Creator = int(org.Creator)
376
-	//		app.Pid = xt_temp_org_app.Id
377
-	//
378
-	//		app.Number = 5
379
-	//		app.Id = 0
380
-	//
381
-	//		app.Status = 1
382
-	//		app.ModifyTime = time.Now().Unix()
383
-	//		app.CreateTime = time.Now().Unix()
384
-	//		service.CreateOrgApp(app)
385
-	//	}
386
-	//	if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
387
-	//		app, _ := service.GetOrgAppA(0, 11)
388
-	//		//org, _ := service.GetOrgById(int64(12))
389
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
390
-	//		if org == nil || org.Id == 0 {
391
-	//			continue
392
-	//		}
393
-	//
394
-	//
395
-	//		app.OrgId = apps.OrgId
396
-	//		app.Creator = int(org.Creator)
397
-	//		app.Pid = xt_temp_org_app.Id
398
-	//		app.Id = 0
399
-	//
400
-	//		app.Number = 6
401
-	//		app.Status = 1
402
-	//		app.ModifyTime = time.Now().Unix()
403
-	//		app.CreateTime = time.Now().Unix()
404
-	//		service.CreateOrgApp(app)
405
-	//	}
406
-	//	if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
407
-	//		app, _ := service.GetOrgAppA(0, 12)
408
-	//		//org, _ := service.GetOrgById(int64(12))
409
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
410
-	//		if org == nil || org.Id == 0 {
411
-	//			continue
412
-	//		}
413
-	//
414
-	//
415
-	//		app.OrgId = apps.OrgId
416
-	//		app.Creator = int(org.Creator)
417
-	//		app.Pid = xt_temp_org_app.Id
418
-	//		app.Number = 7
419
-	//		app.Status = 1
420
-	//		app.Id = 0
421
-	//
422
-	//		app.ModifyTime = time.Now().Unix()
423
-	//		app.CreateTime = time.Now().Unix()
424
-	//		service.CreateOrgApp(app)
425
-	//	}
426
-	//	if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
427
-	//		app, _ := service.GetOrgAppA(0, 13)
428
-	//		//org, _ := service.GetOrgById(int64(12))
429
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
430
-	//		if org == nil || org.Id == 0 {
431
-	//			continue
432
-	//		}
433
-	//
434
-	//
435
-	//		app.OrgId = apps.OrgId
436
-	//		app.Creator = int(org.Creator)
437
-	//		app.Pid = xt_temp_org_app.Id
438
-	//		app.Number = 8
439
-	//		app.Id = 0
440
-	//		app.Status = 1
441
-	//		app.ModifyTime = time.Now().Unix()
442
-	//		app.CreateTime = time.Now().Unix()
443
-	//		service.CreateOrgApp(app)
444
-	//	}
445
-	//	if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
446
-	//		app, _ := service.GetOrgAppA(0, 14)
447
-	//		//org, _ := service.GetOrgById(int64(12))
448
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
449
-	//		if org == nil || org.Id == 0 {
450
-	//			continue
451
-	//		}
452
-	//
453
-	//
454
-	//		app.OrgId = apps.OrgId
455
-	//		app.Creator = int(org.Creator)
456
-	//		app.Pid = xt_temp_org_app.Id
457
-	//		app.Id = 0
458
-	//		app.Number = 9
459
-	//		app.Status = 1
460
-	//		app.ModifyTime = time.Now().Unix()
461
-	//		app.CreateTime = time.Now().Unix()
462
-	//		service.CreateOrgApp(app)
463
-	//	}
464
-	//
465
-	//	if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
466
-	//		app, _ := service.GetOrgAppA(0, 15)
467
-	//		//org, _ := service.GetOrgById(int64(12))
468
-	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
469
-	//		if org == nil || org.Id == 0 {
470
-	//			continue
471
-	//		}
472
-	//
473
-	//		app.OrgId = apps.OrgId
474
-	//		app.Creator = int(org.Creator)
475
-	//		app.Pid = xt_temp_org_app.Id
476
-	//		app.Number = 10
477
-	//		app.Status = 1
478
-	//		app.Id = 0
479
-	//		app.ModifyTime = time.Now().Unix()
480
-	//		app.CreateTime = time.Now().Unix()
481
-	//		service.CreateOrgApp(app)
482
-	//	}
483
-	//}
173
+	for _, apps := range org_app {
174
+		xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
175
+		//org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
176
+		//org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
177
+		//org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
178
+		//org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
179
+		//org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
180
+		//org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
181
+		//org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
182
+		//org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
183
+		//org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
184
+		//org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
185
+
186
+		org_app_16, _ := service.GetAppByType(int64(apps.OrgId), 16)
187
+		org_app_17, _ := service.GetAppByType(int64(apps.OrgId), 17)
188
+
189
+		var xt_temp_org_app *models.OrgApp
190
+		//var mall_temp_org_app *models.OrgApp
191
+
192
+		if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
193
+
194
+			app, _ := service.GetOrgAppA(0, 3)
195
+			org, _ := service.GetOrgByIdB(int64(apps.OrgId))
196
+			if org == nil || org.Id == 0 {
197
+				continue
198
+			}
199
+
200
+			app.Id = 0
201
+			app.OrgId = apps.OrgId
202
+			app.Creator = int(org.Creator)
203
+			app.Number = 0
204
+			app.Status = 1
205
+			app.ModifyTime = time.Now().Unix()
206
+			app.CreateTime = time.Now().Unix()
207
+			service.CreateOrgApp(app)
208
+			xt_temp_org_app = app
209
+		} else {
210
+
211
+			xt_temp_org_app = xt_org_app
212
+
213
+		}
214
+
215
+		//if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
216
+		//
217
+		//	app, _ := service.GetOrgAppA(0, 1)
218
+		//	//org, _ := service.GetOrgById(int64(12))
219
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
220
+		//	if org == nil || org.Id == 0 {
221
+		//		continue
222
+		//	}
223
+		//
224
+		//
225
+		//	app.OrgId = apps.OrgId
226
+		//	app.Id = 0
227
+		//
228
+		//	app.Creator = int(org.Creator)
229
+		//	app.Number = 0
230
+		//	app.Status = 1
231
+		//	app.ModifyTime = time.Now().Unix()
232
+		//	app.CreateTime = time.Now().Unix()
233
+		//	service.CreateOrgApp(app)
234
+		//
235
+		//}
236
+		//
237
+		//if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
238
+		//	app, _ := service.GetOrgAppA(0, 4)
239
+		//	//org, _ := service.GetOrgById(int64(12))
240
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
241
+		//	if org == nil || org.Id == 0 {
242
+		//		continue
243
+		//	}
244
+		//
245
+		//
246
+		//	app.OrgId = apps.OrgId
247
+		//	app.Creator = int(org.Creator)
248
+		//	app.Number = 0
249
+		//	app.Id = 0
250
+		//
251
+		//	app.Status = 1
252
+		//	app.ModifyTime = time.Now().Unix()
253
+		//	app.CreateTime = time.Now().Unix()
254
+		//	service.CreateOrgApp(app)
255
+		//}
256
+		//
257
+		//if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
258
+		//	app, _ := service.GetOrgAppA(0, 5)
259
+		//	//org, _ := service.GetOrgById(int64(12))
260
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
261
+		//
262
+		//	if org == nil || org.Id == 0 {
263
+		//		continue
264
+		//	}
265
+		//
266
+		//	app.OrgId = apps.OrgId
267
+		//	app.Creator = int(org.Creator)
268
+		//	app.Number = 0
269
+		//	app.Id = 0
270
+		//
271
+		//	app.Status = 1
272
+		//	app.ModifyTime = time.Now().Unix()
273
+		//	app.CreateTime = time.Now().Unix()
274
+		//	service.CreateOrgApp(app)
275
+		//	mall_temp_org_app = app
276
+		//} else {
277
+		//	mall_temp_org_app = mall_org_app
278
+		//}
279
+		//
280
+		if org_app_16 == nil || org_app_16.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
281
+			app, _ := service.GetOrgAppA(0, 16)
282
+			//org, _ := service.GetOrgById(int64(12))
283
+			org, _ := service.GetOrgByIdB(int64(apps.OrgId))
284
+			if org == nil || org.Id == 0 {
285
+				continue
286
+			}
287
+
288
+			app.OrgId = apps.OrgId
289
+			app.Creator = int(org.Creator)
290
+			app.Number = 11
291
+			app.Id = 0
292
+			app.Status = 1
293
+			app.ModifyTime = time.Now().Unix()
294
+			app.CreateTime = time.Now().Unix()
295
+			app.Pid = xt_temp_org_app.Id
296
+			service.CreateOrgApp(app)
297
+
298
+		}
299
+
300
+		if org_app_17 == nil || org_app_17.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
301
+			app, _ := service.GetOrgAppA(0, 17)
302
+			//org, _ := service.GetOrgById(int64(12))
303
+			org, _ := service.GetOrgByIdB(int64(apps.OrgId))
304
+			if org == nil || org.Id == 0 {
305
+				continue
306
+			}
307
+
308
+			app.OrgId = apps.OrgId
309
+			app.Creator = int(org.Creator)
310
+			app.Number = 12
311
+			app.Id = 0
312
+			app.Status = 1
313
+			app.ModifyTime = time.Now().Unix()
314
+			app.CreateTime = time.Now().Unix()
315
+			app.Pid = xt_temp_org_app.Id
316
+			service.CreateOrgApp(app)
317
+
318
+		}
319
+		//if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
320
+		//	app, _ := service.GetOrgAppA(0, 7)
321
+		//	//org, _ := service.GetOrgById(int64(12))
322
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
323
+		//	if org == nil || org.Id == 0 {
324
+		//		continue
325
+		//	}
326
+		//
327
+		//
328
+		//	app.OrgId = apps.OrgId
329
+		//	app.Creator = int(org.Creator)
330
+		//	app.Number = 2
331
+		//	app.Status = 2
332
+		//	app.Id = 0
333
+		//
334
+		//	app.ModifyTime = time.Now().Unix()
335
+		//	app.CreateTime = time.Now().Unix()
336
+		//	app.Pid = xt_temp_org_app.Id
337
+		//
338
+		//	service.CreateOrgApp(app)
339
+		//}
340
+		//if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
341
+		//	app, _ := service.GetOrgAppA(0, 8)
342
+		//	//org, _ := service.GetOrgById(int64(12))
343
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
344
+		//	if org == nil || org.Id == 0 {
345
+		//		continue
346
+		//	}
347
+		//
348
+		//
349
+		//	app.OrgId = apps.OrgId
350
+		//	app.Creator = int(org.Creator)
351
+		//	app.Number = 3
352
+		//	app.Id = 0
353
+		//
354
+		//	app.Pid = mall_temp_org_app.Id
355
+		//
356
+		//	app.Status = 1
357
+		//	app.ModifyTime = time.Now().Unix()
358
+		//	app.CreateTime = time.Now().Unix()
359
+		//	service.CreateOrgApp(app)
360
+		//}
361
+		//if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
362
+		//	app, _ := service.GetOrgAppA(0, 9)
363
+		//	//org, _ := service.GetOrgById(int64(12))
364
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
365
+		//	if org == nil || org.Id == 0 {
366
+		//		continue
367
+		//	}
368
+		//
369
+		//
370
+		//	app.OrgId = apps.OrgId
371
+		//	app.Pid = xt_temp_org_app.Id
372
+		//
373
+		//	app.Creator = int(org.Creator)
374
+		//	app.Number = 4
375
+		//	app.Id = 0
376
+		//
377
+		//	app.Status = 1
378
+		//	app.ModifyTime = time.Now().Unix()
379
+		//	app.CreateTime = time.Now().Unix()
380
+		//	service.CreateOrgApp(app)
381
+		//
382
+		//}
383
+		//if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
384
+		//	app, _ := service.GetOrgAppA(0, 10)
385
+		//	//org, _ := service.GetOrgById(int64(12))
386
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
387
+		//	if org == nil || org.Id == 0 {
388
+		//		continue
389
+		//	}
390
+		//
391
+		//
392
+		//	app.OrgId = apps.OrgId
393
+		//	app.Creator = int(org.Creator)
394
+		//	app.Pid = xt_temp_org_app.Id
395
+		//
396
+		//	app.Number = 5
397
+		//	app.Id = 0
398
+		//
399
+		//	app.Status = 1
400
+		//	app.ModifyTime = time.Now().Unix()
401
+		//	app.CreateTime = time.Now().Unix()
402
+		//	service.CreateOrgApp(app)
403
+		//}
404
+		//if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
405
+		//	app, _ := service.GetOrgAppA(0, 11)
406
+		//	//org, _ := service.GetOrgById(int64(12))
407
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
408
+		//	if org == nil || org.Id == 0 {
409
+		//		continue
410
+		//	}
411
+		//
412
+		//
413
+		//	app.OrgId = apps.OrgId
414
+		//	app.Creator = int(org.Creator)
415
+		//	app.Pid = xt_temp_org_app.Id
416
+		//	app.Id = 0
417
+		//
418
+		//	app.Number = 6
419
+		//	app.Status = 1
420
+		//	app.ModifyTime = time.Now().Unix()
421
+		//	app.CreateTime = time.Now().Unix()
422
+		//	service.CreateOrgApp(app)
423
+		//}
424
+		//if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
425
+		//	app, _ := service.GetOrgAppA(0, 12)
426
+		//	//org, _ := service.GetOrgById(int64(12))
427
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
428
+		//	if org == nil || org.Id == 0 {
429
+		//		continue
430
+		//	}
431
+		//
432
+		//
433
+		//	app.OrgId = apps.OrgId
434
+		//	app.Creator = int(org.Creator)
435
+		//	app.Pid = xt_temp_org_app.Id
436
+		//	app.Number = 7
437
+		//	app.Status = 1
438
+		//	app.Id = 0
439
+		//
440
+		//	app.ModifyTime = time.Now().Unix()
441
+		//	app.CreateTime = time.Now().Unix()
442
+		//	service.CreateOrgApp(app)
443
+		//}
444
+		//if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
445
+		//	app, _ := service.GetOrgAppA(0, 13)
446
+		//	//org, _ := service.GetOrgById(int64(12))
447
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
448
+		//	if org == nil || org.Id == 0 {
449
+		//		continue
450
+		//	}
451
+		//
452
+		//
453
+		//	app.OrgId = apps.OrgId
454
+		//	app.Creator = int(org.Creator)
455
+		//	app.Pid = xt_temp_org_app.Id
456
+		//	app.Number = 8
457
+		//	app.Id = 0
458
+		//	app.Status = 1
459
+		//	app.ModifyTime = time.Now().Unix()
460
+		//	app.CreateTime = time.Now().Unix()
461
+		//	service.CreateOrgApp(app)
462
+		//}
463
+		//if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
464
+		//	app, _ := service.GetOrgAppA(0, 14)
465
+		//	//org, _ := service.GetOrgById(int64(12))
466
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
467
+		//	if org == nil || org.Id == 0 {
468
+		//		continue
469
+		//	}
470
+		//
471
+		//
472
+		//	app.OrgId = apps.OrgId
473
+		//	app.Creator = int(org.Creator)
474
+		//	app.Pid = xt_temp_org_app.Id
475
+		//	app.Id = 0
476
+		//	app.Number = 9
477
+		//	app.Status = 1
478
+		//	app.ModifyTime = time.Now().Unix()
479
+		//	app.CreateTime = time.Now().Unix()
480
+		//	service.CreateOrgApp(app)
481
+		//}
482
+
483
+		//if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
484
+		//	app, _ := service.GetOrgAppA(0, 15)
485
+		//	//org, _ := service.GetOrgById(int64(12))
486
+		//	org, _ := service.GetOrgByIdB(int64(apps.OrgId))
487
+		//	if org == nil || org.Id == 0 {
488
+		//		continue
489
+		//	}
490
+		//
491
+		//	app.OrgId = apps.OrgId
492
+		//	app.Creator = int(org.Creator)
493
+		//	app.Pid = xt_temp_org_app.Id
494
+		//	app.Number = 10
495
+		//	app.Status = 1
496
+		//	app.Id = 0
497
+		//	app.ModifyTime = time.Now().Unix()
498
+		//	app.CreateTime = time.Now().Unix()
499
+		//	service.CreateOrgApp(app)
500
+		//}
501
+	}
484 502
 
485 503
 	//for _, role := range org_role {
486 504
 	//	org_ids = append(org_ids, role.OrgId)

+ 9 - 0
controllers/role_controller.go Wyświetl plik

@@ -302,6 +302,15 @@ func (this *RoleAPIController) EditPurview() {
302 302
 		return
303 303
 	}
304 304
 
305
+	redis := service.RedisClient()
306
+	defer redis.Close()
307
+
308
+	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
309
+	for _, item := range users {
310
+		key := "purviews_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + strconv.FormatInt(item.AdminUserId, 10)
311
+		redis.Set(key, "", time.Second)
312
+	}
313
+
305 314
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
306 315
 	err = service.SaveFuncRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, funcPurviewIds)
307 316
 

+ 9 - 0
csx的数据变更脚本.sql Wyświetl plik

@@ -0,0 +1,9 @@
1
+--2020-07-13  --
2
+--修改应用的状态和排序--
3
+UPDATE sgj_user_org_app SET open_status = 1 WHERE name = '质控管理'
4
+UPDATE sgj_user_org_app SET number = 3 WHERE name = '质控管理'
5
+UPDATE sgj_user_org_app SET number = 4 WHERE name =  '分销商城'
6
+UPDATE sgj_user_org_app SET number = 5 WHERE name = '排班管理'
7
+UPDATE sgj_user_org_app SET status = 0 WHERE name = '签到称重' OR  name = '设备管理' OR name='质控上报' OR name='库存管理' OR name ='院感管理'
8
+
9
+

+ 2 - 0
models/vm_models.go Wyświetl plik

@@ -86,6 +86,8 @@ type VMOrgPatients struct {
86 86
 	FirstTreatmentDate       int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
87 87
 	ContactName              string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
88 88
 	UserSysBeforeCount       int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
89
+
90
+	ContagionIds string `json:"contagion_ids" gorm:"-"`
89 91
 }
90 92
 
91 93
 func (VMOrgPatients) TableName() string {

+ 3 - 1
service/dialysis_service.go Wyświetl plik

@@ -638,7 +638,9 @@ func GetDialysisWatch(orgID int64, schedulDate int64, schedulType int64, partiti
638 638
 		Preload("Prescription", "status = 1 AND user_org_id = ?", orgID).
639 639
 		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ?", orgID).
640 640
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ?", orgID).
641
-		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ?", orgID).
641
+		Preload("MonitoringRecord", func(db *gorm.DB) *gorm.DB {
642
+			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time desc")
643
+		}).
642 644
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
643 645
 		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
644 646
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)

+ 57 - 0
service/management_service/management_analyse_service.go Wyświetl plik

@@ -0,0 +1,57 @@
1
+package management_service
2
+
3
+import "XT_New/service"
4
+
5
+type ChartDataStruct struct {
6
+	Date  string `json:"date"`
7
+	Value int64  `json:"value"`
8
+}
9
+
10
+//患者统计
11
+func GetPatientChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ChartDataStruct, total int64, err error) {
12
+	db := service.XTReadDB()
13
+	switch statistics_type {
14
+	case 1:
15
+		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 1 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
16
+
17
+		break
18
+	case 2:
19
+		//err = db.Raw("select from_unixtime(assessment_date,'%Y-%m-%d') as date, weight_after as value from xt_assessment_after_dislysis  Where status = 1 AND user_org_id = ? AND patient_id = ?  AND assessment_date <= ? AND  assessment_date >= ? ", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
20
+		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 2 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
21
+
22
+		break
23
+	}
24
+	for _, item := range datas {
25
+		total = total + item.Value
26
+	}
27
+
28
+	if err != nil {
29
+		return nil, 0, err
30
+	}
31
+	return datas, total, nil
32
+}
33
+
34
+type PatientTableStruct struct {
35
+	Date     string `json:"date"`
36
+	Name     string `json:"name"`
37
+	IdCardNo string `json:"id_card_no"`
38
+	Gender   int    `json:"gender"`
39
+}
40
+
41
+func GetPatientTableData(orgID int64, page, limit, start, end int64, statistics_type int) ([]*PatientTableStruct, int64, error) {
42
+	//offset := (page - 1) * limit
43
+	var total int64
44
+	var err error
45
+	var patients []*PatientTableStruct
46
+	readDb := service.XTReadDB()
47
+	db := readDb.Raw("select from_unixtime(lapseto.`lapseto_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = ? AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?  ", orgID, statistics_type, start, end)
48
+	err = db.Order("lapseto.lapseto_time desc").Scan(&patients).Error
49
+	//.Offset(offset).Limit(limit)
50
+	return patients, total, err
51
+}
52
+
53
+func GetLapsetoPatientTotal(orgID int64, statistics_type int) (Total int64, err error) {
54
+	readDb := service.XTReadDB()
55
+	err = readDb.Raw("select count(*) as total from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type =?", orgID, statistics_type).Count(&Total).Error
56
+	return Total, err
57
+}

+ 103 - 0
service/management_service/management_models.go Wyświetl plik

@@ -0,0 +1,103 @@
1
+package management_service
2
+
3
+type PatientLapseto struct {
4
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
5
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
6
+	LapsetoType int64 `gorm:"column:lapseto_type" json:"lapseto_type" form:"lapseto_type"`
7
+	LapsetoTime int64 `gorm:"column:lapseto_time" json:"lapseto_time" form:"lapseto_time"`
8
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
9
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
10
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
11
+}
12
+
13
+func (PatientLapseto) TableName() string {
14
+	return "xt_patient_lapseto"
15
+}
16
+
17
+type Patients struct {
18
+	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
19
+	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
20
+	UserId                       int64   `gorm:"column:user_id" json:"user_id" form:"user_id"`
21
+	Avatar                       string  `gorm:"column:avatar" json:"avatar" form:"avatar"`
22
+	PatientType                  int64   `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
23
+	DialysisNo                   string  `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
24
+	AdmissionNumber              string  `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
25
+	Source                       int64   `gorm:"column:source" json:"source" form:"source"`
26
+	Lapseto                      int64   `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
27
+	PartitionId                  int64   `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
28
+	BedId                        int64   `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
29
+	Name                         string  `gorm:"column:name" json:"name" form:"name"`
30
+	Alias                        string  `gorm:"column:alias" json:"alias" form:"alias"`
31
+	Gender                       int64   `gorm:"column:gender" json:"gender" form:"gender"`
32
+	MaritalStatus                int64   `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
33
+	IdCardNo                     string  `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
34
+	Birthday                     int64   `gorm:"column:birthday" json:"birthday" form:"birthday"`
35
+	ReimbursementWayId           int64   `gorm:"column:reimbursement_way_id" json:"reimbursement_way_id" form:"reimbursement_way_id"`
36
+	HealthCareType               int64   `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
37
+	HealthCareNo                 string  `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
38
+	HealthCareDueDate            int64   `gorm:"column:health_care_due_date" json:"health_care_due_date" form:"health_care_due_date"`
39
+	Height                       int64   `gorm:"column:height" json:"height" form:"height"`
40
+	BloodType                    int64   `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
41
+	Rh                           int64   `gorm:"column:rh" json:"rh" form:"rh"`
42
+	HealthCareDueAlertDate       int64   `gorm:"column:health_care_due_alert_date" json:"health_care_due_alert_date" form:"health_care_due_alert_date"`
43
+	EducationLevel               int64   `gorm:"column:education_level" json:"education_level" form:"education_level"`
44
+	Profession                   int64   `gorm:"column:profession" json:"profession" form:"profession"`
45
+	Phone                        string  `gorm:"column:phone" json:"phone" form:"phone"`
46
+	HomeTelephone                string  `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
47
+	RelativePhone                string  `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
48
+	RelativeRelations            string  `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
49
+	HomeAddress                  string  `gorm:"column:home_address" json:"home_address" form:"home_address"`
50
+	WorkUnit                     string  `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
51
+	UnitAddress                  string  `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
52
+	Children                     int64   `gorm:"column:children" json:"children" form:"children"`
53
+	ReceivingDate                int64   `gorm:"column:receiving_date" json:"receiving_date" form:"receiving_date"`
54
+	IsHospitalFirstDialysis      int64   `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
55
+	FirstDialysisDate            int64   `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
56
+	FirstDialysisHospital        string  `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
57
+	PredialysisCondition         string  `gorm:"column:predialysis_condition" json:"predialysis_condition" form:"predialysis_condition"`
58
+	PreHospitalDialysisFrequency string  `gorm:"column:pre_hospital_dialysis_frequency" json:"pre_hospital_dialysis_frequency" form:"pre_hospital_dialysis_frequency"`
59
+	PreHospitalDialysisTimes     int64   `gorm:"column:pre_hospital_dialysis_times" json:"pre_hospital_dialysis_times" form:"pre_hospital_dialysis_times"`
60
+	HospitalFirstDialysisDate    int64   `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
61
+	InductionPeriod              int64   `gorm:"column:induction_period" json:"induction_period" form:"induction_period"`
62
+	InitialDialysis              int64   `gorm:"column:initial_dialysis" json:"initial_dialysis" form:"initial_dialysis"`
63
+	TotalDialysis                int64   `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
64
+	AttendingDoctorId            int64   `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
65
+	HeadNurseId                  int64   `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
66
+	Evaluate                     string  `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
67
+	Diagnose                     string  `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
68
+	Remark                       string  `gorm:"column:remark" json:"remark" form:"remark"`
69
+	RegistrarsId                 int64   `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
70
+	Registrars                   string  `gorm:"column:registrars" json:"registrars" form:"registrars"`
71
+	QrCode                       string  `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
72
+	BindingState                 int64   `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
73
+	PatientComplains             string  `gorm:"column:patient_complains" json:"patient_complains" form:"patient_complains"`
74
+	PresentHistory               string  `gorm:"column:present_history" json:"present_history" form:"present_history"`
75
+	PastHistory                  string  `gorm:"column:past_history" json:"past_history" form:"past_history"`
76
+	Temperature                  float64 `gorm:"column:temperature" json:"temperature" form:"temperature"`
77
+	Pulse                        int64   `gorm:"column:pulse" json:"pulse" form:"pulse"`
78
+	Respiratory                  int64   `gorm:"column:respiratory" json:"respiratory" form:"respiratory"`
79
+	Sbp                          int64   `gorm:"column:sbp" json:"sbp" form:"sbp"`
80
+	Dbp                          int64   `gorm:"column:dbp" json:"dbp" form:"dbp"`
81
+	Status                       int64   `gorm:"column:status" json:"status" form:"status"`
82
+	CreatedTime                  int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
83
+	UpdatedTime                  int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
84
+	Nation                       string  `gorm:"column:nation" json:"nation" form:"nation"`
85
+	NativePlace                  string  `gorm:"column:native_place" json:"native_place" form:"native_place"`
86
+	Age                          int64   `gorm:"column:age" json:"age" form:"age"`
87
+	InfectiousNextRecordTime     int64   `gorm:"column:infectious_next_record_time" json:"infectious_next_record_time" form:"infectious_next_record_time"`
88
+	IsInfectious                 int64   `gorm:"column:is_infectious" json:"is_infectious" form:"is_infectious"`
89
+	IsOpenRemind                 int64   `gorm:"column:is_open_remind" json:"is_open_remind" form:"is_open_remind"`
90
+	RemindCycle                  int64   `gorm:"column:remind_cycle" json:"remind_cycle" form:"remind_cycle"`
91
+	ResponseResult               string  `gorm:"column:response_result" json:"response_result" form:"response_result"`
92
+	FirstTreatmentDate           int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
93
+	DialysisAge                  int64   `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
94
+	ExpenseKind                  int64   `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
95
+	TellPhone                    string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
96
+	ContactName                  string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
97
+	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
98
+	IsExcelExport                int64   `gorm:"column:is_excel_export" json:"is_excel_export" form:"is_excel_export"`
99
+}
100
+
101
+func (Patients) TableName() string {
102
+	return "xt_patients"
103
+}

+ 5 - 0
service/mobile_dialysis_service.go Wyświetl plik

@@ -1239,3 +1239,8 @@ func GetSystemDialysisPrescribeByModeId(orgID int64, mode_id int64) (*models.Sys
1239 1239
 	}
1240 1240
 	return &record, nil
1241 1241
 }
1242
+
1243
+func GetDialysisOrderCount(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
1244
+	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
1245
+	return
1246
+}

+ 7 - 7
service/patient_service.go Wyświetl plik

@@ -81,7 +81,7 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
81 81
 }
82 82
 
83 83
 func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patients []*models.PatientListForFaceList, total int64, err error) {
84
-	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and status=1", orgID)
84
+	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=?  AND  status=1  AND  avatar <> 'https://images.shengws.com/201809182128222.png' AND avatar <> 'https://images.shengws.com/201809182128111.png' AND avatar <> ''", orgID)
85 85
 	if force == 0 {
86 86
 		db = db.Where("updated_time >= ?", syncTime)
87 87
 	}
@@ -90,7 +90,7 @@ func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patie
90 90
 }
91 91
 
92 92
 func GetPatientListById(orgID int64, patientId int64) (patients models.PatientListForFace, err error) {
93
-	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID,patientId).First(&patients).Error
93
+	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID, patientId).First(&patients).Error
94 94
 	return
95 95
 }
96 96
 
@@ -352,8 +352,8 @@ func UpdatePatient(patient *models.Patients, contagions []int64, diseases []int6
352 352
 			insertData = append(insertData, patient.ID)
353 353
 			insertData = append(insertData, contagion)
354 354
 			insertData = append(insertData, 1)
355
-			insertData = append(insertData, patient.CreatedTime)
356
-			insertData = append(insertData, patient.UpdatedTime)
355
+			insertData = append(insertData, time.Now().Unix())
356
+			insertData = append(insertData, time.Now().Unix())
357 357
 		}
358 358
 		thisSQL += strings.Join(insertParams, ", ")
359 359
 		err = utx.Exec(thisSQL, insertData...).Error
@@ -377,8 +377,8 @@ func UpdatePatient(patient *models.Patients, contagions []int64, diseases []int6
377 377
 			insertData = append(insertData, patient.ID)
378 378
 			insertData = append(insertData, disease)
379 379
 			insertData = append(insertData, 1)
380
-			insertData = append(insertData, patient.CreatedTime)
381
-			insertData = append(insertData, patient.UpdatedTime)
380
+			insertData = append(insertData, time.Now().Unix())
381
+			insertData = append(insertData, time.Now().Unix())
382 382
 		}
383 383
 		thisSQL += strings.Join(insertParams, ", ")
384 384
 		err = utx.Exec(thisSQL, insertData...).Error
@@ -675,7 +675,7 @@ func DeleteDoctorAdvice(m *models.DoctorAdvice) (err error) {
675 675
 			ut.Rollback()
676 676
 			return
677 677
 		}
678
-		err = ut.Model(&models.DoctorAdvice{}).Where("parent_id=?", m.ID).Update(map[string]interface{}{"UpdatedTime": m.UpdatedTime, "Status": 0, "Modifier": m.Modifier}).Error
678
+		err = ut.Model(&models.DoctorAdvice{}).Where("parent_id=? AND user_org_id = ?", m.ID, m.UserOrgId).Update(map[string]interface{}{"UpdatedTime": m.UpdatedTime, "Status": 0, "Modifier": m.Modifier}).Error
679 679
 		if err != nil {
680 680
 			ut.Rollback()
681 681
 			return

+ 8 - 8
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Wyświetl plik

@@ -137,27 +137,27 @@ func FindPrintStockGoodInfoByType(types int, startTime int64, end_time int64, or
137 137
 	db = db.Model(&models.StockInfo{})
138 138
 	db = db.Where("xt_good_information.org_id = ? AND xt_good_information.status = 1", orgId)
139 139
 	if types == 1 {
140
-		db = db.Joins("JOIN xt_warehouse_info AS info ON info.good_id=xt_good_information.id AND info.status = 1").Group("xt_good_information.id")
140
+		db = db.Joins("JOIN xt_warehouse_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
141 141
 		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
142
-			return db.Where("xt_warehouse_info.org_id = ? AND xt_warehouse_info.status = 1", orgId).Joins("JOIN xt_warehouse AS warehouse ON warehouse.id = xt_warehouse_info.warehousing_id AND warehouse.status = 1 AND warehouse.warehousing_time >=? AND warehouse.warehousing_time<= ?", startTime, end_time)
142
+			return db.Where("xt_warehouse_info.org_id = ? AND xt_warehouse_info.status = 1", orgId).Joins("JOIN xt_warehouse AS warehouse ON warehouse.id = xt_warehouse_info.warehousing_id AND warehouse.status = 1 AND warehouse.warehousing_time >=? AND warehouse.warehousing_time<= ? AND warehouse.org_id = ?", startTime, end_time, orgId)
143 143
 		})
144 144
 	} else if types == 2 {
145
-		db = db.Joins("JOIN xt_sales_return_info AS info ON info.good_id=xt_good_information.id AND info.status = 1").Group("xt_good_information.id")
145
+		db = db.Joins("JOIN xt_sales_return_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
146 146
 		db = db.Preload("QuerySalesReturnInfo", func(db *gorm.DB) *gorm.DB {
147
-			return db.Where("xt_sales_return_info.org_id = ? AND xt_sales_return_info.status = 1", orgId).Joins("JOIN xt_sales_return AS sales ON sales.id = xt_sales_return_info.sales_return_id AND sales.status = 1 AND sales.return_time >=? AND sales.return_time<= ?", startTime, end_time)
147
+			return db.Where("xt_sales_return_info.org_id = ? AND xt_sales_return_info.status = 1", orgId).Joins("JOIN xt_sales_return AS sales ON sales.id = xt_sales_return_info.sales_return_id AND sales.status = 1 AND sales.return_time >=? AND sales.return_time<= ? AND sales.org_id = ?", startTime, end_time, orgId)
148 148
 		})
149 149
 
150 150
 	} else if types == 3 {
151
-		db = db.Joins("JOIN xt_warehouse_out_info AS info ON info.good_id=xt_good_information.id AND info.status = 1").Group("xt_good_information.id")
151
+		db = db.Joins("JOIN xt_warehouse_out_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
152 152
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
153
-			return db.Where("xt_warehouse_out_info.org_id = ? AND xt_warehouse_out_info.status = 1", orgId).Joins("JOIN xt_warehouse_out ON xt_warehouse_out.id = xt_warehouse_out_info.warehouse_out_id AND xt_warehouse_out.status = 1 AND xt_warehouse_out.warehouse_out_time >=? AND xt_warehouse_out.warehouse_out_time<= ?", startTime, end_time)
153
+			return db.Where("xt_warehouse_out_info.org_id = ? AND xt_warehouse_out_info.status = 1", orgId).Joins("JOIN xt_warehouse_out ON xt_warehouse_out.id = xt_warehouse_out_info.warehouse_out_id AND xt_warehouse_out.status = 1 AND xt_warehouse_out.warehouse_out_time >=? AND xt_warehouse_out.warehouse_out_time<= ? AND xt_warehouse_out.org_id = ? ", startTime, end_time, orgId)
154 154
 		})
155 155
 
156 156
 	} else if types == 4 {
157 157
 
158
-		db = db.Joins("JOIN xt_cancel_stock_info AS info ON info.good_id=xt_good_information.id AND info.status = 1").Group("xt_good_information.id")
158
+		db = db.Joins("JOIN xt_cancel_stock_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
159 159
 		db = db.Preload("QueryCancelStockInfo", func(db *gorm.DB) *gorm.DB {
160
-			return db.Where("xt_cancel_stock_info.org_id = ? AND xt_cancel_stock_info.status = 1", orgId).Joins("JOIN xt_cancel_stock AS cancel ON cancel.id = xt_cancel_stock_info.cancel_stock_id AND cancel.status = 1 AND cancel.return_time >=? AND cancel.return_time<= ?", startTime, end_time)
160
+			return db.Where("xt_cancel_stock_info.org_id = ? AND xt_cancel_stock_info.status = 1", orgId).Joins("JOIN xt_cancel_stock AS cancel ON cancel.id = xt_cancel_stock_info.cancel_stock_id AND cancel.status = 1 AND cancel.return_time >=? AND cancel.return_time<= ? AND cancel.org_id = ?", startTime, end_time, orgId)
161 161
 		})
162 162
 
163 163
 	}

+ 11 - 12
service/statistics_service/index_evaluation_service.go Wyświetl plik

@@ -104,17 +104,16 @@ func GetDialysisProcessIndexOtherChartData(user_org_id int64, patient_id int64,
104 104
 
105 105
 		break
106 106
 	case 10:
107
-		config, _ := GetAnticoagulantData(user_org_id)
108
-		selectContent := "CASE"
109
-		for _, item := range config {
110
-			fmt.Println(selectContent)
111
-			selectContent = selectContent + " WHEN p.anticoagulant =" + strconv.Itoa(item.Value) + " THEN " + "'" + item.Name + "'"
112
-
113
-		}
114
-		fmt.Println("selectContent 是什么=============================================", selectContent)
115 107
 		tempErr = db.Table("xt_dialysis_prescription as p").Where("p.user_org_id=? and p.status=1 and  p.record_date >= ? and p.record_date <= ? AND p.patient_id = ? ", user_org_id, start_time, end_time, patient_id).
116
-			Select(selectContent +
117
-				" ELSE '未知' END AS name, COUNT(*) AS total").Group("p.anticoagulant").Scan(&items).Error
108
+			Select("CASE WHEN p.anticoagulant = 1 THEN '无肝素'" +
109
+				" WHEN p.anticoagulant = 2 THEN '普通肝素'" +
110
+				" WHEN p.anticoagulant = 3 THEN '低分子肝素'" +
111
+				" WHEN p.anticoagulant = 4 THEN '阿加曲班'" +
112
+				" WHEN p.anticoagulant = 5 THEN '枸橼酸钠'" +
113
+				" WHEN p.anticoagulant = 6 THEN '低分子肝素钙'" +
114
+				" WHEN p.anticoagulant = 7 THEN '低分子肝素钠'" +
115
+				" ELSE '未知' END AS name, COUNT(*) AS total",
116
+			).Group("p.anticoagulant").Scan(&items).Error
118 117
 
119 118
 		break
120 119
 	}
@@ -1121,10 +1120,10 @@ func GetBloodPressureTableData(orgID, patientID int64, page, limit, start, end i
1121 1120
 	db = db.Preload("VMPredialysisEvaluation", "status = 1 AND user_org_id = ?", orgID).
1122 1121
 		Preload("VMAssessmentAfterDislysis", "status = 1 AND user_org_id = ?", orgID).
1123 1122
 		Preload("VMMinMonitoringRecord", func(db *gorm.DB) *gorm.DB {
1124
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("diastolic_blood_pressure ASC")
1123
+			return db.Where("user_org_id = ? AND status = 1", orgID).Order("diastolic_blood_pressure ASC")
1125 1124
 		}).
1126 1125
 		Preload("VMMaxMonitoringRecord", func(db *gorm.DB) *gorm.DB {
1127
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("systolic_blood_pressure DESC")
1126
+			return db.Where("user_org_id = ? AND status = 1 ", orgID).Order("systolic_blood_pressure DESC")
1128 1127
 		}).
1129 1128
 		Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
1130 1129
 	err = db.Count(&total).Offset(offset).Limit(limit).Order("sch.schedule_date desc").Select(" sch.schedule_date,sch.patient_id,sch.user_org_id").Find(&orders).Error

+ 1 - 0
service/stock_service.go Wyświetl plik

@@ -173,6 +173,7 @@ func AddSigleGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
173 173
 
174 174
 func ModifyGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
175 175
 	err := writeDb.Model(&models.GoodInfo{}).Where("id = ? AND status = 1", goodInfo.ID).Updates(map[string]interface{}{
176
+		"good_type_id":               goodInfo.GoodTypeId,
176 177
 		"modifier":                   goodInfo.Modifier,
177 178
 		"mtime":                      time.Now().Unix(),
178 179
 		"remark":                     goodInfo.Remark,

+ 22 - 0
service/vm_service.go Wyświetl plik

@@ -2,10 +2,32 @@ package service
2 2
 
3 3
 import (
4 4
 	"XT_New/models"
5
+	"strconv"
5 6
 )
6 7
 
7 8
 func CreateVMOrgPatient(patients *models.VMOrgPatients) {
8 9
 	writeDb.Model(&models.VMOrgPatients{}).Create(&patients)
10
+
11
+	var lapseto models.PatientLapseto
12
+	lapseto.PatientId = patients.ID
13
+	lapseto.LapsetoType = patients.Lapseto
14
+	lapseto.CreatedTime = patients.CreatedTime
15
+	lapseto.UpdatedTime = patients.CreatedTime
16
+	lapseto.Status = 1
17
+	lapseto.LapsetoTime = patients.CreatedTime
18
+	writeDb.Create(&lapseto)
19
+
20
+	if len(patients.ContagionIds) > 0 {
21
+		var diseases models.InfectiousDiseases
22
+		diseases.PatientId = patients.ID
23
+		diseases.Status = 1
24
+		diseases.UpdatedTime = patients.UpdatedTime
25
+		diseases.CreatedTime = patients.CreatedTime
26
+		id, _ := strconv.ParseInt(patients.ContagionIds, 10, 64)
27
+		diseases.DiseaseId = id
28
+		writeDb.Create(&diseases)
29
+	}
30
+
9 31
 }
10 32
 
11 33
 func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) {