Procházet zdrojové kódy

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

XMLWAN před 2 roky
rodič
revize
91134da5d0
82 změnil soubory, kde provedl 2846 přidání a 1042 odebrání
  1. binární
      XT_New.exe
  2. 1 1
      conf/app.conf
  3. 0 1
      controllers/base_controller.go
  4. 1 1
      controllers/data_api_controller.go
  5. 138 8
      controllers/dialysis_api_controller.go
  6. 6 0
      controllers/dialysis_record_api_controller.go
  7. 1 1
      controllers/doctors_api_controller.go
  8. 1 1
      controllers/gobal_config_api_controller.go
  9. 6 3
      controllers/his_api_controller.go
  10. 9 8
      controllers/his_config_api_controller.go
  11. 21 21
      controllers/his_deposit_controller.go
  12. 4 1
      controllers/his_project_api_controller.go
  13. 181 3
      controllers/inspection_api_controller.go
  14. 78 80
      controllers/integration_config_api_controller.go
  15. 150 131
      controllers/manage_api_controller.go
  16. 8 4
      controllers/manager_center_api_controller.go
  17. 1 1
      controllers/mobile_api_controllers/check_api_controller.go
  18. 63 0
      controllers/mobile_api_controllers/dialysis_api_controller.go
  19. 8 0
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  20. 7 0
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  21. 183 107
      controllers/mobile_api_controllers/patient_api_controller.go
  22. 2 2
      controllers/new_mobile_api_controllers/index_evaluation_api_controller.go
  23. 3 0
      controllers/new_mobile_api_controllers/staff_schedule_api_controller.go
  24. 56 6
      controllers/patient_api_controller.go
  25. 666 0
      controllers/patient_dataconfig_api_controller.go
  26. 9 9
      controllers/pay_api_controller.go
  27. 2 2
      controllers/pc_index_evaluation_api_controller.go
  28. 1 0
      controllers/pharmacy_controller.go
  29. 3 3
      controllers/print_data_api_controller.go
  30. 17 17
      controllers/public_api_controller.go
  31. 2 2
      controllers/secondary_order_api_contorller.go
  32. 9 9
      controllers/supply_order_api_contorller.go
  33. 30 0
      go.mod
  34. 205 0
      go.sum
  35. 79 0
      models/dialysis.go
  36. 4 0
      models/his_charge_models.go
  37. 3 3
      models/his_deposit_models.go
  38. 4 0
      models/his_hospital_models.go
  39. 7 4
      models/his_models.go
  40. 21 0
      models/inspection_models.go
  41. 94 0
      models/patient_models.go
  42. 13 13
      models/pharmacy_models.go
  43. 4 3
      models/schedule_models.go
  44. 3 3
      models/secondary_models.go
  45. 1 1
      models/supply.models.go
  46. 81 322
      service/app_version.go
  47. 3 3
      service/auto_create_drug.go
  48. 1 1
      service/auto_create_stock.go
  49. 1 1
      service/auto_create_week_disinfection.go
  50. 9 9
      service/data.go
  51. 6 0
      service/device_service.go
  52. 151 2
      service/dialysis_service.go
  53. 6 3
      service/dialysis_solution_service.go
  54. 8 8
      service/gdyb_service.go
  55. 19 19
      service/his_config_service.go
  56. 53 53
      service/his_deposit_service.go
  57. 0 1
      service/his_hospital_service.go
  58. 7 3
      service/his_project_service.go
  59. 34 6
      service/inspection_service.go
  60. 3 3
      service/integration_service.go
  61. 2 3
      service/login_service.go
  62. 1 1
      service/manage_center_service.go
  63. 13 1
      service/manage_service.go
  64. 1 1
      service/management_service/management_analyse_service.go
  65. 1 1
      service/mobile_dialysis_service.go
  66. 71 0
      service/patient_dataconfig_service.go
  67. 29 3
      service/patient_service.go
  68. 1 1
      service/pharmacy_service.go
  69. 1 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  70. 1 1
      service/role_service.go
  71. 1 0
      service/schedule_service.go
  72. 62 62
      service/secondary_service.go
  73. 1 1
      service/sign_weigh_service.go
  74. 6 6
      service/statistics_service/index_evaluation_service.go
  75. 4 4
      service/stock_service.go
  76. 19 19
      service/supply_service.go
  77. 20 0
      service/user_service.go
  78. 53 46
      service/verify_login_token_service.go
  79. 67 4
      service/warhouse_service.go
  80. 0 1
      src/golang.org/x/sync
  81. 1 0
      tests/default_test.go
  82. 4 4
      utils/tools.go

binární
XT_New.exe Zobrazit soubor


+ 1 - 1
conf/app.conf Zobrazit soubor

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9531
2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4
 #dev/prod
4
 #dev/prod
5
 
5
 
6
 #
6
 #

+ 0 - 1
controllers/base_controller.go Zobrazit soubor

37
 func (this *BaseController) TraceLog(format string, a ...interface{}) {
37
 func (this *BaseController) TraceLog(format string, a ...interface{}) {
38
 	//beego.Trace(fmt.Sprintf(format, a...))
38
 	//beego.Trace(fmt.Sprintf(format, a...))
39
 }
39
 }
40
-

+ 1 - 1
controllers/data_api_controller.go Zobrazit soubor

400
 	}
400
 	}
401
 	dataconfig.Module = module
401
 	dataconfig.Module = module
402
 
402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" {
404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405
 			utils.ErrorLog("title")
405
 			utils.ErrorLog("title")
406
 			code = enums.ErrorCodeParamWrong
406
 			code = enums.ErrorCodeParamWrong

+ 138 - 8
controllers/dialysis_api_controller.go Zobrazit soubor

113
 	beego.Router("/api/schedule/getmobileschedulelist", &DialysisApiController{}, "Get:GetMobileScheduleList")
113
 	beego.Router("/api/schedule/getmobileschedulelist", &DialysisApiController{}, "Get:GetMobileScheduleList")
114
 
114
 
115
 	beego.Router("/api/patient/saveinformation", &DialysisApiController{}, "Get:SaveInformation")
115
 	beego.Router("/api/patient/saveinformation", &DialysisApiController{}, "Get:SaveInformation")
116
+
117
+	beego.Router("/api/patient/savedialysisInformationsetting", &DialysisApiController{}, "Get:SaveDialysisInformationSetting")
118
+
119
+	beego.Router("/api/patient/getdialyisinformationsetting", &DialysisApiController{}, "Get:GetDialysisInformationSetting")
120
+
121
+	beego.Router("/api/patient/checkdialysisinformation", &DialysisApiController{}, "Get:CheckDialysisInformation")
122
+
123
+	beego.Router("/api/dialysis/patientsflow", &DialysisApiController{}, "Get:GetDialysisPatientsFlow")
116
 }
124
 }
117
 
125
 
118
 func (c *DialysisApiController) GetQueueCall() {
126
 func (c *DialysisApiController) GetQueueCall() {
586
 			} else {
594
 			} else {
587
 				str = dialysis_dialyszers + "/" + dialysis_irrigation + " " + dialysis_strainer
595
 				str = dialysis_dialyszers + "/" + dialysis_irrigation + " " + dialysis_strainer
588
 			}
596
 			}
589
-			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
597
+
598
+			if adminUserInfo.CurrentOrgId == 10346 {
599
+				service.ModifyScheduleModeOne(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
600
+			} else {
601
+				service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
602
+			}
603
+
590
 		}
604
 		}
591
 
605
 
592
 		prescription.Creater = adminUserInfo.AdminUser.Id
606
 		prescription.Creater = adminUserInfo.AdminUser.Id
906
 			str = dialysis_dialyszers + "/" + dialysis_irrigation + " " + dialysis_strainer
920
 			str = dialysis_dialyszers + "/" + dialysis_irrigation + " " + dialysis_strainer
907
 
921
 
908
 		}
922
 		}
909
-		service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
923
+		if adminUserInfo.CurrentOrgId == 10346 {
924
+			service.ModifyScheduleModeOne(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
925
+		} else {
926
+			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
927
+		}
928
+
910
 	}
929
 	}
911
 
930
 
912
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
931
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
3403
 
3422
 
3404
 	monitor_anticoagulant, _ := c.GetInt64("monitor_anticoagulant")
3423
 	monitor_anticoagulant, _ := c.GetInt64("monitor_anticoagulant")
3405
 	monitor_anticoagulant_value := c.GetString("monitor_anticoagulant_value")
3424
 	monitor_anticoagulant_value := c.GetString("monitor_anticoagulant_value")
3425
+	replacement_speed, _ := c.GetFloat("replacement_speed")
3426
+	dicarbonate, _ := c.GetFloat("dicarbonate")
3406
 	monitoring_date = monitoring_date / 1000
3427
 	monitoring_date = monitoring_date / 1000
3407
 	// operate_time = operate_time / 1000
3428
 	// operate_time = operate_time / 1000
3408
 	if patient <= 0 {
3429
 	if patient <= 0 {
3457
 		DialysateFlow:             dialysate_flow,
3478
 		DialysateFlow:             dialysate_flow,
3458
 		MonitorAnticoagulant:      monitor_anticoagulant,
3479
 		MonitorAnticoagulant:      monitor_anticoagulant,
3459
 		MonitorAnticoagulantValue: monitor_anticoagulant_value,
3480
 		MonitorAnticoagulantValue: monitor_anticoagulant_value,
3481
+		ReplacementSpeed:          replacement_speed,
3482
+		Dicarbonate:               dicarbonate,
3460
 	}
3483
 	}
3461
 
3484
 
3462
 	err := service.CreateMonitor(&monitorRecord)
3485
 	err := service.CreateMonitor(&monitorRecord)
3716
 }
3739
 }
3717
 
3740
 
3718
 func (c *DialysisApiController) GetDialysisOrder() {
3741
 func (c *DialysisApiController) GetDialysisOrder() {
3719
-	xtno := c.GetString("xtno")
3742
+	//xtno := c.GetString("xtno")
3720
 	xtdate := c.GetString("xtdate")
3743
 	xtdate := c.GetString("xtdate")
3721
-
3744
+	patient_id, _ := c.GetInt64("patient_id")
3722
 	timeLayout := "2006-01-02"
3745
 	timeLayout := "2006-01-02"
3723
 	loc, _ := time.LoadLocation("Local")
3746
 	loc, _ := time.LoadLocation("Local")
3724
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", xtdate+" 00:00:00", loc)
3747
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", xtdate+" 00:00:00", loc)
3735
 
3758
 
3736
 	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
3759
 	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
3737
 
3760
 
3738
-	patientInfo, _ := service.FindPatientWithDeviceByNo(adminUserInfo.CurrentOrgId, xtno, xttime)
3761
+	patientInfo, _ := service.FindPatientWithDeviceByPatientId(adminUserInfo.CurrentOrgId, patient_id, xttime)
3739
 
3762
 
3740
 	//透析单
3763
 	//透析单
3741
 	dialysisOrder, _ := service.MobileGetSchedualDialysisRecordTen(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3764
 	dialysisOrder, _ := service.MobileGetSchedualDialysisRecordTen(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
5213
 	goodType, _ := service.GetAllGoodType(orgId)
5236
 	goodType, _ := service.GetAllGoodType(orgId)
5214
 	if config.IsOpen != 1 {
5237
 	if config.IsOpen != 1 {
5215
 		list, total, err := service.GetPatientDialysisSolutionGroupList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId, ids)
5238
 		list, total, err := service.GetPatientDialysisSolutionGroupList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId, ids)
5216
-		fmt.Println("list2232323223332323232", list)
5239
+
5217
 		if err == nil {
5240
 		if err == nil {
5218
 			this.ServeSuccessJSON(map[string]interface{}{
5241
 			this.ServeSuccessJSON(map[string]interface{}{
5219
 				"list":     list,
5242
 				"list":     list,
5392
 
5415
 
5393
 	page, _ := this.GetInt64("page")
5416
 	page, _ := this.GetInt64("page")
5394
 
5417
 
5395
-	partition_id, _ := this.GetInt64("partition_id")
5418
+	//partition_id, _ := this.GetInt64("partition_id")
5396
 
5419
 
5420
+	partion_type := this.GetString("partition_id")
5421
+	idSplit := strings.Split(partion_type, ",")
5397
 	schedule_type, _ := this.GetInt64("schedule_type")
5422
 	schedule_type, _ := this.GetInt64("schedule_type")
5398
 
5423
 
5399
 	start_time := this.GetString("schedule_date")
5424
 	start_time := this.GetString("schedule_date")
5408
 	if scheduids != "" {
5433
 	if scheduids != "" {
5409
 		ids = strings.Split(scheduids, ",")
5434
 		ids = strings.Split(scheduids, ",")
5410
 	}
5435
 	}
5411
-	list, total, err := service.GetDialysisParameterList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId, ids)
5436
+	list, total, err := service.GetDialysisParameterList(keyword, limit, page, idSplit, schedule_type, startTime.Unix(), orgId, ids)
5412
 
5437
 
5413
 	dialysisSett, _ := service.GetDialysisSetting(orgId)
5438
 	dialysisSett, _ := service.GetDialysisSetting(orgId)
5414
 	if err == nil {
5439
 	if err == nil {
6394
 
6419
 
6395
 }
6420
 }
6396
 
6421
 
6422
+func (this *DialysisApiController) SaveDialysisInformationSetting() {
6423
+
6424
+	week_day, _ := this.GetInt64("week_day")
6425
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6426
+	informaitonSetting := models.XtDialysisInformaitonSetting{
6427
+		WeekDay:   week_day,
6428
+		UserOrgId: orgId,
6429
+		Status:    1,
6430
+		Ctime:     time.Now().Unix(),
6431
+		Mtime:     0,
6432
+	}
6433
+	information, _ := service.GetInformationSettingByOrgId(orgId)
6434
+	if information.ID == 0 {
6435
+		service.CreateInformationSetting(informaitonSetting)
6436
+	}
6437
+	if information.ID > 0 {
6438
+		service.UpdateInformationSettingById(orgId, week_day)
6439
+	}
6440
+
6441
+	this.ServeSuccessJSON(map[string]interface{}{
6442
+		"informaitonSetting": informaitonSetting,
6443
+	})
6444
+	return
6445
+}
6446
+
6447
+func (this *DialysisApiController) GetDialysisInformationSetting() {
6448
+
6449
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6450
+
6451
+	limit, _ := this.GetInt64("limit")
6452
+	page, _ := this.GetInt64("page")
6453
+	informationSetting, _ := service.GetDialysisInformationSetting(orgId)
6454
+
6455
+	//未审核
6456
+	infor, total, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 2)
6457
+
6458
+	//已经审核
6459
+	inforList, totalOne, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 1)
6460
+
6461
+	patients, _ := service.GetAllpatientThirty(orgId)
6462
+
6463
+	appId := this.GetAdminUserInfo().CurrentAppId
6464
+	role, _ := service.GetAllDoctorListSix(orgId, appId)
6465
+
6466
+	this.ServeSuccessJSON(map[string]interface{}{
6467
+		"informaitonSetting": informationSetting,
6468
+		"infor":              infor,
6469
+		"total":              total,
6470
+		"totalOne":           totalOne,
6471
+		"inforList":          inforList,
6472
+		"patients":           patients,
6473
+		"adminList":          role,
6474
+	})
6475
+	return
6476
+}
6477
+
6478
+func (this *DialysisApiController) CheckDialysisInformation() {
6479
+
6480
+	id, _ := this.GetInt64("id")
6481
+	application_status, _ := this.GetInt64("application_status")
6482
+	timeNow := time.Now().Unix()
6483
+	checker := this.GetAdminUserInfo().AdminUser.Id
6484
+	information, _ := service.CheckDialysisInformation(id, application_status, timeNow, checker)
6485
+	this.ServeSuccessJSON(map[string]interface{}{
6486
+		"information": information,
6487
+	})
6488
+	return
6489
+}
6490
+
6491
+func (this *DialysisApiController) GetDialysisPatientsFlow() {
6492
+
6493
+	page, _ := this.GetInt64("page", 1)
6494
+	limit, _ := this.GetInt64("limit", 10)
6495
+	schedulType, _ := this.GetInt64("schedul_type", 0)
6496
+	startTime, _ := this.GetInt64("schedul_time", 0)
6497
+	partitionType, _ := this.GetInt64("partition_type", 0)
6498
+	keywords := this.GetString("keywords")
6499
+	start_time, _ := this.GetInt64("start_time")
6500
+	end_time, _ := this.GetInt64("end_time")
6501
+	adminUserInfo := this.GetAdminUserInfo()
6502
+	if len(keywords) > 0 {
6503
+
6504
+		dialysisSchedule, err, total := service.GetDialysisWatchByKeywordFlow(adminUserInfo.CurrentOrgId, keywords, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6505
+		if err == nil {
6506
+			this.ServeSuccessJSON(map[string]interface{}{
6507
+				"schedule": dialysisSchedule,
6508
+				"total":    total,
6509
+			})
6510
+		} else {
6511
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6512
+		}
6513
+
6514
+	} else {
6515
+		dialysisSchedule, err, total := service.GetDialysisWatchFlow(adminUserInfo.CurrentOrgId, startTime/1000, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6516
+		if err == nil {
6517
+			this.ServeSuccessJSON(map[string]interface{}{
6518
+				"schedule": dialysisSchedule,
6519
+				"total":    total,
6520
+			})
6521
+		} else {
6522
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6523
+		}
6524
+	}
6525
+}
6526
+
6397
 func (this *DialysisApiController) SaveInformation() {
6527
 func (this *DialysisApiController) SaveInformation() {
6398
 
6528
 
6399
 	patient_id, _ := this.GetInt64("patient_id")
6529
 	patient_id, _ := this.GetInt64("patient_id")

+ 6 - 0
controllers/dialysis_record_api_controller.go Zobrazit soubor

565
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
565
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
566
 	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
566
 	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
567
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
567
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
568
+	ReplacementSpeed            float64 `gorm:"column:replacement_speed" json:"replacement_speed" form:"replacement_speed"`
569
+	Dicarbonate                 float64 `gorm:"column:dicarbonate" json:"dicarbonate" form:"dicarbonate"`
568
 }
570
 }
569
 
571
 
570
 // /api/dislysis/monitor/edit [post]
572
 // /api/dislysis/monitor/edit [post]
712
 			HeparinAmount:               monitorParam.HeparinAmount,
714
 			HeparinAmount:               monitorParam.HeparinAmount,
713
 			Dehydration:                 monitorParam.Dehydration,
715
 			Dehydration:                 monitorParam.Dehydration,
714
 			FilterPressure:              monitorParam.FilterPressure,
716
 			FilterPressure:              monitorParam.FilterPressure,
717
+			ReplacementSpeed:            monitorParam.ReplacementSpeed,
718
+			Dicarbonate:                 monitorParam.Dicarbonate,
715
 		}
719
 		}
716
 		createErr := service.CreateMonitor(&monitor)
720
 		createErr := service.CreateMonitor(&monitor)
717
 		finish := models.XtDialysisFinish{
721
 		finish := models.XtDialysisFinish{
812
 		monitor.HeparinAmount = monitorParam.HeparinAmount
816
 		monitor.HeparinAmount = monitorParam.HeparinAmount
813
 		monitor.Dehydration = monitorParam.Dehydration
817
 		monitor.Dehydration = monitorParam.Dehydration
814
 		monitor.FilterPressure = monitorParam.FilterPressure
818
 		monitor.FilterPressure = monitorParam.FilterPressure
819
+		monitor.ReplacementSpeed = monitorParam.ReplacementSpeed
820
+		monitor.Dicarbonate = monitorParam.Dicarbonate
815
 		updateErr := service.UpdateMonitor(monitor)
821
 		updateErr := service.UpdateMonitor(monitor)
816
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":monitor_records"
822
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":monitor_records"
817
 		redis := service.RedisClient()
823
 		redis := service.RedisClient()

+ 1 - 1
controllers/doctors_api_controller.go Zobrazit soubor

164
 func (c *DoctorsApiController) GetAllDoctorAndNurse() {
164
 func (c *DoctorsApiController) GetAllDoctorAndNurse() {
165
 
165
 
166
 	adminUserInfo := c.GetAdminUserInfo()
166
 	adminUserInfo := c.GetAdminUserInfo()
167
-	doctors, nursers, _ := service.GetAllDoctorAndNurseSix(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
167
+	doctors, nursers, _ := service.GetAllDoctorAndNurseSeven(adminUserInfo.CurrentOrgId)
168
 
168
 
169
 	c.ServeSuccessJSON(map[string]interface{}{
169
 	c.ServeSuccessJSON(map[string]interface{}{
170
 		"doctors": doctors,
170
 		"doctors": doctors,

+ 1 - 1
controllers/gobal_config_api_controller.go Zobrazit soubor

600
 	})
600
 	})
601
 }
601
 }
602
 
602
 
603
-//SF6090214798525
603
+// SF6090214798525
604
 func (c *GobalConfigApiController) Load(filename string, v interface{}) {
604
 func (c *GobalConfigApiController) Load(filename string, v interface{}) {
605
 	//ReadFile函数会读取文件的全部内容,并将结果以[]byte类型返回
605
 	//ReadFile函数会读取文件的全部内容,并将结果以[]byte类型返回
606
 	data, err := ioutil.ReadFile(filename)
606
 	data, err := ioutil.ReadFile(filename)

+ 6 - 3
controllers/his_api_controller.go Zobrazit soubor

4278
 	label.Status = 0
4278
 	label.Status = 0
4279
 	service.CreateHisLabelRecord(&label)
4279
 	service.CreateHisLabelRecord(&label)
4280
 
4280
 
4281
+	fmt.Println(goodOutConfig.IsOpen)
4281
 	if goodOutConfig.IsOpen != 1 {
4282
 	if goodOutConfig.IsOpen != 1 {
4282
 		if stockConfig.IsOpen == 1 {
4283
 		if stockConfig.IsOpen == 1 {
4283
 			if project.Type == 2 {
4284
 			if project.Type == 2 {
4284
 				err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
4285
 				err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
4285
 				fmt.Println(err)
4286
 				fmt.Println(err)
4286
 			}
4287
 			}
4287
-
4288
 			if project.Type == 3 && project.IsOut == 1 {
4288
 			if project.Type == 3 && project.IsOut == 1 {
4289
 
4289
 
4290
 				houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
4290
 				houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
4536
 				fmt.Println(err)
4536
 				fmt.Println(err)
4537
 			}
4537
 			}
4538
 
4538
 
4539
+		} else {
4540
+			err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
4541
+			fmt.Println(err)
4542
+
4539
 		}
4543
 		}
4540
 	}
4544
 	}
4541
 
4545
 
4542
 	//保存处方出库
4546
 	//保存处方出库
4543
 	if goodOutConfig.IsOpen == 1 {
4547
 	if goodOutConfig.IsOpen == 1 {
4544
-
4545
 		if project.Type == 3 {
4548
 		if project.Type == 3 {
4546
 			houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
4549
 			houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
4547
 			good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
4550
 			good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
9781
 	}
9784
 	}
9782
 
9785
 
9783
 	orderInfos = append(orderInfos, orderInfos_two...)
9786
 	orderInfos = append(orderInfos, orderInfos_two...)
9784
-	if c.GetAdminUserInfo().CurrentOrgId != 10138 {
9787
+	if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9785
 		orderInfos = append(orderInfos, orderInfos_three...)
9788
 		orderInfos = append(orderInfos, orderInfos_three...)
9786
 
9789
 
9787
 	}
9790
 	}

+ 9 - 8
controllers/his_config_api_controller.go Zobrazit soubor

515
 func (this *HisConfigApiController) GetPrescriptionTemplateDetail() {
515
 func (this *HisConfigApiController) GetPrescriptionTemplateDetail() {
516
 
516
 
517
 	mode_id, _ := this.GetInt64("mode_id")
517
 	mode_id, _ := this.GetInt64("mode_id")
518
+
518
 	orgId := this.GetAdminUserInfo().CurrentOrgId
519
 	orgId := this.GetAdminUserInfo().CurrentOrgId
519
 	template, _ := service.GetModeTemplateNameDetail(mode_id, orgId)
520
 	template, _ := service.GetModeTemplateNameDetail(mode_id, orgId)
520
 
521
 
1014
 
1015
 
1015
 }
1016
 }
1016
 
1017
 
1017
-//配置项
1018
+// 配置项
1018
 func (c *HisConfigApiController) GetModeConfigs() {
1019
 func (c *HisConfigApiController) GetModeConfigs() {
1019
 	var err error
1020
 	var err error
1020
 	defer func() {
1021
 	defer func() {
1177
 
1178
 
1178
 }
1179
 }
1179
 
1180
 
1180
-//批量替换——药品
1181
+// 批量替换——药品
1181
 func (c *HisConfigApiController) ReplaceSaveDrug() {
1182
 func (c *HisConfigApiController) ReplaceSaveDrug() {
1182
 	var g errgroup.Group
1183
 	var g errgroup.Group
1183
 	var err error
1184
 	var err error
1323
 	return
1324
 	return
1324
 }
1325
 }
1325
 
1326
 
1326
-//批量替换项目
1327
+// 批量替换项目
1327
 func (c *HisConfigApiController) ReplaceSaveProject() {
1328
 func (c *HisConfigApiController) ReplaceSaveProject() {
1328
 	var g errgroup.Group
1329
 	var g errgroup.Group
1329
 	var err error
1330
 	var err error
1489
 	return
1490
 	return
1490
 }
1491
 }
1491
 
1492
 
1492
-//批量删除项目
1493
+// 批量删除项目
1493
 func (c *HisConfigApiController) BatchDeleteItems() {
1494
 func (c *HisConfigApiController) BatchDeleteItems() {
1494
 	var g errgroup.Group
1495
 	var g errgroup.Group
1495
 	var err error
1496
 	var err error
1539
 	return
1540
 	return
1540
 }
1541
 }
1541
 
1542
 
1542
-//批量删除药品
1543
+// 批量删除药品
1543
 func (c *HisConfigApiController) DeleteDrugsBatch() {
1544
 func (c *HisConfigApiController) DeleteDrugsBatch() {
1544
 	var g errgroup.Group
1545
 	var g errgroup.Group
1545
 	var err error
1546
 	var err error
1589
 	return
1590
 	return
1590
 }
1591
 }
1591
 
1592
 
1592
-//批量添加
1593
+// 批量添加
1593
 func (c *HisConfigApiController) AddsTemplate() {
1594
 func (c *HisConfigApiController) AddsTemplate() {
1594
 	var g errgroup.Group
1595
 	var g errgroup.Group
1595
 	var err error
1596
 	var err error
1787
 
1788
 
1788
 }
1789
 }
1789
 
1790
 
1790
-//根据透析模式和患者id获取该患者的处方内容
1791
+// 根据透析模式和患者id获取该患者的处方内容
1791
 func (c *HisConfigApiController) PTemplateInformation() {
1792
 func (c *HisConfigApiController) PTemplateInformation() {
1792
 	var err error
1793
 	var err error
1793
 	defer func() {
1794
 	defer func() {
1812
 	return
1813
 	return
1813
 }
1814
 }
1814
 
1815
 
1815
-//删除单条记录
1816
+// 删除单条记录
1816
 func (c *HisConfigApiController) DeleteOne() {
1817
 func (c *HisConfigApiController) DeleteOne() {
1817
 	var err error
1818
 	var err error
1818
 	defer func() {
1819
 	defer func() {

+ 21 - 21
controllers/his_deposit_controller.go Zobrazit soubor

59
 //	return
59
 //	return
60
 //}
60
 //}
61
 
61
 
62
-//获取病例中心,有效患者名称(去除了转出和死亡的)
62
+// 获取病例中心,有效患者名称(去除了转出和死亡的)
63
 func (this *HisDepositApiController) GetHisUserToAlive() {
63
 func (this *HisDepositApiController) GetHisUserToAlive() {
64
 	orgid := this.GetAdminUserInfo().CurrentOrgId
64
 	orgid := this.GetAdminUserInfo().CurrentOrgId
65
 	list, err := service.GetHisUserToAlive(orgid)
65
 	list, err := service.GetHisUserToAlive(orgid)
73
 	return
73
 	return
74
 }
74
 }
75
 
75
 
76
-//获取病例中心,有效患者名称
76
+// 获取病例中心,有效患者名称
77
 func (this *HisDepositApiController) GetHisUser() {
77
 func (this *HisDepositApiController) GetHisUser() {
78
 	orgid := this.GetAdminUserInfo().CurrentOrgId
78
 	orgid := this.GetAdminUserInfo().CurrentOrgId
79
 	token := this.Ctx.Request.Header.Get("Cookie")
79
 	token := this.Ctx.Request.Header.Get("Cookie")
89
 	return
89
 	return
90
 }
90
 }
91
 
91
 
92
-//新增押金
92
+// 新增押金
93
 func (this *HisDepositApiController) AddDeposit() {
93
 func (this *HisDepositApiController) AddDeposit() {
94
 	orgid := this.GetAdminUserInfo().CurrentOrgId
94
 	orgid := this.GetAdminUserInfo().CurrentOrgId
95
 	dataBody := make(map[string]interface{}, 0)
95
 	dataBody := make(map[string]interface{}, 0)
162
 	return
162
 	return
163
 }
163
 }
164
 
164
 
165
-//获取新增押金编号
165
+// 获取新增押金编号
166
 func (this *HisDepositApiController) GetDepositCode() {
166
 func (this *HisDepositApiController) GetDepositCode() {
167
 	orgid := this.GetAdminUserInfo().CurrentOrgId
167
 	orgid := this.GetAdminUserInfo().CurrentOrgId
168
 	var code string
168
 	var code string
179
 	return
179
 	return
180
 }
180
 }
181
 
181
 
182
-//获取退款编号
182
+// 获取退款编号
183
 func (this *HisDepositApiController) GetDeleteCode() {
183
 func (this *HisDepositApiController) GetDeleteCode() {
184
 	orgid := this.GetAdminUserInfo().CurrentOrgId
184
 	orgid := this.GetAdminUserInfo().CurrentOrgId
185
 	var code string
185
 	var code string
196
 	return
196
 	return
197
 }
197
 }
198
 
198
 
199
-//充值明细列表
199
+// 充值明细列表
200
 func (this *HisDepositApiController) RechargeDetails() {
200
 func (this *HisDepositApiController) RechargeDetails() {
201
 	orgid := this.GetAdminUserInfo().CurrentOrgId
201
 	orgid := this.GetAdminUserInfo().CurrentOrgId
202
 	timeLayout := "2006-01-02"
202
 	timeLayout := "2006-01-02"
253
 	return
253
 	return
254
 }
254
 }
255
 
255
 
256
-//充值汇总列表
256
+// 充值汇总列表
257
 func (this *HisDepositApiController) RechargeSummary() {
257
 func (this *HisDepositApiController) RechargeSummary() {
258
 	orgid := this.GetAdminUserInfo().CurrentOrgId
258
 	orgid := this.GetAdminUserInfo().CurrentOrgId
259
 	timeLayout := "2006-01-02"
259
 	timeLayout := "2006-01-02"
328
 	return
328
 	return
329
 }
329
 }
330
 
330
 
331
-//审核
331
+// 审核
332
 func (this *HisDepositApiController) UpDeposit() {
332
 func (this *HisDepositApiController) UpDeposit() {
333
 	id, _ := this.GetInt64("id", 0)
333
 	id, _ := this.GetInt64("id", 0)
334
 	if id == 0 {
334
 	if id == 0 {
386
 	return
386
 	return
387
 }
387
 }
388
 
388
 
389
-//根据id获取押金流水
389
+// 根据id获取押金流水
390
 func (this *HisDepositApiController) DepositFlow() {
390
 func (this *HisDepositApiController) DepositFlow() {
391
 	orgid := this.GetAdminUserInfo().CurrentOrgId
391
 	orgid := this.GetAdminUserInfo().CurrentOrgId
392
 	check := map[string][]string{
392
 	check := map[string][]string{
454
 	return
454
 	return
455
 }
455
 }
456
 
456
 
457
-//获取患者押金列表
457
+// 获取患者押金列表
458
 func (this *HisDepositApiController) GetUserList() {
458
 func (this *HisDepositApiController) GetUserList() {
459
 	orgid := this.GetAdminUserInfo().CurrentOrgId
459
 	orgid := this.GetAdminUserInfo().CurrentOrgId
460
 	keyword := this.GetString("keyword")
460
 	keyword := this.GetString("keyword")
499
 	return
499
 	return
500
 }
500
 }
501
 
501
 
502
-//扣费明细查询
502
+// 扣费明细查询
503
 func (this *HisDepositApiController) DeductionDetails() {
503
 func (this *HisDepositApiController) DeductionDetails() {
504
 	orgid := this.GetAdminUserInfo().CurrentOrgId
504
 	orgid := this.GetAdminUserInfo().CurrentOrgId
505
 	timeLayout := "2006-01-02"
505
 	timeLayout := "2006-01-02"
566
 	return
566
 	return
567
 }
567
 }
568
 
568
 
569
-//扣费汇总
569
+// 扣费汇总
570
 func (this *HisDepositApiController) DeSummary() {
570
 func (this *HisDepositApiController) DeSummary() {
571
 	orgid := this.GetAdminUserInfo().CurrentOrgId
571
 	orgid := this.GetAdminUserInfo().CurrentOrgId
572
 	timeLayout := "2006-01-02"
572
 	timeLayout := "2006-01-02"
648
 	return
648
 	return
649
 }
649
 }
650
 
650
 
651
-//根据患者id查询患者的余额
651
+// 根据患者id查询患者的余额
652
 func (this *HisDepositApiController) IdToBalance() {
652
 func (this *HisDepositApiController) IdToBalance() {
653
 	check := map[string][]string{
653
 	check := map[string][]string{
654
 		"his_patient_id": {"must", "int", "his_patient_id"},
654
 		"his_patient_id": {"must", "int", "his_patient_id"},
667
 	return
667
 	return
668
 }
668
 }
669
 
669
 
670
-//新增一条退款申请
670
+// 新增一条退款申请
671
 func (this *HisDepositApiController) RefundApplication() {
671
 func (this *HisDepositApiController) RefundApplication() {
672
 	orgid := this.GetAdminUserInfo().CurrentOrgId
672
 	orgid := this.GetAdminUserInfo().CurrentOrgId
673
 	createid := this.GetAdminUserInfo().AdminUser.Id
673
 	createid := this.GetAdminUserInfo().AdminUser.Id
734
 
734
 
735
 }
735
 }
736
 
736
 
737
-//退款审核通过/拒绝
737
+// 退款审核通过/拒绝
738
 func (this *HisDepositApiController) RefundReview() {
738
 func (this *HisDepositApiController) RefundReview() {
739
 	check := map[string][]string{
739
 	check := map[string][]string{
740
 		"ids":          {"must", "string", "ids"},
740
 		"ids":          {"must", "string", "ids"},
770
 	return
770
 	return
771
 }
771
 }
772
 
772
 
773
-//退款删除
773
+// 退款删除
774
 func (this *HisDepositApiController) DeleteRefund() {
774
 func (this *HisDepositApiController) DeleteRefund() {
775
 	check := map[string][]string{
775
 	check := map[string][]string{
776
 		"id": {"must", "int", "id"},
776
 		"id": {"must", "int", "id"},
793
 	return
793
 	return
794
 }
794
 }
795
 
795
 
796
-//更改退款申请
796
+// 更改退款申请
797
 func (this *HisDepositApiController) ChangeRefund() {
797
 func (this *HisDepositApiController) ChangeRefund() {
798
 	orgid := this.GetAdminUserInfo().CurrentOrgId
798
 	orgid := this.GetAdminUserInfo().CurrentOrgId
799
 	dataBody := make(map[string]interface{}, 0)
799
 	dataBody := make(map[string]interface{}, 0)
861
 	return
861
 	return
862
 }
862
 }
863
 
863
 
864
-//退款分页
864
+// 退款分页
865
 func (this *HisDepositApiController) RefundList() {
865
 func (this *HisDepositApiController) RefundList() {
866
 	check := map[string][]string{
866
 	check := map[string][]string{
867
 		"refundtype":  {"must", "int", "refundtype"},
867
 		"refundtype":  {"must", "int", "refundtype"},
949
 	return
949
 	return
950
 }
950
 }
951
 
951
 
952
-//获取本月时间
952
+// 获取本月时间
953
 func (this *HisDepositApiController) GetMonthTime() {
953
 func (this *HisDepositApiController) GetMonthTime() {
954
 	stime, etime := service.GetMonth()
954
 	stime, etime := service.GetMonth()
955
 	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
955
 	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
962
 	return
962
 	return
963
 }
963
 }
964
 
964
 
965
-//获取本周时间
965
+// 获取本周时间
966
 func (this *HisDepositApiController) GetWeekTime() {
966
 func (this *HisDepositApiController) GetWeekTime() {
967
 	stime, etime := service.GetMondayOfWeek()
967
 	stime, etime := service.GetMondayOfWeek()
968
 	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
968
 	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
975
 	return
975
 	return
976
 }
976
 }
977
 
977
 
978
-//判断前端参数是否为空
978
+// 判断前端参数是否为空
979
 func checks(this *HisDepositApiController, m *map[string][]string) (map[string]string, error) {
979
 func checks(this *HisDepositApiController, m *map[string][]string) (map[string]string, error) {
980
 	tmp := make(map[string]string)
980
 	tmp := make(map[string]string)
981
 	for k, v := range *m {
981
 	for k, v := range *m {

+ 4 - 1
controllers/his_project_api_controller.go Zobrazit soubor

331
 	tube_color, _ := this.GetInt64("tube_color")
331
 	tube_color, _ := this.GetInt64("tube_color")
332
 	team_type, _ := this.GetInt64("team_type")
332
 	team_type, _ := this.GetInt64("team_type")
333
 	remark := this.GetString("remark")
333
 	remark := this.GetString("remark")
334
+	sort, _ := this.GetInt64("sort")
334
 	//ids := this.GetString("ids")
335
 	//ids := this.GetString("ids")
335
 	//item_id := this.GetString("item_id")
336
 	//item_id := this.GetString("item_id")
336
 
337
 
355
 		UserOrgId:   orgId,
356
 		UserOrgId:   orgId,
356
 		Status:      1,
357
 		Status:      1,
357
 		CreatedTime: time.Now().Unix(),
358
 		CreatedTime: time.Now().Unix(),
359
+		Sort:        sort,
358
 		//ProjectId:   ids,
360
 		//ProjectId:   ids,
359
 		//ItemId:      item_id,
361
 		//ItemId:      item_id,
360
 	}
362
 	}
479
 	tube_color, _ := this.GetInt64("tube_color")
481
 	tube_color, _ := this.GetInt64("tube_color")
480
 	team_type, _ := this.GetInt64("team_type")
482
 	team_type, _ := this.GetInt64("team_type")
481
 	remark := this.GetString("remark")
483
 	remark := this.GetString("remark")
482
-
484
+	sort, _ := this.GetInt64("sort")
483
 	projectTeam, _ := service.GetProjectTeamDetail(id)
485
 	projectTeam, _ := service.GetProjectTeamDetail(id)
484
 
486
 
485
 	projectTeam.ProjectTeam = project_team
487
 	projectTeam.ProjectTeam = project_team
489
 	projectTeam.TubeColor = tube_color
491
 	projectTeam.TubeColor = tube_color
490
 	projectTeam.TeamType = team_type
492
 	projectTeam.TeamType = team_type
491
 	projectTeam.Remark = remark
493
 	projectTeam.Remark = remark
494
+	projectTeam.Sort = sort
492
 
495
 
493
 	dataBody := make(map[string]interface{}, 0)
496
 	dataBody := make(map[string]interface{}, 0)
494
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
497
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)

+ 181 - 3
controllers/inspection_api_controller.go Zobrazit soubor

27
 	beego.Router("/api/patient/inspection/get", &InspectionApiController{}, "Get:GetAllPatientInspection")
27
 	beego.Router("/api/patient/inspection/get", &InspectionApiController{}, "Get:GetAllPatientInspection")
28
 	beego.Router("/api/patient/inspectioninit/get", &InspectionApiController{}, "Get:GetInitInsepction")
28
 	beego.Router("/api/patient/inspectioninit/get", &InspectionApiController{}, "Get:GetInitInsepction")
29
 
29
 
30
+	beego.Router("/api/patient/pic_inspection/create", &InspectionApiController{}, "Post:CreatePatientPicInspection")
31
+	beego.Router("/api/patient/pic_inspection/edit", &InspectionApiController{}, "Post:EditPatientPicInspection")
32
+
30
 }
33
 }
31
 
34
 
32
-//PatientInspectionReference 请求检验检查大小项目
33
-//[get]: /api/patient/inspection/reference
35
+// PatientInspectionReference 请求检验检查大小项目
36
+// [get]: /api/patient/inspection/reference
34
 func (c *InspectionApiController) PatientInspectionReference() {
37
 func (c *InspectionApiController) PatientInspectionReference() {
35
 	patient, _ := c.GetInt64("patient")
38
 	patient, _ := c.GetInt64("patient")
39
+	inspect_type, _ := c.GetInt64("type")
40
+
36
 	if patient <= 0 {
41
 	if patient <= 0 {
37
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
42
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
38
 		return
43
 		return
40
 
45
 
41
 	adminUserInfo := c.GetAdminUserInfo()
46
 	adminUserInfo := c.GetAdminUserInfo()
42
 
47
 
43
-	references, err := service.GetInspectionReference(adminUserInfo.CurrentOrgId)
48
+	references, err := service.GetInspectionReference(adminUserInfo.CurrentOrgId, inspect_type)
44
 	if err != nil {
49
 	if err != nil {
45
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
50
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
46
 		return
51
 		return
226
 	})
231
 	})
227
 	return
232
 	return
228
 }
233
 }
234
+func (c *InspectionApiController) CreatePatientPicInspection() {
235
+	patient, _ := c.GetInt64("patient", 0)
236
+	if patient <= 0 {
237
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
+		return
239
+	}
240
+
241
+	adminUserInfo := c.GetAdminUserInfo()
242
+	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
243
+	if patientInfo.ID == 0 {
244
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
245
+		return
246
+	}
247
+
248
+	var from models.InepectionPICForm
249
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
250
+	if err != nil {
251
+		utils.ErrorLog("%v", err)
252
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
253
+		return
254
+	}
255
+
256
+	timeLayout := "2006-01-02 15:04"
257
+	loc, _ := time.LoadLocation("Local")
258
+
259
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
260
+	if err != nil {
261
+		utils.ErrorLog(err.Error())
262
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
263
+		return
264
+	}
265
+	if len(from.Imags) == 0 {
266
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
267
+		return
268
+	}
269
+
270
+	date := theTime.Unix()
271
+	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
272
+	if err != nil {
273
+		utils.ErrorLog("%v", err)
274
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
275
+		return
276
+	}
277
+	if len(insp) > 0 {
278
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateExit)
279
+		return
280
+	}
281
+
282
+	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
283
+
284
+	inspections := make([]models.Inspection, 0)
285
+	for index, item := range from.Imags {
286
+		var inspection models.Inspection
287
+		inspection.OrgId = adminUserInfo.CurrentOrgId
288
+		inspection.PatientId = patient
289
+		inspection.ProjectId = from.ProjectId
290
+		inspection.ItemId = inspection_re[index].ID
291
+		inspection.ItemName = item.Desc
292
+		inspection.ProjectName = ""
293
+		inspection.InspectType = 3
294
+		inspection.InspectValue = item.ImgUrl
295
+		inspection.InspectDesc = item.Desc
296
+		inspection.InspectDate = date
297
+		inspection.Status = 1
298
+		inspection.CreatedTime = time.Now().Unix()
299
+		inspection.UpdatedTime = time.Now().Unix()
300
+		inspections = append(inspections, inspection)
301
+	}
302
+	err = service.CreatePatientInspection(inspections)
303
+	if err != nil {
304
+		utils.ErrorLog("%v", err)
305
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
306
+		return
307
+	}
308
+	c.ServeSuccessJSON(map[string]interface{}{
309
+		"inspections": inspections,
310
+	})
311
+	return
312
+}
313
+func (c *InspectionApiController) EditPatientPicInspection() {
314
+	patient, _ := c.GetInt64("patient", 0)
315
+	if patient <= 0 {
316
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
317
+		return
318
+	}
319
+
320
+	adminUserInfo := c.GetAdminUserInfo()
321
+	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
322
+	if patientInfo.ID == 0 {
323
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
324
+		return
325
+	}
326
+
327
+	var from models.InepectionPICForm
328
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
329
+	if err != nil {
330
+		utils.ErrorLog("%v", err)
331
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
332
+		return
333
+	}
334
+
335
+	timeLayout := "2006-01-02 15:04"
336
+	loc, _ := time.LoadLocation("Local")
337
+
338
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
339
+	if err != nil {
340
+		utils.ErrorLog(err.Error())
341
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
342
+		return
343
+	}
344
+	if len(from.Imags) == 0 {
345
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
346
+		return
347
+	}
348
+
349
+	date := theTime.Unix()
350
+	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
351
+	inspections := make([]models.Inspection, 0)
352
+	for index, item := range from.Imags {
353
+		if item.ID == 0 {
354
+			var inspection models.Inspection
355
+			inspection.OrgId = adminUserInfo.CurrentOrgId
356
+			inspection.PatientId = patient
357
+			inspection.ProjectId = from.ProjectId
358
+			inspection.ItemId = inspection_re[index].ID
359
+			inspection.ItemName = item.Desc
360
+			inspection.ProjectName = ""
361
+			inspection.InspectType = 3
362
+			inspection.InspectValue = item.ImgUrl
363
+			inspection.InspectDesc = item.Desc
364
+			inspection.InspectDate = date
365
+			inspection.Status = 1
366
+			inspection.CreatedTime = time.Now().Unix()
367
+			inspection.UpdatedTime = time.Now().Unix()
368
+			inspections = append(inspections, inspection)
369
+
370
+		} else {
371
+			var inspection models.Inspection
372
+			inspection.ID = item.ID
373
+			inspection.OrgId = adminUserInfo.CurrentOrgId
374
+			inspection.PatientId = patient
375
+			inspection.ProjectId = from.ProjectId
376
+			inspection.ItemId = inspection_re[index].ID
377
+			inspection.ItemName = item.Desc
378
+			inspection.ProjectName = ""
379
+			inspection.InspectType = 3
380
+			inspection.InspectValue = item.ImgUrl
381
+			inspection.InspectDesc = item.Desc
382
+			inspection.InspectDate = date
383
+			inspection.Status = 1
384
+			inspection.CreatedTime = time.Now().Unix()
385
+			inspection.UpdatedTime = time.Now().Unix()
386
+			err = service.SavePatientInspection(inspection)
387
+		}
388
+
389
+	}
390
+
391
+	for _, item := range from.DeleteImg {
392
+		service.DeleteInspectionTwo(item.ID)
393
+	}
394
+	if len(inspections) > 0 {
395
+		err = service.CreatePatientInspection(inspections)
396
+	}
397
+	if err != nil {
398
+		utils.ErrorLog("%v", err)
399
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
400
+		return
401
+	}
402
+	c.ServeSuccessJSON(map[string]interface{}{
403
+		"inspections": inspections,
404
+	})
405
+	return
406
+}
229
 
407
 
230
 func (c *InspectionApiController) EditPatientInspection() {
408
 func (c *InspectionApiController) EditPatientInspection() {
231
 	patient, _ := c.GetInt64("patient", 0)
409
 	patient, _ := c.GetInt64("patient", 0)

+ 78 - 80
controllers/integration_config_api_controller.go Zobrazit soubor

31
 
31
 
32
 func (c *IntegrationConfigApiController) SaveInspectionSysItemId() {
32
 func (c *IntegrationConfigApiController) SaveInspectionSysItemId() {
33
 	adminUserInfo := c.GetAdminUserInfo()
33
 	adminUserInfo := c.GetAdminUserInfo()
34
-	org_id,_ := c.GetInt64("org_id",0)
35
-	sys_item_id,_ := c.GetInt64("sys_item_id",0)
36
-	id,_ := c.GetInt64("id",0)
37
-	if org_id != adminUserInfo.CurrentOrgId || sys_item_id<= 0 || id <= 0 {
34
+	org_id, _ := c.GetInt64("org_id", 0)
35
+	sys_item_id, _ := c.GetInt64("sys_item_id", 0)
36
+	id, _ := c.GetInt64("id", 0)
37
+	if org_id != adminUserInfo.CurrentOrgId || sys_item_id <= 0 || id <= 0 {
38
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
38
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
39
 	}
39
 	}
40
 
40
 
41
 	inspection_reference := &models.InspectionReference{
41
 	inspection_reference := &models.InspectionReference{
42
-		ID : id,
43
-		SysItemId : sys_item_id,
44
-		UpdatedTime : time.Now().Unix(),
42
+		ID:          id,
43
+		SysItemId:   sys_item_id,
44
+		UpdatedTime: time.Now().Unix(),
45
 	}
45
 	}
46
 	err := service.UpdateSysItemIdByID(inspection_reference)
46
 	err := service.UpdateSysItemIdByID(inspection_reference)
47
 	if err != nil {
47
 	if err != nil {
48
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
48
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
49
 	}
49
 	}
50
 	c.ServeSuccessJSON(map[string]interface{}{
50
 	c.ServeSuccessJSON(map[string]interface{}{
51
-		"inspection_reference":  inspection_reference,
51
+		"inspection_reference": inspection_reference,
52
 	})
52
 	})
53
 	return
53
 	return
54
 }
54
 }
55
 
55
 
56
 func (c *IntegrationConfigApiController) GetSysInspectionList() {
56
 func (c *IntegrationConfigApiController) GetSysInspectionList() {
57
 	adminUserInfo := c.GetAdminUserInfo()
57
 	adminUserInfo := c.GetAdminUserInfo()
58
-	sysInspection,ownerInspection,err := service.GetSysInspectionList(adminUserInfo.CurrentOrgId)
58
+	sysInspection, ownerInspection, err := service.GetSysInspectionList(adminUserInfo.CurrentOrgId)
59
 	if err != nil {
59
 	if err != nil {
60
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
60
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
61
 	}
61
 	}
62
 
62
 
63
 	type InspectionStruce struct {
63
 	type InspectionStruce struct {
64
-		ProjectName string  `gorm:"-" json:"project_name" form:"project_name"`
65
-		ProjectId int64 `gorm:"-" json:"project_id" form:"project_id"`
66
-		InspectionReference []*models.InspectionReference  `gorm:"-" json:"inspection_reference" form:"inspection_reference"`
64
+		ProjectName         string                        `gorm:"-" json:"project_name" form:"project_name"`
65
+		ProjectId           int64                         `gorm:"-" json:"project_id" form:"project_id"`
66
+		InspectionReference []*models.InspectionReference `gorm:"-" json:"inspection_reference" form:"inspection_reference"`
67
 	}
67
 	}
68
 
68
 
69
 	sysInspec := make(map[int64]*InspectionStruce, 0)
69
 	sysInspec := make(map[int64]*InspectionStruce, 0)
70
 	ownerInspec := make(map[int64]*InspectionStruce, 0)
70
 	ownerInspec := make(map[int64]*InspectionStruce, 0)
71
 
71
 
72
-	
73
-
74
 	for _, item := range sysInspection {
72
 	for _, item := range sysInspection {
75
 		result := sysInspec[item.ProjectId]
73
 		result := sysInspec[item.ProjectId]
76
 		if result == nil {
74
 		if result == nil {
94
 	}
92
 	}
95
 
93
 
96
 	c.ServeSuccessJSON(map[string]interface{}{
94
 	c.ServeSuccessJSON(map[string]interface{}{
97
-		"sysInspec":  sysInspec,
95
+		"sysInspec":   sysInspec,
98
 		"ownerInspec": ownerInspec,
96
 		"ownerInspec": ownerInspec,
99
 	})
97
 	})
100
 	return
98
 	return
123
 
121
 
124
 func (c *IntegrationConfigApiController) SaveInterface() {
122
 func (c *IntegrationConfigApiController) SaveInterface() {
125
 	adminUserInfo := c.GetAdminUserInfo()
123
 	adminUserInfo := c.GetAdminUserInfo()
126
-	ID,_ := c.GetInt64("id",0)
124
+	ID, _ := c.GetInt64("id", 0)
127
 	OrgId := adminUserInfo.CurrentOrgId
125
 	OrgId := adminUserInfo.CurrentOrgId
128
-	Creater := adminUserInfo.AdminUser.Id 
129
-	Pattern,_ := c.GetInt("pattern",0)		
130
-	Dbhost := c.GetString("dbhost") 
126
+	Creater := adminUserInfo.AdminUser.Id
127
+	Pattern, _ := c.GetInt("pattern", 0)
128
+	Dbhost := c.GetString("dbhost")
131
 	Dbuser := c.GetString("dbuser")
129
 	Dbuser := c.GetString("dbuser")
132
-	Dbpassword := c.GetString("dbpassword") 
130
+	Dbpassword := c.GetString("dbpassword")
133
 	Dbname := c.GetString("dbname")
131
 	Dbname := c.GetString("dbname")
134
-	InterfaceUrl := c.GetString("interface_url") 
132
+	InterfaceUrl := c.GetString("interface_url")
135
 	InterFaceToken := c.GetString("interface_token")
133
 	InterFaceToken := c.GetString("interface_token")
136
 	AllowIp := c.GetString("allow_ip")
134
 	AllowIp := c.GetString("allow_ip")
137
-	AllowToken := c.GetString("allow_token")		
138
-	SyncFrequency,_ := c.GetInt("sync_frequency")
135
+	AllowToken := c.GetString("allow_token")
136
+	SyncFrequency, _ := c.GetInt("sync_frequency")
139
 	Status := 1
137
 	Status := 1
140
-	UpdatedTime :=  time.Now().Unix()
138
+	UpdatedTime := time.Now().Unix()
141
 	interfaceinfo := &models.MiddleInterface{
139
 	interfaceinfo := &models.MiddleInterface{
142
-		ID  		: ID,
143
-	OrgId   		: OrgId	,
144
-	Creater   		: Creater	,
145
-	Pattern 		: Pattern	,
146
-	Dbhost 			: Dbhost	,
147
-	Dbuser 			: Dbuser	,
148
-	Dbpassword 		: Dbpassword	,
149
-	Dbname 			: Dbname	,
150
-	InterfaceUrl 	: InterfaceUrl	,
151
-	InterFaceToken 	: InterFaceToken	,
152
-	AllowIp 		: AllowIp	,
153
-	AllowToken 		: AllowToken	,
154
-	SyncFrequency 	: SyncFrequency	,
155
-	Status			: Status	,
156
-	UpdatedTime     : UpdatedTime	,
140
+		ID:             ID,
141
+		OrgId:          OrgId,
142
+		Creater:        Creater,
143
+		Pattern:        Pattern,
144
+		Dbhost:         Dbhost,
145
+		Dbuser:         Dbuser,
146
+		Dbpassword:     Dbpassword,
147
+		Dbname:         Dbname,
148
+		InterfaceUrl:   InterfaceUrl,
149
+		InterFaceToken: InterFaceToken,
150
+		AllowIp:        AllowIp,
151
+		AllowToken:     AllowToken,
152
+		SyncFrequency:  SyncFrequency,
153
+		Status:         Status,
154
+		UpdatedTime:    UpdatedTime,
157
 	}
155
 	}
158
 	if ID <= 0 {
156
 	if ID <= 0 {
159
-		interfaceinfo.CreatedTime =  time.Now().Unix()
157
+		interfaceinfo.CreatedTime = time.Now().Unix()
160
 	}
158
 	}
161
-	err:= service.SaveInterface(interfaceinfo)
159
+	err := service.SaveInterface(interfaceinfo)
162
 
160
 
163
 	if err == nil {
161
 	if err == nil {
164
 		c.ServeSuccessJSON(map[string]interface{}{
162
 		c.ServeSuccessJSON(map[string]interface{}{
165
-			"interfaceinfo":  interfaceinfo,
163
+			"interfaceinfo": interfaceinfo,
166
 		})
164
 		})
167
 	} else {
165
 	} else {
168
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
166
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
174
 	adminUserInfo := c.GetAdminUserInfo()
172
 	adminUserInfo := c.GetAdminUserInfo()
175
 	interfaceinfo, _ := service.GetInterface(adminUserInfo.CurrentOrgId)
173
 	interfaceinfo, _ := service.GetInterface(adminUserInfo.CurrentOrgId)
176
 	c.ServeSuccessJSON(map[string]interface{}{
174
 	c.ServeSuccessJSON(map[string]interface{}{
177
-		"interfaceinfo":  interfaceinfo,
175
+		"interfaceinfo": interfaceinfo,
178
 	})
176
 	})
179
 	return
177
 	return
180
 
178
 
244
 	}
242
 	}
245
 
243
 
246
 	hisPatient := &models.HisPatients{
244
 	hisPatient := &models.HisPatients{
247
-		UserOrgId:          adminUserInfo.CurrentOrgId,
248
-		UserId:             patient.UserId,
249
-		Avatar:             patient.Avatar,
250
-		PatientType:        patient.PatientType,
251
-		DialysisNo:         patient.DialysisNo,
252
-		AdmissionNumber:    patient.AdmissionNumber,
253
-		Source:             patient.Source,
254
-		Lapseto:            patient.Lapseto,
255
-		PartitionId:        patient.PartitionId,
256
-		BedId:              patient.BedId,
257
-		Name:               patient.Name,
258
-		Alias:              patient.Alias,
259
-		Gender:             patient.Gender,
260
-		Nation:             patient.Nation,
261
-		NativePlace:        patient.NativePlace,
262
-		MaritalStatus:      patient.MaritalStatus,
263
-		IdCardNo:           patient.IdCardNo,
264
-		Birthday:           patient.Birthday,
265
-		ReimbursementWayId: patient.ReimbursementWayId,
266
-		HealthCareType:     patient.HealthCareType,
267
-		HealthCareNo:       patient.HealthCareNo,
268
-		HealthCareDueDate:  patient.HealthCareDueDate,
269
-		Height:             patient.Height,
270
-		BloodType:          patient.BloodType,
271
-		Rh:                 patient.Rh,
245
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
246
+		UserId:                       patient.UserId,
247
+		Avatar:                       patient.Avatar,
248
+		PatientType:                  patient.PatientType,
249
+		DialysisNo:                   patient.DialysisNo,
250
+		AdmissionNumber:              patient.AdmissionNumber,
251
+		Source:                       patient.Source,
252
+		Lapseto:                      patient.Lapseto,
253
+		PartitionId:                  patient.PartitionId,
254
+		BedId:                        patient.BedId,
255
+		Name:                         patient.Name,
256
+		Alias:                        patient.Alias,
257
+		Gender:                       patient.Gender,
258
+		Nation:                       patient.Nation,
259
+		NativePlace:                  patient.NativePlace,
260
+		MaritalStatus:                patient.MaritalStatus,
261
+		IdCardNo:                     patient.IdCardNo,
262
+		Birthday:                     patient.Birthday,
263
+		ReimbursementWayId:           patient.ReimbursementWayId,
264
+		HealthCareType:               patient.HealthCareType,
265
+		HealthCareNo:                 patient.HealthCareNo,
266
+		HealthCareDueDate:            patient.HealthCareDueDate,
267
+		Height:                       patient.Height,
268
+		BloodType:                    patient.BloodType,
269
+		Rh:                           patient.Rh,
272
 		HealthCareDueAlertDate:       patient.HealthCareDueAlertDate,
270
 		HealthCareDueAlertDate:       patient.HealthCareDueAlertDate,
273
 		EducationLevel:               patient.EducationLevel,
271
 		EducationLevel:               patient.EducationLevel,
274
 		Profession:                   patient.Profession,
272
 		Profession:                   patient.Profession,
310
 		CreatedTime:                  time.Now().Unix(),
308
 		CreatedTime:                  time.Now().Unix(),
311
 		UpdatedTime:                  time.Now().Unix(),
309
 		UpdatedTime:                  time.Now().Unix(),
312
 		Age:                          patient.Age,
310
 		Age:                          patient.Age,
313
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
314
-		IsInfectious:             patient.IsInfectious,
315
-		RemindCycle:              patient.RemindCycle,
316
-		ResponseResult:           patient.ResponseResult,
317
-		IsOpenRemind:             patient.IsOpenRemind,
318
-		DialysisAge:              patient.DialysisAge,
319
-		ExpenseKind:              patient.ExpenseKind,
320
-		TellPhone:                patient.TellPhone,
321
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
322
-		ContactName:              patient.ContactName,
323
-		HisUserId:                his_user_id,
324
-		XtPatientId:              patient.ID,
311
+		InfectiousNextRecordTime:     patient.InfectiousNextRecordTime,
312
+		IsInfectious:                 patient.IsInfectious,
313
+		RemindCycle:                  patient.RemindCycle,
314
+		ResponseResult:               patient.ResponseResult,
315
+		IsOpenRemind:                 patient.IsOpenRemind,
316
+		DialysisAge:                  patient.DialysisAge,
317
+		ExpenseKind:                  patient.ExpenseKind,
318
+		TellPhone:                    patient.TellPhone,
319
+		FirstTreatmentDate:           patient.FirstTreatmentDate,
320
+		ContactName:                  patient.ContactName,
321
+		HisUserId:                    his_user_id,
322
+		XtPatientId:                  patient.ID,
325
 	}
323
 	}
326
 
324
 
327
 	err := service.CreatePatientsHis(hisPatient)
325
 	err := service.CreatePatientsHis(hisPatient)

+ 150 - 131
controllers/manage_api_controller.go Zobrazit soubor

145
 	beego.Router("/api/manage/getobjecttabledisinfectbyidlist", &MachineApiController{}, "Get:GetObjectTableDisinfectByList")
145
 	beego.Router("/api/manage/getobjecttabledisinfectbyidlist", &MachineApiController{}, "Get:GetObjectTableDisinfectByList")
146
 	beego.Router("/api/manage/updateobjecttabledisinfect", &MachineApiController{}, "Post:UpdateObjectTableDisinfect")
146
 	beego.Router("/api/manage/updateobjecttabledisinfect", &MachineApiController{}, "Post:UpdateObjectTableDisinfect")
147
 	beego.Router("/api/manage/deleteobjecttabledisinfect", &MachineApiController{}, "Get:DeleteObjectTableDisinfect")
147
 	beego.Router("/api/manage/deleteobjecttabledisinfect", &MachineApiController{}, "Get:DeleteObjectTableDisinfect")
148
+	beego.Router("/api/manage/getairdisinfectionlongtime", &MachineApiController{}, "Get:GetAirDisinfectionLongTime")
149
+	beego.Router("/api/manage/getobjcttabledisinfectlongtime", &MachineApiController{}, "Get:GetObjectDisInfectionLongTime")
148
 }
150
 }
149
 
151
 
150
 func (this *MachineApiController) SaveManageInfo() {
152
 func (this *MachineApiController) SaveManageInfo() {
4495
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4497
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4496
 		return
4498
 		return
4497
 	}
4499
 	}
4498
-	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_start_time)
4500
+	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
4499
 
4501
 
4500
 	first_end_time := dataBody["first_end_time"].(string)
4502
 	first_end_time := dataBody["first_end_time"].(string)
4501
 
4503
 
4503
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4505
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4504
 		return
4506
 		return
4505
 	}
4507
 	}
4506
-	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_end_time)
4508
+	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
4507
 
4509
 
4508
 	first_total_time := dataBody["first_total_time"].(string)
4510
 	first_total_time := dataBody["first_total_time"].(string)
4509
 
4511
 
4523
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4525
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4524
 		return
4526
 		return
4525
 	}
4527
 	}
4526
-	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_start_time)
4528
+	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_start_time)
4527
 
4529
 
4528
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4530
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4529
 
4531
 
4531
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4533
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4532
 		return
4534
 		return
4533
 	}
4535
 	}
4534
-	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_end_time)
4536
+	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_end_time)
4535
 
4537
 
4536
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4538
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4537
 
4539
 
4551
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4553
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4552
 		return
4554
 		return
4553
 	}
4555
 	}
4554
-	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_start_time)
4556
+	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_start_time)
4555
 
4557
 
4556
 	third_end_time := dataBody["third_end_time"].(string)
4558
 	third_end_time := dataBody["third_end_time"].(string)
4557
 
4559
 
4559
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4561
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4560
 		return
4562
 		return
4561
 	}
4563
 	}
4562
-	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_end_time)
4564
+	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_end_time)
4563
 
4565
 
4564
 	third_total_time := dataBody["third_total_time"].(string)
4566
 	third_total_time := dataBody["third_total_time"].(string)
4565
 
4567
 
4575
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4577
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4576
 		return
4578
 		return
4577
 	}
4579
 	}
4578
-	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_start_time)
4580
+	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
4579
 
4581
 
4580
 	last_end_time := dataBody["last_end_time"].(string)
4582
 	last_end_time := dataBody["last_end_time"].(string)
4581
 
4583
 
4583
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4585
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4584
 		return
4586
 		return
4585
 	}
4587
 	}
4586
-	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_end_time)
4588
+	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
4587
 
4589
 
4588
 	last_total_time := dataBody["last_total_time"].(string)
4590
 	last_total_time := dataBody["last_total_time"].(string)
4589
 
4591
 
4723
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4725
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4724
 		return
4726
 		return
4725
 	}
4727
 	}
4726
-	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_start_time)
4728
+	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
4727
 
4729
 
4728
 	first_end_time := dataBody["first_end_time"].(string)
4730
 	first_end_time := dataBody["first_end_time"].(string)
4729
 
4731
 
4731
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4733
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4732
 		return
4734
 		return
4733
 	}
4735
 	}
4734
-	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_end_time)
4736
+	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
4735
 
4737
 
4736
 	first_total_time := dataBody["first_total_time"].(string)
4738
 	first_total_time := dataBody["first_total_time"].(string)
4737
 
4739
 
4751
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4753
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4752
 		return
4754
 		return
4753
 	}
4755
 	}
4754
-	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_start_time)
4756
+	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_start_time)
4755
 
4757
 
4756
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4758
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4757
 
4759
 
4759
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4761
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4760
 		return
4762
 		return
4761
 	}
4763
 	}
4762
-	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_end_time)
4764
+	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_end_time)
4763
 
4765
 
4764
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4766
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4765
 
4767
 
4779
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4781
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4780
 		return
4782
 		return
4781
 	}
4783
 	}
4782
-	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_start_time)
4784
+	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_start_time)
4783
 
4785
 
4784
 	third_end_time := dataBody["third_end_time"].(string)
4786
 	third_end_time := dataBody["third_end_time"].(string)
4785
 
4787
 
4787
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4789
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4788
 		return
4790
 		return
4789
 	}
4791
 	}
4790
-	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_end_time)
4792
+	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_end_time)
4791
 
4793
 
4792
 	third_total_time := dataBody["third_total_time"].(string)
4794
 	third_total_time := dataBody["third_total_time"].(string)
4793
 
4795
 
4803
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4805
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4804
 		return
4806
 		return
4805
 	}
4807
 	}
4806
-	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_start_time)
4808
+	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
4807
 
4809
 
4808
 	last_end_time := dataBody["last_end_time"].(string)
4810
 	last_end_time := dataBody["last_end_time"].(string)
4809
 
4811
 
4811
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4813
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4812
 		return
4814
 		return
4813
 	}
4815
 	}
4814
-	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_end_time)
4816
+	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
4815
 
4817
 
4816
 	last_total_time := dataBody["last_total_time"].(string)
4818
 	last_total_time := dataBody["last_total_time"].(string)
4817
 
4819
 
4908
 
4910
 
4909
 	first_start_time := dataBody["first_start_time"].(string)
4911
 	first_start_time := dataBody["first_start_time"].(string)
4910
 
4912
 
4911
-	if len(first_start_time) == 0 {
4912
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4913
-		return
4913
+	var firstStartTimeUnix int64
4914
+	if len(first_start_time) > 0 {
4915
+		firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
4916
+		firstStartTimeUnix = firstStartTime.Unix()
4914
 	}
4917
 	}
4915
-	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_start_time)
4916
 
4918
 
4919
+	var firstEndTimeUnix int64
4917
 	first_end_time := dataBody["first_end_time"].(string)
4920
 	first_end_time := dataBody["first_end_time"].(string)
4918
 
4921
 
4919
-	if len(first_end_time) == 0 {
4920
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4921
-		return
4922
+	if len(first_end_time) > 0 {
4923
+		firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
4924
+		firstEndTimeUnix = firstEndTime.Unix()
4922
 	}
4925
 	}
4923
-	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_end_time)
4924
 
4926
 
4925
 	first_total_time := dataBody["first_total_time"].(string)
4927
 	first_total_time := dataBody["first_total_time"].(string)
4926
 
4928
 
4935
 	sencond_disinfection_time := dataBody["sencond_disinfection_time"].(string)
4937
 	sencond_disinfection_time := dataBody["sencond_disinfection_time"].(string)
4936
 
4938
 
4937
 	sencond_start_time := dataBody["sencond_start_time"].(string)
4939
 	sencond_start_time := dataBody["sencond_start_time"].(string)
4938
-
4939
-	if len(sencond_start_time) == 0 {
4940
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4941
-		return
4940
+	var sencondStartTimeUnixt int64
4941
+	if len(sencond_start_time) > 0 {
4942
+		sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_start_time)
4943
+		sencondStartTimeUnixt = sencondStartTime.Unix()
4942
 	}
4944
 	}
4943
-	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_start_time)
4944
 
4945
 
4945
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4946
 	sencond_end_time := dataBody["sencond_end_time"].(string)
4946
-
4947
-	if len(sencond_end_time) == 0 {
4948
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4949
-		return
4947
+	var sencondEndTimeUnixt int64
4948
+	if len(sencond_end_time) > 0 {
4949
+		sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_end_time)
4950
+		sencondEndTimeUnixt = sencondEndTime.Unix()
4950
 	}
4951
 	}
4951
-	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_end_time)
4952
 
4952
 
4953
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4953
 	sencond_total_time := dataBody["sencond_total_time"].(string)
4954
 
4954
 
4963
 	third_disinfection_time := dataBody["third_disinfection_time"].(string)
4963
 	third_disinfection_time := dataBody["third_disinfection_time"].(string)
4964
 
4964
 
4965
 	third_start_time := dataBody["third_start_time"].(string)
4965
 	third_start_time := dataBody["third_start_time"].(string)
4966
-
4967
-	if len(third_start_time) == 0 {
4968
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4969
-		return
4966
+	var thirdStartTimeUnix int64
4967
+	if len(third_start_time) > 0 {
4968
+		thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_start_time)
4969
+		thirdStartTimeUnix = thirdStartTime.Unix()
4970
 	}
4970
 	}
4971
-	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_start_time)
4972
 
4971
 
4973
 	third_end_time := dataBody["third_end_time"].(string)
4972
 	third_end_time := dataBody["third_end_time"].(string)
4974
-
4975
-	if len(third_end_time) == 0 {
4976
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4977
-		return
4973
+	var thirdEndTimeUnix int64
4974
+	if len(third_end_time) > 0 {
4975
+		thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_end_time)
4976
+		thirdEndTimeUnix = thirdEndTime.Unix()
4978
 	}
4977
 	}
4979
-	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_end_time)
4980
 
4978
 
4981
 	third_total_time := dataBody["third_total_time"].(string)
4979
 	third_total_time := dataBody["third_total_time"].(string)
4982
 
4980
 
4991
 	fourth_disinfection_time := dataBody["fourth_disinfection_time"].(string)
4989
 	fourth_disinfection_time := dataBody["fourth_disinfection_time"].(string)
4992
 
4990
 
4993
 	fourth_start_time := dataBody["fourth_start_time"].(string)
4991
 	fourth_start_time := dataBody["fourth_start_time"].(string)
4994
-
4995
-	if len(fourth_start_time) == 0 {
4996
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4997
-		return
4992
+	var fourthiStartTimeUnitx int64
4993
+	if len(fourth_start_time) > 0 {
4994
+		fourthStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", fourth_start_time)
4995
+		fourthiStartTimeUnitx = fourthStartTime.Unix()
4998
 	}
4996
 	}
4999
-	fourthStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourth_start_time)
5000
 
4997
 
5001
 	fourth_end_time := dataBody["fourth_end_time"].(string)
4998
 	fourth_end_time := dataBody["fourth_end_time"].(string)
5002
-
5003
-	if len(fourth_end_time) == 0 {
5004
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5005
-		return
4999
+	var fourthEndTimeUnix int64
5000
+	if len(fourth_end_time) > 0 {
5001
+		fourthEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", fourth_end_time)
5002
+		fourthEndTimeUnix = fourthEndTime.Unix()
5006
 	}
5003
 	}
5007
-	fourthEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourth_end_time)
5008
 
5004
 
5009
 	fourth_total_time := dataBody["fourth_total_time"].(string)
5005
 	fourth_total_time := dataBody["fourth_total_time"].(string)
5010
 
5006
 
5018
 	last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
5014
 	last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
5019
 	last_disinfection_time := dataBody["last_disinfection_time"].(string)
5015
 	last_disinfection_time := dataBody["last_disinfection_time"].(string)
5020
 	last_start_time := dataBody["last_start_time"].(string)
5016
 	last_start_time := dataBody["last_start_time"].(string)
5021
-
5022
-	if len(last_start_time) == 0 {
5023
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5024
-		return
5017
+	var lastStartTimeUnix int64
5018
+	if len(last_start_time) > 0 {
5019
+		lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
5020
+		lastStartTimeUnix = lastStartTime.Unix()
5025
 	}
5021
 	}
5026
-	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_start_time)
5027
 
5022
 
5028
 	last_end_time := dataBody["last_end_time"].(string)
5023
 	last_end_time := dataBody["last_end_time"].(string)
5029
 
5024
 
5030
-	if len(last_end_time) == 0 {
5031
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5032
-		return
5025
+	var lastEndTimeUnix int64
5026
+	if len(last_end_time) > 0 {
5027
+		lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
5028
+		lastEndTimeUnix = lastEndTime.Unix()
5033
 	}
5029
 	}
5034
-	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_end_time)
5035
 
5030
 
5036
 	last_total_time := dataBody["last_total_time"].(string)
5031
 	last_total_time := dataBody["last_total_time"].(string)
5037
 
5032
 
5049
 		FirstDisinfectionWater:     first_disinfection_water,
5044
 		FirstDisinfectionWater:     first_disinfection_water,
5050
 		FirstDisinfectionMethods:   first_disinfection_methods,
5045
 		FirstDisinfectionMethods:   first_disinfection_methods,
5051
 		FirstDisinfectionTime:      first_disinfection_time,
5046
 		FirstDisinfectionTime:      first_disinfection_time,
5052
-		FirstStartTime:             firstStartTime.Unix(),
5053
-		FirstEndTime:               firstEndTime.Unix(),
5047
+		FirstStartTime:             firstStartTimeUnix,
5048
+		FirstEndTime:               firstEndTimeUnix,
5054
 		FirstTotalTime:             first_total_time,
5049
 		FirstTotalTime:             first_total_time,
5055
 		FirstIsCheck:               first_is_check,
5050
 		FirstIsCheck:               first_is_check,
5056
 		FirstModifications:         first_modifications,
5051
 		FirstModifications:         first_modifications,
5058
 		SencondDisinfectionWater:   sencond_disinfection_water,
5053
 		SencondDisinfectionWater:   sencond_disinfection_water,
5059
 		SencondDisinfectionMethods: sencond_disinfection_methods,
5054
 		SencondDisinfectionMethods: sencond_disinfection_methods,
5060
 		SencondDisinfectionTime:    sencond_disinfection_time,
5055
 		SencondDisinfectionTime:    sencond_disinfection_time,
5061
-		SencondStartTime:           sencondStartTime.Unix(),
5062
-		SencondEndTime:             sencondEndTime.Unix(),
5056
+		SencondStartTime:           sencondStartTimeUnixt,
5057
+		SencondEndTime:             sencondEndTimeUnixt,
5063
 		SencondTotalTime:           sencond_total_time,
5058
 		SencondTotalTime:           sencond_total_time,
5064
 		SencondIsCheck:             sencond_is_check,
5059
 		SencondIsCheck:             sencond_is_check,
5065
 		SencondModifications:       sencond_modifications,
5060
 		SencondModifications:       sencond_modifications,
5067
 		ThirdDisinfectionWater:     third_disinfection_water,
5062
 		ThirdDisinfectionWater:     third_disinfection_water,
5068
 		ThirdDisinfectionMethods:   third_disinfection_methods,
5063
 		ThirdDisinfectionMethods:   third_disinfection_methods,
5069
 		ThirdDisinfectionTime:      third_disinfection_time,
5064
 		ThirdDisinfectionTime:      third_disinfection_time,
5070
-		ThirdStartTime:             thirdStartTime.Unix(),
5071
-		ThirdEndTime:               thirdEndTime.Unix(),
5065
+		ThirdStartTime:             thirdStartTimeUnix,
5066
+		ThirdEndTime:               thirdEndTimeUnix,
5072
 		ThirdTotalTime:             third_total_time,
5067
 		ThirdTotalTime:             third_total_time,
5073
 		ThirdIsCheck:               third_is_check,
5068
 		ThirdIsCheck:               third_is_check,
5074
 		ThirdModifications:         third_modifications,
5069
 		ThirdModifications:         third_modifications,
5075
 		ThirdCreator:               third_creator,
5070
 		ThirdCreator:               third_creator,
5076
-		LastStartTime:              lastStartTime.Unix(),
5077
-		LastEndTime:                lastEndTime.Unix(),
5071
+		LastStartTime:              lastStartTimeUnix,
5072
+		LastEndTime:                lastEndTimeUnix,
5078
 		LastTotalTime:              last_total_time,
5073
 		LastTotalTime:              last_total_time,
5079
 		LastIsCheck:                last_is_check,
5074
 		LastIsCheck:                last_is_check,
5080
 		LastModifications:          last_modifications,
5075
 		LastModifications:          last_modifications,
5085
 		FourthDisinfectionWater:    fourth_disinfection_water,
5080
 		FourthDisinfectionWater:    fourth_disinfection_water,
5086
 		FourthDisinfectionMethods:  fourth_disinfection_methods,
5081
 		FourthDisinfectionMethods:  fourth_disinfection_methods,
5087
 		FourthDisinfectionTime:     fourth_disinfection_time,
5082
 		FourthDisinfectionTime:     fourth_disinfection_time,
5088
-		FourthStartTime:            fourthStartTime.Unix(),
5089
-		FourthEndTime:              fourthEndTime.Unix(),
5083
+		FourthStartTime:            fourthiStartTimeUnitx,
5084
+		FourthEndTime:              fourthEndTimeUnix,
5090
 		FourthTotalTime:            fourth_total_time,
5085
 		FourthTotalTime:            fourth_total_time,
5091
 		FourthIsCheck:              fourth_is_check,
5086
 		FourthIsCheck:              fourth_is_check,
5092
 		FourthModifications:        fourth_modifications,
5087
 		FourthModifications:        fourth_modifications,
5167
 	dataBody := make(map[string]interface{}, 0)
5162
 	dataBody := make(map[string]interface{}, 0)
5168
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5163
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5169
 	fmt.Println("err", err)
5164
 	fmt.Println("err", err)
5170
-	id := int64(dataBody["id"].(float64))
5171
 	record_date := dataBody["record_date"].(string)
5165
 	record_date := dataBody["record_date"].(string)
5166
+
5167
+	id := int64(dataBody["id"].(float64))
5172
 	recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5168
 	recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5173
 	recorddateunix := recorddate.Unix()
5169
 	recorddateunix := recorddate.Unix()
5174
 
5170
 
5178
 
5174
 
5179
 	first_start_time := dataBody["first_start_time"].(string)
5175
 	first_start_time := dataBody["first_start_time"].(string)
5180
 
5176
 
5181
-	if len(first_start_time) == 0 {
5182
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5183
-		return
5177
+	var firstStartTimeUnix int64
5178
+	if len(first_start_time) > 0 {
5179
+		firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
5180
+		firstStartTimeUnix = firstStartTime.Unix()
5184
 	}
5181
 	}
5185
-	firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_start_time)
5186
 
5182
 
5183
+	var firstEndTimeUnix int64
5187
 	first_end_time := dataBody["first_end_time"].(string)
5184
 	first_end_time := dataBody["first_end_time"].(string)
5188
 
5185
 
5189
-	if len(first_end_time) == 0 {
5190
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5191
-		return
5186
+	if len(first_end_time) > 0 {
5187
+		firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
5188
+		firstEndTimeUnix = firstEndTime.Unix()
5192
 	}
5189
 	}
5193
-	firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", first_end_time)
5194
 
5190
 
5195
 	first_total_time := dataBody["first_total_time"].(string)
5191
 	first_total_time := dataBody["first_total_time"].(string)
5196
 
5192
 
5205
 	sencond_disinfection_time := dataBody["sencond_disinfection_time"].(string)
5201
 	sencond_disinfection_time := dataBody["sencond_disinfection_time"].(string)
5206
 
5202
 
5207
 	sencond_start_time := dataBody["sencond_start_time"].(string)
5203
 	sencond_start_time := dataBody["sencond_start_time"].(string)
5208
-
5209
-	if len(sencond_start_time) == 0 {
5210
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5211
-		return
5204
+	var sencondStartTimeUnixt int64
5205
+	if len(sencond_start_time) > 0 {
5206
+		sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_start_time)
5207
+		sencondStartTimeUnixt = sencondStartTime.Unix()
5212
 	}
5208
 	}
5213
-	sencondStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_start_time)
5214
 
5209
 
5215
 	sencond_end_time := dataBody["sencond_end_time"].(string)
5210
 	sencond_end_time := dataBody["sencond_end_time"].(string)
5216
-
5217
-	if len(sencond_end_time) == 0 {
5218
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5219
-		return
5211
+	var sencondEndTimeUnixt int64
5212
+	if len(sencond_end_time) > 0 {
5213
+		sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", sencond_end_time)
5214
+		sencondEndTimeUnixt = sencondEndTime.Unix()
5220
 	}
5215
 	}
5221
-	sencondEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sencond_end_time)
5222
 
5216
 
5223
 	sencond_total_time := dataBody["sencond_total_time"].(string)
5217
 	sencond_total_time := dataBody["sencond_total_time"].(string)
5224
 
5218
 
5233
 	third_disinfection_time := dataBody["third_disinfection_time"].(string)
5227
 	third_disinfection_time := dataBody["third_disinfection_time"].(string)
5234
 
5228
 
5235
 	third_start_time := dataBody["third_start_time"].(string)
5229
 	third_start_time := dataBody["third_start_time"].(string)
5236
-
5237
-	if len(third_start_time) == 0 {
5238
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5239
-		return
5230
+	var thirdStartTimeUnix int64
5231
+	if len(third_start_time) > 0 {
5232
+		thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_start_time)
5233
+		thirdStartTimeUnix = thirdStartTime.Unix()
5240
 	}
5234
 	}
5241
-	thirdStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_start_time)
5242
 
5235
 
5243
 	third_end_time := dataBody["third_end_time"].(string)
5236
 	third_end_time := dataBody["third_end_time"].(string)
5244
-
5245
-	if len(third_end_time) == 0 {
5246
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5247
-		return
5237
+	var thirdEndTimeUnix int64
5238
+	if len(third_end_time) > 0 {
5239
+		thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", third_end_time)
5240
+		thirdEndTimeUnix = thirdEndTime.Unix()
5248
 	}
5241
 	}
5249
-	thirdEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", third_end_time)
5250
 
5242
 
5251
 	third_total_time := dataBody["third_total_time"].(string)
5243
 	third_total_time := dataBody["third_total_time"].(string)
5252
 
5244
 
5261
 	fourth_disinfection_time := dataBody["fourth_disinfection_time"].(string)
5253
 	fourth_disinfection_time := dataBody["fourth_disinfection_time"].(string)
5262
 
5254
 
5263
 	fourth_start_time := dataBody["fourth_start_time"].(string)
5255
 	fourth_start_time := dataBody["fourth_start_time"].(string)
5264
-
5265
-	if len(fourth_start_time) == 0 {
5266
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5267
-		return
5256
+	var fourthiStartTimeUnitx int64
5257
+	if len(fourth_start_time) > 0 {
5258
+		fourthStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", fourth_start_time)
5259
+		fourthiStartTimeUnitx = fourthStartTime.Unix()
5268
 	}
5260
 	}
5269
-	fourthStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourth_start_time)
5270
 
5261
 
5271
 	fourth_end_time := dataBody["fourth_end_time"].(string)
5262
 	fourth_end_time := dataBody["fourth_end_time"].(string)
5272
-
5273
-	if len(fourth_end_time) == 0 {
5274
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5275
-		return
5263
+	var fourthEndTimeUnix int64
5264
+	if len(fourth_end_time) > 0 {
5265
+		fourthEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", fourth_end_time)
5266
+		fourthEndTimeUnix = fourthEndTime.Unix()
5276
 	}
5267
 	}
5277
-	fourthEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourth_end_time)
5278
 
5268
 
5279
 	fourth_total_time := dataBody["fourth_total_time"].(string)
5269
 	fourth_total_time := dataBody["fourth_total_time"].(string)
5280
 
5270
 
5288
 	last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
5278
 	last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
5289
 	last_disinfection_time := dataBody["last_disinfection_time"].(string)
5279
 	last_disinfection_time := dataBody["last_disinfection_time"].(string)
5290
 	last_start_time := dataBody["last_start_time"].(string)
5280
 	last_start_time := dataBody["last_start_time"].(string)
5291
-
5292
-	if len(last_start_time) == 0 {
5293
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5294
-		return
5281
+	var lastStartTimeUnix int64
5282
+	if len(last_start_time) > 0 {
5283
+		lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
5284
+		lastStartTimeUnix = lastStartTime.Unix()
5295
 	}
5285
 	}
5296
-	lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_start_time)
5297
 
5286
 
5298
 	last_end_time := dataBody["last_end_time"].(string)
5287
 	last_end_time := dataBody["last_end_time"].(string)
5299
 
5288
 
5300
-	if len(last_end_time) == 0 {
5301
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5302
-		return
5289
+	var lastEndTimeUnix int64
5290
+	if len(last_end_time) > 0 {
5291
+		lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
5292
+		lastEndTimeUnix = lastEndTime.Unix()
5303
 	}
5293
 	}
5304
-	lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", last_end_time)
5305
 
5294
 
5306
 	last_total_time := dataBody["last_total_time"].(string)
5295
 	last_total_time := dataBody["last_total_time"].(string)
5307
 
5296
 
5320
 		FirstDisinfectionWater:     first_disinfection_water,
5309
 		FirstDisinfectionWater:     first_disinfection_water,
5321
 		FirstDisinfectionMethods:   first_disinfection_methods,
5310
 		FirstDisinfectionMethods:   first_disinfection_methods,
5322
 		FirstDisinfectionTime:      first_disinfection_time,
5311
 		FirstDisinfectionTime:      first_disinfection_time,
5323
-		FirstStartTime:             firstStartTime.Unix(),
5324
-		FirstEndTime:               firstEndTime.Unix(),
5312
+		FirstStartTime:             firstStartTimeUnix,
5313
+		FirstEndTime:               firstEndTimeUnix,
5325
 		FirstTotalTime:             first_total_time,
5314
 		FirstTotalTime:             first_total_time,
5326
 		FirstIsCheck:               first_is_check,
5315
 		FirstIsCheck:               first_is_check,
5327
 		FirstModifications:         first_modifications,
5316
 		FirstModifications:         first_modifications,
5329
 		SencondDisinfectionWater:   sencond_disinfection_water,
5318
 		SencondDisinfectionWater:   sencond_disinfection_water,
5330
 		SencondDisinfectionMethods: sencond_disinfection_methods,
5319
 		SencondDisinfectionMethods: sencond_disinfection_methods,
5331
 		SencondDisinfectionTime:    sencond_disinfection_time,
5320
 		SencondDisinfectionTime:    sencond_disinfection_time,
5332
-		SencondStartTime:           sencondStartTime.Unix(),
5333
-		SencondEndTime:             sencondEndTime.Unix(),
5321
+		SencondStartTime:           sencondStartTimeUnixt,
5322
+		SencondEndTime:             sencondEndTimeUnixt,
5334
 		SencondTotalTime:           sencond_total_time,
5323
 		SencondTotalTime:           sencond_total_time,
5335
 		SencondIsCheck:             sencond_is_check,
5324
 		SencondIsCheck:             sencond_is_check,
5336
 		SencondModifications:       sencond_modifications,
5325
 		SencondModifications:       sencond_modifications,
5338
 		ThirdDisinfectionWater:     third_disinfection_water,
5327
 		ThirdDisinfectionWater:     third_disinfection_water,
5339
 		ThirdDisinfectionMethods:   third_disinfection_methods,
5328
 		ThirdDisinfectionMethods:   third_disinfection_methods,
5340
 		ThirdDisinfectionTime:      third_disinfection_time,
5329
 		ThirdDisinfectionTime:      third_disinfection_time,
5341
-		ThirdStartTime:             thirdStartTime.Unix(),
5342
-		ThirdEndTime:               thirdEndTime.Unix(),
5330
+		ThirdStartTime:             thirdStartTimeUnix,
5331
+		ThirdEndTime:               thirdEndTimeUnix,
5343
 		ThirdTotalTime:             third_total_time,
5332
 		ThirdTotalTime:             third_total_time,
5344
 		ThirdIsCheck:               third_is_check,
5333
 		ThirdIsCheck:               third_is_check,
5345
 		ThirdModifications:         third_modifications,
5334
 		ThirdModifications:         third_modifications,
5346
 		ThirdCreator:               third_creator,
5335
 		ThirdCreator:               third_creator,
5347
-		LastStartTime:              lastStartTime.Unix(),
5348
-		LastEndTime:                lastEndTime.Unix(),
5336
+		LastStartTime:              lastStartTimeUnix,
5337
+		LastEndTime:                lastEndTimeUnix,
5349
 		LastTotalTime:              last_total_time,
5338
 		LastTotalTime:              last_total_time,
5350
 		LastIsCheck:                last_is_check,
5339
 		LastIsCheck:                last_is_check,
5351
 		LastModifications:          last_modifications,
5340
 		LastModifications:          last_modifications,
5356
 		FourthDisinfectionWater:    fourth_disinfection_water,
5345
 		FourthDisinfectionWater:    fourth_disinfection_water,
5357
 		FourthDisinfectionMethods:  fourth_disinfection_methods,
5346
 		FourthDisinfectionMethods:  fourth_disinfection_methods,
5358
 		FourthDisinfectionTime:     fourth_disinfection_time,
5347
 		FourthDisinfectionTime:     fourth_disinfection_time,
5359
-		FourthStartTime:            fourthStartTime.Unix(),
5360
-		FourthEndTime:              fourthEndTime.Unix(),
5348
+		FourthStartTime:            fourthiStartTimeUnitx,
5349
+		FourthEndTime:              fourthEndTimeUnix,
5361
 		FourthTotalTime:            fourth_total_time,
5350
 		FourthTotalTime:            fourth_total_time,
5362
 		FourthIsCheck:              fourth_is_check,
5351
 		FourthIsCheck:              fourth_is_check,
5363
 		FourthModifications:        fourth_modifications,
5352
 		FourthModifications:        fourth_modifications,
5389
 	this.ServeSuccessJSON(returnData)
5378
 	this.ServeSuccessJSON(returnData)
5390
 	return
5379
 	return
5391
 }
5380
 }
5381
+
5382
+func (this *MachineApiController) GetAirDisinfectionLongTime() {
5383
+
5384
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5385
+
5386
+	list, err := service.GetAirDisInfectionLongTime(orgId)
5387
+
5388
+	if err != nil {
5389
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5390
+		return
5391
+	}
5392
+	this.ServeSuccessJSON(map[string]interface{}{
5393
+		"list": list,
5394
+	})
5395
+}
5396
+
5397
+func (this *MachineApiController) GetObjectDisInfectionLongTime() {
5398
+
5399
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5400
+
5401
+	list, err := service.GetObjectDisInfectionLongTime(orgId)
5402
+
5403
+	if err != nil {
5404
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5405
+		return
5406
+	}
5407
+	this.ServeSuccessJSON(map[string]interface{}{
5408
+		"list": list,
5409
+	})
5410
+}

+ 8 - 4
controllers/manager_center_api_controller.go Zobrazit soubor

665
 
665
 
666
 }
666
 }
667
 
667
 
668
-//GetPatientsList 取配置信息列表
668
+// GetPatientsList 取配置信息列表
669
 func (c *ManagerCenterApiController) GetConfigList() {
669
 func (c *ManagerCenterApiController) GetConfigList() {
670
 	adminUserInfo := c.GetAdminUserInfo()
670
 	adminUserInfo := c.GetAdminUserInfo()
671
 	configList, _ := service.GetDictionaryConfigList(adminUserInfo.CurrentOrgId)
671
 	configList, _ := service.GetDictionaryConfigList(adminUserInfo.CurrentOrgId)
676
 
676
 
677
 }
677
 }
678
 
678
 
679
-//CreateConfig  创建配置信息
679
+// CreateConfig  创建配置信息
680
 func (c *ManagerCenterApiController) CreateConfig() {
680
 func (c *ManagerCenterApiController) CreateConfig() {
681
 	adminUserInfo := c.GetAdminUserInfo()
681
 	adminUserInfo := c.GetAdminUserInfo()
682
 
682
 
917
 	return
917
 	return
918
 }
918
 }
919
 
919
 
920
-//CreateChildConfig  创建子配置信息
920
+// CreateChildConfig  创建子配置信息
921
 func (c *ManagerCenterApiController) CreateChildConfig() {
921
 func (c *ManagerCenterApiController) CreateChildConfig() {
922
 	adminUserInfo := c.GetAdminUserInfo()
922
 	adminUserInfo := c.GetAdminUserInfo()
923
 
923
 
2126
 	pinyin := c.GetString("pinyin")
2126
 	pinyin := c.GetString("pinyin")
2127
 	wubi := c.GetString("wubi")
2127
 	wubi := c.GetString("wubi")
2128
 
2128
 
2129
+	sort, _ := c.GetInt64("sort")
2130
+	fmt.Println("sort-------------------", sort)
2129
 	if len(class_name) <= 0 {
2131
 	if len(class_name) <= 0 {
2130
 		utils.ErrorLog("len(class_name) == 0")
2132
 		utils.ErrorLog("len(class_name) == 0")
2131
 
2133
 
2153
 		Status:             1,
2155
 		Status:             1,
2154
 		Pinyin:             pinyin,
2156
 		Pinyin:             pinyin,
2155
 		Wubi:               wubi,
2157
 		Wubi:               wubi,
2158
+		Sort:               sort,
2156
 	}
2159
 	}
2157
 
2160
 
2158
 	err, dealers := service.AddSigleDiagnose(&dealer)
2161
 	err, dealers := service.AddSigleDiagnose(&dealer)
2182
 	remark := c.GetString("remark")
2185
 	remark := c.GetString("remark")
2183
 	pinyin := c.GetString("pinyin")
2186
 	pinyin := c.GetString("pinyin")
2184
 	wubi := c.GetString("wubi")
2187
 	wubi := c.GetString("wubi")
2185
-
2188
+	sort, _ := c.GetInt64("sort")
2186
 	if id <= 0 {
2189
 	if id <= 0 {
2187
 		utils.ErrorLog("id == 0")
2190
 		utils.ErrorLog("id == 0")
2188
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2191
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2215
 		Pinyin:             pinyin,
2218
 		Pinyin:             pinyin,
2216
 		Wubi:               wubi,
2219
 		Wubi:               wubi,
2217
 		Status:             1,
2220
 		Status:             1,
2221
+		Sort:               sort,
2218
 	}
2222
 	}
2219
 
2223
 
2220
 	err := service.ModifyDiagnose(&dealer)
2224
 	err := service.ModifyDiagnose(&dealer)

+ 1 - 1
controllers/mobile_api_controllers/check_api_controller.go Zobrazit soubor

20
 
20
 
21
 	adminUserInfo := c.GetMobileAdminUserInfo()
21
 	adminUserInfo := c.GetMobileAdminUserInfo()
22
 
22
 
23
-	references, err := service.GetInspectionReference(adminUserInfo.Org.Id)
23
+	references, err := service.GetInspectionReference(adminUserInfo.Org.Id, 0)
24
 	if err != nil {
24
 	if err != nil {
25
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
25
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
26
 		return
26
 		return

+ 63 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Zobrazit soubor

3203
 
3203
 
3204
 			}
3204
 			}
3205
 		}
3205
 		}
3206
+
3206
 		err := service.CreateMonitor(&record)
3207
 		err := service.CreateMonitor(&record)
3207
 		finish := models.XtDialysisFinish{
3208
 		finish := models.XtDialysisFinish{
3208
 			IsFinish:   1,
3209
 			IsFinish:   1,
4004
 
4005
 
4005
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
4006
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
4006
 	fmt.Println(evaluation)
4007
 	fmt.Println(evaluation)
4008
+
4007
 	if prescription.ID > 0 {
4009
 	if prescription.ID > 0 {
4008
 
4010
 
4009
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4011
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4055
 			}
4057
 			}
4056
 
4058
 
4057
 			if adminInfo.Org.Id == 10469 {
4059
 			if adminInfo.Org.Id == 10469 {
4060
+
4058
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 60 / 1000 / float64(totalMin) * 1000)
4061
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 60 / 1000 / float64(totalMin) * 1000)
4059
 
4062
 
4060
 				record.UltrafiltrationRate = ultrafiltration_rate
4063
 				record.UltrafiltrationRate = ultrafiltration_rate
4064
+
4061
 			}
4065
 			}
4062
 
4066
 
4063
 			if adminInfo.Org.Id == 10471 {
4067
 			if adminInfo.Org.Id == 10471 {
8457
 							if config.IsOpen != 1 {
8461
 							if config.IsOpen != 1 {
8458
 								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
8462
 								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
8459
 									service.HisDrugsDelivery(orgId, creater, &advice)
8463
 									service.HisDrugsDelivery(orgId, creater, &advice)
8464
+									if orgId == 3877 || orgId == 10265 {
8465
+										//查询该药品是否有出库记录
8466
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
8467
+										if len(flowMap) == 0 {
8468
+											errs := service.UpdateHisAdviceById(advice.ID)
8469
+											if errs != nil {
8470
+												drugError := models.XtDrugError{
8471
+													UserOrgId:             orgId,
8472
+													DrugId:                item.DrugId,
8473
+													RecordDate:            item.AdviceDate,
8474
+													PatientId:             item.PatientId,
8475
+													Remark:                "透析医嘱页面出库记录为空,更新执行人失败",
8476
+													Status:                1,
8477
+													Ctime:                 time.Now().Unix(),
8478
+													Mtime:                 0,
8479
+													SumCount:              0,
8480
+													Prescribingnumber:     advice.PrescribingNumber,
8481
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
8482
+												}
8483
+												service.CreateDrugError(drugError)
8484
+											}
8485
+											this.ServeSuccessJSON(map[string]interface{}{
8486
+												"msg":  "2",
8487
+												"drug": medical,
8488
+												"ids":  ids,
8489
+											})
8490
+											return
8491
+
8492
+										}
8493
+									}
8460
 								}
8494
 								}
8461
 								if pharmacyConfig.IsOpen != 1 {
8495
 								if pharmacyConfig.IsOpen != 1 {
8462
 									service.HisDrugsDelivery(orgId, creater, &advice)
8496
 									service.HisDrugsDelivery(orgId, creater, &advice)
8497
+									if orgId == 3877 || orgId == 10265 {
8498
+										//查询该药品是否有出库记录
8499
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
8500
+										if len(flowMap) == 0 {
8501
+											errs := service.UpdateHisAdviceById(advice.ID)
8502
+											if errs != nil {
8503
+												drugError := models.XtDrugError{
8504
+													UserOrgId:             orgId,
8505
+													DrugId:                item.DrugId,
8506
+													RecordDate:            item.AdviceDate,
8507
+													PatientId:             item.PatientId,
8508
+													Remark:                "透析医嘱页面出库记录为空,更新执行人失败",
8509
+													Status:                1,
8510
+													Ctime:                 time.Now().Unix(),
8511
+													Mtime:                 0,
8512
+													SumCount:              0,
8513
+													Prescribingnumber:     advice.PrescribingNumber,
8514
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
8515
+												}
8516
+												service.CreateDrugError(drugError)
8517
+											}
8518
+											this.ServeSuccessJSON(map[string]interface{}{
8519
+												"msg":  "2",
8520
+												"drug": medical,
8521
+												"ids":  ids,
8522
+											})
8523
+											return
8524
+										}
8525
+									}
8463
 								}
8526
 								}
8464
 
8527
 
8465
 								//更新字典里面的库存
8528
 								//更新字典里面的库存

+ 8 - 0
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Zobrazit soubor

106
 	blood_monitor, _ := this.GetFloat("blood_monitor")
106
 	blood_monitor, _ := this.GetFloat("blood_monitor")
107
 	dehydration, _ := this.GetFloat("dehydration")
107
 	dehydration, _ := this.GetFloat("dehydration")
108
 	filter_pressure := this.GetString("filter_pressure")
108
 	filter_pressure := this.GetString("filter_pressure")
109
+	replacement_speed, _ := this.GetFloat("replacement_speed")
110
+	dicarbonate, _ := this.GetFloat("dicarbonate")
109
 	adminInfo := this.GetMobileAdminUserInfo()
111
 	adminInfo := this.GetMobileAdminUserInfo()
110
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
112
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
111
 	if getPatientErr != nil {
113
 	if getPatientErr != nil {
196
 		HeparinAmount:               heparin_amount,
198
 		HeparinAmount:               heparin_amount,
197
 		Dehydration:                 dehydration,
199
 		Dehydration:                 dehydration,
198
 		FilterPressure:              filter_pressure,
200
 		FilterPressure:              filter_pressure,
201
+		Dicarbonate:                 dicarbonate,
202
+		ReplacementSpeed:            replacement_speed,
199
 	}
203
 	}
200
 
204
 
201
 	err := service.CreateMonitor(&record)
205
 	err := service.CreateMonitor(&record)
325
 	heparin_amount, _ := this.GetFloat("heparin_amount")
329
 	heparin_amount, _ := this.GetFloat("heparin_amount")
326
 	dehydration, _ := this.GetFloat("dehydration")
330
 	dehydration, _ := this.GetFloat("dehydration")
327
 	filter_pressure := this.GetString("filter_pressure")
331
 	filter_pressure := this.GetString("filter_pressure")
332
+	replacement_speed, _ := this.GetFloat("replacement_speed")
333
+	dicarbonate, _ := this.GetFloat("dicarbonate")
328
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
334
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
329
 	if err != nil {
335
 	if err != nil {
330
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
336
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
409
 
415
 
410
 		}
416
 		}
411
 	}
417
 	}
418
+	monitor.ReplacementSpeed = replacement_speed
419
+	monitor.Dicarbonate = dicarbonate
412
 	err = service.UpdateMonitor(monitor)
420
 	err = service.UpdateMonitor(monitor)
413
 	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
421
 	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
414
 	redis := service.RedisClient()
422
 	redis := service.RedisClient()

+ 7 - 0
controllers/mobile_api_controllers/mobile_api_base_controller.go Zobrazit soubor

143
 
143
 
144
 			//redis key值
144
 			//redis key值
145
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
145
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
+			fmt.Println("ket--------------------", key)
147
+
148
+			redis.Set(key, "", time.Second)
146
 			purviews_json_str, _ := redis.Get(key).Result()
149
 			purviews_json_str, _ := redis.Get(key).Result()
147
 			//获取该用户下所有角色的权限总集
150
 			//获取该用户下所有角色的权限总集
148
 			var userRolePurviews string
151
 			var userRolePurviews string
152
 			fmt.Println(purviews_json_str)
155
 			fmt.Println(purviews_json_str)
153
 			fmt.Println("----redis 结束----")
156
 			fmt.Println("----redis 结束----")
154
 
157
 
158
+			fmt.Println("purviews_json_str0000000000000000000000000000", len(purviews_json_str))
155
 			if len(purviews_json_str) == 0 {
159
 			if len(purviews_json_str) == 0 {
156
 				for _, item := range roles {
160
 				for _, item := range roles {
157
 					role_id, _ := strconv.ParseInt(item, 10, 64)
161
 					role_id, _ := strconv.ParseInt(item, 10, 64)
158
 					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
162
 					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
163
+					fmt.Println("2333333333333333333", purviews)
159
 					if len(userRolePurviews) == 0 {
164
 					if len(userRolePurviews) == 0 {
160
 						userRolePurviews = purviews
165
 						userRolePurviews = purviews
161
 					} else {
166
 					} else {
166
 				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
171
 				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
167
 				//缓存数据
172
 				//缓存数据
168
 				purview_json, err := json.Marshal(userRolePurviewsArr)
173
 				purview_json, err := json.Marshal(userRolePurviewsArr)
174
+				fmt.Println("errr-------------------", err)
169
 				if err == nil {
175
 				if err == nil {
170
 					redis.Set(key, purview_json, time.Minute*60*60*24)
176
 					redis.Set(key, purview_json, time.Minute*60*60*24)
171
 				}
177
 				}
183
 
189
 
184
 			//系统所记录的权限列表
190
 			//系统所记录的权限列表
185
 			allPermission, _ := service.GetAllFunctionPurview()
191
 			allPermission, _ := service.GetAllFunctionPurview()
192
+			fmt.Println("allPermission-----------------------", allPermission)
186
 			for _, item := range allPermission {
193
 			for _, item := range allPermission {
187
 				//判断当前路由是否在权限路由列表里面
194
 				//判断当前路由是否在权限路由列表里面
188
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
195
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 183 - 107
controllers/mobile_api_controllers/patient_api_controller.go Zobrazit soubor

621
 	origin, _ := c.GetInt64("origin", 0)
621
 	origin, _ := c.GetInt64("origin", 0)
622
 	groupno, _ := c.GetInt64("groupno", -1)
622
 	groupno, _ := c.GetInt64("groupno", -1)
623
 
623
 
624
+	fmt.Println("orgind===2=323322323232323", origin)
625
+	fmt.Println("groupno233333333333333333333", groupno)
624
 	if origin != 2 {
626
 	if origin != 2 {
625
 		adminUserInfo := c.GetMobileAdminUserInfo()
627
 		adminUserInfo := c.GetMobileAdminUserInfo()
626
 		execution_staff := adminUserInfo.AdminUser.Id
628
 		execution_staff := adminUserInfo.AdminUser.Id
688
 			UpdatedTime:    time.Now().Unix(),
690
 			UpdatedTime:    time.Now().Unix(),
689
 		}
691
 		}
690
 		var err error
692
 		var err error
693
+		fmt.Println("groupno==============", groupno)
691
 		if groupno > 0 {
694
 		if groupno > 0 {
692
 
695
 
693
 			// 查询信息规挡的设置天数
696
 			// 查询信息规挡的设置天数
805
 
808
 
806
 		if drugStockConfig.IsOpen == 1 {
809
 		if drugStockConfig.IsOpen == 1 {
807
 			if groupno > 0 {
810
 			if groupno > 0 {
808
-				advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
811
+				advices, _ := service.FindAllDoctorAdviceByGoroupNoTwety(adminUserInfo.Org.Id, groupno)
809
 
812
 
810
-				isHasWay := false //用来判断是否包含来自药品库的医嘱
811
-				for _, item := range advices {
812
-					if item.Way == 1 {
813
-						isHasWay = true
814
-					}
815
-
816
-				}
817
-
818
-				if isHasWay {
813
+				if len(advices) > 0 {
819
 					var total int64
814
 					var total int64
820
 					var prescribing_number_total int64
815
 					var prescribing_number_total int64
821
 
816
 
817
+					//出库
822
 					for _, item := range advices {
818
 					for _, item := range advices {
823
 						if item.Way == 1 {
819
 						if item.Way == 1 {
820
+
824
 							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
821
 							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
825
 							//查询该药品的剩余库存
822
 							//查询该药品的剩余库存
826
 							list, _ := service.GetDrugTotalCount(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
823
 							list, _ := service.GetDrugTotalCount(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
843
 							}
840
 							}
844
 
841
 
845
 							if medical.IsUse == 1 {
842
 							if medical.IsUse == 1 {
843
+
846
 								c.ServeSuccessJSON(map[string]interface{}{
844
 								c.ServeSuccessJSON(map[string]interface{}{
847
 									"msg":    "1",
845
 									"msg":    "1",
848
 									"advice": advice,
846
 									"advice": advice,
853
 
851
 
854
 							if medical.IsUse != 1 {
852
 							if medical.IsUse != 1 {
855
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
853
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
854
+									if advice.UserOrgId != 10278 {
855
+										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
856
+										advice.ExecutionTime = 0
857
+										advice.ExecutionState = 2
858
+										advice.ExecutionStaff = 0
859
+									}
860
+
856
 									c.ServeSuccessJSON(map[string]interface{}{
861
 									c.ServeSuccessJSON(map[string]interface{}{
857
 										"msg":    "3",
862
 										"msg":    "3",
858
 										"advice": advice,
863
 										"advice": advice,
859
 										"ids":    ids,
864
 										"ids":    ids,
860
 									})
865
 									})
861
 									return
866
 									return
867
+
862
 								}
868
 								}
863
 								if prescribing_number_total > total {
869
 								if prescribing_number_total > total {
870
+									if advice.UserOrgId != 10278 {
871
+										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
872
+										advice.ExecutionTime = 0
873
+										advice.ExecutionState = 2
874
+										advice.ExecutionStaff = 0
875
+									}
864
 									c.ServeSuccessJSON(map[string]interface{}{
876
 									c.ServeSuccessJSON(map[string]interface{}{
865
 										"msg":    "2",
877
 										"msg":    "2",
866
 										"advice": advice,
878
 										"advice": advice,
869
 									return
881
 									return
870
 								}
882
 								}
871
 							}
883
 							}
872
-
873
-							if prescribing_number_total <= total {
874
-
884
+							//查询是否出库按钮开启
885
+							adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
886
+							if adviceSetting.IsAdviceOpen == 1 {
875
 								//查询是否出库按钮开启
887
 								//查询是否出库按钮开启
876
-								adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
877
-								if adviceSetting.IsAdviceOpen == 1 {
878
-									//查询是否出库按钮开启
879
-									prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
880
-									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
881
-									if prescriptionConfig.IsOpen == 1 {
882
-										if medical.IsUse == 2 {
883
-											if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
884
-												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
885
-											}
886
-											if pharmacyConfig.IsOpen != 1 {
888
+								prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
889
+								//患者发药
890
+								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
891
+								if prescriptionConfig.IsOpen == 1 {
892
+									if medical.IsUse == 2 {
893
+										if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
894
+											//查询今日是否出库
895
+											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
896
+											if drugOutInfo.ID == 0 {
887
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
897
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
888
 											}
898
 											}
889
 
899
 
890
-											//更新字典里面的库存
891
-											stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
892
-											var sum_count int64
893
-											for _, its := range stockInfo {
894
-												if its.MaxUnit == medical.MaxUnit {
895
-													its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
896
-												}
897
-												sum_count += its.StockMaxNumber + its.StockMinNumber
898
-											}
899
-											service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
900
-											//剩余库存
901
-											service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
902
-										}
903
-									}
904
-								} else {
905
-									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
906
-									if medical.IsUse == 2 {
907
-										if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
908
-											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
909
 										}
900
 										}
910
 										if pharmacyConfig.IsOpen != 1 {
901
 										if pharmacyConfig.IsOpen != 1 {
911
-											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
902
+											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
903
+											if drugOutInfo.ID == 0 {
904
+												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
905
+											}
912
 										}
906
 										}
913
 
907
 
908
+										//更新字典里面的库存
914
 										stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
909
 										stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
915
 										var sum_count int64
910
 										var sum_count int64
916
 										for _, its := range stockInfo {
911
 										for _, its := range stockInfo {
924
 										service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
919
 										service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
925
 									}
920
 									}
926
 								}
921
 								}
922
+							} else {
923
+								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
924
+								if medical.IsUse == 2 {
925
+									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
926
+										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
927
+										if drugOutInfo.ID == 0 {
928
+											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
929
+										}
930
+									}
931
+									if pharmacyConfig.IsOpen != 1 {
932
+										drugError := models.XtDrugError{
933
+											ID:                    0,
934
+											UserOrgId:             item.UserOrgId,
935
+											DrugId:                item.DrugId,
936
+											RecordDate:            item.AdviceDate,
937
+											PatientId:             item.PatientId,
938
+											Remark:                "恒泰中医院出库开始",
939
+											Status:                1,
940
+											Ctime:                 time.Now().Unix(),
941
+											Mtime:                 0,
942
+											Prescribingnumber:     item.PrescribingNumber,
943
+											PrescribingNumberUnit: item.PrescribingNumberUnit,
944
+											SumCount:              0,
945
+										}
946
+										service.CreateDrugError(drugError)
947
+										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
948
+										if drugOutInfo.ID == 0 {
949
+
950
+											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
951
+										}
952
+									}
953
+
954
+									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
955
+									var sum_count int64
956
+									for _, its := range stockInfo {
957
+										if its.MaxUnit == medical.MaxUnit {
958
+											its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
959
+										}
960
+										sum_count += its.StockMaxNumber + its.StockMinNumber
961
+									}
962
+									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
963
+									//剩余库存
964
+									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
965
+								}
927
 							}
966
 							}
928
 						}
967
 						}
968
+
929
 					}
969
 					}
930
 
970
 
931
 				}
971
 				}
932
-			} else {
933
 
972
 
934
-				advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
935
-				isHasWay := false //用来判断是否包含来自药品库的医嘱
973
+				c.ServeSuccessJSON(map[string]interface{}{
974
+					"msg":    "1",
975
+					"advice": advice,
976
+					"ids":    ids,
977
+				})
978
+				return
936
 
979
 
937
-				for _, item := range advices {
938
-					if item.Way == 1 {
939
-						isHasWay = true
940
-					}
941
-				}
980
+			} else {
981
+
982
+				advices, _ := service.FindDoctorAdviceByIdsTwety(adminUserInfo.Org.Id, ids)
942
 
983
 
943
-				if isHasWay {
984
+				if len(advices) > 0 {
944
 					var total int64
985
 					var total int64
945
 					var prescribing_number_total int64
986
 					var prescribing_number_total int64
946
-					for _, item := range advices {
947
 
987
 
988
+					for _, item := range advices {
948
 						if item.Way == 1 {
989
 						if item.Way == 1 {
990
+							//查询改药品信息
991
+							medical, _ := service.GetBaseDrugMedical(item.DrugId)
992
+							pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
993
+
949
 							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
994
 							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
950
 							//查询该药品的剩余库存
995
 							//查询该药品的剩余库存
951
 							list, _ := service.GetDrugTotalCount(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
996
 							list, _ := service.GetDrugTotalCount(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
952
 
997
 
953
-							//查询改药品信息
954
-							medical, _ := service.GetBaseDrugMedical(item.DrugId)
955
-
956
 							//判断单位是否相等
998
 							//判断单位是否相等
957
 							if medical.MaxUnit == item.PrescribingNumberUnit {
999
 							if medical.MaxUnit == item.PrescribingNumberUnit {
958
 								prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
1000
 								prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
971
 							}
1013
 							}
972
 
1014
 
973
 							if medical.IsUse == 1 {
1015
 							if medical.IsUse == 1 {
1016
+
974
 								c.ServeSuccessJSON(map[string]interface{}{
1017
 								c.ServeSuccessJSON(map[string]interface{}{
975
 									"msg":    "1",
1018
 									"msg":    "1",
976
 									"advice": advice,
1019
 									"advice": advice,
980
 							}
1023
 							}
981
 							if medical.IsUse != 1 {
1024
 							if medical.IsUse != 1 {
982
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1025
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1026
+									if advice.UserOrgId != 10278 {
1027
+										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1028
+										advice.ExecutionTime = 0
1029
+										advice.ExecutionState = 2
1030
+										advice.ExecutionStaff = 0
1031
+									}
983
 									c.ServeSuccessJSON(map[string]interface{}{
1032
 									c.ServeSuccessJSON(map[string]interface{}{
984
 										"msg":    "3",
1033
 										"msg":    "3",
985
 										"advice": advice,
1034
 										"advice": advice,
988
 									return
1037
 									return
989
 								}
1038
 								}
990
 								if prescribing_number_total > total {
1039
 								if prescribing_number_total > total {
1040
+									if advice.UserOrgId != 10278 {
1041
+										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1042
+										advice.ExecutionTime = 0
1043
+										advice.ExecutionState = 2
1044
+										advice.ExecutionStaff = 0
1045
+									}
991
 									c.ServeSuccessJSON(map[string]interface{}{
1046
 									c.ServeSuccessJSON(map[string]interface{}{
992
 										"msg":    "2",
1047
 										"msg":    "2",
993
 										"advice": advice,
1048
 										"advice": advice,
996
 									return
1051
 									return
997
 								}
1052
 								}
998
 							}
1053
 							}
999
-
1000
-							if prescribing_number_total <= total {
1001
-								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
1002
-								if medical.IsUse == 2 {
1003
-									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1054
+							if medical.IsUse == 2 {
1055
+								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1056
+									//查询今日是否出库
1057
+									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1058
+									if drugOutInfo.ID == 0 {
1004
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1059
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1005
 									}
1060
 									}
1006
-									if pharmacyConfig.IsOpen != 1 {
1061
+								}
1062
+								if pharmacyConfig.IsOpen != 1 {
1063
+									//查询今日是否出库
1064
+									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1065
+									if drugOutInfo.ID == 0 {
1007
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1066
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1008
 									}
1067
 									}
1068
+								}
1009
 
1069
 
1010
-									//更新字典里面的库存
1011
-									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1012
-									var sum_count int64
1013
-									for _, its := range stockInfo {
1014
-										baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
1015
-										if its.MaxUnit == baseDrug.MaxUnit {
1016
-											its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
1017
-										}
1018
-										sum_count += its.StockMaxNumber + its.StockMinNumber
1070
+								//更新字典里面的库存
1071
+								stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1072
+								var sum_count int64
1073
+								for _, its := range stockInfo {
1074
+									baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
1075
+									if its.MaxUnit == baseDrug.MaxUnit {
1076
+										its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
1019
 									}
1077
 									}
1020
-									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1021
-									//剩余库存
1022
-									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1078
+									sum_count += its.StockMaxNumber + its.StockMinNumber
1023
 								}
1079
 								}
1024
-								if medical.IsUse == 1 {
1025
-									c.ServeSuccessJSON(map[string]interface{}{
1026
-										"msg":    "1",
1027
-										"advice": advice,
1028
-										"ids":    ids,
1029
-									})
1030
-									return
1031
-								}
1032
-
1080
+								service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1081
+								//剩余库存
1082
+								service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1083
+							}
1084
+							if medical.IsUse == 1 {
1085
+								c.ServeSuccessJSON(map[string]interface{}{
1086
+									"msg":    "1",
1087
+									"advice": advice,
1088
+									"ids":    ids,
1089
+								})
1090
+								return
1033
 							}
1091
 							}
1092
+
1034
 						}
1093
 						}
1094
+
1035
 					}
1095
 					}
1036
 				}
1096
 				}
1097
+				c.ServeSuccessJSON(map[string]interface{}{
1098
+					"msg":    "1",
1099
+					"advice": advice,
1100
+					"ids":    ids,
1101
+				})
1102
+				return
1037
 			}
1103
 			}
1038
-
1039
-			c.ServeSuccessJSON(map[string]interface{}{
1040
-				"msg":    "1",
1041
-				"advice": advice,
1042
-				"ids":    ids,
1043
-			})
1044
-			return
1045
 		}
1104
 		}
1046
 
1105
 
1047
 		if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
1106
 		if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
1219
 				}
1278
 				}
1220
 			}
1279
 			}
1221
 			err = service.SaveHisDoctorAdvice(item)
1280
 			err = service.SaveHisDoctorAdvice(item)
1281
+			if err == nil {
1282
+				drugError := models.XtDrugError{
1283
+					UserOrgId:             adminInfo.Org.Id,
1284
+					DrugId:                item.DrugId,
1285
+					RecordDate:            item.AdviceDate,
1286
+					PatientId:             item.PatientId,
1287
+					Remark:                "执行成功",
1288
+					Status:                1,
1289
+					Ctime:                 time.Now().Unix(),
1290
+					Mtime:                 0,
1291
+					SumCount:              0,
1292
+					Prescribingnumber:     item.PrescribingNumber,
1293
+					PrescribingNumberUnit: item.PrescribingNumberUnit,
1294
+				}
1295
+				service.CreateDrugError(drugError)
1296
+			}
1297
+
1222
 			key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1298
 			key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1223
 			redis := service.RedisClient()
1299
 			redis := service.RedisClient()
1224
 			//清空key 值
1300
 			//清空key 值
1514
 					}
1590
 					}
1515
 
1591
 
1516
 					//
1592
 					//
1517
-					//if config.IsOpen == 1 && item.UserOrgId == 10088 {
1518
-					//
1519
-					//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1520
-					//	//更新字典里面的库存
1521
-					//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1522
-					//	var sum_count int64
1523
-					//	for _, its := range stockInfo {
1524
-					//		if its.MaxUnit == medical.MaxUnit {
1525
-					//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1526
-					//		}
1527
-					//		sum_count += its.StockMaxNumber + its.StockMinNumber
1528
-					//	}
1529
-					//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1530
-					//	//剩余库存
1531
-					//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1532
-					//}
1593
+					if config.IsOpen == 1 && item.UserOrgId == 10028 {
1594
+
1595
+						service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1596
+						//更新字典里面的库存
1597
+						stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1598
+						var sum_count int64
1599
+						for _, its := range stockInfo {
1600
+							if its.MaxUnit == medical.MaxUnit {
1601
+								its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1602
+							}
1603
+							sum_count += its.StockMaxNumber + its.StockMinNumber
1604
+						}
1605
+						service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1606
+						//剩余库存
1607
+						service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1608
+					}
1533
 
1609
 
1534
 				}
1610
 				}
1535
 			}
1611
 			}

+ 2 - 2
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Zobrazit soubor

22
 
22
 
23
 //化验指标
23
 //化验指标
24
 
24
 
25
-//初始化数据
25
+// 初始化数据
26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
27
 	adminUserInfo := this.GetMobileAdminUserInfo()
27
 	adminUserInfo := this.GetMobileAdminUserInfo()
28
 	var references []*models.InspectionReference
28
 	var references []*models.InspectionReference
56
 
56
 
57
 }
57
 }
58
 
58
 
59
-//获取取值范围
59
+// 获取取值范围
60
 func (this *IndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
60
 func (this *IndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
61
 	range_type, _ := this.GetInt64("range_type")
61
 	range_type, _ := this.GetInt64("range_type")
62
 	project_id, _ := this.GetInt64("project_id")
62
 	project_id, _ := this.GetInt64("project_id")

+ 3 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Zobrazit soubor

1039
 	id, _ := c.GetInt64("id")
1039
 	id, _ := c.GetInt64("id")
1040
 	org_id := c.GetMobileAdminUserInfo().Org.Id
1040
 	org_id := c.GetMobileAdminUserInfo().Org.Id
1041
 
1041
 
1042
+	temp_schedule, _ := service.GetScheduleByClassTypeTwo(schedule_type, schedule_date, patient_id, org_id)
1043
+	id = temp_schedule.ID
1044
+
1042
 	//查询该班次该床位是否已经存在患者
1045
 	//查询该班次该床位是否已经存在患者
1043
 	schedule, _ := service.GetScheduleByClassType(schedule_type, schedule_date, bed_id, org_id)
1046
 	schedule, _ := service.GetScheduleByClassType(schedule_type, schedule_date, bed_id, org_id)
1044
 	//查询该床位所属分区
1047
 	//查询该床位所属分区

+ 56 - 6
controllers/patient_api_controller.go Zobrazit soubor

1718
 		}
1718
 		}
1719
 	}
1719
 	}
1720
 
1720
 
1721
+	if advice.UserOrgId == 3877 || advice.UserOrgId == 10340 || advice.UserOrgId == 9671 {
1722
+		if advice.PrescribingNumber == 0 {
1723
+			advice.PrescribingNumber = 1
1724
+		}
1725
+		//查询该患者今日有没有双人核对
1726
+		check, _ := service.MobileGetDoubleCheckSix(advice.UserOrgId, patientInfo.ID, advice.AdviceDate)
1727
+
1728
+		if check.ID > 0 {
1729
+			advice.Checker = check.Modifier
1730
+			advice.CheckState = 1
1731
+			advice.CheckTime = time.Now().Unix()
1732
+		}
1733
+	}
1721
 	err := service.CreateDoctorAdvice(&advice)
1734
 	err := service.CreateDoctorAdvice(&advice)
1722
 	//创建步骤表
1735
 	//创建步骤表
1723
 	finish := models.XtDialysisFinish{
1736
 	finish := models.XtDialysisFinish{
1899
 				pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1912
 				pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1900
 				if medical.IsUse == 2 {
1913
 				if medical.IsUse == 2 {
1901
 					if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1914
 					if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1902
-						service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
1915
+						drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1916
+						if drugOutInfo.ID == 0 {
1917
+							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1918
+						}
1919
+
1903
 					}
1920
 					}
1904
 					if pharmacyConfig.IsOpen != 1 {
1921
 					if pharmacyConfig.IsOpen != 1 {
1905
-						service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
1922
+						drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1923
+						if drugOutInfo.ID == 0 {
1924
+							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1925
+						}
1906
 					}
1926
 					}
1907
 
1927
 
1908
 					//查询默认仓库
1928
 					//查询默认仓库
2122
 				}
2142
 				}
2123
 
2143
 
2124
 				if medical.IsUse != 1 {
2144
 				if medical.IsUse != 1 {
2145
+
2125
 					if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
2146
 					if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
2147
+						service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
2148
+						advice.ExecutionState = 2
2149
+						advice.ExecutionStaff = 0
2150
+						advice.ExecutionTime = 0
2126
 						c.ServeSuccessJSON(map[string]interface{}{
2151
 						c.ServeSuccessJSON(map[string]interface{}{
2127
 							"msg":    "3",
2152
 							"msg":    "3",
2128
 							"advice": advice,
2153
 							"advice": advice,
2130
 						return
2155
 						return
2131
 					}
2156
 					}
2132
 					if prescribing_number_total > total {
2157
 					if prescribing_number_total > total {
2158
+						service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
2159
+						advice.ExecutionState = 2
2160
+						advice.ExecutionStaff = 0
2161
+						advice.ExecutionTime = 0
2133
 						c.ServeSuccessJSON(map[string]interface{}{
2162
 						c.ServeSuccessJSON(map[string]interface{}{
2134
 							"msg":    "2",
2163
 							"msg":    "2",
2135
 							"advice": advice,
2164
 							"advice": advice,
2162
 								//是通过药房发药
2191
 								//是通过药房发药
2163
 								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
2192
 								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
2164
 									//执行出库
2193
 									//执行出库
2165
-									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2194
+
2195
+									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2196
+									if drugOutInfo.ID == 0 {
2197
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2198
+									}
2166
 								}
2199
 								}
2167
 								//不通过药房发药
2200
 								//不通过药房发药
2168
 								if pharmacyConfig.IsOpen != 1 {
2201
 								if pharmacyConfig.IsOpen != 1 {
2169
 									//执行出库
2202
 									//执行出库
2170
-									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2203
+
2204
+									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2205
+									if drugOutInfo.ID == 0 {
2206
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2207
+									}
2171
 								}
2208
 								}
2172
 
2209
 
2173
 								//查询默认仓库
2210
 								//查询默认仓库
2184
 								}
2221
 								}
2185
 
2222
 
2186
 								service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
2223
 								service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
2224
+
2225
+								//剩余库存
2226
+								service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
2187
 								break
2227
 								break
2188
 								c.ServeSuccessJSON(map[string]interface{}{
2228
 								c.ServeSuccessJSON(map[string]interface{}{
2189
 									"msg":    "1",
2229
 									"msg":    "1",
2213
 						if medical.IsUse == 2 {
2253
 						if medical.IsUse == 2 {
2214
 							//是通过药房发药
2254
 							//是通过药房发药
2215
 							if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
2255
 							if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
2216
-								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2256
+
2257
+								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2258
+								if drugOutInfo.ID == 0 {
2259
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2260
+								}
2217
 							}
2261
 							}
2218
 							//不通过药房发药
2262
 							//不通过药房发药
2219
 							if pharmacyConfig.IsOpen != 1 {
2263
 							if pharmacyConfig.IsOpen != 1 {
2220
-								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2264
+
2265
+								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2266
+								if drugOutInfo.ID == 0 {
2267
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2268
+								}
2221
 							}
2269
 							}
2222
 							//更新字典里面的库存
2270
 							//更新字典里面的库存
2223
 							var sum_count int64
2271
 							var sum_count int64
2229
 								sum_count += its.StockMaxNumber + its.StockMinNumber
2277
 								sum_count += its.StockMaxNumber + its.StockMinNumber
2230
 							}
2278
 							}
2231
 							service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
2279
 							service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
2280
+							//剩余库存
2281
+							service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
2232
 							break
2282
 							break
2233
 							c.ServeSuccessJSON(map[string]interface{}{
2283
 							c.ServeSuccessJSON(map[string]interface{}{
2234
 								"msg":    "1",
2284
 								"msg":    "1",

+ 666 - 0
controllers/patient_dataconfig_api_controller.go Zobrazit soubor

22
 	beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
22
 	beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
23
 	beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
23
 	beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
24
 	beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
24
 	beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
25
+
26
+	beego.Router("/api/patient/sickhistory", &PatientDataConfigAPIController{}, "get:GetSickHistorys")
27
+	beego.Router("/api/patient/sickhistory/create", &PatientDataConfigAPIController{}, "get:CreateSickHistory")
28
+	beego.Router("/api/patient/sickhistory/delete", &PatientDataConfigAPIController{}, "post:DeleteSickHistory")
29
+	beego.Router("/api/patient/sickhistory/modify", &PatientDataConfigAPIController{}, "get:ModifySickHistory")
30
+
31
+	beego.Router("/api/patient/physiquecheck", &PatientDataConfigAPIController{}, "get:GetPhysiqueChecks")
32
+	beego.Router("/api/patient/physiquecheck/create", &PatientDataConfigAPIController{}, "get:CreatePhysiqueCheck")
33
+	beego.Router("/api/patient/physiquecheck/delete", &PatientDataConfigAPIController{}, "post:DeletePhysiqueCheck")
34
+	beego.Router("/api/patient/physiquecheck/modify", &PatientDataConfigAPIController{}, "get:ModifyPhysiqueCheck")
35
+
36
+	beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
37
+	beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
38
+
25
 }
39
 }
26
 
40
 
27
 type PatientDataConfigAPIController struct {
41
 type PatientDataConfigAPIController struct {
28
 	BaseAuthAPIController
42
 	BaseAuthAPIController
29
 }
43
 }
30
 
44
 
45
+func (this *PatientDataConfigAPIController) GetPhysiquecheckPrints() {
46
+
47
+	patientID, _ := this.GetInt64("patient_id")
48
+	idsStr := this.GetString("ids")
49
+	if patientID <= 0 || len(idsStr) == 0 {
50
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
51
+		return
52
+	}
53
+	recordIDStrs := strings.Split(idsStr, ",")
54
+	patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
55
+	sickHostory, _ := service.GetPatienttPhysiqueByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
56
+	this.ServeSuccessJSON(map[string]interface{}{
57
+		"patient":      patient,
58
+		"sickhistorys": sickHostory,
59
+	})
60
+
61
+}
62
+func (this *PatientDataConfigAPIController) GetSickhistoryPrints() {
63
+	patientID, _ := this.GetInt64("patient_id")
64
+	idsStr := this.GetString("ids")
65
+	if patientID <= 0 || len(idsStr) == 0 {
66
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
67
+		return
68
+	}
69
+	recordIDStrs := strings.Split(idsStr, ",")
70
+	patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
71
+	sickHostory, _ := service.GetPatientSickHistoryByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
72
+	for _, item := range sickHostory {
73
+		pc, _ := service.GetLastPatientPhysiqueCheck(this.GetAdminUserInfo().CurrentOrgId, item.PatientId, item.RecordDate)
74
+		item.XtPatientPhysiqueCheck = pc
75
+	}
76
+	this.ServeSuccessJSON(map[string]interface{}{
77
+		"patient":      patient,
78
+		"sickhistorys": sickHostory,
79
+	})
80
+}
81
+
82
+func (this *PatientDataConfigAPIController) GetSickHistorys() {
83
+	patientID, _ := this.GetInt64("patient_id")
84
+	startTimeYMDStr := this.GetString("start_time")
85
+	endTimeYMDStr := this.GetString("end_time")
86
+	if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
87
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
88
+		return
89
+	}
90
+	endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
91
+	startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
92
+	endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
93
+	if parseStartTimeErr != nil || parseEndTimeErr != nil {
94
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
95
+		return
96
+	}
97
+
98
+	adminUserInfo := this.GetAdminUserInfo()
99
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
100
+	if getPatientErr != nil {
101
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
102
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
103
+		return
104
+	} else if patient == nil {
105
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
106
+		return
107
+	}
108
+
109
+	records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
110
+	if getRecordsErr != nil {
111
+		this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
112
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
113
+		return
114
+	}
115
+
116
+	admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
117
+	if getAllAdminsErr != nil {
118
+		this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
119
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
120
+		return
121
+	}
122
+
123
+	this.ServeSuccessJSON(map[string]interface{}{
124
+		"records": records,
125
+		"doctors": admins,
126
+	})
127
+}
128
+func (this *PatientDataConfigAPIController) CreateSickHistory() {
129
+	patientID, _ := this.GetInt64("patient_id")
130
+	content := this.GetString("content")
131
+	record_time_str := this.GetString("record_time")
132
+	title := this.GetString("title")
133
+	is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
134
+	is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
135
+	is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
136
+	guominyaowu_desc := this.GetString("guominyaowu_desc")
137
+	doctor_id, _ := this.GetInt64("doctor_id")
138
+
139
+	if patientID <= 0 || len(content) == 0 {
140
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
141
+		return
142
+	}
143
+
144
+	if len(record_time_str) == 0 {
145
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
146
+		return
147
+	}
148
+	record_date := strings.Split(record_time_str, " ")
149
+
150
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
151
+	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
152
+
153
+	adminUserInfo := this.GetAdminUserInfo()
154
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
155
+	if getPatientErr != nil {
156
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
157
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
158
+		return
159
+	} else if patient == nil {
160
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
161
+		return
162
+	}
163
+
164
+	now := time.Now().Unix()
165
+	record := models.XtPatientSickHistory{
166
+		OrgId:                   adminUserInfo.CurrentOrgId,
167
+		PatientId:               patientID,
168
+		Recorder:                adminUserInfo.AdminUser.Id,
169
+		RecordTime:              checkDate.Unix(),
170
+		Content:                 content,
171
+		Status:                  1,
172
+		Title:                   title,
173
+		IsShenyizhiHistory:      is_shenyizhishi,
174
+		IsFumoDialysisHistory:   is_fumotouxishi,
175
+		HypersusceptibilityDesc: guominyaowu_desc,
176
+		IsHypersusceptibility:   is_guominyaowu,
177
+		Ctime:                   now,
178
+		Mtime:                   now,
179
+		DoctorId:                doctor_id,
180
+		RecordDate:              checkDate_two.Unix(),
181
+	}
182
+
183
+	createErr := service.CreatePatientSickHistory(&record)
184
+	if createErr != nil {
185
+		this.ErrorLog("创建患者病史记录失败:%v", createErr)
186
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
187
+		return
188
+	}
189
+
190
+	this.ServeSuccessJSON(map[string]interface{}{
191
+		"record": record,
192
+	})
193
+}
194
+func (this *PatientDataConfigAPIController) DeleteSickHistory() {
195
+	patientID, _ := this.GetInt64("patient_id")
196
+	idsStr := this.GetString("ids")
197
+	if patientID <= 0 || len(idsStr) == 0 {
198
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
199
+		return
200
+	}
201
+
202
+	adminUserInfo := this.GetAdminUserInfo()
203
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
204
+	if getPatientErr != nil {
205
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
206
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
207
+		return
208
+	} else if patient == nil {
209
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
210
+		return
211
+	}
212
+
213
+	recordIDStrs := strings.Split(idsStr, ",")
214
+	recordIDs := make([]int64, 0, len(recordIDStrs))
215
+	for _, idStr := range recordIDStrs {
216
+		id, parseErr := strconv.Atoi(idStr)
217
+		if parseErr != nil {
218
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
219
+			return
220
+		}
221
+		recordIDs = append(recordIDs, int64(id))
222
+	}
223
+
224
+	deleteErr := service.DeletePatientSickHistoryInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
225
+	if deleteErr != nil {
226
+		this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
227
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
228
+		return
229
+	}
230
+	this.ServeSuccessJSON(nil)
231
+}
232
+func (this *PatientDataConfigAPIController) ModifySickHistory() {
233
+	patientID, _ := this.GetInt64("patient_id")
234
+	content := this.GetString("content")
235
+	id, _ := this.GetInt64("id", 0)
236
+	record_time_str := this.GetString("record_time")
237
+	title := this.GetString("title")
238
+
239
+	is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
240
+	is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
241
+	is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
242
+	guominyaowu_desc := this.GetString("guominyaowu_desc")
243
+	doctor_id, _ := this.GetInt64("doctor_id")
244
+
245
+	if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
246
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
247
+		return
248
+	}
249
+	//timeLayout := "2006-01-02"
250
+	//loc, _ := time.LoadLocation("Local")
251
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
252
+
253
+	fmt.Println("checkDate--------------", checkDate)
254
+	adminUserInfo := this.GetAdminUserInfo()
255
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
256
+	if getPatientErr != nil {
257
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
258
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
259
+		return
260
+	} else if patient == nil {
261
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
262
+		return
263
+	}
264
+
265
+	now := time.Now().Unix()
266
+
267
+	record := models.XtPatientSickHistory{
268
+		ID:                      id,
269
+		OrgId:                   adminUserInfo.CurrentOrgId,
270
+		PatientId:               patientID,
271
+		Recorder:                adminUserInfo.AdminUser.Id,
272
+		Content:                 content,
273
+		Status:                  1,
274
+		Ctime:                   now,
275
+		Mtime:                   now,
276
+		Title:                   title,
277
+		RecordTime:              checkDate.Unix(),
278
+		IsShenyizhiHistory:      is_shenyizhishi,
279
+		IsFumoDialysisHistory:   is_fumotouxishi,
280
+		HypersusceptibilityDesc: guominyaowu_desc,
281
+		IsHypersusceptibility:   is_guominyaowu,
282
+		DoctorId:                doctor_id,
283
+	}
284
+	createErr := service.ModifyPatientSickHistory(&record)
285
+	if createErr != nil {
286
+		this.ErrorLog("创建患者抢救记录失败:%v", createErr)
287
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
288
+		return
289
+	}
290
+	this.ServeSuccessJSON(map[string]interface{}{
291
+		"record": record,
292
+	})
293
+}
294
+
295
+func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
296
+	patientID, _ := this.GetInt64("patient_id")
297
+	startTimeYMDStr := this.GetString("start_time")
298
+	endTimeYMDStr := this.GetString("end_time")
299
+	if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
300
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
301
+		return
302
+	}
303
+	endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
304
+	startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
305
+	endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
306
+	if parseStartTimeErr != nil || parseEndTimeErr != nil {
307
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
308
+		return
309
+	}
310
+
311
+	adminUserInfo := this.GetAdminUserInfo()
312
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
313
+	if getPatientErr != nil {
314
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
315
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
316
+		return
317
+	} else if patient == nil {
318
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
319
+		return
320
+	}
321
+
322
+	records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
323
+	if getRecordsErr != nil {
324
+		this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
325
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
326
+		return
327
+	}
328
+
329
+	admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
330
+	if getAllAdminsErr != nil {
331
+		this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
332
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
333
+		return
334
+	}
335
+
336
+	this.ServeSuccessJSON(map[string]interface{}{
337
+		"records": records,
338
+		"doctors": admins,
339
+	})
340
+}
341
+func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
342
+	patientID, _ := this.GetInt64("patient_id")
343
+	doctor_id, _ := this.GetInt64("doctor_id")
344
+	record_time_str := this.GetString("record_time")
345
+	t := this.GetString("t")
346
+	p := this.GetString("p")
347
+	r := this.GetString("r")
348
+	bp_left := this.GetString("bp_left")
349
+	bp_right := this.GetString("bp_right")
350
+	pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
351
+	tiwei, _ := this.GetInt64("tiwei")
352
+	fuzhong, _ := this.GetInt64("fuzhong")
353
+	chuxuedian, _ := this.GetInt64("chuxuedian")
354
+
355
+	fayu, _ := this.GetInt64("fayu")
356
+	yinyang, _ := this.GetInt64("yinyang")
357
+	shenzhi, _ := this.GetInt64("shenzhi")
358
+	pifunianmo, _ := this.GetInt64("pifunianmo")
359
+	buwei := this.GetString("buwei")
360
+	chengdu := this.GetString("chengdu")
361
+	pixiachuxue, _ := this.GetInt64("pixiachuxue")
362
+	zidian, _ := this.GetInt64("zidian")
363
+	pifuwendu, _ := this.GetInt64("pifuwendu")
364
+	qita := this.GetString("qita")
365
+
366
+	linbazhongda, _ := this.GetInt64("linbazhongda")
367
+	linbabuwei := this.GetString("linbabuwei")
368
+
369
+	yanlian, _ := this.GetInt64("yanlian")
370
+	tongkong, _ := this.GetInt64("tongkong")
371
+	zuo := this.GetString("zuo")
372
+	you := this.GetString("you")
373
+
374
+	duiguangfanshe := this.GetString("duiguangfanshe")
375
+	biantaoti := this.GetString("biantaoti")
376
+	yanbu := this.GetString("yanbu")
377
+	toubuqita := this.GetString("toubuqita")
378
+	huxiyin := this.GetString("huxiyin")
379
+
380
+	xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
381
+	feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
382
+	luoyin, _ := this.GetInt64("luoyin")
383
+	desc := this.GetString("desc")
384
+
385
+	xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
386
+	xinlv, _ := this.GetInt64("xinlv")
387
+	xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
388
+	zayin, _ := this.GetInt64("zayin")
389
+	fujiayin, _ := this.GetInt64("fujiayin")
390
+	xinzangdesc := this.GetString("xinzangdesc")
391
+
392
+	fushuizheng, _ := this.GetInt64("fushuizheng")
393
+	ganjingjingmai := this.GetString("ganjingjingmai")
394
+
395
+	gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
396
+	gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
397
+	pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
398
+	pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
399
+
400
+	shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
401
+	shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
402
+	fubu_desc := this.GetString("fubu_desc")
403
+	oth_desc := this.GetString("oth_desc")
404
+
405
+	if patientID <= 0 {
406
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
407
+		return
408
+	}
409
+
410
+	if len(record_time_str) == 0 {
411
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
412
+		return
413
+	}
414
+
415
+	record_date := strings.Split(record_time_str, " ")
416
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
417
+	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
418
+
419
+	adminUserInfo := this.GetAdminUserInfo()
420
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
421
+	if getPatientErr != nil {
422
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
423
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
424
+		return
425
+	} else if patient == nil {
426
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
427
+		return
428
+	}
429
+
430
+	now := time.Now().Unix()
431
+	record := models.XtPatientPhysiqueCheck{
432
+		DoctorId:         doctor_id,
433
+		OrgId:            adminUserInfo.CurrentOrgId,
434
+		PatientId:        patientID,
435
+		Recorder:         adminUserInfo.AdminUser.Id,
436
+		RecordTime:       checkDate.Unix(),
437
+		Status:           1,
438
+		Ctime:            now,
439
+		Mtime:            now,
440
+		T:                t,
441
+		P:                p,
442
+		R:                r,
443
+		BpRight:          bp_right,
444
+		BpLeft:           bp_left,
445
+		Pinxuerongmao:    pinxuerongmao,
446
+		Tiwei:            tiwei,
447
+		Fuzhong:          fuzhong,
448
+		Chuxuedian:       chuxuedian,
449
+		Fayu:             fayu,
450
+		Yinyang:          yinyang,
451
+		Shenzhi:          shenzhi,
452
+		Pifunianmo:       pifunianmo,
453
+		Buwei:            buwei,
454
+		Chengdu:          chengdu,
455
+		Pixiachuxue:      pixiachuxue,
456
+		Zidian:           zidian,
457
+		Pifuwendu:        pifuwendu,
458
+		Qita:             qita,
459
+		Linbazhongda:     linbazhongda,
460
+		Linbabuwei:       linbabuwei,
461
+		Yanlian:          yanlian,
462
+		Tongkong:         tongkong,
463
+		Zuo:              zuo,
464
+		You:              you,
465
+		Duiguangfanshe:   duiguangfanshe,
466
+		Biantaoti:        biantaoti,
467
+		Yanbu:            yanbu,
468
+		Toubuqita:        toubuqita,
469
+		Huxiyin:          huxiyin,
470
+		Xiongmomocayin:   xiongmomocayin,
471
+		Feizhangbuwei:    feizhangbuwei,
472
+		Luoyin:           luoyin,
473
+		Desc:             desc,
474
+		Xinzangdaxiao:    xinzangdaxiao,
475
+		Xinlv:            xinlv,
476
+		Xinbaomocasheng:  xinbaomocasheng,
477
+		Zayin:            zayin,
478
+		Fujiayin:         fujiayin,
479
+		Xinzangdesc:      xinzangdesc,
480
+		Fushuizheng:      fushuizheng,
481
+		Ganjingjingmai:   ganjingjingmai,
482
+		GangzhangYatong:  gangzhang_yatong,
483
+		GangzhangKoutong: gangzhang_koutong,
484
+		PizhangKoutong:   pizhang_koutong,
485
+		PizhangYatong:    pizhang_yatong,
486
+		ShenzhangKoutong: shenzhang_koutong,
487
+		ShenzhangYatong:  shenzhang_yatong,
488
+		FubuDesc:         fubu_desc,
489
+		OthDesc:          oth_desc,
490
+		RecordDate:       checkDate_two.Unix(),
491
+	}
492
+	createErr := service.CreatePatientPhysiqueCheck(&record)
493
+	if createErr != nil {
494
+		this.ErrorLog("创建患者病史记录失败:%v", createErr)
495
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
496
+		return
497
+	}
498
+
499
+	this.ServeSuccessJSON(map[string]interface{}{
500
+		"record": record,
501
+	})
502
+}
503
+func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
504
+	patientID, _ := this.GetInt64("patient_id")
505
+	idsStr := this.GetString("ids")
506
+	if patientID <= 0 || len(idsStr) == 0 {
507
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
508
+		return
509
+	}
510
+
511
+	adminUserInfo := this.GetAdminUserInfo()
512
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
513
+	if getPatientErr != nil {
514
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
515
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
516
+		return
517
+	} else if patient == nil {
518
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
519
+		return
520
+	}
521
+
522
+	recordIDStrs := strings.Split(idsStr, ",")
523
+	recordIDs := make([]int64, 0, len(recordIDStrs))
524
+	for _, idStr := range recordIDStrs {
525
+		id, parseErr := strconv.Atoi(idStr)
526
+		if parseErr != nil {
527
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
528
+			return
529
+		}
530
+		recordIDs = append(recordIDs, int64(id))
531
+	}
532
+
533
+	deleteErr := service.DeletePatientPhysiqueCheckInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
534
+	if deleteErr != nil {
535
+		this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
536
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
537
+		return
538
+	}
539
+	this.ServeSuccessJSON(nil)
540
+}
541
+func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
542
+	patientID, _ := this.GetInt64("patient_id")
543
+	id, _ := this.GetInt64("id", 0)
544
+	doctor_id, _ := this.GetInt64("doctor_id", 0)
545
+
546
+	record_time_str := this.GetString("record_time")
547
+
548
+	if patientID <= 0 || id == 0 || len(record_time_str) == 0 {
549
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
550
+		return
551
+	}
552
+	t := this.GetString("t")
553
+	p := this.GetString("p")
554
+	r := this.GetString("r")
555
+	bp_left := this.GetString("bp_left")
556
+	bp_right := this.GetString("bp_right")
557
+	pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
558
+	tiwei, _ := this.GetInt64("tiwei")
559
+	fuzhong, _ := this.GetInt64("fuzhong")
560
+	chuxuedian, _ := this.GetInt64("chuxuedian")
561
+
562
+	fayu, _ := this.GetInt64("fayu")
563
+	yinyang, _ := this.GetInt64("yinyang")
564
+	shenzhi, _ := this.GetInt64("shenzhi")
565
+	pifunianmo, _ := this.GetInt64("pifunianmo")
566
+	buwei := this.GetString("buwei")
567
+	chengdu := this.GetString("chengdu")
568
+	pixiachuxue, _ := this.GetInt64("pixiachuxue")
569
+	zidian, _ := this.GetInt64("zidian")
570
+	pifuwendu, _ := this.GetInt64("pifuwendu")
571
+	qita := this.GetString("qita")
572
+
573
+	linbazhongda, _ := this.GetInt64("linbazhongda")
574
+	linbabuwei := this.GetString("linbabuwei")
575
+
576
+	yanlian, _ := this.GetInt64("yanlian")
577
+	tongkong, _ := this.GetInt64("tongkong")
578
+	zuo := this.GetString("zuo")
579
+	you := this.GetString("you")
580
+
581
+	duiguangfanshe := this.GetString("duiguangfanshe")
582
+	biantaoti := this.GetString("biantaoti")
583
+	yanbu := this.GetString("yanbu")
584
+	toubuqita := this.GetString("toubuqita")
585
+	huxiyin := this.GetString("huxiyin")
586
+
587
+	xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
588
+	feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
589
+	luoyin, _ := this.GetInt64("luoyin")
590
+	desc := this.GetString("desc")
591
+
592
+	xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
593
+	xinlv, _ := this.GetInt64("xinlv")
594
+	xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
595
+	zayin, _ := this.GetInt64("zayin")
596
+	fujiayin, _ := this.GetInt64("fujiayin")
597
+	xinzangdesc := this.GetString("xinzangdesc")
598
+
599
+	fushuizheng, _ := this.GetInt64("fushuizheng")
600
+	ganjingjingmai := this.GetString("ganjingjingmai")
601
+
602
+	gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
603
+	gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
604
+	pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
605
+	pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
606
+
607
+	shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
608
+	shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
609
+	fubu_desc := this.GetString("fubu_desc")
610
+	oth_desc := this.GetString("oth_desc")
611
+
612
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
613
+	adminUserInfo := this.GetAdminUserInfo()
614
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
615
+	if getPatientErr != nil {
616
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
617
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
618
+		return
619
+	} else if patient == nil {
620
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
621
+		return
622
+	}
623
+	now := time.Now().Unix()
624
+
625
+	record := models.XtPatientPhysiqueCheck{
626
+		ID:               id,
627
+		OrgId:            adminUserInfo.CurrentOrgId,
628
+		PatientId:        patientID,
629
+		Recorder:         adminUserInfo.AdminUser.Id,
630
+		RecordTime:       checkDate.Unix(),
631
+		DoctorId:         doctor_id,
632
+		Status:           1,
633
+		Ctime:            now,
634
+		Mtime:            now,
635
+		T:                t,
636
+		P:                p,
637
+		R:                r,
638
+		BpRight:          bp_right,
639
+		BpLeft:           bp_left,
640
+		Pinxuerongmao:    pinxuerongmao,
641
+		Tiwei:            tiwei,
642
+		Fuzhong:          fuzhong,
643
+		Chuxuedian:       chuxuedian,
644
+		Fayu:             fayu,
645
+		Yinyang:          yinyang,
646
+		Shenzhi:          shenzhi,
647
+		Pifunianmo:       pifunianmo,
648
+		Buwei:            buwei,
649
+		Chengdu:          chengdu,
650
+		Pixiachuxue:      pixiachuxue,
651
+		Zidian:           zidian,
652
+		Pifuwendu:        pifuwendu,
653
+		Qita:             qita,
654
+		Linbazhongda:     linbazhongda,
655
+		Linbabuwei:       linbabuwei,
656
+		Yanlian:          yanlian,
657
+		Tongkong:         tongkong,
658
+		Zuo:              zuo,
659
+		You:              you,
660
+		Duiguangfanshe:   duiguangfanshe,
661
+		Biantaoti:        biantaoti,
662
+		Yanbu:            yanbu,
663
+		Toubuqita:        toubuqita,
664
+		Huxiyin:          huxiyin,
665
+		Xiongmomocayin:   xiongmomocayin,
666
+		Feizhangbuwei:    feizhangbuwei,
667
+		Luoyin:           luoyin,
668
+		Desc:             desc,
669
+		Xinzangdaxiao:    xinzangdaxiao,
670
+		Xinlv:            xinlv,
671
+		Xinbaomocasheng:  xinbaomocasheng,
672
+		Zayin:            zayin,
673
+		Fujiayin:         fujiayin,
674
+		Xinzangdesc:      xinzangdesc,
675
+		Fushuizheng:      fushuizheng,
676
+		Ganjingjingmai:   ganjingjingmai,
677
+		GangzhangYatong:  gangzhang_yatong,
678
+		GangzhangKoutong: gangzhang_koutong,
679
+		PizhangKoutong:   pizhang_koutong,
680
+		PizhangYatong:    pizhang_yatong,
681
+		ShenzhangKoutong: shenzhang_koutong,
682
+		ShenzhangYatong:  shenzhang_yatong,
683
+		FubuDesc:         fubu_desc,
684
+		OthDesc:          oth_desc,
685
+	}
686
+	createErr := service.ModifyPatientPhysiqueCheck(&record)
687
+	if createErr != nil {
688
+		this.ErrorLog("修改患者体格检查失败:%v", createErr)
689
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
690
+		return
691
+	}
692
+	this.ServeSuccessJSON(map[string]interface{}{
693
+		"record": record,
694
+	})
695
+}
696
+
31
 // /api/patient/courses [get]
697
 // /api/patient/courses [get]
32
 // @param patient_id:int
698
 // @param patient_id:int
33
 // @param start_time:string (yyyy-MM-dd)
699
 // @param start_time:string (yyyy-MM-dd)

+ 9 - 9
controllers/pay_api_controller.go Zobrazit soubor

348
 	return ip
348
 	return ip
349
 }
349
 }
350
 
350
 
351
-//截取字符串 start 起点下标 end 终点下标(不包括)
351
+// 截取字符串 start 起点下标 end 终点下标(不包括)
352
 func (this *PayApiController) Substr(str string, start int, end int) string {
352
 func (this *PayApiController) Substr(str string, start int, end int) string {
353
 	rs := []rune(str)
353
 	rs := []rune(str)
354
 	length := len(rs)
354
 	length := len(rs)
362
 	return string(rs[start:end])
362
 	return string(rs[start:end])
363
 }
363
 }
364
 
364
 
365
-//设置请求参数
365
+// 设置请求参数
366
 func (this *PayApiController) SetParameter(key string, value string) {
366
 func (this *PayApiController) SetParameter(key string, value string) {
367
 	if this.parameters == nil {
367
 	if this.parameters == nil {
368
 		this.parameters = make(map[string]string)
368
 		this.parameters = make(map[string]string)
370
 	this.parameters[key] = value
370
 	this.parameters[key] = value
371
 }
371
 }
372
 
372
 
373
-//设置请求参数
373
+// 设置请求参数
374
 func (this *PayApiController2) SetResultParameter(key string, value string) {
374
 func (this *PayApiController2) SetResultParameter(key string, value string) {
375
 	if this.resultParameters == nil {
375
 	if this.resultParameters == nil {
376
 		this.resultParameters = make(map[string]string)
376
 		this.resultParameters = make(map[string]string)
378
 	this.resultParameters[key] = value
378
 	this.resultParameters[key] = value
379
 }
379
 }
380
 
380
 
381
-//设置prepay_id
381
+// 设置prepay_id
382
 func (this *PayApiController) SetPayUrl(payUrl string) {
382
 func (this *PayApiController) SetPayUrl(payUrl string) {
383
 	this.payUrl = payUrl
383
 	this.payUrl = payUrl
384
 }
384
 }
461
 	return this.ParamsToXml(this.parameters), nil
461
 	return this.ParamsToXml(this.parameters), nil
462
 }
462
 }
463
 
463
 
464
-//产生随机字符串,不长于32位
464
+// 产生随机字符串,不长于32位
465
 func (this *PayApiController) CreateNoncestr(length int) (nonceStr string) {
465
 func (this *PayApiController) CreateNoncestr(length int) (nonceStr string) {
466
 	chars := "abcdefghijklmnopqrstuvwxyz0123456789"
466
 	chars := "abcdefghijklmnopqrstuvwxyz0123456789"
467
 	for i := 0; i < length; i++ {
467
 	for i := 0; i < length; i++ {
479
 	}
479
 	}
480
 }
480
 }
481
 
481
 
482
-//格式化参数,签名过程需要使用
482
+// 格式化参数,签名过程需要使用
483
 func (this *PayApiController) FormatParams(paramsMap map[string]string) string {
483
 func (this *PayApiController) FormatParams(paramsMap map[string]string) string {
484
 	//STEP 1, 对key进行升序排序.
484
 	//STEP 1, 对key进行升序排序.
485
 	var sorted_keys []string
485
 	var sorted_keys []string
499
 	return strings.Join(paramsStr, "&")
499
 	return strings.Join(paramsStr, "&")
500
 }
500
 }
501
 
501
 
502
-//生成签名
502
+// 生成签名
503
 func (this *PayApiController) GetSign(paramsMap map[string]string, wxKey string) string {
503
 func (this *PayApiController) GetSign(paramsMap map[string]string, wxKey string) string {
504
 	//STEP 1:按字典序排序参数
504
 	//STEP 1:按字典序排序参数
505
 	paramsStr := this.FormatParams(paramsMap)
505
 	paramsStr := this.FormatParams(paramsMap)
512
 	return strings.ToUpper(hex.EncodeToString(sign.Sum(nil)))
512
 	return strings.ToUpper(hex.EncodeToString(sign.Sum(nil)))
513
 }
513
 }
514
 
514
 
515
-//xml结构
515
+// xml结构
516
 func (this *PayApiController) ParamsToXml(data map[string]string) string {
516
 func (this *PayApiController) ParamsToXml(data map[string]string) string {
517
 	fmt.Println(data)
517
 	fmt.Println(data)
518
 	buf := bytes.NewBufferString("<xml>")
518
 	buf := bytes.NewBufferString("<xml>")
528
 	return buf.String()
528
 	return buf.String()
529
 }
529
 }
530
 
530
 
531
-//xml结构
531
+// xml结构
532
 func (this *PayApiController2) ParamsToXml2(data map[string]string) string {
532
 func (this *PayApiController2) ParamsToXml2(data map[string]string) string {
533
 	fmt.Println(data)
533
 	fmt.Println(data)
534
 	buf := bytes.NewBufferString("<xml>")
534
 	buf := bytes.NewBufferString("<xml>")

+ 2 - 2
controllers/pc_index_evaluation_api_controller.go Zobrazit soubor

49
 
49
 
50
 //化验指标
50
 //化验指标
51
 
51
 
52
-//初始化数据
52
+// 初始化数据
53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
54
 	adminUserInfo := this.GetAdminUserInfo()
54
 	adminUserInfo := this.GetAdminUserInfo()
55
 
55
 
71
 	})
71
 	})
72
 }
72
 }
73
 
73
 
74
-//获取取值范围
74
+// 获取取值范围
75
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
75
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
76
 	range_type, _ := this.GetInt64("range_type")
76
 	range_type, _ := this.GetInt64("range_type")
77
 	project_id, _ := this.GetInt64("project_id")
77
 	project_id, _ := this.GetInt64("project_id")

+ 1 - 0
controllers/pharmacy_controller.go Zobrazit soubor

438
 
438
 
439
 // 退药按钮点击
439
 // 退药按钮点击
440
 func (this *PharmacyController) DrugWithdrawal() {
440
 func (this *PharmacyController) DrugWithdrawal() {
441
+	fmt.Println("寄哪里2333333333333333333333333333333")
441
 	var err error
442
 	var err error
442
 	defer func() {
443
 	defer func() {
443
 		if rec := recover(); rec != nil {
444
 		if rec := recover(); rec != nil {

+ 3 - 3
controllers/print_data_api_controller.go Zobrazit soubor

37
 	idStrs := strings.Split(schIDStr, ",")
37
 	idStrs := strings.Split(schIDStr, ",")
38
 	adminUserInfo := this.GetAdminUserInfo()
38
 	adminUserInfo := this.GetAdminUserInfo()
39
 
39
 
40
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 {
40
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 {
41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42
 		for _, item := range schedules {
42
 		for _, item := range schedules {
43
 
43
 
136
 		})
136
 		})
137
 	}
137
 	}
138
 
138
 
139
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 {
139
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 {
140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141
 		for _, item := range schedules {
141
 		for _, item := range schedules {
142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
339
 	if types == 2 {
339
 	if types == 2 {
340
 		//list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
340
 		//list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
341
 		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
341
 		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
342
-		fmt.Println("list23323232233232", list)
342
+
343
 		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
343
 		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
344
 		if err != nil {
344
 		if err != nil {
345
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
345
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 17 - 17
controllers/public_api_controller.go Zobrazit soubor

115
 
115
 
116
 func (c *PublicApiController) HandleOne() {
116
 func (c *PublicApiController) HandleOne() {
117
 	//fmt.Println("~~~~~~")
117
 	//fmt.Println("~~~~~~")
118
-	start_time := c.GetString("start_time")
119
-	end_time := c.GetString("end_time")
120
-
121
-	timeLayout := "2006-01-02"
122
-	loc, _ := time.LoadLocation("Local")
123
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
124
-	if err != nil {
125
-	}
126
-	startRecordDateTime := startTime.Unix()
127
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
128
-	if err != nil {
129
-	}
130
-	endRecordDateTime := endTime.Unix()
131
-	orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
132
-	c.ServeSuccessJSON(map[string]interface{}{
133
-		"order": orders,
134
-	})
118
+	//start_time := c.GetString("start_time")
119
+	//end_time := c.GetString("end_time")
120
+	//
121
+	//timeLayout := "2006-01-02"
122
+	//loc, _ := time.LoadLocation("Local")
123
+	//startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
124
+	//if err != nil {
125
+	//}
126
+	//startRecordDateTime := startTime.Unix()
127
+	//endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
128
+	//if err != nil {
129
+	//}
130
+	//endRecordDateTime := endTime.Unix()
131
+	//orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
132
+	//c.ServeSuccessJSON(map[string]interface{}{
133
+	//	"order": orders,
134
+	//})
135
 }
135
 }
136
 
136
 
137
 //func (c *PublicApiController) HandleScheduleTwo() {
137
 //func (c *PublicApiController) HandleScheduleTwo() {

+ 2 - 2
controllers/secondary_order_api_contorller.go Zobrazit soubor

1321
 					}
1321
 					}
1322
 					//查询该调拨单是否有生成入库单
1322
 					//查询该调拨单是否有生成入库单
1323
 					_, errcodess := service.GetWarehouseBySecondWarehouseId(12, item.WarehouseId, orgId, record_date)
1323
 					_, errcodess := service.GetWarehouseBySecondWarehouseId(12, item.WarehouseId, orgId, record_date)
1324
-					fmt.Println("ERRCODESSS-------------------", errcodess)
1324
+
1325
 					if errcodess == gorm.ErrRecordNotFound {
1325
 					if errcodess == gorm.ErrRecordNotFound {
1326
 						service.AddSigleWarehouse(&warehousing)
1326
 						service.AddSigleWarehouse(&warehousing)
1327
 					}
1327
 					}
1328
 					infoObj, _ := service.GetLastWarehouseById(12, item.WarehouseId, orgId, record_date)
1328
 					infoObj, _ := service.GetLastWarehouseById(12, item.WarehouseId, orgId, record_date)
1329
-					fmt.Println("INFOR----------------------", infoObj.ID)
1329
+
1330
 					warehouseInfo := &models.WarehousingInfo{
1330
 					warehouseInfo := &models.WarehousingInfo{
1331
 						WarehousingOrder:      infoObj.WarehousingOrder,
1331
 						WarehousingOrder:      infoObj.WarehousingOrder,
1332
 						WarehousingId:         infoObj.ID,
1332
 						WarehousingId:         infoObj.ID,

+ 9 - 9
controllers/supply_order_api_contorller.go Zobrazit soubor

108
 	beego.Router("/api/supply/getgoodorderdetaillist", &SupplyOrderApiController{}, "Get:GetGoodOrderDetailList")
108
 	beego.Router("/api/supply/getgoodorderdetaillist", &SupplyOrderApiController{}, "Get:GetGoodOrderDetailList")
109
 }
109
 }
110
 
110
 
111
-//判断前端参数是否为空
111
+// 判断前端参数是否为空
112
 func CheckParams(this *SupplyOrderApiController, m *map[string][]string) (map[string]string, error) {
112
 func CheckParams(this *SupplyOrderApiController, m *map[string][]string) (map[string]string, error) {
113
 	tmp := make(map[string]string)
113
 	tmp := make(map[string]string)
114
 	for k, v := range *m {
114
 	for k, v := range *m {
121
 	return tmp, nil
121
 	return tmp, nil
122
 }
122
 }
123
 
123
 
124
-//获取供应商列表GetSupplyList
124
+// 获取供应商列表GetSupplyList
125
 func (this *SupplyOrderApiController) GetSupplyList() {
125
 func (this *SupplyOrderApiController) GetSupplyList() {
126
 	var err error
126
 	var err error
127
 	defer func() {
127
 	defer func() {
224
 	}
224
 	}
225
 }
225
 }
226
 
226
 
227
-//保存供应商及联系人(用于更改)
227
+// 保存供应商及联系人(用于更改)
228
 func (this *SupplyOrderApiController) UpdateSupply() {
228
 func (this *SupplyOrderApiController) UpdateSupply() {
229
 	orgId := this.GetAdminUserInfo().CurrentOrgId
229
 	orgId := this.GetAdminUserInfo().CurrentOrgId
230
 	dataBody := make(map[string]interface{}, 0)
230
 	dataBody := make(map[string]interface{}, 0)
371
 	return
371
 	return
372
 }
372
 }
373
 
373
 
374
-//获取单条供应商和涉及到的联系人记录
374
+// 获取单条供应商和涉及到的联系人记录
375
 func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
375
 func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
376
 	orgId := this.GetAdminUserInfo().CurrentOrgId
376
 	orgId := this.GetAdminUserInfo().CurrentOrgId
377
 	id, _ := this.GetInt64("id")
377
 	id, _ := this.GetInt64("id")
441
 	return
441
 	return
442
 }
442
 }
443
 
443
 
444
-//获取供应商类别
444
+// 获取供应商类别
445
 func (this *SupplyOrderApiController) GetSupplyType() {
445
 func (this *SupplyOrderApiController) GetSupplyType() {
446
 	orgId := this.GetAdminUserInfo().CurrentOrgId
446
 	orgId := this.GetAdminUserInfo().CurrentOrgId
447
 	costClassify := "供应商类别"
447
 	costClassify := "供应商类别"
453
 	return
453
 	return
454
 }
454
 }
455
 
455
 
456
-//删除供应商及联系人
456
+// 删除供应商及联系人
457
 func (this *SupplyOrderApiController) DelSupply() {
457
 func (this *SupplyOrderApiController) DelSupply() {
458
 	orgId := this.GetAdminUserInfo().CurrentOrgId
458
 	orgId := this.GetAdminUserInfo().CurrentOrgId
459
 	//拿到供应商的id
459
 	//拿到供应商的id
478
 	return
478
 	return
479
 }
479
 }
480
 
480
 
481
-//删除单条联系人记录
481
+// 删除单条联系人记录
482
 func (this *SupplyOrderApiController) DelContactOne() {
482
 func (this *SupplyOrderApiController) DelContactOne() {
483
 	id, _ := this.GetInt64("id")
483
 	id, _ := this.GetInt64("id")
484
 	if id == 0 {
484
 	if id == 0 {
499
 	return
499
 	return
500
 }
500
 }
501
 
501
 
502
-//获取供应商编码
502
+// 获取供应商编码
503
 func (this *SupplyOrderApiController) GetSupplyCode() {
503
 func (this *SupplyOrderApiController) GetSupplyCode() {
504
 	orgId := this.GetAdminUserInfo().CurrentOrgId
504
 	orgId := this.GetAdminUserInfo().CurrentOrgId
505
 	supply, err := service.GetSuppliyCode(orgId)
505
 	supply, err := service.GetSuppliyCode(orgId)
531
 	return
531
 	return
532
 }
532
 }
533
 
533
 
534
-//保存供应商(用于新增)
534
+// 保存供应商(用于新增)
535
 func (this *SupplyOrderApiController) SaveSupply() {
535
 func (this *SupplyOrderApiController) SaveSupply() {
536
 	orgId := this.GetAdminUserInfo().CurrentOrgId
536
 	orgId := this.GetAdminUserInfo().CurrentOrgId
537
 	dataBody := make(map[string]interface{}, 0)
537
 	dataBody := make(map[string]interface{}, 0)

+ 30 - 0
go.mod Zobrazit soubor

1
+module XT_New
2
+
3
+go 1.19
4
+
5
+require (
6
+	github.com/astaxie/beego v1.12.3 // indirect
7
+	github.com/beorn7/perks v1.0.1 // indirect
8
+	github.com/cespare/xxhash/v2 v2.1.1 // indirect
9
+	github.com/go-redis/redis v6.15.9+incompatible // indirect
10
+	github.com/go-sql-driver/mysql v1.7.0 // indirect
11
+	github.com/golang/protobuf v1.4.2 // indirect
12
+	github.com/hashicorp/golang-lru v0.5.4 // indirect
13
+	github.com/jinzhu/gorm v1.9.16 // indirect
14
+	github.com/jinzhu/inflection v1.0.0 // indirect
15
+	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
16
+	github.com/prometheus/client_golang v1.7.0 // indirect
17
+	github.com/prometheus/client_model v0.2.0 // indirect
18
+	github.com/prometheus/common v0.10.0 // indirect
19
+	github.com/prometheus/procfs v0.1.3 // indirect
20
+	github.com/robfig/cron v1.2.0 // indirect
21
+	github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
22
+	github.com/shopspring/decimal v1.3.1 // indirect
23
+	golang.org/x/crypto v0.7.0 // indirect
24
+	golang.org/x/net v0.8.0 // indirect
25
+	golang.org/x/sync v0.1.0 // indirect
26
+	golang.org/x/sys v0.6.0 // indirect
27
+	golang.org/x/text v0.8.0 // indirect
28
+	google.golang.org/protobuf v1.23.0 // indirect
29
+	gopkg.in/yaml.v2 v2.2.8 // indirect
30
+)

+ 205 - 0
go.sum Zobrazit soubor

1
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2
+github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
3
+github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
4
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
6
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
7
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
8
+github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
9
+github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
10
+github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
11
+github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
12
+github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
13
+github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
14
+github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
15
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
16
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
17
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
18
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
19
+github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
20
+github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
21
+github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
22
+github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
23
+github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
24
+github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
25
+github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
26
+github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
27
+github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
28
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
29
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
30
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
31
+github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
32
+github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
33
+github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
34
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
35
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
36
+github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
37
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
38
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
39
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
40
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
41
+github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
42
+github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
43
+github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
44
+github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
45
+github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
46
+github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
47
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
48
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
49
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
50
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
51
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
52
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
53
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
54
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
55
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
56
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
57
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
58
+github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
59
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
60
+github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
61
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
62
+github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
63
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
64
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
65
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
66
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
67
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
68
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
69
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
70
+github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
71
+github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
72
+github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
73
+github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
74
+github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
75
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
76
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
77
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
78
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
79
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
80
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
81
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
82
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
83
+github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
84
+github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
85
+github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
86
+github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
87
+github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
88
+github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
89
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
90
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
91
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
92
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
93
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
94
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
95
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
96
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
97
+github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
98
+github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
99
+github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
100
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
101
+github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
102
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
103
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
104
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
105
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
106
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
107
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
108
+github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
109
+github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
110
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
111
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
112
+github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
113
+github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
114
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
115
+github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
116
+github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
117
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
118
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
119
+github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
120
+github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
121
+github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
122
+github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
123
+github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
124
+github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
125
+github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
126
+github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
127
+github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
128
+github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
129
+github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
130
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
131
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
132
+github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
133
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
134
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
135
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
136
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
137
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
138
+github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
139
+github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
140
+github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
141
+github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
142
+github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
143
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
144
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
145
+golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
146
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
147
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
148
+golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
149
+golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
150
+golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
151
+golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
152
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
153
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
154
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
155
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
156
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
157
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
158
+golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
159
+golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
160
+golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
161
+golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
162
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
163
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
164
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
165
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
166
+golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
167
+golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
168
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
169
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
170
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
171
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
172
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
173
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
174
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
175
+golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
176
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177
+golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
178
+golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
179
+golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
180
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
181
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
182
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
183
+golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
184
+golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
185
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
186
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
187
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
188
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
189
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
190
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
191
+google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
192
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
193
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
194
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
195
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
196
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
197
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
198
+gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
199
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
200
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
201
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
202
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
203
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
204
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
205
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 79 - 0
models/dialysis.go Zobrazit soubor

763
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
763
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
764
 	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
764
 	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
765
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
765
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
766
+	ReplacementSpeed            float64 `gorm:"column:replacement_speed" json:"replacement_speed" form:"replacement_speed"`
767
+	Dicarbonate                 float64 `gorm:"column:dicarbonate" json:"dicarbonate" form:"dicarbonate"`
766
 }
768
 }
767
 
769
 
768
 func (MonitoringRecord) TableName() string {
770
 func (MonitoringRecord) TableName() string {
1241
 	DrugId                int64              `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1243
 	DrugId                int64              `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1242
 	DrugNameId            int64              `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
1244
 	DrugNameId            int64              `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
1243
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1245
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1246
+	IsMobile              int64              `gorm:"column:is_mobile" json:"is_mobile" form:"is_mobile"`
1244
 }
1247
 }
1245
 
1248
 
1246
 func (HisDoctorAdvice) TableName() string {
1249
 func (HisDoctorAdvice) TableName() string {
1471
 func (NewAssessmentAfterDislysis) TableName() string {
1474
 func (NewAssessmentAfterDislysis) TableName() string {
1472
 	return "xt_assessment_after_dislysis"
1475
 	return "xt_assessment_after_dislysis"
1473
 }
1476
 }
1477
+
1478
+type XtDialysisInformaitonSetting struct {
1479
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1480
+	WeekDay   int64 `gorm:"column:week_day" json:"week_day" form:"week_day"`
1481
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1482
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1483
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1484
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1485
+}
1486
+
1487
+func (XtDialysisInformaitonSetting) TableName() string {
1488
+	return "xt_dialysis_informaiton_setting"
1489
+}
1490
+
1491
+type DialysisInformation struct {
1492
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
1493
+	Module            int64  `gorm:"column:module" json:"module" form:"module"`
1494
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1495
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1496
+	ApplicationDate   int64  `gorm:"column:application_date" json:"application_date" form:"application_date"`
1497
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
1498
+	ApplicationStatus int64  `gorm:"column:application_status" json:"application_status" form:"application_status"`
1499
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
1500
+	CheckTime         int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
1501
+	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
1502
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1503
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1504
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
1505
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1506
+}
1507
+
1508
+func (DialysisInformation) TableName() string {
1509
+	return "xt_dialysis_information"
1510
+}
1511
+
1512
+type DialysisScheduleFlow struct {
1513
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1514
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1515
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1516
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1517
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1518
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1519
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1520
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1521
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1522
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1523
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
1524
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1525
+
1526
+	MonitorPatients *MonitorPatients `gorm:"ForeignKey:PatientId" json:"patient"`
1527
+	DeviceNumber    *DeviceNumber    `gorm:"ForeignKey:BedId" json:"device_number"`
1528
+	DeviceZone      *DeviceZone      `gorm:"ForeignKey:PartitionId" json:"device_zone"`
1529
+	TreatmentMode   *TreatmentMode   `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
1530
+	DialysisFinish  *DialysisFinish  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId" json:"dialysis_finish"`
1531
+}
1532
+
1533
+func (DialysisScheduleFlow) TableName() string {
1534
+	return "xt_schedule"
1535
+}
1536
+
1537
+type DialysisFinish struct {
1538
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1539
+	IsFinish   int64 `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`
1540
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1541
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
1542
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1543
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1544
+	Module     int64 `gorm:"column:module" json:"module" form:"module"`
1545
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1546
+	Sourse     int64 `gorm:"column:sourse" json:"sourse" form:"sourse"`
1547
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1548
+}
1549
+
1550
+func (DialysisFinish) TableName() string {
1551
+	return "xt_dialysis_finish"
1552
+}

+ 4 - 0
models/his_charge_models.go Zobrazit soubor

179
 	AliPay      string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
179
 	AliPay      string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
180
 	JifenPay    string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
180
 	JifenPay    string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
181
 	OthDesc     string `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
181
 	OthDesc     string `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
182
+
183
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
184
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
185
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
182
 }
186
 }
183
 
187
 
184
 func (HisChargeSettleOrder) TableName() string {
188
 func (HisChargeSettleOrder) TableName() string {

+ 3 - 3
models/his_deposit_models.go Zobrazit soubor

129
 	return "sgj_xt.his_deposit"
129
 	return "sgj_xt.his_deposit"
130
 }
130
 }
131
 
131
 
132
-//扣费明细列表
132
+// 扣费明细列表
133
 type Details struct {
133
 type Details struct {
134
 	ID         int64           `json:"id"`          //原始code
134
 	ID         int64           `json:"id"`          //原始code
135
 	Code       string          `json:"code"`        //就诊号
135
 	Code       string          `json:"code"`        //就诊号
143
 	ButtonShow int64           `json:"button_show"` //查看详情按钮是否显示,0隐藏,1显示
143
 	ButtonShow int64           `json:"button_show"` //查看详情按钮是否显示,0隐藏,1显示
144
 }
144
 }
145
 
145
 
146
-//扣费汇总
146
+// 扣费汇总
147
 type DeductionSummary struct {
147
 type DeductionSummary struct {
148
 	Name    string          `json:"name"`    //患者名字
148
 	Name    string          `json:"name"`    //患者名字
149
 	Total   decimal.Decimal `json:"total"`   //医疗费总额
149
 	Total   decimal.Decimal `json:"total"`   //医疗费总额
159
 	return "sgj_users.sgj_user_org"
159
 	return "sgj_users.sgj_user_org"
160
 }
160
 }
161
 
161
 
162
-//获取就诊号
162
+// 获取就诊号
163
 type GetMdtrtId struct {
163
 type GetMdtrtId struct {
164
 	Id      int64  `json:"id"`
164
 	Id      int64  `json:"id"`
165
 	MdtrtId string `json:"mdtrt_id"`
165
 	MdtrtId string `json:"mdtrt_id"`

+ 4 - 0
models/his_hospital_models.go Zobrazit soubor

33
 
33
 
34
 	IsPre     int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
34
 	IsPre     int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
35
 	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
35
 	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
36
+
37
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
38
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
39
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
36
 }
40
 }
37
 
41
 
38
 func (HisHospitalOrder) TableName() string {
42
 func (HisHospitalOrder) TableName() string {

+ 7 - 4
models/his_models.go Zobrazit soubor

65
 	ProjectId   string              `gorm:"column:project_id" json:"project_id" form:"project_id"`
65
 	ProjectId   string              `gorm:"column:project_id" json:"project_id" form:"project_id"`
66
 	ItemId      string              `gorm:"column:item_id" json:"item_id" form:"item_id"`
66
 	ItemId      string              `gorm:"column:item_id" json:"item_id" form:"item_id"`
67
 	List        []*XtHisProjectList `gorm:"-" json:"list" form:"list"`
67
 	List        []*XtHisProjectList `gorm:"-" json:"list" form:"list"`
68
+	Sort        int64               `gorm:"column:sort" json:"sort" form:"sort"`
68
 }
69
 }
69
 
70
 
70
 func (XtHisProjectTeam) TableName() string {
71
 func (XtHisProjectTeam) TableName() string {
507
 	FaPiaoCode            string  `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
508
 	FaPiaoCode            string  `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
508
 	FaPiaoNumber          string  `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
509
 	FaPiaoNumber          string  `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
509
 
510
 
510
-	AdminUser         AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
511
-	IsUploadDiagnose  int64     `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
512
-	IsUploadOrderInfo int64     `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
513
-	IsUploadSuccess   int64     `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
511
+	AdminUser AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
514
 
512
 
515
 	SettleType      int64  `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
513
 	SettleType      int64  `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
516
 	SettleStartTime int64  `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
514
 	SettleStartTime int64  `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
517
 	SettleEndTime   int64  `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
515
 	SettleEndTime   int64  `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
518
 	IsPre           int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
516
 	IsPre           int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
519
 	Diagnosis       string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
517
 	Diagnosis       string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
518
+
519
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
520
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
521
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
520
 }
522
 }
521
 
523
 
522
 func (TempHisOrder) TableName() string {
524
 func (TempHisOrder) TableName() string {
1402
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
1404
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
1403
 	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1405
 	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1404
 	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1406
 	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1407
+	Sort               int64  `gorm:"column:sort" json:"sort" form:"sort"`
1405
 }
1408
 }
1406
 
1409
 
1407
 func (HisXtDiagnoseConfig) TableName() string {
1410
 func (HisXtDiagnoseConfig) TableName() string {

+ 21 - 0
models/inspection_models.go Zobrazit soubor

15
 	Status       int64  `gorm:"column:status" json:"status" form:"status"`
15
 	Status       int64  `gorm:"column:status" json:"status" form:"status"`
16
 	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
16
 	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
17
 	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
17
 	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
18
+	InspectDesc  string `gorm:"column:inspect_desc" json:"inspect_desc" form:"inspect_desc"`
18
 }
19
 }
19
 
20
 
20
 func (Inspection) TableName() string {
21
 func (Inspection) TableName() string {
112
 		RangeType   int64  `json:"range_type"`
113
 		RangeType   int64  `json:"range_type"`
113
 		Value       string `json:"value"`
114
 		Value       string `json:"value"`
114
 	} `json:"formItem"`
115
 	} `json:"formItem"`
116
+	Imags []struct {
117
+		ID     int64  `json:"id"`
118
+		ImgUrl string `json:"img_url"`
119
+		Desc   string `json:"desc"`
120
+	} `json:"imgs"`
121
+}
122
+
123
+type InepectionPICForm struct {
124
+	Method         string `json:"method"`
125
+	ProjectId      int64  `json:"project_id"`
126
+	InspectDate    string `json:"inspect_date"`
127
+	OldInspectDate string `json:"old_inspect_date"`
128
+	Imags          []struct {
129
+		ID     int64  `json:"id"`
130
+		ImgUrl string `json:"img_url"`
131
+		Desc   string `json:"desc"`
132
+	} `json:"imgs"`
133
+	DeleteImg []struct {
134
+		ID int64 `json:"id"`
135
+	} `json:"delete_imgs"`
115
 }
136
 }
116
 
137
 
117
 type InspectionDate struct {
138
 type InspectionDate struct {

+ 94 - 0
models/patient_models.go Zobrazit soubor

1602
 	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1602
 	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1603
 	ModeName                   string `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
1603
 	ModeName                   string `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
1604
 	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1604
 	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1605
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
1605
 }
1606
 }
1606
 
1607
 
1607
 func (VmDialysisSolutionOne) TableName() string {
1608
 func (VmDialysisSolutionOne) TableName() string {
1634
 	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1635
 	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1635
 	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1636
 	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1636
 	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1637
 	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1638
+	Status           int64              `gorm:"column:status" json:"status" form:"status"`
1637
 }
1639
 }
1638
 
1640
 
1639
 func (XtScheduleList) TableName() string {
1641
 func (XtScheduleList) TableName() string {
1856
 func (XtDialysisInformaitonSetting) TableName() string {
1858
 func (XtDialysisInformaitonSetting) TableName() string {
1857
 	return "xt_dialysis_informaiton_setting"
1859
 	return "xt_dialysis_informaiton_setting"
1858
 }
1860
 }
1861
+
1862
+type XtPatientSickHistory struct {
1863
+	ID                      int64                  `gorm:"column:id" json:"id" form:"id"`
1864
+	OrgId                   int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
1865
+	PatientId               int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1866
+	Recorder                int64                  `gorm:"column:recorder" json:"recorder" form:"recorder"`
1867
+	RecordTime              int64                  `gorm:"column:record_time" json:"record_time" form:"record_time"`
1868
+	RecordDate              int64                  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1869
+	Content                 string                 `gorm:"column:content" json:"content" form:"content"`
1870
+	Status                  int64                  `gorm:"column:status" json:"status" form:"status"`
1871
+	Ctime                   int64                  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1872
+	Mtime                   int64                  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1873
+	Title                   string                 `gorm:"column:title" json:"title" form:"title"`
1874
+	IsShenyizhiHistory      int64                  `gorm:"column:is_shenyizhi_history" json:"is_shenyizhi_history" form:"is_shenyizhi_history"`
1875
+	IsFumoDialysisHistory   int64                  `gorm:"column:is_fumo_dialysis_history" json:"is_fumo_dialysis_history" form:"is_fumo_dialysis_history"`
1876
+	HypersusceptibilityDesc string                 `gorm:"column:hypersusceptibility_desc" json:"hypersusceptibility_desc" form:"hypersusceptibility_desc"`
1877
+	DoctorId                int64                  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
1878
+	IsHypersusceptibility   int64                  `gorm:"column:is_hypersusceptibility" json:"is_hypersusceptibility" form:"is_hypersusceptibility"`
1879
+	XtPatientPhysiqueCheck  XtPatientPhysiqueCheck `gorm:"json:"ppc"`
1880
+}
1881
+
1882
+func (XtPatientSickHistory) TableName() string {
1883
+	return "xt_patient_sick_history"
1884
+}
1885
+
1886
+type XtPatientPhysiqueCheck struct {
1887
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1888
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
1889
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1890
+	Recorder   int64 `gorm:"column:recorder" json:"recorder" form:"recorder"`
1891
+	RecordTime int64 `gorm:"column:record_time" json:"record_time" form:"record_time"`
1892
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1893
+
1894
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
1895
+	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1896
+	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1897
+	T                string `gorm:"column:t" json:"t" form:"t"`
1898
+	P                string `gorm:"column:p" json:"p" form:"p"`
1899
+	R                string `gorm:"column:r" json:"r" form:"r"`
1900
+	BpRight          string `gorm:"column:bp_right" json:"bp_right" form:"bp_right"`
1901
+	BpLeft           string `gorm:"column:bp_left" json:"bp_left" form:"bp_left"`
1902
+	Pinxuerongmao    int64  `gorm:"column:pinxuerongmao" json:"pinxuerongmao" form:"pinxuerongmao"`
1903
+	Tiwei            int64  `gorm:"column:tiwei" json:"tiwei" form:"tiwei"`
1904
+	Fuzhong          int64  `gorm:"column:fuzhong" json:"fuzhong" form:"fuzhong"`
1905
+	Chuxuedian       int64  `gorm:"column:chuxuedian" json:"chuxuedian" form:"chuxuedian"`
1906
+	Fayu             int64  `gorm:"column:fayu" json:"fayu" form:"fayu"`
1907
+	Yinyang          int64  `gorm:"column:yinyang" json:"yinyang" form:"yinyang"`
1908
+	Shenzhi          int64  `gorm:"column:shenzhi" json:"shenzhi" form:"shenzhi"`
1909
+	Pifunianmo       int64  `gorm:"column:pifunianmo" json:"pifunianmo" form:"pifunianmo"`
1910
+	Buwei            string `gorm:"column:buwei" json:"buwei" form:"buwei"`
1911
+	Chengdu          string `gorm:"column:chengdu" json:"chengdu" form:"chengdu"`
1912
+	Pixiachuxue      int64  `gorm:"column:pixiachuxue" json:"pixiachuxue" form:"pixiachuxue"`
1913
+	Zidian           int64  `gorm:"column:zidian" json:"zidian" form:"zidian"`
1914
+	Pifuwendu        int64  `gorm:"column:pifuwendu" json:"pifuwendu" form:"pifuwendu"`
1915
+	Qita             string `gorm:"column:qita" json:"qita" form:"qita"`
1916
+	Linbazhongda     int64  `gorm:"column:linbazhongda" json:"linbazhongda" form:"linbazhongda"`
1917
+	Linbabuwei       string `gorm:"column:linbabuwei" json:"linbabuwei" form:"linbabuwei"`
1918
+	Yanlian          int64  `gorm:"column:yanlian" json:"yanlian" form:"yanlian"`
1919
+	Tongkong         int64  `gorm:"column:tongkong" json:"tongkong" form:"tongkong"`
1920
+	Zuo              string `gorm:"column:zuo" json:"zuo" form:"zuo"`
1921
+	You              string `gorm:"column:you" json:"you" form:"you"`
1922
+	Duiguangfanshe   string `gorm:"column:duiguangfanshe" json:"duiguangfanshe" form:"duiguangfanshe"`
1923
+	Biantaoti        string `gorm:"column:biantaoti" json:"biantaoti" form:"biantaoti"`
1924
+	Yanbu            string `gorm:"column:yanbu" json:"yanbu" form:"yanbu"`
1925
+	Toubuqita        string `gorm:"column:toubuqita" json:"toubuqita" form:"toubuqita"`
1926
+	Huxiyin          string `gorm:"column:huxiyin" json:"huxiyin" form:"huxiyin"`
1927
+	Xiongmomocayin   int64  `gorm:"column:xiongmomocayin" json:"xiongmomocayin" form:"xiongmomocayin"`
1928
+	Feizhangbuwei    int64  `gorm:"column:feizhangbuwei" json:"feizhangbuwei" form:"feizhangbuwei"`
1929
+	Luoyin           int64  `gorm:"column:luoyin" json:"luoyin" form:"luoyin"`
1930
+	Desc             string `gorm:"column:desc" json:"desc" form:"desc"`
1931
+	Xinzangdaxiao    int64  `gorm:"column:xinzangdaxiao" json:"xinzangdaxiao" form:"xinzangdaxiao"`
1932
+	Xinlv            int64  `gorm:"column:xinlv" json:"xinlv" form:"xinlv"`
1933
+	Xinbaomocasheng  int64  `gorm:"column:xinbaomocasheng" json:"xinbaomocasheng" form:"xinbaomocasheng"`
1934
+	Zayin            int64  `gorm:"column:zayin" json:"zayin" form:"zayin"`
1935
+	Fujiayin         int64  `gorm:"column:fujiayin" json:"fujiayin" form:"fujiayin"`
1936
+	Xinzangdesc      string `gorm:"column:xinzangdesc" json:"xinzangdesc" form:"xinzangdesc"`
1937
+	Fushuizheng      int64  `gorm:"column:fushuizheng" json:"fushuizheng" form:"fushuizheng"`
1938
+	Ganjingjingmai   string `gorm:"column:ganjingjingmai" json:"ganjingjingmai" form:"ganjingjingmai"`
1939
+	GangzhangYatong  int64  `gorm:"column:gangzhang_yatong" json:"gangzhang_yatong" form:"gangzhang_yatong"`
1940
+	GangzhangKoutong int64  `gorm:"column:gangzhang_koutong" json:"gangzhang_koutong" form:"gangzhang_koutong"`
1941
+	PizhangYatong    int64  `gorm:"column:pizhang_yatong" json:"pizhang_yatong" form:"pizhang_yatong"`
1942
+	PizhangKoutong   int64  `gorm:"column:pizhang_koutong" json:"pizhang_koutong" form:"pizhang_koutong"`
1943
+	ShenzhangYatong  int64  `gorm:"column:shenzhang_yatong" json:"shenzhang_yatong" form:"shenzhang_yatong"`
1944
+	ShenzhangKoutong int64  `gorm:"column:shenzhang_koutong" json:"shenzhang_koutong" form:"shenzhang_koutong"`
1945
+	FubuDesc         string `gorm:"column:fubu_desc" json:"fubu_desc" form:"fubu_desc"`
1946
+	OthDesc          string `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1947
+	DoctorId         int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
1948
+}
1949
+
1950
+func (XtPatientPhysiqueCheck) TableName() string {
1951
+	return "xt_patient_physique_check"
1952
+}

+ 13 - 13
models/pharmacy_models.go Zobrazit soubor

1
 package models
1
 package models
2
 
2
 
3
-//药房表
3
+// 药房表
4
 type Pharmary struct {
4
 type Pharmary struct {
5
 	ID         int64 `gorm:"column:id" json:"id" form:"id"`
5
 	ID         int64 `gorm:"column:id" json:"id" form:"id"`
6
 	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6
 	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
26
 	return "sgj_xt.xt_errs"
26
 	return "sgj_xt.xt_errs"
27
 }
27
 }
28
 
28
 
29
-//病人
29
+// 病人
30
 type TmpPatient struct {
30
 type TmpPatient struct {
31
 	PatientID  int64
31
 	PatientID  int64
32
 	Name       string
32
 	Name       string
44
 	return "xt_patients"
44
 	return "xt_patients"
45
 }
45
 }
46
 
46
 
47
-//药品信息
47
+// 药品信息
48
 type PharmacyContent struct {
48
 type PharmacyContent struct {
49
 	Name         string //名称
49
 	Name         string //名称
50
 	SingleDosage string //单次用量
50
 	SingleDosage string //单次用量
57
 	Remarks      string //备注
57
 	Remarks      string //备注
58
 }
58
 }
59
 
59
 
60
-//发药明细列表
60
+// 发药明细列表
61
 type DispensingList struct {
61
 type DispensingList struct {
62
 	PatientID  int64  //	患者id
62
 	PatientID  int64  //	患者id
63
 	Name       string //患者姓名
63
 	Name       string //患者姓名
72
 	Pres []*PrescripDetails
72
 	Pres []*PrescripDetails
73
 }
73
 }
74
 
74
 
75
-//处方详情
75
+// 处方详情
76
 type PrescripDetails struct {
76
 type PrescripDetails struct {
77
 	Drugname     string //药品名称
77
 	Drugname     string //药品名称
78
 	SingleDosage string //单次用量
78
 	SingleDosage string //单次用量
84
 	Remarks      string //备注
84
 	Remarks      string //备注
85
 }
85
 }
86
 
86
 
87
-//临时医嘱
87
+// 临时医嘱
88
 type StatOrder struct {
88
 type StatOrder struct {
89
 	StartTime             string //开始时间
89
 	StartTime             string //开始时间
90
 	Name                  string //医嘱名称
90
 	Name                  string //医嘱名称
95
 	ExecutionFrequency    string //执行频率
95
 	ExecutionFrequency    string //执行频率
96
 }
96
 }
97
 
97
 
98
-//退库用的结构体
98
+// 退库用的结构体
99
 type SpecialForStock struct {
99
 type SpecialForStock struct {
100
 	BatchNumber       string      `json:"batch_number"`
100
 	BatchNumber       string      `json:"batch_number"`
101
 	BatchNumberId     int64       `json:"batch_number_id"`
101
 	BatchNumberId     int64       `json:"batch_number_id"`
118
 	ReturnCount       string      `json:"return_count"`
118
 	ReturnCount       string      `json:"return_count"`
119
 }
119
 }
120
 
120
 
121
-//药品发药药品列表
121
+// 药品发药药品列表
122
 type ListOfDrugs struct {
122
 type ListOfDrugs struct {
123
 	ID             int64  `json:"id"`             //药品id
123
 	ID             int64  `json:"id"`             //药品id
124
 	Name           string `json:"name"`           //药品 名称
124
 	Name           string `json:"name"`           //药品 名称
126
 	Stock          string `json:"stock"`          //库存(当前的仓库库存)
126
 	Stock          string `json:"stock"`          //库存(当前的仓库库存)
127
 }
127
 }
128
 
128
 
129
-//病人信息
129
+// 病人信息
130
 type PatientInformation struct {
130
 type PatientInformation struct {
131
 	Id           string `json:"id"`            //hid表示his_doctor_advice_info的id ,xid表示xt_doctor_advice的id
131
 	Id           string `json:"id"`            //hid表示his_doctor_advice_info的id ,xid表示xt_doctor_advice的id
132
 	PatientId    int64  `json:"patient_id"`    //患者id
132
 	PatientId    int64  `json:"patient_id"`    //患者id
274
 	AdviceDoctor int64
274
 	AdviceDoctor int64
275
 }
275
 }
276
 
276
 
277
-//替换药品名称
277
+// 替换药品名称
278
 type ReplacementDrugs struct {
278
 type ReplacementDrugs struct {
279
 	Id   int64  `json:"id"`
279
 	Id   int64  `json:"id"`
280
 	Name string `json:"name"`
280
 	Name string `json:"name"`
281
 }
281
 }
282
 
282
 
283
-//病人
283
+// 病人
284
 type DialysisPatient struct {
284
 type DialysisPatient struct {
285
 	ID   int64  `json:"id"`
285
 	ID   int64  `json:"id"`
286
 	Name string `json:"name"`
286
 	Name string `json:"name"`
287
 }
287
 }
288
 
288
 
289
-//项目下拉列表
289
+// 项目下拉列表
290
 type DropDownList struct {
290
 type DropDownList struct {
291
 	Id   string `json:"id"`
291
 	Id   string `json:"id"`
292
 	Name string `json:"name"`
292
 	Name string `json:"name"`
497
 	return "xt_base_drug"
497
 	return "xt_base_drug"
498
 }
498
 }
499
 
499
 
500
-//组
500
+// 
501
 type HisPrescriptionInfoTemplateL struct {
501
 type HisPrescriptionInfoTemplateL struct {
502
 	ID                             int64                              `gorm:"column:id" json:"id" form:"id"`
502
 	ID                             int64                              `gorm:"column:id" json:"id" form:"id"`
503
 	UserOrgId                      int64                              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
503
 	UserOrgId                      int64                              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 4 - 3
models/schedule_models.go Zobrazit soubor

74
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
74
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
75
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
75
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
76
 
76
 
77
-	Patient                   string               `gorm:"-" json:"patient" form:"patient"`
78
-	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
-	DialysisMachineName       string               `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
77
+	Patient                   string                `gorm:"-" json:"patient" form:"patient"`
78
+	PatientInfectiousDiseases []InfectiousDiseases  `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
+	DialysisMachineName       string                `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
80
+	DialysisSolution          VmDialysisSolutionOne `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
80
 }
81
 }
81
 
82
 
82
 func (ScheduleTwo) TableName() string {
83
 func (ScheduleTwo) TableName() string {

+ 3 - 3
models/secondary_models.go Zobrazit soubor

1
 package models
1
 package models
2
 
2
 
3
-//仓库配置
3
+// 仓库配置
4
 type StorehouseConfig struct {
4
 type StorehouseConfig struct {
5
 	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
5
 	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
6
 	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`                         //机构id
6
 	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`                         //机构id
37
 	return "sgj_users.sgj_user_org"
37
 	return "sgj_users.sgj_user_org"
38
 }
38
 }
39
 
39
 
40
-//分页
40
+// 分页
41
 type Storehouselist struct {
41
 type Storehouselist struct {
42
 	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
42
 	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
43
 	StorehouseCode      string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`                 //仓库编号
43
 	StorehouseCode      string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`                 //仓库编号
119
 	return "xt_storehouse_config"
119
 	return "xt_storehouse_config"
120
 }
120
 }
121
 
121
 
122
-//二级仓库
122
+// 二级仓库
123
 type Storehouse struct {
123
 type Storehouse struct {
124
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
124
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
125
 	StorehouseCode    string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`             //仓库编号
125
 	StorehouseCode    string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`             //仓库编号

+ 1 - 1
models/supply.models.go Zobrazit soubor

1
 package models
1
 package models
2
 
2
 
3
-//供应商联系人
3
+// 供应商联系人
4
 type SpSupplierContacts struct {
4
 type SpSupplierContacts struct {
5
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`
5
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`
6
 	Name         string `gorm:"column:name" json:"name" form:"name"`
6
 	Name         string `gorm:"column:name" json:"name" form:"name"`

+ 81 - 322
service/app_version.go Zobrazit soubor

353
 func (HisPrescriptionInfoTemplateTwo) TableName() string {
353
 func (HisPrescriptionInfoTemplateTwo) TableName() string {
354
 	return "his_prescription_info_template"
354
 	return "his_prescription_info_template"
355
 }
355
 }
356
+
356
 func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplateTwo, err error) {
357
 func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplateTwo, err error) {
357
 	err = readDb.Model(&HisPrescriptionInfoTemplateTwo{}).
358
 	err = readDb.Model(&HisPrescriptionInfoTemplateTwo{}).
358
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
359
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
362
 		Find(&prescription).Error
363
 		Find(&prescription).Error
363
 	return
364
 	return
364
 }
365
 }
366
+
365
 func SaveAdviceTemplate(advice HisPrescriptionAdviceTemplate) {
367
 func SaveAdviceTemplate(advice HisPrescriptionAdviceTemplate) {
366
 	writeDb.Save(&advice)
368
 	writeDb.Save(&advice)
367
 }
369
 }
370
+
368
 func GetAllPT(org_id int64) (his []*models.HisPrescriptionTemplate, err error) {
371
 func GetAllPT(org_id int64) (his []*models.HisPrescriptionTemplate, err error) {
369
 	err = readDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
372
 	err = readDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
370
 	return
373
 	return
422
 func (HisPrescriptionInfoTemplateTHree) TableName() string {
425
 func (HisPrescriptionInfoTemplateTHree) TableName() string {
423
 	return "his_prescription_info_template"
426
 	return "his_prescription_info_template"
424
 }
427
 }
428
+
425
 func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfoTemplateTHree, err error) {
429
 func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfoTemplateTHree, err error) {
426
 	err = readDb.Model(&HisPrescriptionInfoTemplateTHree{}).Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
430
 	err = readDb.Model(&HisPrescriptionInfoTemplateTHree{}).Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
427
 		return db.Where("status = 1")
431
 		return db.Where("status = 1")
430
 	}).Where("user_org_id = ? AND status = 1 AND p_template_id = ?", org_id, p_template_id).Find(&his).Error
434
 	}).Where("user_org_id = ? AND status = 1 AND p_template_id = ?", org_id, p_template_id).Find(&his).Error
431
 	return
435
 	return
432
 }
436
 }
437
+
433
 func GetAllInfo(org_id int64, project_id int64) (his []*HisPrescriptionProjectTemplate, err error) {
438
 func GetAllInfo(org_id int64, project_id int64) (his []*HisPrescriptionProjectTemplate, err error) {
434
 	err = readDb.Model(&HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND status = 1 AND project_id = ? ", org_id, project_id).Find(&his).Error
439
 	err = readDb.Model(&HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND status = 1 AND project_id = ? ", org_id, project_id).Find(&his).Error
435
 	return
440
 	return
438
 	writeDb.Model(&HisPrescriptionProjectTemplate{}).Where("id = ?", project_id).Updates(map[string]interface{}{"status": 0})
443
 	writeDb.Model(&HisPrescriptionProjectTemplate{}).Where("id = ?", project_id).Updates(map[string]interface{}{"status": 0})
439
 	writeDb.Model(&HisPrescriptionInfoTemplateTwo{}).Where("id = ?", p_id).Updates(map[string]interface{}{"status": 0})
444
 	writeDb.Model(&HisPrescriptionInfoTemplateTwo{}).Where("id = ?", p_id).Updates(map[string]interface{}{"status": 0})
440
 }
445
 }
446
+
441
 func SaveOrder(order *models.HisOrder) {
447
 func SaveOrder(order *models.HisOrder) {
442
 	writeDb.Save(&order)
448
 	writeDb.Save(&order)
443
 }
449
 }
450
+
444
 func GetAllPrivateHis(org_id int64) (his []*models.HisPatient) {
451
 func GetAllPrivateHis(org_id int64) (his []*models.HisPatient) {
445
 	readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND balance_accounts_type = 2 AND status = 1", org_id).Find(&his)
452
 	readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND balance_accounts_type = 2 AND status = 1", org_id).Find(&his)
446
 	return
453
 	return
447
 }
454
 }
455
+
448
 func SaveHis(his *models.HisPatient) {
456
 func SaveHis(his *models.HisPatient) {
449
 	writeDb.Save(his)
457
 	writeDb.Save(his)
450
 	return
458
 	return
451
 }
459
 }
460
+
452
 func GetAllProjectPrescription() (pre []*models.HisPrescription) {
461
 func GetAllProjectPrescription() (pre []*models.HisPrescription) {
453
 	readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
462
 	readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
454
 	return
463
 	return
455
 }
464
 }
465
+
456
 func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
466
 func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
457
 	readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735  AND prescription_id = ?", id).Find(&pre)
467
 	readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735  AND prescription_id = ?", id).Find(&pre)
458
 	return
468
 	return
468
 //	}).Find(&order).Error
478
 //	}).Find(&order).Error
469
 //	return
479
 //	return
470
 //}
480
 //}
481
+
471
 type HisOrderTen struct {
482
 type HisOrderTen struct {
472
 	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
483
 	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
473
 	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
484
 	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
542
 	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
553
 	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
543
 	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
554
 	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
544
 	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
555
 	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
545
-	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
546
-	//VmHisOrderInfo9504    []*VmHisOrderInfo9504 `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"order_info"`
547
-	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
548
-	OthDesc            string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
549
-	PayWays            string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
550
-
551
-	Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
556
+	VmHisOrderInfo9504    []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"info"`
557
+	Patients              Patients              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
552
 }
558
 }
553
 
559
 
554
 func (HisOrderTen) TableName() string {
560
 func (HisOrderTen) TableName() string {
555
 	return "his_order"
561
 	return "his_order"
556
 }
562
 }
557
 
563
 
558
-type HisPrescriptionInfoOne struct {
559
-	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
560
-	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
561
-	RecordDate         int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
562
-	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
563
-	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
564
-	Status             int64  `gorm:"column:status" json:"status" form:"status"`
565
-	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
566
-	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
567
-	Creator            int64  `gorm:"column:creator" json:"creator" form:"creator"`
568
-	Modifier           int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
569
-	Diagnosis          string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
570
-	RegisterType       int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
571
-	Doctor             string `gorm:"column:doctor" json:"doctor" form:"doctor"`
572
-	Departments        int64  `gorm:"column:departments" json:"departments" form:"departments"`
573
-	SickHistory        string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
574
-	PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
575
-	PrescriptionStatus int64  `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
576
-	BatchNumber        string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
577
-	DoctorId           int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
578
-	SickType           int64  `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
579
-	PType              int64  `gorm:"column:p_type" json:"p_type" form:"p_type"`
580
-}
581
-
582
-func (HisPrescriptionInfoOne) TableName() string {
583
-	return "his_prescription_info"
584
-}
585
-
586
 type HisPrescriptionTen struct {
564
 type HisPrescriptionTen struct {
587
 	ID                        int64                        `gorm:"column:id" json:"id" form:"id"`
565
 	ID                        int64                        `gorm:"column:id" json:"id" form:"id"`
588
 	UserOrgId                 int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
566
 	UserOrgId                 int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
604
 	Patients                  Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
582
 	Patients                  Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
605
 	HisDoctorAdviceInfoTen    []*HisDoctorAdviceInfoTen    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
583
 	HisDoctorAdviceInfoTen    []*HisDoctorAdviceInfoTen    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
606
 	HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
584
 	HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
607
-	HisPrescriptionInfoOne    HisPrescriptionInfoOne       `gorm:"ForeignKey:PrescriptionNumber;AssociationForeignKey:PrescriptionNumber" json:"p_info"`
608
 	Total                     string                       `gorm:"-" json:"total" form:"total"`
585
 	Total                     string                       `gorm:"-" json:"total" form:"total"`
609
 	PType                     int64                        `gorm:"column:p_type" json:"p_type" form:"p_type"`
586
 	PType                     int64                        `gorm:"column:p_type" json:"p_type" form:"p_type"`
610
 	MedType                   string                       `gorm:"column:med_type" json:"med_type" form:"med_type"`
587
 	MedType                   string                       `gorm:"column:med_type" json:"med_type" form:"med_type"`
614
 func (HisPrescriptionTen) TableName() string {
591
 func (HisPrescriptionTen) TableName() string {
615
 	return "his_prescription"
592
 	return "his_prescription"
616
 }
593
 }
594
+
617
 func GetHisOrderDetailThree() (order []*HisOrderTen, err error) {
595
 func GetHisOrderDetailThree() (order []*HisOrderTen, err error) {
618
-	err = readDb.Model(&HisOrderTen{}).Preload("VmHisOrderInfo9504", "status = 1").Preload("Patients", "status = 1").Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
596
+	err = readDb.Model(&HisOrderTen{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
619
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
597
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
620
 			return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
598
 			return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
621
 		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
599
 		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
622
 			return db.Where("status = 1").Preload("Drug", "status = 1")
600
 			return db.Where("status = 1").Preload("Drug", "status = 1")
623
 		})
601
 		})
624
-	}).Where("settle_accounts_date >= 1675180800 AND settle_accounts_date <= 1677513600 AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
602
+	}).Where("setl_time >= '2023-03-01 00:00:00' AND setl_time <= '2023-03-31 23:59:59' AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
625
 	return
603
 	return
626
 }
604
 }
627
 
605
 
628
-type VmHisOrderInfo9504Two struct {
629
-	ID               int64   `gorm:"column:id" json:"id" form:"id"`
630
-	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
631
-	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
632
-	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
633
-	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
634
-	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
635
-	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
636
-	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
637
-	PricUplmtAmt     float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
638
-	SelfpayProp      float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
639
-	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
640
-	OverlmtAmt       float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
641
-	PreselfpayAmt    float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
642
-	BasMednFlag      string  `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
643
-	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
644
-	HiNegoDrugFlag   string  `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
645
-	Status           int64   `gorm:"column:status" json:"status" form:"status"`
646
-	Memo             string  `gorm:"column:memo" json:"memo" form:"memo"`
647
-	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
648
-	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
649
-	InscpScpAmt      float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
650
-	DrtReimFlag      string  `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
651
-	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
652
-	ListSpItemFlag   string  `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
653
-	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
654
-	LmtUsedFlag      string  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
655
-	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
656
-	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
657
-	HisPatientId     int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
658
-	OrderId          int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
659
-	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
660
-	Type             int64   `gorm:"column:type" json:"type" form:"type"`
661
-	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
662
-	SettleType       int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
663
-}
664
-
665
-func (VmHisOrderInfo9504Two) TableName() string {
666
-	return "his_order_info"
667
-}
668
-
669
 type HisDoctorAdviceInfoTen struct {
606
 type HisDoctorAdviceInfoTen struct {
670
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
671
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
672
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
673
-	AdviceDate            int64                 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
674
-	AdviceName            string                `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
675
-	AdviceDesc            string                `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
676
-	SingleDose            float64               `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
677
-	SingleDoseUnit        string                `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
678
-	PrescribingNumber     float64               `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
679
-	PrescribingNumberUnit string                `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
680
-	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
681
-	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
682
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
683
-	CreatedTime           int64                 `gorm:"column:created_time" json:"created_time" form:"created_time"`
684
-	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
685
-	DrugSpec              float64               `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
686
-	DrugSpecUnit          string                `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
687
-	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
688
-	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:AdviceId;AssociationForeignKey:ID" json:"order_info"`
689
-	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
690
-	DrugId                int64                 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
691
-	Drug                  Drug                  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
692
-	IsMedicine            int64                 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
693
-	ExecutionFrequencyId  int64                 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
607
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
608
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
609
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
610
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
611
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
612
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
613
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
614
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
615
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
616
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
617
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
618
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
619
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
620
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
621
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
622
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
623
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
624
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
625
+
626
+	Price                float64 `gorm:"column:price" json:"price" form:"price"`
627
+	DrugId               int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
628
+	Drug                 Drug    `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
629
+	IsMedicine           int64   `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
630
+	ExecutionFrequencyId int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
694
 }
631
 }
695
 
632
 
696
 func (HisDoctorAdviceInfoTen) TableName() string {
633
 func (HisDoctorAdviceInfoTen) TableName() string {
698
 }
635
 }
699
 
636
 
700
 type HisPrescriptionProjectTen struct {
637
 type HisPrescriptionProjectTen struct {
701
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
702
-	ProjectId             int64                 `gorm:"column:project_id" json:"project_id" form:"project_id"`
703
-	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
704
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
705
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
706
-	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
707
-	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
708
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
709
-	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
710
-	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
711
-	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
712
-	Count                 string                `gorm:"column:count" json:"count" form:"count"`
713
-	FeedetlSn             string                `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
714
-	MedListCodg           string                `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
715
-	SingleDose            string                `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
716
-	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
717
-	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
718
-	Day                   string                `gorm:"column:day" json:"day" form:"day"`
719
-	VMHisProject          VMHisProject          `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
720
-	VMGoodInfo            VMGoodInfo            `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
721
-	Remark                string                `gorm:"column:remark" json:"remark" form:"remark"`
722
-	Unit                  string                `gorm:"column:unit" json:"unit" form:"unit"`
723
-	Type                  int64                 `gorm:"column:type" json:"type" form:"type"`
724
-	Doctor                int64                 `gorm:"column:doctor" json:"doctor" form:"doctor"`
725
-	ExecutionTime         int64                 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
726
-	ExecutionStaff        int64                 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
727
-	ExecutionState        int64                 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
728
-	CheckTime             int64                 `gorm:"column:check_time" json:"check_time" form:"check_time"`
729
-	CheckState            int64                 `gorm:"column:check_state" json:"check_state" form:"check_state"`
730
-	Checker               int64                 `gorm:"column:checker" json:"checker" form:"checker"`
731
-	StartTime             int64                 `gorm:"column:start_time" json:"start_time" form:"start_time"`
732
-	TeamId                int64                 `gorm:"column:team_id" json:"team_id" form:"team_id"`
733
-	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
638
+	ID                 int64        `gorm:"column:id" json:"id" form:"id"`
639
+	ProjectId          int64        `gorm:"column:project_id" json:"project_id" form:"project_id"`
640
+	Price              float64      `gorm:"column:price" json:"price" form:"price"`
641
+	UserOrgId          int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
642
+	Status             int64        `gorm:"column:status" json:"status" form:"status"`
643
+	Ctime              int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
644
+	Mtime              int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
645
+	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
646
+	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
647
+	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
648
+	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
649
+	Count              string       `gorm:"column:count" json:"count" form:"count"`
650
+	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
651
+	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
652
+	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
653
+	DeliveryWay        string       `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
654
+	ExecutionFrequency string       `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
655
+	Day                string       `gorm:"column:day" json:"day" form:"day"`
656
+	VMHisProject       VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
657
+	VMGoodInfo         VMGoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
658
+	Remark             string       `gorm:"column:remark" json:"remark" form:"remark"`
659
+	Unit               string       `gorm:"column:unit" json:"unit" form:"unit"`
660
+	Type               int64        `gorm:"column:type" json:"type" form:"type"`
661
+	Doctor             int64        `gorm:"column:doctor" json:"doctor" form:"doctor"`
662
+	ExecutionTime      int64        `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
663
+	ExecutionStaff     int64        `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
664
+	ExecutionState     int64        `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
665
+	CheckTime          int64        `gorm:"column:check_time" json:"check_time" form:"check_time"`
666
+	CheckState         int64        `gorm:"column:check_state" json:"check_state" form:"check_state"`
667
+	Checker            int64        `gorm:"column:checker" json:"checker" form:"checker"`
668
+	StartTime          int64        `gorm:"column:start_time" json:"start_time" form:"start_time"`
669
+	TeamId             int64        `gorm:"column:team_id" json:"team_id" form:"team_id"`
734
 
670
 
735
 	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
671
 	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
736
 	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
672
 	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
741
 func (HisPrescriptionProjectTen) TableName() string {
677
 func (HisPrescriptionProjectTen) TableName() string {
742
 	return "his_prescription_project"
678
 	return "his_prescription_project"
743
 }
679
 }
680
+
744
 func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
681
 func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
745
-	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2023-02-01 00:00:00' AND in_hosptial_time <= '2023-02-28 23:59:59'", orgid).Find(&paitent).Error
746
-	return paitent, err
747
-}
748
-func GetHisPatient2222(orgid int64) (paitent []*models.HisPatient, err error) {
749
-	err = XTReadDB().Model(&models.HisPatient{}).Where("user_org_id = ?  and status = 1 AND record_date >= 1654012800 AND record_date <= 1659196800 ", orgid).Find(&paitent).Error
682
+	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2022-12-01 00:00:00' AND in_hosptial_time <= '2022-12-31 23:59:59'", orgid).Find(&paitent).Error
750
 	return paitent, err
683
 	return paitent, err
751
 }
684
 }
685
+
752
 func SaveHP(paitent *models.HisHospitalCheckRecord) {
686
 func SaveHP(paitent *models.HisHospitalCheckRecord) {
753
 	writeDb.Save(&paitent)
687
 	writeDb.Save(&paitent)
754
-}
755
-func SaveHPtWO(paitent *models.HisPatient) {
756
-	writeDb.Save(&paitent)
757
 
688
 
758
 }
689
 }
759
 
690
 
829
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
760
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
830
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
761
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
831
 	SettleStartTime       int64     `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
762
 	SettleStartTime       int64     `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
832
-	OthDesc               string    `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
833
-	PayWays               string    `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
834
 
763
 
835
 	Creator            int64                 `gorm:"column:creator" json:"creator" form:"creator"`
764
 	Creator            int64                 `gorm:"column:creator" json:"creator" form:"creator"`
836
 	PType              int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
765
 	PType              int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
926
 func (VmHisOrderInfo95042) TableName() string {
855
 func (VmHisOrderInfo95042) TableName() string {
927
 	return "his_order_info"
856
 	return "his_order_info"
928
 }
857
 }
858
+
929
 func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
859
 func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
930
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
860
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
931
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
861
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
936
 	}).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2  AND user_org_id = 9504").Find(&order).Order("setl_time").Error
866
 	}).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2  AND user_org_id = 9504").Find(&order).Order("setl_time").Error
937
 	return
867
 	return
938
 }
868
 }
869
+
939
 func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
870
 func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
940
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
871
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
941
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
872
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
959
 		return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
890
 		return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
960
 			return db.Where("status = 1").Preload("VMHisProject")
891
 			return db.Where("status = 1").Preload("VMHisProject")
961
 		})
892
 		})
962
-	}).Where("settle_accounts_date >= 1672502400 AND settle_accounts_date <= 1676822400 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
893
+	}).Where("settle_accounts_date >= 1664553600 AND settle_accounts_date <= 1672416000 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
963
 	return
894
 	return
964
 }
895
 }
965
 
896
 
1104
 }
1035
 }
1105
 
1036
 
1106
 func SaveSchTwo(sch models.Schedule, sch_two models.Schedule) (err error) {
1037
 func SaveSchTwo(sch models.Schedule, sch_two models.Schedule) (err error) {
1107
-	utx := writeDb.Begin()
1108
-	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1109
-		utx.Rollback()
1110
-		return err
1111
-	}
1112
-	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1113
-		utx.Rollback()
1114
-		return err
1115
-	}
1116
-	utx.Commit()
1117
-	return err
1118
-}
1038
+	//err = writeDb.Save(&sch).Error
1039
+	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error
1040
+	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error
1119
 
1041
 
1120
-func GetHisOrderInfoDetail() (order []*VmHisOrderInfo9504, err error) {
1121
-	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1122
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1123
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1124
-		return db.Where("status = 1").Preload("Drug")
1125
-	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1126
-	return
1127
-}
1128
-
1129
-func GetHisPrescriptionInfoDetail() (order []*HisPrescriptionProjectTen, err error) {
1130
-	err = readDb.Model(&HisPrescriptionProjectTen{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1131
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1132
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1133
-		return db.Where("status = 1").Preload("Drug")
1134
-	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1135
-	return
1136
-}
1137
-
1138
-type HisOrder10138 struct {
1139
-	ID                 int64                 `gorm:"column:id" json:"id" form:"id"`
1140
-	UserOrgId          int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1141
-	Status             int64                 `gorm:"column:status" json:"status" form:"status"`
1142
-	Number             string                `gorm:"column:number" json:"number" form:"number"`
1143
-	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1144
-	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1145
-	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1146
-	Ctime              int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1147
-	SettleAccountsDate int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1148
-	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `json:"infos" form:"infos"`
1149
-}
1150
-
1151
-func (HisOrder10138) TableName() string {
1152
-	return "his_order"
1153
-}
1154
-
1155
-type PatientVM10138 struct {
1156
-	ID            int64            `gorm:"column:id" json:"id" form:"id"`
1157
-	UserOrgId     int64            `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1158
-	Name          string           `gorm:"column:name" json:"name" form:"name"`
1159
-	HisOrder10138 []*HisOrder10138 `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"order"`
1160
-}
1161
-
1162
-func (PatientVM10138) TableName() string {
1163
-	return "xt_patients"
1164
-}
1165
-
1166
-func GetHisAllPatientOrder(start_time int64, end_time int64) (order []*PatientVM10138, err error) {
1167
-	err = readDb.Model(&PatientVM10138{}).Preload("HisOrder10138", " ctime >= ? AND ctime <= ? AND status = 1 AND order_status = 2", start_time, end_time).Where("user_org_id = 10138 AND status = 1").Find(&order).Error
1168
-	return
1169
-}
1170
-
1171
-func GetHisOrderInfoDetail10138(order_number string) (order []*VmHisOrderInfo9504, err error) {
1172
-	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1173
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1174
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1175
-		return db.Where("status = 1").Preload("Drug")
1176
-	}).Where("status = 1 AND order_number = ?", order_number).Find(&order).Error
1177
-	return
1178
-}
1179
-
1180
-//func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
1181
-//	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
1182
-//		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1183
-//			return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1184
-//		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1185
-//			return db.Where("status = 1").Preload("Drug")
1186
-//		})
1187
-//	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2  AND user_org_id = 9919", start_time, end_time).Find(&order).Order("setl_time").Error
1188
-//	return
1189
-//}
1190
-//
1191
-
1192
-type HisOrderTenOne struct {
1193
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
1194
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1195
-	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1196
-	SettleAccountsDate    int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1197
-	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1198
-	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1199
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
1200
-	Number                string                `gorm:"column:number" json:"number" form:"number"`
1201
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1202
-	Infcode               int64                 `gorm:"column:infcode" json:"infcode" form:"infcode"`
1203
-	WarnMsg               string                `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
1204
-	Cainfo                string                `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
1205
-	ErrMsg                string                `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
1206
-	RespondTime           string                `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
1207
-	InfRefmsgid           string                `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
1208
-	OrderStatus           int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1209
-	MdtrtId               string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1210
-	SetlId                string                `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
1211
-	PsnNo                 string                `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1212
-	PsnName               string                `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1213
-	PsnCertType           string                `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1214
-	Certno                string                `gorm:"column:certno" json:"certno" form:"certno"`
1215
-	Gend                  string                `gorm:"column:gend" json:"gend" form:"gend"`
1216
-	Naty                  string                `gorm:"column:naty" json:"naty" form:"naty"`
1217
-	Brdy                  time.Time             `gorm:"column:brdy" json:"brdy" form:"brdy"`
1218
-	Age                   float64               `gorm:"column:age" json:"age" form:"age"`
1219
-	Insutype              string                `gorm:"column:insutype" json:"insutype" form:"insutype"`
1220
-	PsnType               string                `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
1221
-	CvlservFlag           string                `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
1222
-	SetlTime              string                `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
1223
-	MdtrtCertType         string                `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
1224
-	MedType               string                `gorm:"column:med_type" json:"med_type" form:"med_type"`
1225
-	MedfeeSumamt          float64               `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
1226
-	FulamtOwnpayAmt       float64               `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1227
-	OverlmtSelfPay        float64               `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
1228
-	PreselfpayAmt         float64               `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
1229
-	InscpScpAmt           float64               `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
1230
-	ActPayDedc            float64               `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
1231
-	HifpPay               float64               `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
1232
-	CvlservPay            float64               `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1233
-	PoolPropSelfpay       float64               `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
1234
-	HifesPay              float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1235
-	HifmiPay              float64               `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1236
-	HifobPay              float64               `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1237
-	MafPay                float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1238
-	OthPay                float64               `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
1239
-	FundPaySumamt         float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
1240
-	PsnPartAmt            float64               `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
1241
-	AcctPay               float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
1242
-	PsnCashPay            float64               `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
1243
-	HospPartAmt           float64               `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
1244
-	Balc                  float64               `gorm:"column:balc" json:"balc" form:"balc"`
1245
-	AcctMulaidPay         float64               `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
1246
-	MedinsSetlId          string                `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
1247
-	ClrOptins             string                `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
1248
-	ClrWay                string                `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
1249
-	ClrType               string                `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1250
-	SetlDetail            string                `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1251
-	IsMedicineInsurance   int64                 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
1252
-	PayWay                int64                 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
1253
-	PayPrice              float64               `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
1254
-	PayCardNo             string                `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
1255
-	DiscountPrice         float64               `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
1256
-	PreferentialPrice     float64               `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
1257
-	RealityPrice          float64               `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
1258
-	FoundPrice            float64               `gorm:"column:found_price" json:"found_price" form:"found_price"`
1259
-	MedicalInsurancePrice float64               `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
1260
-	PrivatePrice          float64               `gorm:"column:private_price" json:"private_price" form:"private_price"`
1261
-	DepartmentName        string                `gorm:"-" json:"department_name" form:"department_name"`
1262
-	DoctorName            string                `gorm:"-" json:"doctor_name" form:"doctor_name"`
1263
-	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
1264
-	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
1265
-	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
1266
-	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
1267
-	OthDesc               string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
1268
-	PayWays               string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
1269
-}
1270
-
1271
-func (HisOrderTenOne) TableName() string {
1272
-	return "his_order"
1273
-}
1274
-
1275
-func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrderTen, err error) {
1276
-	err = readDb.Model(&HisOrderTen{}).Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
1277
-		return db.Where("status = 1").Preload("HisPrescriptionInfoOne", "status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1278
-			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
1279
-		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1280
-			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("Drug", "status = 1")
1281
-		})
1282
-	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 9919 AND setl_id <> ''", start_time, end_time).Find(&order).Error
1283
 	return
1042
 	return
1284
 }
1043
 }

+ 3 - 3
service/auto_create_drug.go Zobrazit soubor

70
 
70
 
71
 }
71
 }
72
 
72
 
73
-//查询当天有排班的所有机构
73
+// 查询当天有排班的所有机构
74
 func GetAllOrgName(time int64) (schedule []*models.XtSchedule, err error) {
74
 func GetAllOrgName(time int64) (schedule []*models.XtSchedule, err error) {
75
 
75
 
76
 	err = XTReadDB().Raw("select user_org_id,id,partition_id,bed_id,patient_id,schedule_date,schedule_type,schedule_week,mode_id from xt_schedule where schedule_date = ?  group by user_org_id", time).Scan(&schedule).Error
76
 	err = XTReadDB().Raw("select user_org_id,id,partition_id,bed_id,patient_id,schedule_date,schedule_type,schedule_week,mode_id from xt_schedule where schedule_date = ?  group by user_org_id", time).Scan(&schedule).Error
78
 	return schedule, err
78
 	return schedule, err
79
 }
79
 }
80
 
80
 
81
-//根据机构ID查询药品信息
81
+// 根据机构ID查询药品信息
82
 func FindAllDrugList(orgid int64) (lib []*models.BaseDrugLib, err error) {
82
 func FindAllDrugList(orgid int64) (lib []*models.BaseDrugLib, err error) {
83
 
83
 
84
 	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&lib).Error
84
 	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&lib).Error
85
 	return lib, err
85
 	return lib, err
86
 }
86
 }
87
 
87
 
88
-//根据药品ID统计该药品的库存
88
+// 根据药品ID统计该药品的库存
89
 func FindAllDrugTotalCount(drug_id int64) (info []*models.DrugWarehouseInfoSix, err error) {
89
 func FindAllDrugTotalCount(drug_id int64) (info []*models.DrugWarehouseInfoSix, err error) {
90
 
90
 
91
 	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
91
 	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")

+ 1 - 1
service/auto_create_stock.go Zobrazit soubor

79
 	}
79
 	}
80
 }
80
 }
81
 
81
 
82
-//查询所有的耗材信息
82
+// 查询所有的耗材信息
83
 func FindAlLGoodInformation(orgid int64) (info []*models.GoodInfo, err error) {
83
 func FindAlLGoodInformation(orgid int64) (info []*models.GoodInfo, err error) {
84
 
84
 
85
 	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&info).Error
85
 	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&info).Error

+ 1 - 1
service/auto_create_week_disinfection.go Zobrazit soubor

31
 }
31
 }
32
 
32
 
33
 func AutoCreateWeekDisinfectionJob() {
33
 func AutoCreateWeekDisinfectionJob() {
34
-	fmt.Println("开始执行-----------------------------------------------")
34
+
35
 	timeStr := time.Now().Format("2006-01-02")
35
 	timeStr := time.Now().Format("2006-01-02")
36
 	timeLayout := "2006-01-02 15:04:05"
36
 	timeLayout := "2006-01-02 15:04:05"
37
 	fmt.Println("timeStr:", timeStr)
37
 	fmt.Println("timeStr:", timeStr)

+ 9 - 9
service/data.go Zobrazit soubor

8
 	"time"
8
 	"time"
9
 )
9
 )
10
 
10
 
11
-//GetPatientList 返回患者的列表
11
+// GetPatientList 返回患者的列表
12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
13
 	var configList []*models.Dataconfig
13
 	var configList []*models.Dataconfig
14
 
14
 
296
 }
296
 }
297
 
297
 
298
 func BatchInsertFiledConfig(org_id int64) (err error) {
298
 func BatchInsertFiledConfig(org_id int64) (err error) {
299
-	err = readDb.Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 0 AND is_show = 1", org_id).Error
299
+	err = XTWriteDB().Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 0 AND is_show = 1", org_id).Error
300
 	return
300
 	return
301
 }
301
 }
302
 
302
 
303
 func BatchInsertQualityControl(org_id int64) (err error) {
303
 func BatchInsertQualityControl(org_id int64) (err error) {
304
 
304
 
305
-	err = readDb.Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status FROM xt_quality_control_standard where user_org_id = 0 and is_status = 1", org_id).Error
305
+	err = XTWriteDB().Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status FROM xt_quality_control_standard where user_org_id = 0 and is_status = 1", org_id).Error
306
 	return
306
 	return
307
 }
307
 }
308
 
308
 
309
 func BathInsertQualityControlTwo(org_id int64) (err error) {
309
 func BathInsertQualityControlTwo(org_id int64) (err error) {
310
-	err = readDb.Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status FROM xt_quality_control_standard where user_org_id = 0 and is_status = 0", org_id).Error
310
+	err = XTWriteDB().Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value,is_status FROM xt_quality_control_standard where user_org_id = 0 and is_status = 0", org_id).Error
311
 	return
311
 	return
312
 }
312
 }
313
 
313
 
314
 func BatchInspectionConfiguration(orgid int64) (err error) {
314
 func BatchInspectionConfiguration(orgid int64) (err error) {
315
 
315
 
316
-	err = readDb.Exec("INSERT INTO xt_check_configuration(user_org_id,inspection_major,inspection_frequency,sort,created_time,status) SELECT ?,inspection_major,inspection_frequency,sort,created_time,status FROM xt_check_configuration where user_org_id = 0", orgid).Error
316
+	err = XTWriteDB().Exec("INSERT INTO xt_check_configuration(user_org_id,inspection_major,inspection_frequency,sort,created_time,status) SELECT ?,inspection_major,inspection_frequency,sort,created_time,status FROM xt_check_configuration where user_org_id = 0", orgid).Error
317
 	return
317
 	return
318
 }
318
 }
319
 
319
 
320
 func ShowFiledConfig(org_id int64, isShow int, is_write int, id int64) (err error) {
320
 func ShowFiledConfig(org_id int64, isShow int, is_write int, id int64) (err error) {
321
-	err = readDb.Model(&models.FiledConfig{}).Where("org_id = ? AND id = ?", org_id, id).Updates(map[string]interface{}{"create_time": time.Now().Unix(), "update_time": time.Now().Unix(), "is_show": isShow, "is_write": is_write}).Error
321
+	err = XTWriteDB().Model(&models.FiledConfig{}).Where("org_id = ? AND id = ?", org_id, id).Updates(map[string]interface{}{"create_time": time.Now().Unix(), "update_time": time.Now().Unix(), "is_show": isShow, "is_write": is_write}).Error
322
 	return
322
 	return
323
 }
323
 }
324
 
324
 
325
 func FindSysDialysisFiledByOrgId() (filedConfig []*models.FiledConfig, err error) {
325
 func FindSysDialysisFiledByOrgId() (filedConfig []*models.FiledConfig, err error) {
326
-	err = readDb.Model(&models.FiledConfig{}).Where("org_id =? AND id in (11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262)", 0).Find(&filedConfig).Error
326
+	err = XTWriteDB().Model(&models.FiledConfig{}).Where("org_id =? AND id in (11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262)", 0).Find(&filedConfig).Error
327
 	return
327
 	return
328
 }
328
 }
329
 
329
 
330
 func BatchInsertFiledSystemConfig(org_id int64) (err error) {
330
 func BatchInsertFiledSystemConfig(org_id int64) (err error) {
331
-	err = readDb.Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 9442", org_id).Error
331
+	err = XTWriteDB().Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 9442", org_id).Error
332
 	return
332
 	return
333
 }
333
 }
334
 
334
 
335
 func BatchInsertDoctorSchedule(orgid int64) (err error) {
335
 func BatchInsertDoctorSchedule(orgid int64) (err error) {
336
 
336
 
337
-	err = readDb.Exec("INSERT INTO sgj_xt.xt_doctor_schedules(user_org_id,class_name,class_attributes,timeone_start,timeone_type,timeone_end,timetwo_start,timetwo_type,timetwo_end,work_time,remarks,status,ctime,minute) SELECT ?, class_name,class_attributes,timeone_start,timeone_type,timeone_end,timetwo_start,timetwo_type,timetwo_end,work_time,remarks,status,ctime,minute FROM xt_doctor_schedules WHERE user_org_id = 0", orgid).Error
337
+	err = XTWriteDB().Exec("INSERT INTO sgj_xt.xt_doctor_schedules(user_org_id,class_name,class_attributes,timeone_start,timeone_type,timeone_end,timetwo_start,timetwo_type,timetwo_end,work_time,remarks,status,ctime,minute) SELECT ?, class_name,class_attributes,timeone_start,timeone_type,timeone_end,timetwo_start,timetwo_type,timetwo_end,work_time,remarks,status,ctime,minute FROM xt_doctor_schedules WHERE user_org_id = 0", orgid).Error
338
 	return
338
 	return
339
 }
339
 }
340
 
340
 

+ 6 - 0
service/device_service.go Zobrazit soubor

824
 	return schedule, err
824
 	return schedule, err
825
 }
825
 }
826
 
826
 
827
+func GetScheduleByClassTypeTwo(schedule_type int64, schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
828
+	schedule := models.XtSchedule{}
829
+	err := XTReadDB().Where(" schedule_date = ? and patient_id = ? and user_org_id = ? and status = 1", schedule_date, patient_id, user_org_id).Find(&schedule).Error
830
+	return schedule, err
831
+}
832
+
827
 func GetPartionId(bed_id int64, org_id int64) (models.XtDeviceNumber, error) {
833
 func GetPartionId(bed_id int64, org_id int64) (models.XtDeviceNumber, error) {
828
 
834
 
829
 	number := models.XtDeviceNumber{}
835
 	number := models.XtDeviceNumber{}

+ 151 - 2
service/dialysis_service.go Zobrazit soubor

1119
 	ut.Commit()
1119
 	ut.Commit()
1120
 }
1120
 }
1121
 
1121
 
1122
+func ModifyScheduleModeOne(mode_id int64, patient_id int64, recordDate int64, org_id int64, dialysis_machine_name string) {
1123
+	ut := writeDb.Begin()
1124
+	err = writeDb.Model(&models.Schedule{}).Where("status = 1   AND user_org_id = ? AND patient_id = ? AND schedule_date >= ? mode_id= ?", org_id, patient_id, recordDate, mode_id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "dialysis_machine_name": dialysis_machine_name}).Error
1125
+	if err != nil {
1126
+		ut.Rollback()
1127
+		return
1128
+	}
1129
+	ut.Commit()
1130
+}
1131
+
1122
 func FindDialysisOrderById(id int64) (error, *models.DialysisOrder) {
1132
 func FindDialysisOrderById(id int64) (error, *models.DialysisOrder) {
1123
 	dialysisRecord := models.DialysisOrder{}
1133
 	dialysisRecord := models.DialysisOrder{}
1124
 	err := readDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1", id).Find(&dialysisRecord).Error
1134
 	err := readDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1", id).Find(&dialysisRecord).Error
1988
 func ExectionMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
1998
 func ExectionMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
1989
 
1999
 
1990
 	advice := models.HisDoctorAdvice{}
2000
 	advice := models.HisDoctorAdvice{}
1991
-	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
2001
+	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1, "is_mobile": 3}).Error
1992
 	return err
2002
 	return err
1993
 }
2003
 }
1994
 
2004
 
2010
 }
2020
 }
2011
 
2021
 
2012
 func ExectionBloodMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
2022
 func ExectionBloodMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
2013
-	fmt.Println("ids2323232323323223233223wode", ids)
2023
+
2014
 	advice := models.DoctorAdviceThrity{}
2024
 	advice := models.DoctorAdviceThrity{}
2015
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
2025
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
2016
 	return err
2026
 	return err
2137
 	err := XTWriteDB().Model(&information).Where("patient_id = ? and record_date = ? and user_org_id  =? and module = ? and status=1", patient_id, record_date, user_org_id, module).Update(map[string]interface{}{"application_date": advice_date, "remark": remark}).Error
2147
 	err := XTWriteDB().Model(&information).Where("patient_id = ? and record_date = ? and user_org_id  =? and module = ? and status=1", patient_id, record_date, user_org_id, module).Update(map[string]interface{}{"application_date": advice_date, "remark": remark}).Error
2138
 	return err
2148
 	return err
2139
 }
2149
 }
2150
+
2151
+func UpdateDoctorAdviceByExcecute(id int64, user_org_id int64) error {
2152
+
2153
+	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("id = ? and user_org_id = ? and status =1", id, user_org_id).Updates(map[string]interface{}{"execution_time": 0, "execution_staff": 0, "execution_state": 2}).Error
2154
+	return err
2155
+}
2156
+
2157
+func UpdateInformationSettingById(orgid int64, week_day int64) error {
2158
+
2159
+	err := XTWriteDB().Model(&models.XtDialysisInformaitonSetting{}).Where("user_org_id = ? and status =1", orgid).Updates(map[string]interface{}{"week_day": week_day}).Error
2160
+	return err
2161
+}
2162
+
2163
+func CreateInformationSetting(setting models.XtDialysisInformaitonSetting) error {
2164
+
2165
+	err := XTWriteDB().Create(&setting).Error
2166
+
2167
+	return err
2168
+}
2169
+
2170
+func GetInformationSettingByOrgId(user_org_id int64) (models.XtDialysisInformaitonSetting, error) {
2171
+
2172
+	setting := models.XtDialysisInformaitonSetting{}
2173
+
2174
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&setting).Error
2175
+
2176
+	return setting, err
2177
+}
2178
+
2179
+func GetDialysisInformationSetting(user_org_id int64) (infor []*models.XtDialysisInformaitonSetting, err error) {
2180
+
2181
+	err = XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&infor).Error
2182
+
2183
+	return infor, err
2184
+}
2185
+
2186
+func GetDialysisInformationIsNoCheck(user_org_id int64, limit int64, page int64, application_status int64) (infor []*models.DialysisInformation, total int64, err error) {
2187
+
2188
+	db := XTReadDB().Model(&infor).Where("status= 1")
2189
+	if application_status > 0 {
2190
+		db = db.Where("application_status = ?", application_status)
2191
+	}
2192
+	if user_org_id > 0 {
2193
+		db = db.Where("user_org_id = ?", user_org_id)
2194
+	}
2195
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Find(&infor).Error
2196
+	return infor, total, err
2197
+}
2198
+
2199
+func CheckDialysisInformation(id int64, application_status int64, timenow int64, checker int64) (models.DialysisInformation, error) {
2200
+
2201
+	information := models.DialysisInformation{}
2202
+
2203
+	err := XTWriteDB().Model(&information).Where("id=? and status = 1", id).Updates(map[string]interface{}{"application_status": application_status, "check_time": timenow, "checker": checker}).Error
2204
+
2205
+	return information, err
2206
+
2207
+}
2208
+
2209
+func GetDialysisWatchByKeywordFlow(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) ([]*models.DialysisScheduleFlow, error, int64) {
2210
+	var patients []*models.Patients
2211
+	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
2212
+	if getPatientErr != nil {
2213
+		return nil, getPatientErr, 0
2214
+	}
2215
+	patientIDs := make([]int64, len(patients))
2216
+	for index, patient := range patients {
2217
+		patientIDs[index] = patient.ID
2218
+	}
2219
+
2220
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2221
+	if start > 0 && end > 0 {
2222
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2223
+			// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
2224
+			Preload("TreatmentMode", "status = 1").
2225
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date >= ? and record_date<=?", orgID, start, end).
2226
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2227
+	} else {
2228
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2229
+			Preload("TreatmentMode", "status = 1").
2230
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ?", orgID).
2231
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2232
+	}
2233
+
2234
+	db = db.Where("xt_schedule.status = 1 AND patient_id in (?)", patientIDs)
2235
+	if schedulType > 0 {
2236
+		db = db.Where("schedule_type = ?", schedulType)
2237
+	}
2238
+	if start > 0 {
2239
+		db = db.Where("schedule_date >= ?", start)
2240
+	}
2241
+	if end > 0 {
2242
+		db = db.Where("schedule_date<=?", end)
2243
+	}
2244
+	if partitionType > 0 {
2245
+		db = db.Joins("inner join xt_device_number as d_n on d_n.id = xt_schedule.bed_id and d_n.zone_id = ?", partitionType)
2246
+	}
2247
+	var schedules []*models.DialysisScheduleFlow
2248
+	total := int64(0)
2249
+	err := db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("schedule_date desc").Find(&schedules).Error
2250
+	return schedules, err, total
2251
+}
2252
+
2253
+func GetDialysisWatchFlow(orgID int64, schedulDate int64, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) (schedule []*models.DialysisScheduleFlow, err error, total int64) {
2254
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2255
+	if start > 0 && end > 0 {
2256
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2257
+			Preload("TreatmentMode", "status = 1").
2258
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, start, end).
2259
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2260
+		db = db.Where("xt_schedule.status = 1")
2261
+	}
2262
+	if schedulDate > 0 {
2263
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2264
+			Preload("TreatmentMode", "status = 1").
2265
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, schedulDate, schedulDate).
2266
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2267
+		db = db.Where("xt_schedule.status = 1")
2268
+		db = db.Where("schedule_date = ?", schedulDate)
2269
+	}
2270
+	if schedulType > 0 {
2271
+		db = db.Where("schedule_type = ?", schedulType)
2272
+	}
2273
+	if start > 0 {
2274
+		db = db.Where("schedule_date >= ?", start)
2275
+	}
2276
+	if end > 0 {
2277
+		db = db.Where("schedule_date <= ?", end)
2278
+	}
2279
+	if orgID > 0 {
2280
+		db = db.Where("user_org_id = ?", orgID)
2281
+	}
2282
+	if partitionType > 0 {
2283
+		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ?", partitionType)
2284
+	}
2285
+	offset := (page - 1) * limit
2286
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("bed_id desc").Find(&schedule).Error
2287
+	return schedule, err, total
2288
+}

+ 6 - 3
service/dialysis_solution_service.go Zobrazit soubor

139
 	return setting, err
139
 	return setting, err
140
 }
140
 }
141
 
141
 
142
-func GetDialysisParameterList(keywords string, limit int64, page int64, partition_id int64, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
142
+func GetDialysisParameterList(keywords string, limit int64, page int64, partition_id []string, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
143
 	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
143
 	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
144
 	offset := (page - 1) * limit
144
 	offset := (page - 1) * limit
145
 	if scheduleDate > 0 {
145
 	if scheduleDate > 0 {
148
 	if schedule_type > 0 {
148
 	if schedule_type > 0 {
149
 		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
149
 		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
150
 	}
150
 	}
151
-	if partition_id > 0 {
152
-		db = db.Where("xt_schedule.partition_id = ?", partition_id)
151
+	//if partition_id > 0 {
152
+	//	db = db.Where("xt_schedule.partition_id = ?", partition_id)
153
+	//}
154
+	if len(partition_id) > 0 {
155
+		db = db.Where("xt_schedule.partition_id in(?)", partition_id)
153
 	}
156
 	}
154
 	if orgID > 0 {
157
 	if orgID > 0 {
155
 		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
158
 		db = db.Where("xt_schedule.user_org_id  = ?", orgID)

+ 8 - 8
service/gdyb_service.go Zobrazit soubor

421
 	OrderId        int64   `json:"order_id" form:"order_id"`
421
 	OrderId        int64   `json:"order_id" form:"order_id"`
422
 }
422
 }
423
 
423
 
424
-//  门诊费用明细信息上传
424
+// 门诊费用明细信息上传
425
 func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
425
 func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
426
 	// 生成签名
426
 	// 生成签名
427
 	nonce := GetRandomString(32)
427
 	nonce := GetRandomString(32)
572
 	//return &result
572
 	//return &result
573
 }
573
 }
574
 
574
 
575
-//  门诊费用明细信息撤销
575
+// 门诊费用明细信息撤销
576
 func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) string {
576
 func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) string {
577
 	// 生成签名
577
 	// 生成签名
578
 	nonce := GetRandomString(32)
578
 	nonce := GetRandomString(32)
633
 	return str
633
 	return str
634
 }
634
 }
635
 
635
 
636
-//  门诊预结算
636
+// 门诊预结算
637
 func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
637
 func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
638
 	// 生成签名
638
 	// 生成签名
639
 	nonce := GetRandomString(32)
639
 	nonce := GetRandomString(32)
699
 	return str
699
 	return str
700
 }
700
 }
701
 
701
 
702
-//  门诊结算
702
+// 门诊结算
703
 func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
703
 func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
704
 	// 生成签名
704
 	// 生成签名
705
 	nonce := GetRandomString(32)
705
 	nonce := GetRandomString(32)
765
 	return str
765
 	return str
766
 }
766
 }
767
 
767
 
768
-//  门诊结算撤销
768
+// 门诊结算撤销
769
 func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
769
 func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
770
 	// 生成签名
770
 	// 生成签名
771
 	nonce := GetRandomString(32)
771
 	nonce := GetRandomString(32)
823
 	return str
823
 	return str
824
 }
824
 }
825
 
825
 
826
-//  医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
826
+// 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
827
 func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
827
 func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
828
 	fmt.Println("11222333-----")
828
 	fmt.Println("11222333-----")
829
 
829
 
896
 	FixmedinsCode string `json:"fixmedins_code"` //调用环境生产为1 沙盒2
896
 	FixmedinsCode string `json:"fixmedins_code"` //调用环境生产为1 沙盒2
897
 }
897
 }
898
 
898
 
899
-//文件上传
900
-//文件上传
899
+// 文件上传
900
+// 文件上传
901
 func Gdyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
901
 func Gdyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
902
 
902
 
903
 	// 生成签名
903
 	// 生成签名

+ 19 - 19
service/his_config_service.go Zobrazit soubor

54
 
54
 
55
 func DelelteHisPrescriptionTemplate(id int64, user_org_id int64) (err error) {
55
 func DelelteHisPrescriptionTemplate(id int64, user_org_id int64) (err error) {
56
 	err = writeDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
56
 	err = writeDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
57
-	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
57
+	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND p_template_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
58
 	return
58
 	return
59
 }
59
 }
60
 
60
 
69
 	return
69
 	return
70
 }
70
 }
71
 
71
 
72
-//封装保存接口
72
+// 封装保存接口
73
 func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name string, adminInfo *AdminUserInfo, dataBody map[string]interface{}) (err error) {
73
 func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name string, adminInfo *AdminUserInfo, dataBody map[string]interface{}) (err error) {
74
 	tmp_bool_id := IsDialysisMode(adminInfo.CurrentOrgId, patient_id, mode_id)
74
 	tmp_bool_id := IsDialysisMode(adminInfo.CurrentOrgId, patient_id, mode_id)
75
 
75
 
203
 	return
203
 	return
204
 }
204
 }
205
 
205
 
206
-//复制一个setProjectTemplateWithJSON接口
206
+// 复制一个setProjectTemplateWithJSON接口
207
 func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplate, json map[string]interface{}) int {
207
 func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplate, json map[string]interface{}) int {
208
 	if json["id"] != nil {
208
 	if json["id"] != nil {
209
 		id := json["id"].(string)
209
 		id := json["id"].(string)
321
 	return 0
321
 	return 0
322
 }
322
 }
323
 
323
 
324
-//复制一个setAdviceTemplateWithJSON接口
324
+// 复制一个setAdviceTemplateWithJSON接口
325
 func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate, json map[string]interface{}) int {
325
 func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate, json map[string]interface{}) int {
326
 	//if json["advice_id"] != nil || reflect.TypeOf(json["advice_id"]).String() == "float64" {
326
 	//if json["advice_id"] != nil || reflect.TypeOf(json["advice_id"]).String() == "float64" {
327
 	//	advice_id := int64(json["advice_id"].(float64))
327
 	//	advice_id := int64(json["advice_id"].(float64))
448
 	return 0
448
 	return 0
449
 }
449
 }
450
 
450
 
451
-//判断该患者是否有该透析模式
451
+// 判断该患者是否有该透析模式
452
 func IsDialysisMode(orgid, patient_id, mode int64) bool {
452
 func IsDialysisMode(orgid, patient_id, mode int64) bool {
453
 	var total int
453
 	var total int
454
 	XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode).Count(&total)
454
 	XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode).Count(&total)
459
 	}
459
 	}
460
 }
460
 }
461
 
461
 
462
-//获取该透析模式的患者列表
462
+// 获取该透析模式的患者列表
463
 func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient, err error) {
463
 func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient, err error) {
464
 	var tmp []*models.DialysisPatient
464
 	var tmp []*models.DialysisPatient
465
 	err = XTReadDB().Raw("select id,name from xt_patients,(SELECT patient_id FROM his_prescription_template WHERE user_org_id = ? and "+
465
 	err = XTReadDB().Raw("select id,name from xt_patients,(SELECT patient_id FROM his_prescription_template WHERE user_org_id = ? and "+
470
 	return tmp, err
470
 	return tmp, err
471
 }
471
 }
472
 
472
 
473
-//如果没有名字默认透析模式
473
+// 如果没有名字默认透析模式
474
 func DialysisModeName(mode int64) string {
474
 func DialysisModeName(mode int64) string {
475
 	tmp := make(map[int64]string)
475
 	tmp := make(map[int64]string)
476
 	tmp[1] = "HD"
476
 	tmp[1] = "HD"
511
 	return ""
511
 	return ""
512
 }
512
 }
513
 
513
 
514
-//查询出该模板的id
514
+// 查询出该模板的id
515
 func IdOfTheTemplate(orgid, patient_id, mode_id int64) (src_template models.HisPrescriptionTemplate, err error) {
515
 func IdOfTheTemplate(orgid, patient_id, mode_id int64) (src_template models.HisPrescriptionTemplate, err error) {
516
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and "+
516
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and "+
517
 		"patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode_id).Find(&src_template).Error
517
 		"patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode_id).Find(&src_template).Error
518
 	return src_template, err
518
 	return src_template, err
519
 }
519
 }
520
 
520
 
521
-//根据透析模式、患者姓名、药品项目获取处方内容
521
+// 根据透析模式、患者姓名、药品项目获取处方内容
522
 func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPrescriptionInfoTemplate, err error) {
522
 func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPrescriptionInfoTemplate, err error) {
523
 	var tmp models.HisPrescriptionTemplate
523
 	var tmp models.HisPrescriptionTemplate
524
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and mode = ? and status = 1", orgid, patient_id, mode).Find(&tmp).Error
524
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and mode = ? and status = 1", orgid, patient_id, mode).Find(&tmp).Error
531
 
531
 
532
 }
532
 }
533
 
533
 
534
-//获取该透析模式患者列表(批量删除时用)药品
534
+// 获取该透析模式患者列表(批量删除时用)药品
535
 func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
535
 func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
536
 	var tmp []*models.DialysisPatient
536
 	var tmp []*models.DialysisPatient
537
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
537
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
546
 	return tmp, err
546
 	return tmp, err
547
 }
547
 }
548
 
548
 
549
-//获取该透析模式患者列表(批量删除时用)项目
549
+// 获取该透析模式患者列表(批量删除时用)项目
550
 func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
550
 func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
551
 	var tmp []*models.DialysisPatient
551
 	var tmp []*models.DialysisPatient
552
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
552
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
561
 	return tmp, err
561
 	return tmp, err
562
 }
562
 }
563
 
563
 
564
-//获取该透析模式患者列表(批量删除时用)耗材
564
+// 获取该透析模式患者列表(批量删除时用)耗材
565
 func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
565
 func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
566
 	var tmp []*models.DialysisPatient
566
 	var tmp []*models.DialysisPatient
567
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
567
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
576
 	return tmp, err
576
 	return tmp, err
577
 }
577
 }
578
 
578
 
579
-//根据透析模式删除药品
579
+// 根据透析模式删除药品
580
 func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error) {
580
 func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error) {
581
 	//开事务
581
 	//开事务
582
 	tx := XTWriteDB().Begin()
582
 	tx := XTWriteDB().Begin()
613
 	return
613
 	return
614
 }
614
 }
615
 
615
 
616
-//根据透析模式删除项目和耗材
616
+// 根据透析模式删除项目和耗材
617
 func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64) (err error) {
617
 func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64) (err error) {
618
 	//开事务
618
 	//开事务
619
 	tx := XTWriteDB().Begin()
619
 	tx := XTWriteDB().Begin()
668
 	return
668
 	return
669
 }
669
 }
670
 
670
 
671
-//替换该透析模式药品
671
+// 替换该透析模式药品
672
 func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.HisPrescriptionAdviceTemplate) (err error) {
672
 func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.HisPrescriptionAdviceTemplate) (err error) {
673
 	//开事务
673
 	//开事务
674
 	tx := XTWriteDB().Begin()
674
 	tx := XTWriteDB().Begin()
714
 	return
714
 	return
715
 }
715
 }
716
 
716
 
717
-//替换该透析模式耗材
717
+// 替换该透析模式耗材
718
 func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64, project models.HisPrescriptionProjectTemplate) (err error) {
718
 func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64, project models.HisPrescriptionProjectTemplate) (err error) {
719
 	//开事务
719
 	//开事务
720
 	tx := XTWriteDB().Begin()
720
 	tx := XTWriteDB().Begin()
778
 	return
778
 	return
779
 }
779
 }
780
 
780
 
781
-//跟据id查询药品、项目、耗材、套餐
781
+// 跟据id查询药品、项目、耗材、套餐
782
 func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
782
 func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
783
 	if id[0] == 112 {
783
 	if id[0] == 112 {
784
 		after := id[1:]
784
 		after := id[1:]
857
 	}
857
 	}
858
 }
858
 }
859
 
859
 
860
-//获取机构项目中所用的组
860
+// 获取机构项目中所用的组
861
 func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error) {
861
 func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error) {
862
 	err = XTReadDB().Raw("select * from xt_drug_data_config where parent_id in "+
862
 	err = XTReadDB().Raw("select * from xt_drug_data_config where parent_id in "+
863
 		"(select id from xt_drug_data_config where name = \"统计分类\" and parent_id = 0) "+
863
 		"(select id from xt_drug_data_config where name = \"统计分类\" and parent_id = 0) "+
865
 	return
865
 	return
866
 }
866
 }
867
 
867
 
868
-//翻译项目中的组
868
+// 翻译项目中的组
869
 func TranslateZu(sc, orgid int64, types string) (s string, err error) {
869
 func TranslateZu(sc, orgid int64, types string) (s string, err error) {
870
 	var dataconfig []*models.DictDataconfig
870
 	var dataconfig []*models.DictDataconfig
871
 	tmp := "select * from xt_drug_data_config where parent_id in (select id from xt_d·rug_data_config where name = \"" + types + "\" and parent_id = 0) and value = " + config.ToString(sc) + " and status = 1 and (org_id = " + config.ToString(orgid) + " or org_id = 0)"
871
 	tmp := "select * from xt_drug_data_config where parent_id in (select id from xt_d·rug_data_config where name = \"" + types + "\" and parent_id = 0) and value = " + config.ToString(sc) + " and status = 1 and (org_id = " + config.ToString(orgid) + " or org_id = 0)"

+ 53 - 53
service/his_deposit_service.go Zobrazit soubor

12
 	"time"
12
 	"time"
13
 )
13
 )
14
 
14
 
15
-//生成编号?+yymmdd+随机数(4位)
16
-//新增参数为CP
17
-//退款参数为AF
15
+// 生成编号?+yymmdd+随机数(4位)
16
+// 新增参数为CP
17
+// 退款参数为AF
18
 func CreateCPCode(str string) string {
18
 func CreateCPCode(str string) string {
19
 	s := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(10000))
19
 	s := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(10000))
20
 	t := time.Now().Format("20060102")
20
 	t := time.Now().Format("20060102")
22
 	return code
22
 	return code
23
 }
23
 }
24
 
24
 
25
-//获取his中的有效患者
25
+// 获取his中的有效患者
26
 func GetHisUser(orgid int64) (hisname []models.GetHisName, err error) {
26
 func GetHisUser(orgid int64) (hisname []models.GetHisName, err error) {
27
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ?", orgid).Find(&hisname).Error
27
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ?", orgid).Find(&hisname).Error
28
 	return
28
 	return
29
 }
29
 }
30
 
30
 
31
-//获取his中的有效患者去除了转出和死亡的
31
+// 获取his中的有效患者去除了转出和死亡的
32
 func GetHisUserToAlive(orgid int64) (hisname []models.GetHisName, err error) {
32
 func GetHisUserToAlive(orgid int64) (hisname []models.GetHisName, err error) {
33
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ? and lapseto = 1", orgid).Find(&hisname).Error
33
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ? and lapseto = 1", orgid).Find(&hisname).Error
34
 	return
34
 	return
35
 }
35
 }
36
 
36
 
37
-//获取his中的有效患者
37
+// 获取his中的有效患者
38
 func GetHisUserName(orgid, id int64) (hisname models.GetHisName, err error) {
38
 func GetHisUserName(orgid, id int64) (hisname models.GetHisName, err error) {
39
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ? and id = ?", orgid, id).Find(&hisname).Error
39
 	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ? and id = ?", orgid, id).Find(&hisname).Error
40
 	return
40
 	return
41
 }
41
 }
42
 
42
 
43
-//添加押金(开始)调用接口前记得判断审核状态,确认通过审核后在调用
43
+// 添加押金(开始)调用接口前记得判断审核状态,确认通过审核后在调用
44
 func UpDeposit(code, remarks string, his_patient_id, orgid, trial_status, createid int64, deposit decimal.Decimal) (err error) {
44
 func UpDeposit(code, remarks string, his_patient_id, orgid, trial_status, createid int64, deposit decimal.Decimal) (err error) {
45
 	//查押金表是否存在记录
45
 	//查押金表是否存在记录
46
 	tmp, tmpdeposit := IsHisPatientId(his_patient_id, orgid)
46
 	tmp, tmpdeposit := IsHisPatientId(his_patient_id, orgid)
96
 	return
96
 	return
97
 }
97
 }
98
 
98
 
99
-//添加押金记录
99
+// 添加押金记录
100
 func AddDepositHistory(dh models.DepositHistory) error {
100
 func AddDepositHistory(dh models.DepositHistory) error {
101
 	err := XTWriteDB().Create(&dh).Error
101
 	err := XTWriteDB().Create(&dh).Error
102
 	return err
102
 	return err
103
 }
103
 }
104
 
104
 
105
-//押金中添加一条记录,并返回该数据的id和押金余额(当没有该用户记录时调用)
105
+// 押金中添加一条记录,并返回该数据的id和押金余额(当没有该用户记录时调用)
106
 func AddDeposit(de models.Deposit) (int64, decimal.Decimal, error) {
106
 func AddDeposit(de models.Deposit) (int64, decimal.Decimal, error) {
107
 	var tmp models.Deposit
107
 	var tmp models.Deposit
108
 	err := XTWriteDB().Create(&de).Find(&tmp).Error
108
 	err := XTWriteDB().Create(&de).Find(&tmp).Error
112
 	return tmp.ID, tmp.Deposit, err
112
 	return tmp.ID, tmp.Deposit, err
113
 }
113
 }
114
 
114
 
115
-//更改押金记录
115
+// 更改押金记录
116
 func UpdateDeposit(de models.Deposit) (err error) {
116
 func UpdateDeposit(de models.Deposit) (err error) {
117
 	err = XTWriteDB().Model(&models.Deposit{}).Where("id = ? and status = 1", de.ID).Updates(map[string]interface{}{
117
 	err = XTWriteDB().Model(&models.Deposit{}).Where("id = ? and status = 1", de.ID).Updates(map[string]interface{}{
118
 		"mtime":   de.Mtime,
118
 		"mtime":   de.Mtime,
121
 	return
121
 	return
122
 }
122
 }
123
 
123
 
124
-//判断押金表是否存在当前的患者的一条有效数据,如果有返回id和押金余额,没有返回0
124
+// 判断押金表是否存在当前的患者的一条有效数据,如果有返回id和押金余额,没有返回0
125
 func IsHisPatientId(his_patient_id, orgid int64) (int64, decimal.Decimal) {
125
 func IsHisPatientId(his_patient_id, orgid int64) (int64, decimal.Decimal) {
126
 	var tmp []models.Deposit
126
 	var tmp []models.Deposit
127
 	XTReadDB().Model(&models.Deposit{}).Where("user_org_id = ? and his_patient_id = ? and status = 1", orgid, his_patient_id).Find(&tmp)
127
 	XTReadDB().Model(&models.Deposit{}).Where("user_org_id = ? and his_patient_id = ? and status = 1", orgid, his_patient_id).Find(&tmp)
131
 	return tmp[0].ID, tmp[0].Deposit
131
 	return tmp[0].ID, tmp[0].Deposit
132
 }
132
 }
133
 
133
 
134
-//查询押金编号是否重复
134
+// 查询押金编号是否重复
135
 func FindDecimalCode(orgid int64, code string) bool {
135
 func FindDecimalCode(orgid int64, code string) bool {
136
 	var total int
136
 	var total int
137
 	XTReadDB().Model(&models.DepositHistory{}).Where("user_org_id = ? and deposit_code = ? and status = 1", orgid, code).Count(&total)
137
 	XTReadDB().Model(&models.DepositHistory{}).Where("user_org_id = ? and deposit_code = ? and status = 1", orgid, code).Count(&total)
142
 	}
142
 	}
143
 }
143
 }
144
 
144
 
145
-//充值明细列表
145
+// 充值明细列表
146
 func DetailsList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistoryname, err error) {
146
 func DetailsList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistoryname, err error) {
147
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and deposit_status = 1 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
147
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and deposit_status = 1 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
148
 	if len(keyword) > 0 {
148
 	if len(keyword) > 0 {
159
 	return
159
 	return
160
 }
160
 }
161
 
161
 
162
-//充值汇总列表
162
+// 充值汇总列表
163
 func SummaryList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistory, err error) {
163
 func SummaryList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistory, err error) {
164
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and trial_status = 1 and user_org_id = ? and deposit_status = 1 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
164
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and trial_status = 1 and user_org_id = ? and deposit_status = 1 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
165
 	if len(slicekey) > 0 {
165
 	if len(slicekey) > 0 {
180
 	return
180
 	return
181
 }
181
 }
182
 
182
 
183
-//获取本周周一和周日的起止时间戳
183
+// 获取本周周一和周日的起止时间戳
184
 func GetMondayOfWeek() (int64, int64) {
184
 func GetMondayOfWeek() (int64, int64) {
185
 	t := time.Now()
185
 	t := time.Now()
186
 	dayObj := GetZeroTime(t)
186
 	dayObj := GetZeroTime(t)
200
 	return stime.Unix(), stime.Unix() + 604799
200
 	return stime.Unix(), stime.Unix() + 604799
201
 }
201
 }
202
 
202
 
203
-//获取本月的起止时间戳
203
+// 获取本月的起止时间戳
204
 func GetMonth() (int64, int64) {
204
 func GetMonth() (int64, int64) {
205
 	timeNow := time.Now()
205
 	timeNow := time.Now()
206
 	timeToday := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location()) // 获取当天0点时间 time类型
206
 	timeToday := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location()) // 获取当天0点时间 time类型
209
 	return timeMonthStartUnix1, timeMonthEndUnix1
209
 	return timeMonthStartUnix1, timeMonthEndUnix1
210
 }
210
 }
211
 
211
 
212
-//获取当天起止时间戳
212
+// 获取当天起止时间戳
213
 func GetNowTime() (int64, int64) {
213
 func GetNowTime() (int64, int64) {
214
 	t := time.Now()
214
 	t := time.Now()
215
 	addTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
215
 	addTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
217
 	return timesamp, timesamp + 86399
217
 	return timesamp, timesamp + 86399
218
 }
218
 }
219
 
219
 
220
-//获取创建者的姓名
221
-//原先的(sgj_users.sgj_user_admin)
222
-//新加的(sgj_users.sgj_user_admin_role)
220
+// 获取创建者的姓名
221
+// 原先的(sgj_users.sgj_user_admin)
222
+// 新加的(sgj_users.sgj_user_admin_role)
223
 func GetCreateidName(id, orgid int64) string {
223
 func GetCreateidName(id, orgid int64) string {
224
 	//var tmp models.CreateUser
224
 	//var tmp models.CreateUser
225
 	//XTReadDB().Select("name").Where("id = ?", id).Find(&tmp)
225
 	//XTReadDB().Select("name").Where("id = ?", id).Find(&tmp)
230
 	return tmp.UserName
230
 	return tmp.UserName
231
 }
231
 }
232
 
232
 
233
-//审核通过
233
+// 审核通过
234
 func UpDecimalHistory(id int64) (err error) {
234
 func UpDecimalHistory(id int64) (err error) {
235
 	//开事务
235
 	//开事务
236
 	tx := XTWriteDB().Begin()
236
 	tx := XTWriteDB().Begin()
272
 	return
272
 	return
273
 }
273
 }
274
 
274
 
275
-//删除本次记录
275
+// 删除本次记录
276
 func DelDecimalHistory(id int64) (err error) {
276
 func DelDecimalHistory(id int64) (err error) {
277
 	err = XTWriteDB().Model(models.DepositHistory{}).Where("id = ?", id).Updates(map[string]interface{}{
277
 	err = XTWriteDB().Model(models.DepositHistory{}).Where("id = ?", id).Updates(map[string]interface{}{
278
 		"status": 0,
278
 		"status": 0,
281
 	return
281
 	return
282
 }
282
 }
283
 
283
 
284
-//根据id获取一条押金历史记录
284
+// 根据id获取一条押金历史记录
285
 func GetDecimalHistoryOne(id int64) (history models.DepositHistory, err error) {
285
 func GetDecimalHistoryOne(id int64) (history models.DepositHistory, err error) {
286
 	err = XTReadDB().Model(&models.DepositHistory{}).Where("id = ?", id).Find(&history).Error
286
 	err = XTReadDB().Model(&models.DepositHistory{}).Where("id = ?", id).Find(&history).Error
287
 	return
287
 	return
288
 }
288
 }
289
 
289
 
290
-//根据患者id获取该患者当前剩余的押金
290
+// 根据患者id获取该患者当前剩余的押金
291
 func GetUserMoney(id, orgid int64) decimal.Decimal {
291
 func GetUserMoney(id, orgid int64) decimal.Decimal {
292
 	tmp := models.Deposit{}
292
 	tmp := models.Deposit{}
293
 	err := XTReadDB().Model(&models.Deposit{}).Where("his_patient_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&tmp).Error
293
 	err := XTReadDB().Model(&models.Deposit{}).Where("his_patient_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&tmp).Error
297
 	return tmp.Deposit
297
 	return tmp.Deposit
298
 }
298
 }
299
 
299
 
300
-//查询时间段内患者的余额
300
+// 查询时间段内患者的余额
301
 func GetMoneyforTime(id, orgid, etime int64) decimal.Decimal {
301
 func GetMoneyforTime(id, orgid, etime int64) decimal.Decimal {
302
 	tmp := models.DepositHistory{}
302
 	tmp := models.DepositHistory{}
303
 	XTReadDB().Model(&models.DepositHistory{}).Where("his_patient_id = ? and user_org_id = ? and status = 1 and mtime <= ?", id, orgid, etime).Order("mtime").Find(&tmp)
303
 	XTReadDB().Model(&models.DepositHistory{}).Where("his_patient_id = ? and user_org_id = ? and status = 1 and mtime <= ?", id, orgid, etime).Order("mtime").Find(&tmp)
304
 	return tmp.SurplusDeposit
304
 	return tmp.SurplusDeposit
305
 }
305
 }
306
 
306
 
307
-//押金流水
307
+// 押金流水
308
 func GetFlowList(page, limit, id, orgid, stime, etime, deposit_status int64) (deposit []models.DepositHistory, total int64, err error) {
308
 func GetFlowList(page, limit, id, orgid, stime, etime, deposit_status int64) (deposit []models.DepositHistory, total int64, err error) {
309
 	s := "status = 1 and trial_status = 1 and user_org_id = ? and his_patient_id = ? and mtime >= ? and mtime <= ?"
309
 	s := "status = 1 and trial_status = 1 and user_org_id = ? and his_patient_id = ? and mtime >= ? and mtime <= ?"
310
 	offset := (page - 1) * limit
310
 	offset := (page - 1) * limit
315
 	return
315
 	return
316
 }
316
 }
317
 
317
 
318
-//获取患者押金列表
318
+// 获取患者押金列表
319
 func GetUserList(page, limit, orgid int64, keyword string, slicekey []int64) (m []models.Deposit1, total int64, err error) {
319
 func GetUserList(page, limit, orgid int64, keyword string, slicekey []int64) (m []models.Deposit1, total int64, err error) {
320
 	db := XTReadDB().Model(&models.Deposit{}).Where("status = 1 and user_org_id = ? ", orgid)
320
 	db := XTReadDB().Model(&models.Deposit{}).Where("status = 1 and user_org_id = ? ", orgid)
321
 	offset := (page - 1) * limit
321
 	offset := (page - 1) * limit
326
 	return
326
 	return
327
 }
327
 }
328
 
328
 
329
-//扣费明细列表
329
+// 扣费明细列表
330
 func DeductionList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistory, err error) {
330
 func DeductionList(orgid, stime, etime int64, keyword string, slicekey []int64) (deposithistory []models.DepositHistory, err error) {
331
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and deposit_status = 2 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
331
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and deposit_status = 2 ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
332
 	if len(keyword) > 0 {
332
 	if len(keyword) > 0 {
343
 	return
343
 	return
344
 }
344
 }
345
 
345
 
346
-//获取医疗费总额
346
+// 获取医疗费总额
347
 func MedicalTotal(orgid, id int64) decimal.Decimal {
347
 func MedicalTotal(orgid, id int64) decimal.Decimal {
348
 	tmp := models.HisChargeSettleOrder{}
348
 	tmp := models.HisChargeSettleOrder{}
349
 	//and status = 1 and order_status = 2
349
 	//and status = 1 and order_status = 2
351
 	return decimal.NewFromFloat(tmp.MedfeeSumamt)
351
 	return decimal.NewFromFloat(tmp.MedfeeSumamt)
352
 }
352
 }
353
 
353
 
354
-//根据就诊号查询出医收费类型
354
+// 根据就诊号查询出医收费类型
355
 func CodeToChargetype(orgid int64, code string) (s string) {
355
 func CodeToChargetype(orgid int64, code string) (s string) {
356
 	tmp := models.HisPrintPatient{}
356
 	tmp := models.HisPrintPatient{}
357
 	tmp_hhcr := models.HisHospitalCheckRecordTwo{}
357
 	tmp_hhcr := models.HisHospitalCheckRecordTwo{}
385
 	return
385
 	return
386
 }
386
 }
387
 
387
 
388
-//扣除患者的押金,并生成一条扣费历史记录
389
-//orgid 机构id;
390
-//his_user_id	患者id;
391
-//create_id		创建者id;
392
-//code		就诊号;
393
-//deposit	本次使用的押金金额,支持float64、int、int64、decimal.Decimal类型
388
+// 扣除患者的押金,并生成一条扣费历史记录
389
+// orgid 机构id;
390
+// his_user_id	患者id;
391
+// create_id		创建者id;
392
+// code		就诊号;
393
+// deposit	本次使用的押金金额,支持float64、int、int64、decimal.Decimal类型
394
 func SpendDeposit(orgid, his_user_id, create_id int64, code string, deposit interface{}) (err error) {
394
 func SpendDeposit(orgid, his_user_id, create_id int64, code string, deposit interface{}) (err error) {
395
 	tmp_deposit := decimal.Decimal{} //本次患者使用的押金
395
 	tmp_deposit := decimal.Decimal{} //本次患者使用的押金
396
 	tmp_deposit, err = ToDecimal(deposit)
396
 	tmp_deposit, err = ToDecimal(deposit)
445
 	return
445
 	return
446
 }
446
 }
447
 
447
 
448
-//新增一条退款申请
448
+// 新增一条退款申请
449
 func RefundApplication(orgid, his_patient_id, trial_status, createid int64, code string, deposit decimal.Decimal) (err error) {
449
 func RefundApplication(orgid, his_patient_id, trial_status, createid int64, code string, deposit decimal.Decimal) (err error) {
450
 	//开事务
450
 	//开事务
451
 	tx := XTWriteDB().Begin()
451
 	tx := XTWriteDB().Begin()
502
 	return
502
 	return
503
 }
503
 }
504
 
504
 
505
-//退款审核通过/拒绝批量处理
505
+// 退款审核通过/拒绝批量处理
506
 func RefundReviewMore(orgid, trial_status int64, ids string) (err error) {
506
 func RefundReviewMore(orgid, trial_status int64, ids string) (err error) {
507
 	//处理下字符串
507
 	//处理下字符串
508
 	t_ids := ""
508
 	t_ids := ""
537
 	return err
537
 	return err
538
 }
538
 }
539
 
539
 
540
-//退款审核通过/拒绝
540
+// 退款审核通过/拒绝
541
 func RefundReview(orgid, id, trial_status int64, tx *gorm.DB) (err error) {
541
 func RefundReview(orgid, id, trial_status int64, tx *gorm.DB) (err error) {
542
 	//根据id查询该条历史记录
542
 	//根据id查询该条历史记录
543
 	history := models.DepositHistory{}
543
 	history := models.DepositHistory{}
593
 	return err
593
 	return err
594
 }
594
 }
595
 
595
 
596
-//退款删除
596
+// 退款删除
597
 func DeleteRefund(orgid, id int64) (err error) {
597
 func DeleteRefund(orgid, id int64) (err error) {
598
 	//根据id查询历史记录
598
 	//根据id查询历史记录
599
 	history := models.DepositHistory{}
599
 	history := models.DepositHistory{}
615
 	return
615
 	return
616
 }
616
 }
617
 
617
 
618
-//更改退款申请
618
+// 更改退款申请
619
 func ChangeRefund(orgid, his_patient_id, trial_status, id int64, code string, deposit decimal.Decimal) (err error) {
619
 func ChangeRefund(orgid, his_patient_id, trial_status, id int64, code string, deposit decimal.Decimal) (err error) {
620
 	//开事务
620
 	//开事务
621
 	tx := XTWriteDB().Begin()
621
 	tx := XTWriteDB().Begin()
671
 	return
671
 	return
672
 }
672
 }
673
 
673
 
674
-//退款分页
674
+// 退款分页
675
 func RefundList(page, limit, orgid, stime, etime, refundtype, examinetype int64, keyword string, slicekey []int64) (depo []models.RefundList, total int64, err error) {
675
 func RefundList(page, limit, orgid, stime, etime, refundtype, examinetype int64, keyword string, slicekey []int64) (depo []models.RefundList, total int64, err error) {
676
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
676
 	db := XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? ", orgid).Where("ctime >= ? and ctime <= ?", stime, etime)
677
 	offset := (page - 1) * limit
677
 	offset := (page - 1) * limit
710
 
710
 
711
 }
711
 }
712
 
712
 
713
-//退回患者的押金,并生成一条退费历史记录
714
-//orgid 机构id
715
-//his_user_id 患者id
716
-//code 编号
717
-//deposit 本次退费的金额,支持float64、int、int64、decimal.Decimal类型
713
+// 退回患者的押金,并生成一条退费历史记录
714
+// orgid 机构id
715
+// his_user_id 患者id
716
+// code 编号
717
+// deposit 本次退费的金额,支持float64、int、int64、decimal.Decimal类型
718
 func MoneyIncrease(orgid, his_user_id int64, code string, deposit interface{}) (err error) {
718
 func MoneyIncrease(orgid, his_user_id int64, code string, deposit interface{}) (err error) {
719
 	tmp_deposit := decimal.Decimal{}
719
 	tmp_deposit := decimal.Decimal{}
720
 	tmp_deposit, err = ToDecimal(deposit)
720
 	tmp_deposit, err = ToDecimal(deposit)
768
 	return tmp.OrgName
768
 	return tmp.OrgName
769
 }
769
 }
770
 
770
 
771
-//根据id查询就诊号
771
+// 根据id查询就诊号
772
 func FindcodeToid(id int64) (code string) {
772
 func FindcodeToid(id int64) (code string) {
773
 	tmp := models.GetMdtrtId{}
773
 	tmp := models.GetMdtrtId{}
774
 	XTReadDB().Model(&models.GetMdtrtId{}).Where("id = ?", id).Find(&tmp)
774
 	XTReadDB().Model(&models.GetMdtrtId{}).Where("id = ?", id).Find(&tmp)
775
 	return tmp.MdtrtId
775
 	return tmp.MdtrtId
776
 }
776
 }
777
 
777
 
778
-//根据id查询就诊号
778
+// 根据id查询就诊号
779
 func FindnumberToid(id int64) (number string) {
779
 func FindnumberToid(id int64) (number string) {
780
 	tmp := models.GetMdtrtId{}
780
 	tmp := models.GetMdtrtId{}
781
 	XTReadDB().Model(&models.GetMdtrtId{}).Where("id = ?", id).Find(&tmp)
781
 	XTReadDB().Model(&models.GetMdtrtId{}).Where("id = ?", id).Find(&tmp)
782
 	return tmp.Number
782
 	return tmp.Number
783
 }
783
 }
784
 
784
 
785
-//扣费明细列表,查看详情按钮是否显示,0隐藏,1显示
785
+// 扣费明细列表,查看详情按钮是否显示,0隐藏,1显示
786
 func IsButtonShow(code string, orgid, his_patient_id int64) (tmp int64) {
786
 func IsButtonShow(code string, orgid, his_patient_id int64) (tmp int64) {
787
 	var total int
787
 	var total int
788
 	XTReadDB().Model(&models.RefundList{}).Where(" user_org_id = ? and his_patient_id = ? and deposit_code = ? and deposit_status = 4 and status = 1", orgid, his_patient_id, code).Count(&total)
788
 	XTReadDB().Model(&models.RefundList{}).Where(" user_org_id = ? and his_patient_id = ? and deposit_code = ? and deposit_status = 4 and status = 1", orgid, his_patient_id, code).Count(&total)
798
 	}
798
 	}
799
 }
799
 }
800
 
800
 
801
-//把其他的类型转换成decimal.Decimal类型
801
+// 把其他的类型转换成decimal.Decimal类型
802
 func ToDecimal(i interface{}) (d decimal.Decimal, err error) {
802
 func ToDecimal(i interface{}) (d decimal.Decimal, err error) {
803
 	switch i.(type) {
803
 	switch i.(type) {
804
 	case float64:
804
 	case float64:
909
 	return s
909
 	return s
910
 }
910
 }
911
 
911
 
912
-//获取本段时间内患者退款的总额
913
-//orgid:机构id,stime:开始时间,etime:结束时间,patient_id:患者id
912
+// 获取本段时间内患者退款的总额
913
+// orgid:机构id,stime:开始时间,etime:结束时间,patient_id:患者id
914
 func RefundListSum(orgid, stime, etime, patient_id int64) (sum decimal.Decimal, err error) {
914
 func RefundListSum(orgid, stime, etime, patient_id int64) (sum decimal.Decimal, err error) {
915
 	var depo []models.RefundList
915
 	var depo []models.RefundList
916
 	err = XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and trial_status = 1 and ctime >= ? and ctime <= ? and deposit_status = 3 and his_patient_id = ? ", orgid, stime, etime, patient_id).Find(&depo).Error
916
 	err = XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and trial_status = 1 and ctime >= ? and ctime <= ? and deposit_status = 3 and his_patient_id = ? ", orgid, stime, etime, patient_id).Find(&depo).Error

+ 0 - 1
service/his_hospital_service.go Zobrazit soubor

172
 	return
172
 	return
173
 }
173
 }
174
 
174
 
175
-//
176
 type VMHospitalPatient struct {
175
 type VMHospitalPatient struct {
177
 	ID                     int64                         `gorm:"column:id" json:"id" form:"id"`
176
 	ID                     int64                         `gorm:"column:id" json:"id" form:"id"`
178
 	UserOrgId              int64                         `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
177
 	UserOrgId              int64                         `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 7 - 3
service/his_project_service.go Zobrazit soubor

93
 func GetProjectTeamList(limit int64, page int64, orgid int64, keyword string) (projectTeam []*models.XtHisProjectTeam, total int64, err error) {
93
 func GetProjectTeamList(limit int64, page int64, orgid int64, keyword string) (projectTeam []*models.XtHisProjectTeam, total int64, err error) {
94
 	offset := (page - 1) * limit
94
 	offset := (page - 1) * limit
95
 	likeKey := "%" + keyword + "%"
95
 	likeKey := "%" + keyword + "%"
96
-	db := XTReadDB().Model(&projectTeam)
96
+	db := XTReadDB().Model(&projectTeam).Where("status=1")
97
 	if len(keyword) > 0 {
97
 	if len(keyword) > 0 {
98
 		db = db.Where("project_team like ?", likeKey)
98
 		db = db.Where("project_team like ?", likeKey)
99
 	}
99
 	}
100
-	err = db.Where("user_org_id = ? and status = 1", orgid).Count(&total).Offset(offset).Limit(limit).Order("created_time desc").Find(&projectTeam).Error
100
+	if orgid > 0 {
101
+		db = db.Where("user_org_id = ?", orgid)
102
+	}
103
+
104
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("sort asc").Find(&projectTeam).Error
101
 	return projectTeam, total, err
105
 	return projectTeam, total, err
102
 }
106
 }
103
 
107
 
110
 
114
 
111
 func UpdatedProjectTeam(id int64, team *models.XtHisProjectTeam) error {
115
 func UpdatedProjectTeam(id int64, team *models.XtHisProjectTeam) error {
112
 
116
 
113
-	err := XTWriteDB().Model(&team).Where("id=? and status = 1", id).Updates(map[string]interface{}{"project_team": team.ProjectTeam, "price": team.Price, "pinyin": team.Pinyin, "wubi": team.Wubi, "tube_color": team.TubeColor, "team_type": team.TeamType, "remark": team.Remark, "project_id": team.ProjectId, "item_id": team.ItemId}).Error
117
+	err := XTWriteDB().Model(&team).Where("id=? and status = 1", id).Updates(map[string]interface{}{"project_team": team.ProjectTeam, "price": team.Price, "pinyin": team.Pinyin, "wubi": team.Wubi, "tube_color": team.TubeColor, "team_type": team.TeamType, "remark": team.Remark, "project_id": team.ProjectId, "item_id": team.ItemId, "sort": team.Sort}).Error
114
 	return err
118
 	return err
115
 }
119
 }
116
 
120
 

+ 34 - 6
service/inspection_service.go Zobrazit soubor

7
 	"time"
7
 	"time"
8
 )
8
 )
9
 
9
 
10
-func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
11
-	var count int
12
-	err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Count(&count).Error
13
-	if count > 0 {
14
-		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Order("project_id").Find(&reference).Error
10
+func GetInspectionReference(orgId int64, inspect_type int64) (reference []*models.InspectionReference, err error) {
11
+	if inspect_type == 0 {
12
+		var count int
13
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Count(&count).Error
14
+		if count > 0 {
15
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Order("project_id").Find(&reference).Error
16
+		} else {
17
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = 0").Order("project_id").Find(&reference).Error
18
+		}
19
+
15
 	} else {
20
 	} else {
16
-		err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1").Order("project_id").Find(&reference).Error
21
+
22
+		var count int
23
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Count(&count).Error
24
+		if count > 0 {
25
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Order("project_id").Find(&reference).Error
26
+		} else {
27
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = ?", inspect_type).Order("project_id").Find(&reference).Error
28
+		}
29
+
17
 	}
30
 	}
31
+
18
 	return
32
 	return
19
 }
33
 }
20
 
34
 
82
 	return
96
 	return
83
 }
97
 }
84
 
98
 
99
+func SavePatientInspection(inspectin models.Inspection) (err error) {
100
+	err = writeDb.Save(&inspectin).Error
101
+	return
102
+}
103
+func DeleteInspectionTwo(id int64) {
104
+	err = writeDb.Model(&models.Inspection{}).Where("id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
105
+	return
106
+}
107
+
85
 func EditPatientInspection(add []models.Inspection, edit []models.Inspection, noDeleteIDs []int64, patientId, orgId, projectId, date int64) (err error) {
108
 func EditPatientInspection(add []models.Inspection, edit []models.Inspection, noDeleteIDs []int64, patientId, orgId, projectId, date int64) (err error) {
86
 	if len(add) == 0 && len(edit) == 0 && len(noDeleteIDs) == 0 {
109
 	if len(add) == 0 && len(edit) == 0 && len(noDeleteIDs) == 0 {
87
 		err = errors.New(" Cant be nil.")
110
 		err = errors.New(" Cant be nil.")
236
 	err = readDb.Model(&insepciton).Where("org_id = ? and status = 1 and project_name = '传染病检查'", orgid).Find(&insepciton).Error
259
 	err = readDb.Model(&insepciton).Where("org_id = ? and status = 1 and project_name = '传染病检查'", orgid).Find(&insepciton).Error
237
 	return insepciton, err
260
 	return insepciton, err
238
 }
261
 }
262
+
263
+func GetInspectionReferenceTwo(project_id int64) (reference []*models.InspectionReference, err error) {
264
+	err = readDb.Model(&models.InspectionReference{}).Where("project_id = ? and status = 1", project_id).Order("project_id").Find(&reference).Error
265
+	return
266
+}

+ 3 - 3
service/integration_service.go Zobrazit soubor

12
 	return err
12
 	return err
13
 }
13
 }
14
 
14
 
15
-func GetSysInspectionList(orgID int64) (sysInspection []*models.InspectionReference,ownerInspection []*models.InspectionReference, err error) {
15
+func GetSysInspectionList(orgID int64) (sysInspection []*models.InspectionReference, ownerInspection []*models.InspectionReference, err error) {
16
 	db := XTReadDB()
16
 	db := XTReadDB()
17
 	err = db.Model(&models.InspectionReference{}).Where("org_id= 0 and status=1").Find(&sysInspection).Error
17
 	err = db.Model(&models.InspectionReference{}).Where("org_id= 0 and status=1").Find(&sysInspection).Error
18
 	err = db.Model(&models.InspectionReference{}).Where("org_id= ? and status=1", orgID).Find(&ownerInspection).Error
18
 	err = db.Model(&models.InspectionReference{}).Where("org_id= ? and status=1", orgID).Find(&ownerInspection).Error
29
 
29
 
30
 func SaveInterface(interfaceinfo *models.MiddleInterface) error {
30
 func SaveInterface(interfaceinfo *models.MiddleInterface) error {
31
 	db := MiddleWriteDB()
31
 	db := MiddleWriteDB()
32
-	if (interfaceinfo.ID > 0 ) {
32
+	if interfaceinfo.ID > 0 {
33
 		err := db.Save(&interfaceinfo).Error
33
 		err := db.Save(&interfaceinfo).Error
34
 		return err
34
 		return err
35
 	} else {
35
 	} else {
38
 	}
38
 	}
39
 }
39
 }
40
 
40
 
41
-func GetInterface(orgID int64) (interfaceinfo models.MiddleInterface, err error){
41
+func GetInterface(orgID int64) (interfaceinfo models.MiddleInterface, err error) {
42
 	db := MiddleReadDB()
42
 	db := MiddleReadDB()
43
 	err = db.Model(&models.MiddleInterface{}).Where("org_id=? and status=1", orgID).First(&interfaceinfo).Error
43
 	err = db.Model(&models.MiddleInterface{}).Where("org_id=? and status=1", orgID).First(&interfaceinfo).Error
44
 	return
44
 	return

+ 2 - 3
service/login_service.go Zobrazit soubor

3
 import (
3
 import (
4
 	"XT_New/models"
4
 	"XT_New/models"
5
 	"XT_New/utils"
5
 	"XT_New/utils"
6
-	"strconv"
7
-	"github.com/jinzhu/gorm"
8
 	"encoding/json"
6
 	"encoding/json"
7
+	"github.com/jinzhu/gorm"
8
+	"strconv"
9
 	"time"
9
 	"time"
10
 )
10
 )
11
 
11
 
206
 	return &model, nil
206
 	return &model, nil
207
 }
207
 }
208
 
208
 
209
-//
210
 func GetAppRoleById(id int64) (*models.App_Role, error) {
209
 func GetAppRoleById(id int64) (*models.App_Role, error) {
211
 	var model models.App_Role
210
 	var model models.App_Role
212
 	err := readUserDb.Model(&models.App_Role{}).Where("id = ? AND status = 1", id).First(&model).Error
211
 	err := readUserDb.Model(&models.App_Role{}).Where("id = ? AND status = 1", id).First(&model).Error

+ 1 - 1
service/manage_center_service.go Zobrazit soubor

406
 	offset := (page - 1) * limit
406
 	offset := (page - 1) * limit
407
 	db := readDb.Model(&models.HisXtDiagnoseConfig{})
407
 	db := readDb.Model(&models.HisXtDiagnoseConfig{})
408
 	db = db.Where("user_org_id = ? AND status = 1", orgId)
408
 	db = db.Where("user_org_id = ? AND status = 1", orgId)
409
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("ctime desc").Find(&list).Error
409
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("sort asc").Find(&list).Error
410
 	return
410
 	return
411
 }
411
 }
412
 
412
 

+ 13 - 1
service/manage_service.go Zobrazit soubor

1046
 	//db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
1046
 	//db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
1047
 	//err = db.Raw("select id,date,class,zone,bed_number,patient_id,contagion,dialysis_mode,start_time,end_time,dialysis_hour,hyperfiltratio,weight_loss,warning_value,user_total,move,failure_stage,fault_description,code_information,disinfect_type,disinfectant_type,disinfection,machine_run,fluid_path,disinfectant,disinfection_status,disinfection_residue,long_time,disinfec_startime,disinfec_endtime,dialysis_checked,dialysis_name,norms,dialysis_concentration,germ_checked,germ_name,germ_number,clean,sign_name,status,ctime,mtime,user_org_id,equiment_id,bed,stime from xt_device_information where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ? and equiment_id = ? and user_org_id = ?",timenow,equitid, orgid).Error
1047
 	//err = db.Raw("select id,date,class,zone,bed_number,patient_id,contagion,dialysis_mode,start_time,end_time,dialysis_hour,hyperfiltratio,weight_loss,warning_value,user_total,move,failure_stage,fault_description,code_information,disinfect_type,disinfectant_type,disinfection,machine_run,fluid_path,disinfectant,disinfection_status,disinfection_residue,long_time,disinfec_startime,disinfec_endtime,dialysis_checked,dialysis_name,norms,dialysis_concentration,germ_checked,germ_name,germ_number,clean,sign_name,status,ctime,mtime,user_org_id,equiment_id,bed,stime from xt_device_information where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ? and equiment_id = ? and user_org_id = ?",timenow,equitid, orgid).Error
1048
 	day := time.Now().Day()
1048
 	day := time.Now().Day()
1049
-	oldMonth := day - 90
1049
+	oldMonth := day - 30
1050
 	t := time.Date(time.Now().Year(), time.Now().Month(), oldMonth, time.Now().Hour(), time.Now().Minute(), time.Now().Second(), time.Now().Nanosecond(), time.Local)
1050
 	t := time.Date(time.Now().Year(), time.Now().Month(), oldMonth, time.Now().Hour(), time.Now().Minute(), time.Now().Second(), time.Now().Nanosecond(), time.Local)
1051
 
1051
 
1052
 	err = UserReadDB().Model(&information).Where("date>= ? and date <= ? and equiment_id = ? and user_org_id = ? and dialysis_checked = 1 ", t.Unix(), timenow, equitid, orgid).Find(&information).Error
1052
 	err = UserReadDB().Model(&information).Where("date>= ? and date <= ? and equiment_id = ? and user_org_id = ? and dialysis_checked = 1 ", t.Unix(), timenow, equitid, orgid).Find(&information).Error
1729
 	err := XTWriteDB().Model(&models.XtNewObjectDisinfect{}).Where("id=? and status= 1", id).Updates(map[string]interface{}{"status": 0}).Error
1729
 	err := XTWriteDB().Model(&models.XtNewObjectDisinfect{}).Where("id=? and status= 1", id).Updates(map[string]interface{}{"status": 0}).Error
1730
 	return err
1730
 	return err
1731
 }
1731
 }
1732
+
1733
+func GetAirDisInfectionLongTime(user_org_id int64) (list []*models.XtNewAriDisinfect, err error) {
1734
+
1735
+	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Order("id desc").First(&list).Error
1736
+	return
1737
+}
1738
+
1739
+func GetObjectDisInfectionLongTime(user_org_id int64) (list []*models.XtNewObjectDisinfect, err error) {
1740
+
1741
+	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&list).Error
1742
+	return
1743
+}

+ 1 - 1
service/management_service/management_analyse_service.go Zobrazit soubor

7
 	Value int64  `json:"value"`
7
 	Value int64  `json:"value"`
8
 }
8
 }
9
 
9
 
10
-//患者统计
10
+// 患者统计
11
 func GetPatientChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ChartDataStruct, total int64, err error) {
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()
12
 	db := service.XTReadDB()
13
 	switch statistics_type {
13
 	switch statistics_type {

+ 1 - 1
service/mobile_dialysis_service.go Zobrazit soubor

7239
 
7239
 
7240
 func GetPatientDryWeight(org_id int64, patient_id int64) (weight []*models.SgjPatientDryweight, err error) {
7240
 func GetPatientDryWeight(org_id int64, patient_id int64) (weight []*models.SgjPatientDryweight, err error) {
7241
 
7241
 
7242
-	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and status =1", org_id, patient_id).Order("id asc").Limit(6).Find(&weight).Error
7242
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and status =1", org_id, patient_id).Order("id desc").Limit(6).Find(&weight).Error
7243
 
7243
 
7244
 	return weight, err
7244
 	return weight, err
7245
 }
7245
 }

+ 71 - 0
service/patient_dataconfig_service.go Zobrazit soubor

29
 	return records, nil
29
 	return records, nil
30
 }
30
 }
31
 
31
 
32
+func GetPatientSickHistory(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.XtPatientSickHistory, error) {
33
+	var records []*models.XtPatientSickHistory
34
+	err := readDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
35
+	if err != nil {
36
+		return nil, err
37
+	}
38
+	return records, nil
39
+}
40
+
41
+func GetPatientSickHistoryByIds(orgID int64, patientID int64, ids []string) ([]*models.XtPatientSickHistory, error) {
42
+	var records []*models.XtPatientSickHistory
43
+	err := readDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, ids).Order("record_time desc").Find(&records).Error
44
+	if err != nil {
45
+		return nil, err
46
+	}
47
+	return records, nil
48
+}
49
+
50
+func GetPatienttPhysiqueByIds(orgID int64, patientID int64, ids []string) ([]*models.XtPatientPhysiqueCheck, error) {
51
+	var records []*models.XtPatientPhysiqueCheck
52
+	err := readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, ids).Order("record_time desc").Find(&records).Error
53
+	if err != nil {
54
+		return nil, err
55
+	}
56
+	return records, nil
57
+}
58
+
59
+func GetPatientPhysiqueCheck(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.XtPatientPhysiqueCheck, error) {
60
+	var records []*models.XtPatientPhysiqueCheck
61
+	err := readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
62
+	if err != nil {
63
+		return nil, err
64
+	}
65
+	return records, nil
66
+}
67
+
68
+func GetLastPatientPhysiqueCheck(orgID int64, patientID int64, record_date int64) (records models.XtPatientPhysiqueCheck, err error) {
69
+	err = readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and record_date = ? and status = 1", orgID, patientID, record_date).Order("record_time desc").Last(&records).Error
70
+	return records, err
71
+}
72
+
32
 func CreatePatientCourseOfDisease(record *models.PatientDiseaseCourse) error {
73
 func CreatePatientCourseOfDisease(record *models.PatientDiseaseCourse) error {
33
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Create(record).Error
74
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Create(record).Error
34
 	return err
75
 	return err
35
 }
76
 }
36
 
77
 
78
+func CreatePatientSickHistory(record *models.XtPatientSickHistory) error {
79
+	err := writeDb.Model(&models.XtPatientSickHistory{}).Create(record).Error
80
+	return err
81
+}
82
+
83
+func CreatePatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
84
+	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Create(record).Error
85
+	return err
86
+}
37
 func GetPatientRescueRecords(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.PatientRescueRecord, error) {
87
 func GetPatientRescueRecords(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.PatientRescueRecord, error) {
38
 	var records []*models.PatientRescueRecord
88
 	var records []*models.PatientRescueRecord
39
 	err := readDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
89
 	err := readDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
53
 	return err
103
 	return err
54
 }
104
 }
55
 
105
 
106
+func ModifyPatientSickHistory(record *models.XtPatientSickHistory) error {
107
+	err := writeDb.Save(record).Error
108
+	//err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and status = 1 and id = ?", record.OrgId, record.PatientId, record.ID).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error
109
+	return err
110
+}
111
+
112
+func ModifyPatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
113
+	err := writeDb.Save(record).Error
114
+	//err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and status = 1 and id = ?", record.OrgId, record.PatientId, record.ID).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error
115
+	return err
116
+}
56
 func DeletePatientCoursesInBatch(orgID int64, patientID int64, recordIDs []int64) error {
117
 func DeletePatientCoursesInBatch(orgID int64, patientID int64, recordIDs []int64) error {
57
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
118
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
58
 	return err
119
 	return err
59
 }
120
 }
60
 
121
 
122
+func DeletePatientSickHistoryInBatch(orgID int64, patientID int64, recordIDs []int64) error {
123
+	err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
124
+	return err
125
+}
126
+
61
 func DeletePatientResuceRecordsInBatch(orgID int64, patientID int64, recordIDs []int64) error {
127
 func DeletePatientResuceRecordsInBatch(orgID int64, patientID int64, recordIDs []int64) error {
62
 	err := writeDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
128
 	err := writeDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
63
 	return err
129
 	return err
64
 }
130
 }
131
+
132
+func DeletePatientPhysiqueCheckInBatch(orgID int64, patientID int64, recordIDs []int64) error {
133
+	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
134
+	return err
135
+}

+ 29 - 3
service/patient_service.go Zobrazit soubor

520
 
520
 
521
 func ChechLastDialysisNo(orgID int64) (dialysisNo int64) {
521
 func ChechLastDialysisNo(orgID int64) (dialysisNo int64) {
522
 	var patient models.Patients
522
 	var patient models.Patients
523
-	err := readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=?", orgID).Order("dialysis_no desc").First(&patient).Error
524
-	if err != nil {
525
-		return
523
+	if orgID == 10278 {
524
+		err := readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=?", orgID).Order("id desc").First(&patient).Error
525
+		if err != nil {
526
+			return
527
+		}
528
+	} else {
529
+		err := readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=?", orgID).Order("dialysis_no desc").First(&patient).Error
530
+		if err != nil {
531
+			return
532
+		}
526
 	}
533
 	}
527
 
534
 
528
 	if patient.ID == 0 {
535
 	if patient.ID == 0 {
609
 	return
616
 	return
610
 }
617
 }
611
 
618
 
619
+func FindPatientWithDeviceByPatientId(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
620
+	err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
621
+		return db.Preload("DeviceNumber", "org_id = ?", orgID).
622
+			Preload("DeviceZone", "org_id = ?", orgID).
623
+			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
624
+	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and id = ? and status = 1 ", orgID, id).First(&patient).Error
625
+	return
626
+}
627
+
612
 func CreatePatient(patient *models.Patients, contagions []int64, diseases []int64) (err error) {
628
 func CreatePatient(patient *models.Patients, contagions []int64, diseases []int64) (err error) {
613
 
629
 
614
 	user, _ := GetSgjUserByMobild(patient.Phone)
630
 	user, _ := GetSgjUserByMobild(patient.Phone)
1580
 	return
1596
 	return
1581
 }
1597
 }
1582
 
1598
 
1599
+func FindAllDoctorAdviceByGoroupNoTwety(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1600
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 and (drug_id >0 or drug_name_id >0)", orgID, groupno).Find(&advice).Error
1601
+	return
1602
+}
1603
+
1583
 func FindDoctorAdviceByIds(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1604
 func FindDoctorAdviceByIds(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1584
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id IN (?) AND user_org_id = ? AND status = 1", ids, orgID).Find(&advice).Error
1605
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id IN (?) AND user_org_id = ? AND status = 1", ids, orgID).Find(&advice).Error
1585
 	return
1606
 	return
1586
 }
1607
 }
1587
 
1608
 
1609
+func FindDoctorAdviceByIdsTwety(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1610
+	err = readDb.Model(&models.DoctorAdvice{}).Where("id IN (?) AND user_org_id = ? AND status = 1 and (drug_id >0 or drug_name_id >0)", ids, orgID).Find(&advice).Error
1611
+	return
1612
+}
1613
+
1588
 func BatchDeleteDoctorAdvice(ids []string, user_id int64) (err error) {
1614
 func BatchDeleteDoctorAdvice(ids []string, user_id int64) (err error) {
1589
 	ut := writeDb.Begin()
1615
 	ut := writeDb.Begin()
1590
 	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix(), "modifier": user_id}).Error
1616
 	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix(), "modifier": user_id}).Error

+ 1 - 1
service/pharmacy_service.go Zobrazit soubor

789
 	var hids []*models.TmpID
789
 	var hids []*models.TmpID
790
 	var xids []*models.TmpID
790
 	var xids []*models.TmpID
791
 	//var hid,xid []int64//查询已发药的药品
791
 	//var hid,xid []int64//查询已发药的药品
792
-	err = tx.Raw("select id,dispensing_time from his_doctor_advice_info where status = 1 and created_time >= ? and created_time <= ? "+
792
+	err = tx.Raw("select id,dispensing_time from his_doctor_advice_info where status = 1 and advice_date >= ? and advice_date <= ? "+
793
 		"and user_org_id = ? and patient_id = ? and is_medicine = 1 and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, orgid).Scan(&hids).Error
793
 		"and user_org_id = ? and patient_id = ? and is_medicine = 1 and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, orgid).Scan(&hids).Error
794
 	if err != nil {
794
 	if err != nil {
795
 		return
795
 		return

+ 1 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Zobrazit soubor

227
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
227
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
228
 	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
228
 	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
229
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
229
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
230
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
230
 }
231
 }
231
 
232
 
232
 func (PrescriptionVM) TableName() string {
233
 func (PrescriptionVM) TableName() string {

+ 1 - 1
service/role_service.go Zobrazit soubor

500
 	return purviewVMs, nil
500
 	return purviewVMs, nil
501
 }
501
 }
502
 
502
 
503
-//用来处理树形结构
503
+// 用来处理树形结构
504
 func Totree(map1 map[int64]int64, map2 map[int64]*PurviewTreeViewModel, tmp int64) []*PurviewTreeViewModel {
504
 func Totree(map1 map[int64]int64, map2 map[int64]*PurviewTreeViewModel, tmp int64) []*PurviewTreeViewModel {
505
 	var j int //用来计数
505
 	var j int //用来计数
506
 	var tmp_purview []*PurviewTreeViewModel
506
 	var tmp_purview []*PurviewTreeViewModel

+ 1 - 0
service/schedule_service.go Zobrazit soubor

168
 		db = db.Where("s.schedule_week in(?)", WeekDayIds)
168
 		db = db.Where("s.schedule_week in(?)", WeekDayIds)
169
 	}
169
 	}
170
 	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
170
 	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
171
+		Preload("DialysisSolution", "status= 1 and solution_status = 1").
171
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
172
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
172
 		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
173
 		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
173
 		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,s.dialysis_machine_name, p.name as patient").
174
 		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,s.dialysis_machine_name, p.name as patient").

+ 62 - 62
service/secondary_service.go Zobrazit soubor

10
 	"time"
10
 	"time"
11
 )
11
 )
12
 
12
 
13
-//生成编号,规则为:"SH-"+4位随机数
13
+// 生成编号,规则为:"SH-"+4位随机数
14
 func CreateCode() string {
14
 func CreateCode() string {
15
 	s := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(10000))
15
 	s := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(10000))
16
 	code := "SH-" + s
16
 	code := "SH-" + s
17
 	return code
17
 	return code
18
 }
18
 }
19
 
19
 
20
-//查询仓库名称是否重复(用于修改)
20
+// 查询仓库名称是否重复(用于修改)
21
 func IsStorehouseNameUp(orgid, id int64, storehouse_name string) (bool, error) {
21
 func IsStorehouseNameUp(orgid, id int64, storehouse_name string) (bool, error) {
22
 	var total int
22
 	var total int
23
 	var tmp bool
23
 	var tmp bool
30
 	return tmp, err
30
 	return tmp, err
31
 }
31
 }
32
 
32
 
33
-//查询仓库地址是否重复(用于修改)
33
+// 查询仓库地址是否重复(用于修改)
34
 func IsStorehouseAddressUp(orgid, id int64, storehouse_address string) (bool, error) {
34
 func IsStorehouseAddressUp(orgid, id int64, storehouse_address string) (bool, error) {
35
 	var total int
35
 	var total int
36
 	var tmp bool
36
 	var tmp bool
43
 	return tmp, err
43
 	return tmp, err
44
 }
44
 }
45
 
45
 
46
-//查询编号是否重复
46
+// 查询编号是否重复
47
 func FindStorehouseCode(orgid int64, code string) bool {
47
 func FindStorehouseCode(orgid int64, code string) bool {
48
 	var total int
48
 	var total int
49
 	XTReadDB().Model(&models.Storehouse{}).Where(" storehouse_code = ? and user_org_id = ? and status = 1", code, orgid).Count(&total)
49
 	XTReadDB().Model(&models.Storehouse{}).Where(" storehouse_code = ? and user_org_id = ? and status = 1", code, orgid).Count(&total)
54
 	}
54
 	}
55
 }
55
 }
56
 
56
 
57
-//判断仓库的库存是否为零 true为零,false不为零
57
+// 判断仓库的库存是否为零 true为零,false不为零
58
 func IsStorehouseNil(id, orgid int64) bool { //根据 id gro_id 查为零的库存
58
 func IsStorehouseNil(id, orgid int64) bool { //根据 id gro_id 查为零的库存
59
 	var h, y int
59
 	var h, y int
60
 	//判断耗材是否为零
60
 	//判断耗材是否为零
70
 	return true
70
 	return true
71
 }
71
 }
72
 
72
 
73
-//修改仓库状态
73
+// 修改仓库状态
74
 func UpdateStorehouseStatus(id int64) error {
74
 func UpdateStorehouseStatus(id int64) error {
75
 	err := XTWriteDB().Exec("UPDATE xt_storehouse,(SELECT CASE storehouse_status WHEN 1 THEN 0 WHEN 0 THEN 1 END AS tt FROM xt_storehouse WHERE id=?)tmp SET storehouse_status = tmp.tt where id=?", id, id).Error
75
 	err := XTWriteDB().Exec("UPDATE xt_storehouse,(SELECT CASE storehouse_status WHEN 1 THEN 0 WHEN 0 THEN 1 END AS tt FROM xt_storehouse WHERE id=?)tmp SET storehouse_status = tmp.tt where id=?", id, id).Error
76
 	return err
76
 	return err
77
 }
77
 }
78
 
78
 
79
-//删除仓库
79
+// 删除仓库
80
 func DeleteStorehouse(id int64) error {
80
 func DeleteStorehouse(id int64) error {
81
 	err := XTWriteDB().Model(&models.Storehouse{}).Where("id = ?", id).Update("status", 0).Error
81
 	err := XTWriteDB().Model(&models.Storehouse{}).Where("id = ?", id).Update("status", 0).Error
82
 	return err
82
 	return err
83
 }
83
 }
84
 
84
 
85
-//查询仓库名称是否重复
85
+// 查询仓库名称是否重复
86
 func IsStorehouseName(orgid int64, storehouse_name string) (bool, error) {
86
 func IsStorehouseName(orgid int64, storehouse_name string) (bool, error) {
87
 	var total int
87
 	var total int
88
 	var tmp bool
88
 	var tmp bool
95
 	return tmp, err
95
 	return tmp, err
96
 }
96
 }
97
 
97
 
98
-//查询仓库地址是否重复
98
+// 查询仓库地址是否重复
99
 func IsStorehouseAddress(orgid int64, storehouse_address string) (bool, error) {
99
 func IsStorehouseAddress(orgid int64, storehouse_address string) (bool, error) {
100
 	var total int
100
 	var total int
101
 	var tmp bool
101
 	var tmp bool
108
 	return tmp, err
108
 	return tmp, err
109
 }
109
 }
110
 
110
 
111
-//新增仓库
111
+// 新增仓库
112
 func AddStroehouse(storehouse models.Storehouse) (shiwu string, err error) {
112
 func AddStroehouse(storehouse models.Storehouse) (shiwu string, err error) {
113
 	tx := XTWriteDB().Begin()
113
 	tx := XTWriteDB().Begin()
114
 	defer func() {
114
 	defer func() {
150
 	return shiwu, err
150
 	return shiwu, err
151
 }
151
 }
152
 
152
 
153
-//修改仓库
153
+// 修改仓库
154
 func UpdateStroehouse(storehouse models.Storehouse) error {
154
 func UpdateStroehouse(storehouse models.Storehouse) error {
155
 	err := XTWriteDB().Model(&models.Storehouse{}).Where("id = ? and status = 1", storehouse.ID).Updates(
155
 	err := XTWriteDB().Model(&models.Storehouse{}).Where("id = ? and status = 1", storehouse.ID).Updates(
156
 		map[string]interface{}{
156
 		map[string]interface{}{
163
 	return err
163
 	return err
164
 }
164
 }
165
 
165
 
166
-//查询一条仓库的信息
166
+// 查询一条仓库的信息
167
 func GetOneStorehouse(id, orgid int64) (storehouse models.Storehouse, err error) {
167
 func GetOneStorehouse(id, orgid int64) (storehouse models.Storehouse, err error) {
168
 	err = XTReadDB().Model(&models.Storehouse{}).Where("id = ? and user_org_id = ?", id, orgid).Find(&storehouse).Error
168
 	err = XTReadDB().Model(&models.Storehouse{}).Where("id = ? and user_org_id = ?", id, orgid).Find(&storehouse).Error
169
 	return
169
 	return
170
 }
170
 }
171
 
171
 
172
-//分页
172
+// 分页
173
 func StorehouseList(page, limit, orgid int64, keyword string, slicekey []int64) (storehouse []models.Storehouse, total int64, err error) {
173
 func StorehouseList(page, limit, orgid int64, keyword string, slicekey []int64) (storehouse []models.Storehouse, total int64, err error) {
174
 	db := XTReadDB().Model(&storehouse).Where("status = 1 and user_org_id = ?", orgid)
174
 	db := XTReadDB().Model(&storehouse).Where("status = 1 and user_org_id = ?", orgid)
175
 	offset := (page - 1) * limit
175
 	offset := (page - 1) * limit
187
 	return storehouse, total, err
187
 	return storehouse, total, err
188
 }
188
 }
189
 
189
 
190
-//获取当前机构所有可用的仓库名字
190
+// 获取当前机构所有可用的仓库名字
191
 func GetAllStorehouseName(orgid int64) (storehouse []models.Storehouse, err error) {
191
 func GetAllStorehouseName(orgid int64) (storehouse []models.Storehouse, err error) {
192
 	err = XTReadDB().Model(&models.Storehouse{}).Where("storehouse_status = 1 and status = 1 and user_org_id = ?", orgid).Find(&storehouse).Error
192
 	err = XTReadDB().Model(&models.Storehouse{}).Where("storehouse_status = 1 and status = 1 and user_org_id = ?", orgid).Find(&storehouse).Error
193
 	return
193
 	return
194
 }
194
 }
195
 
195
 
196
-//根据机构id,生成一个默认仓库
196
+// 根据机构id,生成一个默认仓库
197
 func GetDefaultStorehouse(orgid int64) error {
197
 func GetDefaultStorehouse(orgid int64) error {
198
 	var code string
198
 	var code string
199
 	for a := true; a == true; {
199
 	for a := true; a == true; {
222
 	return err
222
 	return err
223
 }
223
 }
224
 
224
 
225
-//查找该机构id是否有仓库存在,ture存在,false不存在
225
+// 查找该机构id是否有仓库存在,ture存在,false不存在
226
 func IsStorehouse(orgid int64) bool {
226
 func IsStorehouse(orgid int64) bool {
227
 	var total int
227
 	var total int
228
 	XTReadDB().Model(&models.Storehouse{}).Where("user_org_id = ?", orgid).Count(&total)
228
 	XTReadDB().Model(&models.Storehouse{}).Where("user_org_id = ?", orgid).Count(&total)
233
 	}
233
 	}
234
 }
234
 }
235
 
235
 
236
-//查找该机构id是否有仓库配置存在,ture存在,false不存在
236
+// 查找该机构id是否有仓库配置存在,ture存在,false不存在
237
 func IsStorehouseconfigXT(orgid int64, tx *gorm.DB) bool {
237
 func IsStorehouseconfigXT(orgid int64, tx *gorm.DB) bool {
238
 	var total int
238
 	var total int
239
 	tx.Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Count(&total)
239
 	tx.Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Count(&total)
244
 	}
244
 	}
245
 }
245
 }
246
 
246
 
247
-//  根据机构id查询仓库配置
248
-//storehouse_info:耗材 自动入库 的仓库id
249
-//storehouse_out_info:耗材 自动出库 的仓库id
250
-//drug_storehouse_info:药品 自动入库 的仓库id
251
-//drug_storehouse_out:药品 自动出库 的仓库id
247
+//	根据机构id查询仓库配置
248
+//
249
+// storehouse_info:耗材 自动入库 的仓库id
250
+// storehouse_out_info:耗材 自动出库 的仓库id
251
+// drug_storehouse_info:药品 自动入库 的仓库id
252
+// drug_storehouse_out:药品 自动出库 的仓库id
252
 func FindStorehouseConfig(orgid int64) (storehouse_config models.StorehouseConfig, err error) {
253
 func FindStorehouseConfig(orgid int64) (storehouse_config models.StorehouseConfig, err error) {
253
 	err = XTReadDB().Model(&models.StorehouseConfig{}).Where("status = 1 and user_org_id = ?", orgid).Find(&storehouse_config).Error
254
 	err = XTReadDB().Model(&models.StorehouseConfig{}).Where("status = 1 and user_org_id = ?", orgid).Find(&storehouse_config).Error
254
 	return
255
 	return
255
 }
256
 }
256
 
257
 
257
-//根据机构id,仓库id新建一个仓库配置
258
+// 根据机构id,仓库id新建一个仓库配置
258
 func CreateStorehouseConfig(orgid, id int64) (err error) {
259
 func CreateStorehouseConfig(orgid, id int64) (err error) {
259
 	storeconfig := models.StorehouseConfig{
260
 	storeconfig := models.StorehouseConfig{
260
 		UserOrgId:          orgid,
261
 		UserOrgId:          orgid,
269
 	return
270
 	return
270
 }
271
 }
271
 
272
 
272
-//根据机构id,仓库id新建一个仓库配置,带事务
273
+// 根据机构id,仓库id新建一个仓库配置,带事务
273
 func CreateStorehouseConfigXT(orgid, id int64, tx *gorm.DB) (err error) {
274
 func CreateStorehouseConfigXT(orgid, id int64, tx *gorm.DB) (err error) {
274
 	storeconfig := models.StorehouseConfig{
275
 	storeconfig := models.StorehouseConfig{
275
 		UserOrgId:          orgid,
276
 		UserOrgId:          orgid,
284
 	return
285
 	return
285
 }
286
 }
286
 
287
 
287
-//更改耗材自动入库仓库
288
+// 更改耗材自动入库仓库
288
 func UpdateInfo(orgid, id int64) (err error) {
289
 func UpdateInfo(orgid, id int64) (err error) {
289
 	mtime := time.Now().Unix()
290
 	mtime := time.Now().Unix()
290
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"storehouse_info": id, "mtime": mtime}).Error
291
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"storehouse_info": id, "mtime": mtime}).Error
291
 	return
292
 	return
292
 }
293
 }
293
 
294
 
294
-//更改耗材自动出库仓库
295
+// 更改耗材自动出库仓库
295
 func UpdateOutInfo(orgid, id int64) (err error) {
296
 func UpdateOutInfo(orgid, id int64) (err error) {
296
 	mtime := time.Now().Unix()
297
 	mtime := time.Now().Unix()
297
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"storehouse_out_info": id, "mtime": mtime}).Error
298
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"storehouse_out_info": id, "mtime": mtime}).Error
298
 	return
299
 	return
299
 }
300
 }
300
 
301
 
301
-//更改药品自动入库仓库
302
+// 更改药品自动入库仓库
302
 func UpdateDrugInfo2(orgid, id int64) (err error) {
303
 func UpdateDrugInfo2(orgid, id int64) (err error) {
303
 	mtime := time.Now().Unix()
304
 	mtime := time.Now().Unix()
304
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"drug_storehouse_info": id, "mtime": mtime}).Error
305
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"drug_storehouse_info": id, "mtime": mtime}).Error
305
 	return
306
 	return
306
 }
307
 }
307
 
308
 
308
-//更改药品自动出库仓库
309
+// 更改药品自动出库仓库
309
 func UpdateDrugOut(orgid, id int64) (err error) {
310
 func UpdateDrugOut(orgid, id int64) (err error) {
310
 	mtime := time.Now().Unix()
311
 	mtime := time.Now().Unix()
311
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"drug_storehouse_out": id, "mtime": mtime}).Error
312
 	err = XTWriteDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"drug_storehouse_out": id, "mtime": mtime}).Error
312
 	return
313
 	return
313
 }
314
 }
314
 
315
 
315
-//根据id查询仓库名称
316
+// 根据id查询仓库名称
316
 func FindStorehouseName(id int64) (storehouse models.Storehouse, err error) {
317
 func FindStorehouseName(id int64) (storehouse models.Storehouse, err error) {
317
 	err = XTReadDB().Model(&models.Storehouse{}).Where("id = ?", id).Find(&storehouse).Error
318
 	err = XTReadDB().Model(&models.Storehouse{}).Where("id = ?", id).Find(&storehouse).Error
318
 	return
319
 	return
319
 }
320
 }
320
 
321
 
321
-//判断该仓库是否在仓库配置表中
322
+// 判断该仓库是否在仓库配置表中
322
 func IsInConfig(orgid, id int64) bool {
323
 func IsInConfig(orgid, id int64) bool {
323
 	var total int
324
 	var total int
324
 	XTReadDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Where(
325
 	XTReadDB().Model(&models.StorehouseConfig{}).Where("user_org_id = ? and status = 1", orgid).Where(
330
 	}
331
 	}
331
 }
332
 }
332
 
333
 
333
-//兼容旧数据
334
+// 兼容旧数据
334
 func Byliinit() (err error) {
335
 func Byliinit() (err error) {
335
 	tx := XTWriteDB().Begin()
336
 	tx := XTWriteDB().Begin()
336
 	defer func() {
337
 	defer func() {
449
 	return
450
 	return
450
 }
451
 }
451
 
452
 
452
-//初始化管理员名字
453
+// 初始化管理员名字
453
 func initsgj_user_admin(tx *gorm.DB) (err error) {
454
 func initsgj_user_admin(tx *gorm.DB) (err error) {
454
 	err = tx.Exec("update sgj_users.sgj_user_admin set name = \"超级管理员\" where name is null or name = \"\"").Error
455
 	err = tx.Exec("update sgj_users.sgj_user_admin set name = \"超级管理员\" where name is null or name = \"\"").Error
455
 	return
456
 	return
456
 }
457
 }
457
 
458
 
458
-//根据xt_gobal_template 获取的机构id减去仓库表存在的机构id,把结果插入到仓库表
459
+// 根据xt_gobal_template 获取的机构id减去仓库表存在的机构id,把结果插入到仓库表
459
 func StoreReduceOrg(tx *gorm.DB) (err error) {
460
 func StoreReduceOrg(tx *gorm.DB) (err error) {
460
 	err = tx.Exec("INSERT INTO sgj_xt.xt_storehouse(storehouse_code,storehouse_name,user_org_id,ctime)" +
461
 	err = tx.Exec("INSERT INTO sgj_xt.xt_storehouse(storehouse_code,storehouse_name,user_org_id,ctime)" +
461
 		"SELECT CONCAT(\"SH-\",FLOOR(RAND()*9000+1000)),\"默认仓库\",tmp.id,UNIX_TIMESTAMP()" +
462
 		"SELECT CONCAT(\"SH-\",FLOOR(RAND()*9000+1000)),\"默认仓库\",tmp.id,UNIX_TIMESTAMP()" +
470
 	return
471
 	return
471
 }
472
 }
472
 
473
 
473
-//查找仓库表的orgid 减去仓库配置表的orgid,把结果插入到仓库配置表
474
+// 查找仓库表的orgid 减去仓库配置表的orgid,把结果插入到仓库配置表
474
 func StoreReduceConfig(tx *gorm.DB) (err error) {
475
 func StoreReduceConfig(tx *gorm.DB) (err error) {
475
 	err = tx.Exec("INSERT INTO sgj_xt.xt_storehouse_config(user_org_id,storehouse_info,storehouse_out_info,drug_storehouse_info,drug_storehouse_out,ctime)" +
476
 	err = tx.Exec("INSERT INTO sgj_xt.xt_storehouse_config(user_org_id,storehouse_info,storehouse_out_info,drug_storehouse_info,drug_storehouse_out,ctime)" +
476
 		"SELECT tmp.user_org_id,tmp.id,tmp.id,tmp.id,tmp.id,UNIX_TIMESTAMP()" +
477
 		"SELECT tmp.user_org_id,tmp.id,tmp.id,tmp.id,tmp.id,UNIX_TIMESTAMP()" +
479
 	return
480
 	return
480
 }
481
 }
481
 
482
 
482
-//初始化 xt_storehouse 管理员的名字
483
+// 初始化 xt_storehouse 管理员的名字
483
 func initxt_storehouse(tx *gorm.DB) (err error) {
484
 func initxt_storehouse(tx *gorm.DB) (err error) {
484
 	err = tx.Exec("UPDATE sgj_xt.xt_storehouse as t," +
485
 	err = tx.Exec("UPDATE sgj_xt.xt_storehouse as t," +
485
 		"(SELECT o.id,o.creator from sgj_users.sgj_user_org as o," +
486
 		"(SELECT o.id,o.creator from sgj_users.sgj_user_org as o," +
490
 	return
491
 	return
491
 }
492
 }
492
 
493
 
493
-//初始化 xt_stock_flow(完成)
494
+// 初始化 xt_stock_flow(完成)
494
 func initxt_stock_flow(tx *gorm.DB) (err error) {
495
 func initxt_stock_flow(tx *gorm.DB) (err error) {
495
 	err = tx.Exec("UPDATE sgj_xt.xt_stock_flow as t," +
496
 	err = tx.Exec("UPDATE sgj_xt.xt_stock_flow as t," +
496
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
497
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
501
 	return
502
 	return
502
 }
503
 }
503
 
504
 
504
-//初始化 xt_drug_flow(完成)
505
+// 初始化 xt_drug_flow(完成)
505
 func initxt_drug_flow(tx *gorm.DB) (err error) {
506
 func initxt_drug_flow(tx *gorm.DB) (err error) {
506
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_flow as t," +
507
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_flow as t," +
507
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
508
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
512
 	return
513
 	return
513
 }
514
 }
514
 
515
 
515
-//初始化 dialysis_before_prepare(完成)
516
+// 初始化 dialysis_before_prepare(完成)
516
 func initdialysis_before_prepare(tx *gorm.DB) (err error) {
517
 func initdialysis_before_prepare(tx *gorm.DB) (err error) {
517
 	err = tx.Exec("UPDATE sgj_xt.dialysis_before_prepare as t," +
518
 	err = tx.Exec("UPDATE sgj_xt.dialysis_before_prepare as t," +
518
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
519
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
523
 	return
524
 	return
524
 }
525
 }
525
 
526
 
526
-//初始化 xt_automatic_reduce_detail(完成)
527
+// 初始化 xt_automatic_reduce_detail(完成)
527
 func initxt_automatic_reduce_detail(tx *gorm.DB) (err error) {
528
 func initxt_automatic_reduce_detail(tx *gorm.DB) (err error) {
528
 	err = tx.Exec("UPDATE sgj_xt.xt_automatic_reduce_detail as t," +
529
 	err = tx.Exec("UPDATE sgj_xt.xt_automatic_reduce_detail as t," +
529
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
530
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
534
 	return
535
 	return
535
 }
536
 }
536
 
537
 
537
-//初始化 xt_drug_automatic_reduce_detail(完成)
538
+// 初始化 xt_drug_automatic_reduce_detail(完成)
538
 func initxt_drug_automatic_reduce_detail(tx *gorm.DB) (err error) {
539
 func initxt_drug_automatic_reduce_detail(tx *gorm.DB) (err error) {
539
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_automatic_reduce_detail as t," +
540
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_automatic_reduce_detail as t," +
540
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
541
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
545
 	return
546
 	return
546
 }
547
 }
547
 
548
 
548
-//初始化 xt_warehouse(完成)
549
+// 初始化 xt_warehouse(完成)
549
 func initxt_warehouse(tx *gorm.DB) (err error) {
550
 func initxt_warehouse(tx *gorm.DB) (err error) {
550
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse as t," +
551
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse as t," +
551
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
552
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
556
 	return
557
 	return
557
 }
558
 }
558
 
559
 
559
-//初始化 xt_warehouse_info(完成)
560
+// 初始化 xt_warehouse_info(完成)
560
 func initxt_warehouse_info(tx *gorm.DB) (err error) {
561
 func initxt_warehouse_info(tx *gorm.DB) (err error) {
561
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_info as t," +
562
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_info as t," +
562
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
563
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
567
 	return
568
 	return
568
 }
569
 }
569
 
570
 
570
-//初始化 xt_warehouse_out(完成)
571
+// 初始化 xt_warehouse_out(完成)
571
 func initxt_warehouse_out(tx *gorm.DB) (err error) {
572
 func initxt_warehouse_out(tx *gorm.DB) (err error) {
572
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_out as t," +
573
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_out as t," +
573
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
574
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
578
 	return
579
 	return
579
 }
580
 }
580
 
581
 
581
-//初始化 xt_warehouse_out_info(完成)
582
+// 初始化 xt_warehouse_out_info(完成)
582
 func initxt_warehouse_out_info(tx *gorm.DB) (err error) {
583
 func initxt_warehouse_out_info(tx *gorm.DB) (err error) {
583
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_out_info as t," +
584
 	err = tx.Exec("UPDATE sgj_xt.xt_warehouse_out_info as t," +
584
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
585
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
589
 	return
590
 	return
590
 }
591
 }
591
 
592
 
592
-//初始化 xt_drug_warehouse(完成)
593
+// 初始化 xt_drug_warehouse(完成)
593
 func initxt_drug_warehouse(tx *gorm.DB) (err error) {
594
 func initxt_drug_warehouse(tx *gorm.DB) (err error) {
594
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse as t," +
595
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse as t," +
595
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
596
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
600
 	return
601
 	return
601
 }
602
 }
602
 
603
 
603
-//初始化 xt_drug_warehouse_info(完成)
604
+// 初始化 xt_drug_warehouse_info(完成)
604
 func initxt_drug_warehouse_info(tx *gorm.DB) (err error) {
605
 func initxt_drug_warehouse_info(tx *gorm.DB) (err error) {
605
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_info as t," +
606
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_info as t," +
606
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
607
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
611
 	return
612
 	return
612
 }
613
 }
613
 
614
 
614
-//初始化 xt_drug_warehouse_out(完成)
615
+// 初始化 xt_drug_warehouse_out(完成)
615
 func initxt_drug_warehouse_out(tx *gorm.DB) (err error) {
616
 func initxt_drug_warehouse_out(tx *gorm.DB) (err error) {
616
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_out as t," +
617
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_out as t," +
617
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
618
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
622
 	return
623
 	return
623
 }
624
 }
624
 
625
 
625
-//初始化 xt_drug_warehouse_out_info(完成)
626
+// 初始化 xt_drug_warehouse_out_info(完成)
626
 func initxt_drug_warehouse_out_info(tx *gorm.DB) (err error) {
627
 func initxt_drug_warehouse_out_info(tx *gorm.DB) (err error) {
627
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_out_info as t," +
628
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_warehouse_out_info as t," +
628
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
629
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
633
 	return
634
 	return
634
 }
635
 }
635
 
636
 
636
-//初始化 xt_cancel_stock(完成)
637
+// 初始化 xt_cancel_stock(完成)
637
 func initxt_cancel_stock(tx *gorm.DB) (err error) {
638
 func initxt_cancel_stock(tx *gorm.DB) (err error) {
638
 	err = tx.Exec("UPDATE sgj_xt.xt_cancel_stock as t," +
639
 	err = tx.Exec("UPDATE sgj_xt.xt_cancel_stock as t," +
639
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
640
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
644
 	return
645
 	return
645
 }
646
 }
646
 
647
 
647
-//初始化 xt_cancel_stock_info(完成)
648
+// 初始化 xt_cancel_stock_info(完成)
648
 func initxt_cancel_stock_info(tx *gorm.DB) (err error) {
649
 func initxt_cancel_stock_info(tx *gorm.DB) (err error) {
649
 	err = tx.Exec("UPDATE sgj_xt.xt_cancel_stock_info as t," +
650
 	err = tx.Exec("UPDATE sgj_xt.xt_cancel_stock_info as t," +
650
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
651
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
655
 	return
656
 	return
656
 }
657
 }
657
 
658
 
658
-//初始化 xt_drug_cancel_stock(完成)
659
+// 初始化 xt_drug_cancel_stock(完成)
659
 func initxt_drug_cancel_stock(tx *gorm.DB) (err error) {
660
 func initxt_drug_cancel_stock(tx *gorm.DB) (err error) {
660
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_cancel_stock as t," +
661
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_cancel_stock as t," +
661
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
662
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
666
 	return
667
 	return
667
 }
668
 }
668
 
669
 
669
-//初始化 xt_drug_cancel_stock_info(完成)
670
+// 初始化 xt_drug_cancel_stock_info(完成)
670
 func initxt_drug_cancel_stock_info(tx *gorm.DB) (err error) {
671
 func initxt_drug_cancel_stock_info(tx *gorm.DB) (err error) {
671
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_cancel_stock_info as t," +
672
 	err = tx.Exec("UPDATE sgj_xt.xt_drug_cancel_stock_info as t," +
672
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
673
 		"(SELECT t1.user_org_id as orgid,t1.drug_storehouse_out as id from sgj_xt.xt_storehouse_config as t1," +
677
 	return
678
 	return
678
 }
679
 }
679
 
680
 
680
-//初始化 xt_supplier_warehouse_info(完成)
681
+// 初始化 xt_supplier_warehouse_info(完成)
681
 func initxt_supplier_warehouse_info(tx *gorm.DB) (err error) {
682
 func initxt_supplier_warehouse_info(tx *gorm.DB) (err error) {
682
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_info as t," +
683
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_info as t," +
683
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
684
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
688
 	return
689
 	return
689
 }
690
 }
690
 
691
 
691
-//初始化 xt_supplier_warehousing_info_order(完成)
692
+// 初始化 xt_supplier_warehousing_info_order(完成)
692
 func initxt_supplier_warehousing_info_order(tx *gorm.DB) (err error) {
693
 func initxt_supplier_warehousing_info_order(tx *gorm.DB) (err error) {
693
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_info_order as t," +
694
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_info_order as t," +
694
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
695
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
699
 	return
700
 	return
700
 }
701
 }
701
 
702
 
702
-//初始化 xt_supplier_warehouse_out(完成)
703
+// 初始化 xt_supplier_warehouse_out(完成)
703
 func initxt_supplier_warehouse_out(tx *gorm.DB) (err error) {
704
 func initxt_supplier_warehouse_out(tx *gorm.DB) (err error) {
704
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_out as t," +
705
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_out as t," +
705
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
706
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_out_info as id from sgj_xt.xt_storehouse_config as t1," +
710
 	return
711
 	return
711
 }
712
 }
712
 
713
 
713
-//初始化 xt_supplier_warehousing_out_order(完成)
714
+// 初始化 xt_supplier_warehousing_out_order(完成)
714
 func initxt_supplier_warehousing_out_order(tx *gorm.DB) (err error) {
715
 func initxt_supplier_warehousing_out_order(tx *gorm.DB) (err error) {
715
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_out_order as t," +
716
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_out_order as t," +
716
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
717
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
721
 	return
722
 	return
722
 }
723
 }
723
 
724
 
724
-//初始化 xt_supplier_warehouse_cancel(完成)
725
+// 初始化 xt_supplier_warehouse_cancel(完成)
725
 func initxt_supplier_warehouse_cancel(tx *gorm.DB) (err error) {
726
 func initxt_supplier_warehouse_cancel(tx *gorm.DB) (err error) {
726
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_cancel as t," +
727
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehouse_cancel as t," +
727
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
728
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
732
 	return
733
 	return
733
 }
734
 }
734
 
735
 
735
-//初始化 xt_supplier_warehousing_cancel_order(完成)
736
+// 初始化 xt_supplier_warehousing_cancel_order(完成)
736
 func initxt_supplier_warehousing_cancel_order(tx *gorm.DB) (err error) {
737
 func initxt_supplier_warehousing_cancel_order(tx *gorm.DB) (err error) {
737
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_cancel_order as t," +
738
 	err = tx.Exec("UPDATE sgj_xt.xt_supplier_warehousing_cancel_order as t," +
738
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
739
 		"(SELECT t1.user_org_id as orgid,t1.storehouse_info as id from sgj_xt.xt_storehouse_config as t1," +
743
 	return
744
 	return
744
 }
745
 }
745
 
746
 
746
-//查询机构创建者的id
747
+// 查询机构创建者的id
747
 func Getcreateid(orgid int64) (createid models.UserOrg, err error) {
748
 func Getcreateid(orgid int64) (createid models.UserOrg, err error) {
748
 	err = XTReadDB().Select("id,creator").Where("id = ? and status = 1", orgid).Find(&createid).Error
749
 	err = XTReadDB().Select("id,creator").Where("id = ? and status = 1", orgid).Find(&createid).Error
749
 	return
750
 	return
750
 }
751
 }
751
 
752
 
752
-//根据机构id查询拥有仓库管理权限的角色
753
+// 根据机构id查询拥有仓库管理权限的角色
753
 func FindRoles(orgid int64) map[string]int {
754
 func FindRoles(orgid int64) map[string]int {
754
 	role := []models.RolePurviews{}
755
 	role := []models.RolePurviews{}
755
 	tmp := models.PurviewTmp{}
756
 	tmp := models.PurviewTmp{}
764
 	return roles
765
 	return roles
765
 }
766
 }
766
 
767
 
767
-//判断两个切片中的元素是否有重复的,true有重复的元素,false无相同元素
768
+// 判断两个切片中的元素是否有重复的,true有重复的元素,false无相同元素
768
 func IsIdentical(str1 []string, str2 []string) (t bool) {
769
 func IsIdentical(str1 []string, str2 []string) (t bool) {
769
 	t = false
770
 	t = false
770
 	if len(str1) == 0 || len(str2) == 0 {
771
 	if len(str1) == 0 || len(str2) == 0 {
785
 	return
786
 	return
786
 }
787
 }
787
 
788
 
788
-//
789
 func GetAllStoreHouseList(orgid int64) (house []*models.XtStorehouse, err error) {
789
 func GetAllStoreHouseList(orgid int64) (house []*models.XtStorehouse, err error) {
790
 
790
 
791
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&house).Error
791
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&house).Error

+ 1 - 1
service/sign_weigh_service.go Zobrazit soubor

27
 	return
27
 	return
28
 }
28
 }
29
 
29
 
30
-//GetSignPanels  签到称重班次休息
30
+// GetSignPanels  签到称重班次休息
31
 func GetSignPanels(orgid, dateTime int64) (map[int64]map[string]int64, error) {
31
 func GetSignPanels(orgid, dateTime int64) (map[int64]map[string]int64, error) {
32
 	fmt.Println(dateTime)
32
 	fmt.Println(dateTime)
33
 	fmt.Println("世界的尽头")
33
 	fmt.Println("世界的尽头")

+ 6 - 6
service/statistics_service/index_evaluation_service.go Zobrazit soubor

28
 	Value float64 `json:"value"`
28
 	Value float64 `json:"value"`
29
 }
29
 }
30
 
30
 
31
-//透析过程统计
31
+// 透析过程统计
32
 func GetDialysisProcessIndexChartData(user_org_id int64, patient_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ProcessIndexDataStruct, err error) {
32
 func GetDialysisProcessIndexChartData(user_org_id int64, patient_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ProcessIndexDataStruct, err error) {
33
 	db := service.XTReadDB()
33
 	db := service.XTReadDB()
34
 	switch statistics_type {
34
 	switch statistics_type {
176
 
176
 
177
 //透析过程统计
177
 //透析过程统计
178
 
178
 
179
-//透析监测统计
179
+// 透析监测统计
180
 func GetDialysisWatchChartData(user_org_id int64, patient_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ProcessIndexDataStruct, err error) {
180
 func GetDialysisWatchChartData(user_org_id int64, patient_id int64, start_time int64, end_time int64, statistics_type int) (datas []*ProcessIndexDataStruct, err error) {
181
 	db := service.XTReadDB()
181
 	db := service.XTReadDB()
182
 	switch statistics_type {
182
 	switch statistics_type {
334
 
334
 
335
 //透析监测统计
335
 //透析监测统计
336
 
336
 
337
-//透析体重统计
337
+// 透析体重统计
338
 func GetDialysisWeightChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (item []*otherItemAmount, err error) {
338
 func GetDialysisWeightChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (item []*otherItemAmount, err error) {
339
 	db := service.XTReadDB()
339
 	db := service.XTReadDB()
340
 	var items []*otherItemAmount
340
 	var items []*otherItemAmount
826
 
826
 
827
 //透析体重统计
827
 //透析体重统计
828
 
828
 
829
-//透析血压统计
829
+// 透析血压统计
830
 func GetBloodPressureChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, patient_id int64) (item []*otherItemAmount, err error) {
830
 func GetBloodPressureChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, patient_id int64) (item []*otherItemAmount, err error) {
831
 	db := service.XTReadDB()
831
 	db := service.XTReadDB()
832
 	var items []*otherItemAmount
832
 	var items []*otherItemAmount
1157
 
1157
 
1158
 //透析血压统计
1158
 //透析血压统计
1159
 
1159
 
1160
-//工作量统计
1160
+// 工作量统计
1161
 func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, admin_user_id int64) (datas []*VMUserAdminRole, err error) {
1161
 func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, admin_user_id int64) (datas []*VMUserAdminRole, err error) {
1162
 	userDb := service.UserReadDB()
1162
 	userDb := service.UserReadDB()
1163
 	db := service.XTReadDB()
1163
 	db := service.XTReadDB()
1550
 //
1550
 //
1551
 //}
1551
 //}
1552
 
1552
 
1553
-//工作量统计
1553
+// 工作量统计
1554
 type AdminUser struct {
1554
 type AdminUser struct {
1555
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
1555
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
1556
 	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1556
 	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`

+ 4 - 4
service/stock_service.go Zobrazit soubor

3999
 
3999
 
4000
 func GetAllAutoRecordByPatient(patientid int64, recorddate int64) (auto []*models.WarehouseOutInfoNight, err error) {
4000
 func GetAllAutoRecordByPatient(patientid int64, recorddate int64) (auto []*models.WarehouseOutInfoNight, err error) {
4001
 
4001
 
4002
-	err = XTReadDB().Select("count,warehouse_info_id,good_id,org_id,sys_record_time,patient_id,project_id,warehouse_info_id,warehouse_out_order_number,storehouse_id,price,dealer,manufacturer,good_type_id,product_date,expiry_date,number,license_number").Where(" patient_id = ? and sys_record_time = ?  and status = 1 and is_sys = 1 and count>0 and project_id >0", patientid, recorddate).Find(&auto).Error
4002
+	err = XTReadDB().Select("count,warehouse_info_id,good_id,org_id,sys_record_time,patient_id,project_id,warehouse_info_id,warehouse_out_order_number,storehouse_id,price,dealer,manufacturer,good_type_id,product_date,expiry_date,number,license_number").Where(" patient_id = ? and sys_record_time = ?  and status = 1 and is_sys = 1 and count>0", patientid, recorddate).Find(&auto).Error
4003
 	return auto, err
4003
 	return auto, err
4004
 
4004
 
4005
 }
4005
 }
4012
 
4012
 
4013
 func DeleteAutoWarehouse(patient_id int64, record_time int64) error {
4013
 func DeleteAutoWarehouse(patient_id int64, record_time int64) error {
4014
 
4014
 
4015
-	err := XTWriteDB().Model(models.AutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4016
-	err = XTWriteDB().Model(models.DialysisBeforePrepare{}).Where("patient_id = ? and record_date = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4017
-	err = XTWriteDB().Model(models.VmStockFlow{}).Where("patient_id = ? and system_time = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"is_read": 1}).Error
4015
+	err := XTWriteDB().Model(models.AutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4016
+	err = XTWriteDB().Model(models.DialysisBeforePrepare{}).Where("patient_id = ? and record_date = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4017
+	err = XTWriteDB().Model(models.VmStockFlow{}).Where("patient_id = ? and system_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"is_read": 1}).Error
4018
 	//err = XTWriteDB().Model(models.WarehouseOutInfoNight{}).Where("patient_id = ? and sys_record_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4018
 	//err = XTWriteDB().Model(models.WarehouseOutInfoNight{}).Where("patient_id = ? and sys_record_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4019
 
4019
 
4020
 	return err
4020
 	return err

+ 19 - 19
service/supply_service.go Zobrazit soubor

8
 	"time"
8
 	"time"
9
 )
9
 )
10
 
10
 
11
-//根据供应商编号获取首要联系人
11
+// 根据供应商编号获取首要联系人
12
 func FindName(code string, orgid int64) (fistname models.SpSupplierContacts, err error) {
12
 func FindName(code string, orgid int64) (fistname models.SpSupplierContacts, err error) {
13
 	err = XTReadDB().Model(&models.SpSupplierContacts{}).Where("supplier_code = ? and status = 1 and is_first = 1 and user_org_id = ?", code, orgid).First(&fistname).Error
13
 	err = XTReadDB().Model(&models.SpSupplierContacts{}).Where("supplier_code = ? and status = 1 and is_first = 1 and user_org_id = ?", code, orgid).First(&fistname).Error
14
 	return fistname, err
14
 	return fistname, err
15
 }
15
 }
16
 
16
 
17
-//供应商分页
17
+// 供应商分页
18
 func GetSupplyList(ctype int64, page int64, limit int64, keyword string, orgid int64) (supplylist []*models.SpSupplierName, total int64, err error) {
18
 func GetSupplyList(ctype int64, page int64, limit int64, keyword string, orgid int64) (supplylist []*models.SpSupplierName, total int64, err error) {
19
 	db := XTReadDB().Model(&supplylist).Where("xt_supplier_name.status = 1 and xt_supplier_name.user_org_id = ?", orgid)
19
 	db := XTReadDB().Model(&supplylist).Where("xt_supplier_name.status = 1 and xt_supplier_name.user_org_id = ?", orgid)
20
 	offset := (page - 1) * limit
20
 	offset := (page - 1) * limit
30
 	return supplylist, total, err
30
 	return supplylist, total, err
31
 }
31
 }
32
 
32
 
33
-//修改供应商和联系人
33
+// 修改供应商和联系人
34
 func UpdateSupplyAndContact(thisStockIn []interface{}, suid, orgId, supplierType, tcreater int64, supplierCode, supplierName, number, bank, bankAccount string, vatRate float64) error {
34
 func UpdateSupplyAndContact(thisStockIn []interface{}, suid, orgId, supplierType, tcreater int64, supplierCode, supplierName, number, bank, bankAccount string, vatRate float64) error {
35
 	tx := XTWriteDB().Begin()
35
 	tx := XTWriteDB().Begin()
36
 	defer func() {
36
 	defer func() {
130
 	return err
130
 	return err
131
 }
131
 }
132
 
132
 
133
-//更新一条供应商的信息,添加了事务的
133
+// 更新一条供应商的信息,添加了事务的
134
 func UpdateSupplyNameTX(upsupply models.SpSupplierName, tx *gorm.DB) error {
134
 func UpdateSupplyNameTX(upsupply models.SpSupplierName, tx *gorm.DB) error {
135
 	err := tx.Model(&models.SpSupplierName{}).Where("id = ? and status = 1", upsupply.ID).Updates(map[string]interface{}{"supplier_code": upsupply.SupplierCode, "supplier_name": upsupply.SupplierName, "supplier_type": upsupply.SupplierType, "vat_rate": upsupply.VatRate, "number": upsupply.Number, "bank": upsupply.Bank, "bank_account": upsupply.BankAccount, "user_org_id": upsupply.UserOrgId, "status": upsupply.Status, "contacts_id": upsupply.ContactsId, "mtime": upsupply.Mtime, "modify": upsupply.Modify}).Error
135
 	err := tx.Model(&models.SpSupplierName{}).Where("id = ? and status = 1", upsupply.ID).Updates(map[string]interface{}{"supplier_code": upsupply.SupplierCode, "supplier_name": upsupply.SupplierName, "supplier_type": upsupply.SupplierType, "vat_rate": upsupply.VatRate, "number": upsupply.Number, "bank": upsupply.Bank, "bank_account": upsupply.BankAccount, "user_org_id": upsupply.UserOrgId, "status": upsupply.Status, "contacts_id": upsupply.ContactsId, "mtime": upsupply.Mtime, "modify": upsupply.Modify}).Error
136
 	return err
136
 	return err
137
 }
137
 }
138
 
138
 
139
-//更新一条供应商的信息,没有添加事务
139
+// 更新一条供应商的信息,没有添加事务
140
 func UpdateSupplyName(upsupply models.SpSupplierName) error {
140
 func UpdateSupplyName(upsupply models.SpSupplierName) error {
141
 	err := XTWriteDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1", upsupply.ID).Updates(map[string]interface{}{"supplier_code": upsupply.SupplierCode, "supplier_name": upsupply.SupplierName, "supplier_type": upsupply.SupplierType, "vat_rate": upsupply.VatRate, "number": upsupply.Number, "bank": upsupply.Bank, "bank_account": upsupply.BankAccount, "user_org_id": upsupply.UserOrgId, "status": upsupply.Status, "contacts_id": upsupply.ContactsId, "mtime": upsupply.Mtime, "modify": upsupply.Modify}).Error
141
 	err := XTWriteDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1", upsupply.ID).Updates(map[string]interface{}{"supplier_code": upsupply.SupplierCode, "supplier_name": upsupply.SupplierName, "supplier_type": upsupply.SupplierType, "vat_rate": upsupply.VatRate, "number": upsupply.Number, "bank": upsupply.Bank, "bank_account": upsupply.BankAccount, "user_org_id": upsupply.UserOrgId, "status": upsupply.Status, "contacts_id": upsupply.ContactsId, "mtime": upsupply.Mtime, "modify": upsupply.Modify}).Error
142
 	return err
142
 	return err
143
 }
143
 }
144
 
144
 
145
-//更新一条联系人的信息
145
+// 更新一条联系人的信息
146
 func UpdateContact(updatecontacts models.SpSupplierContacts, tx *gorm.DB) error {
146
 func UpdateContact(updatecontacts models.SpSupplierContacts, tx *gorm.DB) error {
147
 	err := tx.Model(&models.SpSupplierContacts{}).Where("id = ? and status = 1", updatecontacts.ID).Updates(map[string]interface{}{"name": updatecontacts.Name, "phone": updatecontacts.Phone, "address": updatecontacts.Address, "is_first": updatecontacts.IsFirst, "supplier_code": updatecontacts.SupplierCode, "user_org_id": updatecontacts.UserOrgId, "status": updatecontacts.Status, "mtime": updatecontacts.Mtime}).Error
147
 	err := tx.Model(&models.SpSupplierContacts{}).Where("id = ? and status = 1", updatecontacts.ID).Updates(map[string]interface{}{"name": updatecontacts.Name, "phone": updatecontacts.Phone, "address": updatecontacts.Address, "is_first": updatecontacts.IsFirst, "supplier_code": updatecontacts.SupplierCode, "user_org_id": updatecontacts.UserOrgId, "status": updatecontacts.Status, "mtime": updatecontacts.Mtime}).Error
148
 	return err
148
 	return err
149
 }
149
 }
150
 
150
 
151
-//查询供应商单条记录
151
+// 查询供应商单条记录
152
 func GetSupplyOne(id int64) (supply models.SpSupplierName, err error) {
152
 func GetSupplyOne(id int64) (supply models.SpSupplierName, err error) {
153
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1", id).First(&supply).Error
153
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1", id).First(&supply).Error
154
 	return supply, err
154
 	return supply, err
155
 }
155
 }
156
 
156
 
157
-//删除单条联系人记录
157
+// 删除单条联系人记录
158
 func DelContactOne(id int64) error {
158
 func DelContactOne(id int64) error {
159
 	err := XTWriteDB().Model(&models.SpSupplierContacts{}).Where("id = ?", id).Update("status", 0).Error
159
 	err := XTWriteDB().Model(&models.SpSupplierContacts{}).Where("id = ?", id).Update("status", 0).Error
160
 	return err
160
 	return err
161
 }
161
 }
162
 
162
 
163
-//获取单条供应商和涉及到的联系人记录
163
+// 获取单条供应商和涉及到的联系人记录
164
 func GetSupplyAndContactOne(id, orgId int64) (supply models.SpSupplierName, contact []*models.SpSupplierContacts, err error) {
164
 func GetSupplyAndContactOne(id, orgId int64) (supply models.SpSupplierName, contact []*models.SpSupplierContacts, err error) {
165
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1 and user_org_id = ?", id, orgId).First(&supply).Error
165
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("id = ? and status = 1 and user_org_id = ?", id, orgId).First(&supply).Error
166
 	code := supply.SupplierCode
166
 	code := supply.SupplierCode
168
 	return supply, contact, err
168
 	return supply, contact, err
169
 }
169
 }
170
 
170
 
171
-//删除供应商及联系人
171
+// 删除供应商及联系人
172
 func DelSupply(supply models.SpSupplierName, orgId int64) (shiwu string, err error) {
172
 func DelSupply(supply models.SpSupplierName, orgId int64) (shiwu string, err error) {
173
 	tx := XTWriteDB().Begin()
173
 	tx := XTWriteDB().Begin()
174
 	defer func() {
174
 	defer func() {
197
 	return shiwu, err
197
 	return shiwu, err
198
 }
198
 }
199
 
199
 
200
-//保存供应商和联系人
200
+// 保存供应商和联系人
201
 func SaveSupplyAndContact(thisStockIn []interface{}, orgId, supplierType, tcreater int64, supplierCode, supplierName, number, bank, bankAccount string, vatRate float64) error {
201
 func SaveSupplyAndContact(thisStockIn []interface{}, orgId, supplierType, tcreater int64, supplierCode, supplierName, number, bank, bankAccount string, vatRate float64) error {
202
 	tx := XTWriteDB().Begin()
202
 	tx := XTWriteDB().Begin()
203
 	defer func() {
203
 	defer func() {
272
 	return err
272
 	return err
273
 }
273
 }
274
 
274
 
275
-//获取供应商编码
275
+// 获取供应商编码
276
 func GetSuppliyCode(orgId int64) (spcode []*models.SpSupplierName, err error) {
276
 func GetSuppliyCode(orgId int64) (spcode []*models.SpSupplierName, err error) {
277
 	err = XTReadDB().Model(&models.SpSupplierName{}).Select("supplier_code").Where("supplier_code like 'gys%' and status = 1 and user_org_id = ? ", orgId).Order("supplier_code desc").First(&spcode).Error
277
 	err = XTReadDB().Model(&models.SpSupplierName{}).Select("supplier_code").Where("supplier_code like 'gys%' and status = 1 and user_org_id = ? ", orgId).Order("supplier_code desc").First(&spcode).Error
278
 	return spcode, err
278
 	return spcode, err
279
 }
279
 }
280
 
280
 
281
-//查询供应商的名字是否有重复
281
+// 查询供应商的名字是否有重复
282
 func FindSupplierName(supplierName string, orgId int64) (sbool bool, err error) {
282
 func FindSupplierName(supplierName string, orgId int64) (sbool bool, err error) {
283
 	var total int
283
 	var total int
284
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_name = ? and user_org_id = ? and status = 1", supplierName, orgId).Count(&total).Error
284
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_name = ? and user_org_id = ? and status = 1", supplierName, orgId).Count(&total).Error
290
 	return sbool, err
290
 	return sbool, err
291
 }
291
 }
292
 
292
 
293
-//查询供应商的编号是否有重复(用于修改)
293
+// 查询供应商的编号是否有重复(用于修改)
294
 func FindSupplierCode(supplierCode string, supplierid, orgid int64) (codebool bool, err error) {
294
 func FindSupplierCode(supplierCode string, supplierid, orgid int64) (codebool bool, err error) {
295
 	var total int
295
 	var total int
296
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_code = ? and id != ? and user_org_id = ? and status = 1", supplierCode, supplierid, orgid).Count(&total).Error
296
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_code = ? and id != ? and user_org_id = ? and status = 1", supplierCode, supplierid, orgid).Count(&total).Error
302
 	return codebool, err
302
 	return codebool, err
303
 }
303
 }
304
 
304
 
305
-//查询供应商的编号是否有重复(用于新增)
305
+// 查询供应商的编号是否有重复(用于新增)
306
 func FindSupplierCodes(supplierCode string, orgid int64) (codebool bool, err error) {
306
 func FindSupplierCodes(supplierCode string, orgid int64) (codebool bool, err error) {
307
 	var total int
307
 	var total int
308
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_code = ? and status = 1 and user_org_id = ?", supplierCode, orgid).Count(&total).Error
308
 	err = XTReadDB().Model(&models.SpSupplierName{}).Where("supplier_code = ? and status = 1 and user_org_id = ?", supplierCode, orgid).Count(&total).Error
314
 	return codebool, err
314
 	return codebool, err
315
 }
315
 }
316
 
316
 
317
-//保存一条供应商数据加事务的
317
+// 保存一条供应商数据加事务的
318
 func SaveSupplyTx(supply models.SpSupplierName, tx *gorm.DB) error {
318
 func SaveSupplyTx(supply models.SpSupplierName, tx *gorm.DB) error {
319
 	err := tx.Create(&supply).Error
319
 	err := tx.Create(&supply).Error
320
 	return err
320
 	return err
321
 }
321
 }
322
 
322
 
323
-//保存一条供应商数据没有事务的
323
+// 保存一条供应商数据没有事务的
324
 func SaveSupply(supply models.SpSupplierName) error {
324
 func SaveSupply(supply models.SpSupplierName) error {
325
 	err := XTWriteDB().Create(&supply).Error
325
 	err := XTWriteDB().Create(&supply).Error
326
 	return err
326
 	return err
327
 }
327
 }
328
 
328
 
329
-//获取联系人的id
329
+// 获取联系人的id
330
 func SaveContactsId(tx *gorm.DB, orgid int64) (spconid []*models.SpSupplierContacts, err error) {
330
 func SaveContactsId(tx *gorm.DB, orgid int64) (spconid []*models.SpSupplierContacts, err error) {
331
 	err = tx.Model(&models.SpSupplierContacts{}).Select("id").Where("status = 1 and user_org_id = ?", orgid).Order("id desc").First(&spconid).Error
331
 	err = tx.Model(&models.SpSupplierContacts{}).Select("id").Where("status = 1 and user_org_id = ?", orgid).Order("id desc").First(&spconid).Error
332
 	return
332
 	return
333
 }
333
 }
334
 
334
 
335
-//保存一条联系人数据
335
+// 保存一条联系人数据
336
 func SaveContacts(spcontacts models.SpSupplierContacts, tx *gorm.DB) error {
336
 func SaveContacts(spcontacts models.SpSupplierContacts, tx *gorm.DB) error {
337
 	err := tx.Create(&spcontacts).Error
337
 	err := tx.Create(&spcontacts).Error
338
 	return err
338
 	return err

+ 20 - 0
service/user_service.go Zobrazit soubor

68
 	return
68
 	return
69
 }
69
 }
70
 
70
 
71
+func GetAllDoctorAndNurseSeven(orgId int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
72
+
73
+	var users []AdminUserList
74
+	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("org_id=?  and uar.user_type IN (2,3)", orgId).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&users).Error
75
+	if err != nil {
76
+		return
77
+	}
78
+	if len(users) == 0 {
79
+		return
80
+	}
81
+	for _, item := range users {
82
+		if item.UserType == 2 {
83
+			doctors = append(doctors, item)
84
+		} else {
85
+			nurses = append(nurses, item)
86
+		}
87
+	}
88
+	return
89
+}
90
+
71
 func GetAllAdminUsers(orgId, appid int64) (list []*AdminUserList, err error) {
91
 func GetAllAdminUsers(orgId, appid int64) (list []*AdminUserList, err error) {
72
 
92
 
73
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error
93
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error

+ 53 - 46
service/verify_login_token_service.go Zobrazit soubor

130
 		return nil, err, 0
130
 		return nil, err, 0
131
 	}
131
 	}
132
 
132
 
133
-
134
 	if respJSON["state"].(float64) != 1 {
133
 	if respJSON["state"].(float64) != 1 {
135
 		msg := respJSON["msg"].(string)
134
 		msg := respJSON["msg"].(string)
136
 		utils.ErrorLog("验证 sso token 接口请求失败: %v", msg)
135
 		utils.ErrorLog("验证 sso token 接口请求失败: %v", msg)
204
 }
203
 }
205
 
204
 
206
 // "orgs": { (org_id: Org_Obj)
205
 // "orgs": { (org_id: Org_Obj)
207
-// 	1: { Org's json },
208
-// 	2: { Org's json },
209
-// },
206
+//
207
+//		1: { Org's json },
208
+//		2: { Org's json },
209
+//	},
210
 func processOrgs(data map[string]interface{}) map[int64]*models.Org {
210
 func processOrgs(data map[string]interface{}) map[int64]*models.Org {
211
 	orgJSONs := data["orgs"].(map[string]interface{})
211
 	orgJSONs := data["orgs"].(map[string]interface{})
212
 	orgs := make(map[int64]*models.Org)
212
 	orgs := make(map[int64]*models.Org)
220
 }
220
 }
221
 
221
 
222
 // "org_app_ids": { (org_id: org_app_ids)
222
 // "org_app_ids": { (org_id: org_app_ids)
223
-// 	1: [11, 12, 13],
224
-// 	2: [21, 22, 23],
225
-// },
223
+//
224
+//		1: [11, 12, 13],
225
+//		2: [21, 22, 23],
226
+//	},
226
 func processOrgAppIds(data map[string]interface{}) map[int64][]int64 {
227
 func processOrgAppIds(data map[string]interface{}) map[int64][]int64 {
227
 	orgAppIdStrs := data["org_app_ids"].(map[string]interface{})
228
 	orgAppIdStrs := data["org_app_ids"].(map[string]interface{})
228
 	orgAppIds := make(map[int64][]int64)
229
 	orgAppIds := make(map[int64][]int64)
239
 }
240
 }
240
 
241
 
241
 // "org_apps": { (org_id: {app_id: OrgApp_Obj})
242
 // "org_apps": { (org_id: {app_id: OrgApp_Obj})
242
-// 	1: {
243
-// 		11: { OrgApp's json },
244
-// 		12: { OrgApp's json },
245
-// 	},
246
-// 	2: {
247
-// 		21: { OrgApp's json },
248
-// 		22: { OrgApp's json },
249
-// 	},
250
-// },
243
+//
244
+//		1: {
245
+//			11: { OrgApp's json },
246
+//			12: { OrgApp's json },
247
+//		},
248
+//		2: {
249
+//			21: { OrgApp's json },
250
+//			22: { OrgApp's json },
251
+//		},
252
+//	},
251
 func processOrgApps(data map[string]interface{}) map[int64]map[int64]*models.OrgApp {
253
 func processOrgApps(data map[string]interface{}) map[int64]map[int64]*models.OrgApp {
252
 	orgAppJSONs := data["org_apps"].(map[string]interface{})
254
 	orgAppJSONs := data["org_apps"].(map[string]interface{})
253
 	orgApps := make(map[int64]map[int64]*models.OrgApp)
255
 	orgApps := make(map[int64]map[int64]*models.OrgApp)
269
 }
271
 }
270
 
272
 
271
 // "app_to_org_ids": { (app_id: org_id)
273
 // "app_to_org_ids": { (app_id: org_id)
272
-// 	11: 1,
273
-// 	12: 1,
274
-// 	21: 2,
275
-// 	22: 2,
276
-// },
274
+//
275
+//		11: 1,
276
+//		12: 1,
277
+//		21: 2,
278
+//		22: 2,
279
+//	},
277
 func processApp2OrgIds(data map[string]interface{}) map[int64]int64 {
280
 func processApp2OrgIds(data map[string]interface{}) map[int64]int64 {
278
 	app2OrgIdStrs := data["app_to_org_ids"].(map[string]interface{})
281
 	app2OrgIdStrs := data["app_to_org_ids"].(map[string]interface{})
279
 	app2OrgIds := make(map[int64]int64)
282
 	app2OrgIds := make(map[int64]int64)
286
 }
289
 }
287
 
290
 
288
 // "app_roles": { (app_id: App_Role Obj)
291
 // "app_roles": { (app_id: App_Role Obj)
289
-// 	11: {App_Role's json},
290
-// 	12: {App_Role's json},
291
-// 	21: {App_Role's json},
292
-// },
292
+//
293
+//		11: {App_Role's json},
294
+//		12: {App_Role's json},
295
+//		21: {App_Role's json},
296
+//	},
293
 func processAppRoles(data map[string]interface{}) map[int64]*models.App_Role {
297
 func processAppRoles(data map[string]interface{}) map[int64]*models.App_Role {
294
 	appRoleJSONs := data["app_roles"].(map[string]interface{})
298
 	appRoleJSONs := data["app_roles"].(map[string]interface{})
295
 	appRoles := make(map[int64]*models.App_Role)
299
 	appRoles := make(map[int64]*models.App_Role)
303
 }
307
 }
304
 
308
 
305
 // "purviews": { (app_id: [processed Purviews' json])
309
 // "purviews": { (app_id: [processed Purviews' json])
306
-// 	11: [
307
-// 		{Purview's json .childs[
308
-// 			{Purview's json},
309
-// 			{Purview's json},
310
-// 		]},
311
-// 		{Purview's json},
312
-// 	],
313
-// 	12: [
314
-// 		{Purview's json},
315
-// 		{Purview's json},
316
-// 	],
317
-// },
310
+//
311
+//		11: [
312
+//			{Purview's json .childs[
313
+//				{Purview's json},
314
+//				{Purview's json},
315
+//			]},
316
+//			{Purview's json},
317
+//		],
318
+//		12: [
319
+//			{Purview's json},
320
+//			{Purview's json},
321
+//		],
322
+//	},
318
 func processPurviews(data map[string]interface{}) map[int64][]*models.Purview {
323
 func processPurviews(data map[string]interface{}) map[int64][]*models.Purview {
319
 	appPurviewJSONsStrs := data["purviews"].(map[string]interface{})
324
 	appPurviewJSONsStrs := data["purviews"].(map[string]interface{})
320
 	appPurviews := make(map[int64][]*models.Purview)
325
 	appPurviews := make(map[int64][]*models.Purview)
345
 // }
350
 // }
346
 
351
 
347
 // "purview_urlfors": { (app_id: [url_for])
352
 // "purview_urlfors": { (app_id: [url_for])
348
-// 	11: [
349
-// 		"Controller1.Action1",
350
-// 		"Controller1.Action2",
351
-// 		"Controller2.Action1",
352
-// 		"Controller2.Action2",
353
-// 	],
354
-// }
353
+//
354
+//		11: [
355
+//			"Controller1.Action1",
356
+//			"Controller1.Action2",
357
+//			"Controller2.Action1",
358
+//			"Controller2.Action2",
359
+//		],
360
+//	}
355
 func processPurviewUrlfors(data map[string]interface{}) map[int64][]string {
361
 func processPurviewUrlfors(data map[string]interface{}) map[int64][]string {
356
 	appUrlforsStrs := data["purview_urlfors"].(map[string]interface{})
362
 	appUrlforsStrs := data["purview_urlfors"].(map[string]interface{})
357
 	appUrlfors := make(map[int64][]string)
363
 	appUrlfors := make(map[int64][]string)
365
 }
371
 }
366
 
372
 
367
 // "org_subscibes": { (org_id: ServeSubscibe)
373
 // "org_subscibes": { (org_id: ServeSubscibe)
368
-//  11: {ServeSubscibe's json}
369
-// },
374
+//
375
+//	 11: {ServeSubscibe's json}
376
+//	},
370
 func processOrgSubscibes(data map[string]interface{}) map[int64]*models.ServeSubscibe {
377
 func processOrgSubscibes(data map[string]interface{}) map[int64]*models.ServeSubscibe {
371
 	subscibeJSONs := data["org_subscibes"].(map[string]interface{})
378
 	subscibeJSONs := data["org_subscibes"].(map[string]interface{})
372
 	subscibes := make(map[int64]*models.ServeSubscibe)
379
 	subscibes := make(map[int64]*models.ServeSubscibe)

+ 67 - 4
service/warhouse_service.go Zobrazit soubor

83
 // 药品自动出库 递归方式
83
 // 药品自动出库 递归方式
84
 func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.DoctorAdvice) (err error) {
84
 func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.DoctorAdvice) (err error) {
85
 
85
 
86
+	drugError := models.XtDrugError{
87
+		ID:                    0,
88
+		UserOrgId:             advice.UserOrgId,
89
+		DrugId:                advice.DrugId,
90
+		RecordDate:            advice.AdviceDate,
91
+		PatientId:             advice.PatientId,
92
+		Remark:                "恒泰中医院出库进来",
93
+		Status:                1,
94
+		Ctime:                 time.Now().Unix(),
95
+		Mtime:                 0,
96
+		Prescribingnumber:     advice.PrescribingNumber,
97
+		PrescribingNumberUnit: advice.PrescribingNumberUnit,
98
+		SumCount:              0,
99
+	}
100
+	CreateDrugError(drugError)
86
 	// 判断处方里药品单位是拆零单位还是包装单位,	如果是包装单位,则根据规格,将包装数量转为拆零数量
101
 	// 判断处方里药品单位是拆零单位还是包装单位,	如果是包装单位,则根据规格,将包装数量转为拆零数量
87
 	var deliver_number int64 = 0
102
 	var deliver_number int64 = 0
88
 	var stock_number int64 = 0
103
 	var stock_number int64 = 0
249
 			StorehouseId:            storeConfig.DrugStorehouseOut,
264
 			StorehouseId:            storeConfig.DrugStorehouseOut,
250
 			IsCheck:                 1,
265
 			IsCheck:                 1,
251
 			OverCount:               sum_count,
266
 			OverCount:               sum_count,
267
+			AdviceId:                advice.ID,
252
 		}
268
 		}
253
 
269
 
254
 		errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
270
 		errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
282
 			WarehouseOutDetailId:    lastDrugOutInfo.ID,
298
 			WarehouseOutDetailId:    lastDrugOutInfo.ID,
283
 			LastPrice:               warehouse.Price,
299
 			LastPrice:               warehouse.Price,
284
 			OverCount:               sum_count,
300
 			OverCount:               sum_count,
301
+			AdviceId:                advice.ID,
285
 		}
302
 		}
286
 
303
 
287
 		CreateDrugFlowOne(drugflow)
304
 		CreateDrugFlowOne(drugflow)
302
 			CountUnit:               drup.MinUnit,
319
 			CountUnit:               drup.MinUnit,
303
 			WarehouseInfoId:         warehouse.ID,
320
 			WarehouseInfoId:         warehouse.ID,
304
 			StorehouseId:            storeConfig.DrugStorehouseOut,
321
 			StorehouseId:            storeConfig.DrugStorehouseOut,
322
+			AdviceId:                advice.ID,
305
 		}
323
 		}
306
 		errTwo := AddSigleDrugAutoReduceRecordInfo(details)
324
 		errTwo := AddSigleDrugAutoReduceRecordInfo(details)
307
 		if errTwo != nil {
325
 		if errTwo != nil {
346
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
364
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
347
 			StorehouseId:            storeConfig.DrugStorehouseOut,
365
 			StorehouseId:            storeConfig.DrugStorehouseOut,
348
 			IsCheck:                 1,
366
 			IsCheck:                 1,
367
+			AdviceId:                advice.ID,
349
 		}
368
 		}
350
 		errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
369
 		errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
351
 		if errOne != nil {
370
 		if errOne != nil {
366
 			CountUnit:               drup.MinUnit,
385
 			CountUnit:               drup.MinUnit,
367
 			WarehouseInfoId:         warehouse.ID,
386
 			WarehouseInfoId:         warehouse.ID,
368
 			StorehouseId:            storeConfig.DrugStorehouseOut,
387
 			StorehouseId:            storeConfig.DrugStorehouseOut,
388
+			AdviceId:                advice.ID,
369
 		}
389
 		}
370
 		errTwo := AddSigleDrugAutoReduceRecordInfo(details)
390
 		errTwo := AddSigleDrugAutoReduceRecordInfo(details)
371
 		if errTwo != nil {
391
 		if errTwo != nil {
455
 			WarehouseOutDetailId:    lastDrugOutInfo.ID,
475
 			WarehouseOutDetailId:    lastDrugOutInfo.ID,
456
 			LastPrice:               warehouse.Price,
476
 			LastPrice:               warehouse.Price,
457
 			OverCount:               sum_count,
477
 			OverCount:               sum_count,
478
+			AdviceId:                advice.ID,
458
 		}
479
 		}
459
 
480
 
460
 		CreateDrugFlowOne(drugflow)
481
 		CreateDrugFlowOne(drugflow)
4005
 
4026
 
4006
 		AddWarehosingInfo(warehouseInfo)
4027
 		AddWarehosingInfo(warehouseInfo)
4007
 
4028
 
4029
+		//查询剩余库存
4030
+		goodListOne, _ := GetAllGoodSumCount(goods.GoodId, orgID, warehouseInfo.StorehouseId)
4031
+		var sum_count_one int64
4032
+		for _, item := range goodListOne {
4033
+			sum_count_one += item.StockCount
4034
+		}
4008
 		stockInfoFlow := models.VmStockFlow{
4035
 		stockInfoFlow := models.VmStockFlow{
4009
 			WarehousingId:           warehouseInfo.WarehousingId,
4036
 			WarehousingId:           warehouseInfo.WarehousingId,
4010
 			GoodId:                  goods.GoodId,
4037
 			GoodId:                  goods.GoodId,
4038
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
4065
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
4039
 			StorehouseId:            warehouseInfo.StorehouseId,
4066
 			StorehouseId:            warehouseInfo.StorehouseId,
4040
 			SecondWarehouseInfoId:   warehouseInfo.SecondWarehouseInfoId,
4067
 			SecondWarehouseInfoId:   warehouseInfo.SecondWarehouseInfoId,
4068
+			OverCount:               sum_count_one,
4041
 		}
4069
 		}
4042
 
4070
 
4043
 		//创建入库流水
4071
 		//创建入库流水
4178
 
4206
 
4179
 		AddWarehosingInfo(warehouseInfo)
4207
 		AddWarehosingInfo(warehouseInfo)
4180
 
4208
 
4209
+		//查询剩余库存
4210
+		goodListOne, _ := GetAllGoodSumCount(goods.GoodId, orgID, warehouseInfo.StorehouseId)
4211
+		var sum_count_one int64
4212
+		for _, item := range goodListOne {
4213
+			sum_count_one += item.StockCount
4214
+		}
4181
 		stockInfoFlow := models.VmStockFlow{
4215
 		stockInfoFlow := models.VmStockFlow{
4182
 			WarehousingId:           warehouseInfo.WarehousingId,
4216
 			WarehousingId:           warehouseInfo.WarehousingId,
4183
 			GoodId:                  goods.GoodId,
4217
 			GoodId:                  goods.GoodId,
4211
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
4245
 			SupplyWarehouseId:       warehouse.SupplyWarehouseId,
4212
 			StorehouseId:            warehouseInfo.StorehouseId,
4246
 			StorehouseId:            warehouseInfo.StorehouseId,
4213
 			SecondWarehouseInfoId:   warehouseInfo.SecondWarehouseInfoId,
4247
 			SecondWarehouseInfoId:   warehouseInfo.SecondWarehouseInfoId,
4248
+			OverCount:               sum_count_one,
4214
 		}
4249
 		}
4215
 
4250
 
4216
 		//创建出库流水
4251
 		//创建出库流水
4246
 	//开启事物
4281
 	//开启事物
4247
 	//storeConfig, _ := GetAllStoreHouseConfig(orgID)
4282
 	//storeConfig, _ := GetAllStoreHouseConfig(orgID)
4248
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, warehouseout.StorehouseId)
4283
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, warehouseout.StorehouseId)
4249
-	fmt.Println("lastWarehouse.StockMinNumber", lastWarehouse.StockMinNumber)
4250
-	fmt.Println("drup.MinNumber", drup.MinNumber)
4284
+	//fmt.Println("lastWarehouse.StockMinNumber", lastWarehouse.StockMinNumber)
4285
+	//fmt.Println("drup.MinNumber", drup.MinNumber)
4251
 	if lastWarehouse.StockMinNumber >= drup.MinNumber {
4286
 	if lastWarehouse.StockMinNumber >= drup.MinNumber {
4252
 		var stockMax int64
4287
 		var stockMax int64
4253
 		var stockMin int64
4288
 		var stockMin int64
4268
 
4303
 
4269
 	stock_number = warehouse.StockMaxNumber*drup.MinNumber + warehouse.StockMinNumber
4304
 	stock_number = warehouse.StockMaxNumber*drup.MinNumber + warehouse.StockMinNumber
4270
 
4305
 
4271
-	fmt.Println("stock23233233232", stock_number)
4272
-	fmt.Println("deliver_number", deliver_number)
4306
+	//fmt.Println("stock23233233232", stock_number)
4307
+	//fmt.Println("deliver_number", deliver_number)
4273
 
4308
 
4274
 	// 出库完成后,要减去对应批次的库存数量
4309
 	// 出库完成后,要减去对应批次的库存数量
4275
 	// 判断处方里药品单位是拆零单位还是包装单位,	如果是拆零单位,则根据规格,将拆零数量转为包装数量
4310
 	// 判断处方里药品单位是拆零单位还是包装单位,	如果是拆零单位,则根据规格,将拆零数量转为包装数量
4434
 
4469
 
4435
 		CreateDrugWarehouseInfo(drugInfo)
4470
 		CreateDrugWarehouseInfo(drugInfo)
4436
 
4471
 
4472
+		//查询剩余库存
4473
+		stockInfoOne, _ := GetDrugAllStockInfo(drugWarehouse.StorehouseId, orgID, advice.DrugId)
4474
+		var sum_count_one int64
4475
+		for _, its := range stockInfoOne {
4476
+			if its.MaxUnit == drup.MaxUnit {
4477
+				its.StockMaxNumber = its.StockMaxNumber * drup.MinNumber
4478
+			}
4479
+			sum_count_one += its.StockMaxNumber + its.StockMinNumber
4480
+		}
4437
 		flow := models.DrugFlow{
4481
 		flow := models.DrugFlow{
4438
 			WarehousingId:           drugWarehouse.WarehousingId,
4482
 			WarehousingId:           drugWarehouse.WarehousingId,
4439
 			DrugId:                  warehouse.DrugId,
4483
 			DrugId:                  warehouse.DrugId,
4470
 			StockMinNumber:          deliver_number,
4514
 			StockMinNumber:          deliver_number,
4471
 			StorehouseId:            drugWarehouse.StorehouseId,
4515
 			StorehouseId:            drugWarehouse.StorehouseId,
4472
 			SecondWarehouseInfoId:   drugWarehouse.SecondWarehouseInfoId,
4516
 			SecondWarehouseInfoId:   drugWarehouse.SecondWarehouseInfoId,
4517
+			OverCount:               sum_count_one,
4473
 		}
4518
 		}
4474
 
4519
 
4475
 		CreateDrugFlowOne(flow)
4520
 		CreateDrugFlowOne(flow)
4602
 
4647
 
4603
 		CreateDrugWarehouseInfo(drugInfo)
4648
 		CreateDrugWarehouseInfo(drugInfo)
4604
 
4649
 
4650
+		//查询剩余库存
4651
+		stockInfoTwo, _ := GetDrugAllStockInfo(drugWarehouse.StorehouseId, orgID, advice.DrugId)
4652
+		var sum_count_one int64
4653
+		for _, its := range stockInfoTwo {
4654
+			if its.MaxUnit == drup.MaxUnit {
4655
+				its.StockMaxNumber = its.StockMaxNumber * drup.MinNumber
4656
+			}
4657
+			sum_count_one += its.StockMaxNumber + its.StockMinNumber
4658
+		}
4605
 		flow := models.DrugFlow{
4659
 		flow := models.DrugFlow{
4606
 			WarehousingId:           drugWarehouse.WarehousingId,
4660
 			WarehousingId:           drugWarehouse.WarehousingId,
4607
 			DrugId:                  warehouse.DrugId,
4661
 			DrugId:                  warehouse.DrugId,
7489
 	err := XTWriteDB().Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"execution_time": "", "execution_staff": "", "execution_state": 2}).Error
7543
 	err := XTWriteDB().Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"execution_time": "", "execution_staff": "", "execution_state": 2}).Error
7490
 	return err
7544
 	return err
7491
 }
7545
 }
7546
+
7547
+func GetAdviceIsOut(advice_id int64, user_org_id int64, patient_id int64, advice_date int64, drug_id int64) (models.DrugWarehouseOutInfo, error) {
7548
+
7549
+	advice := models.DrugWarehouseOutInfo{}
7550
+
7551
+	err := XTReadDB().Where("advice_id = ? and org_id = ? and patient_id = ? and sys_record_time = ? and status=1 and drug_id = ?", advice_id, user_org_id, patient_id, advice_date, drug_id).Find(&advice).Error
7552
+
7553
+	return advice, err
7554
+}

+ 0 - 1
src/golang.org/x/sync

1
-Subproject commit f12130a5280420d36872ab0a7717d160c768df46

+ 1 - 0
tests/default_test.go Zobrazit soubor

1
 package test
1
 package test
2
+
2
 //
3
 //
3
 //import (
4
 //import (
4
 //	_ "XT_New/routers"
5
 //	_ "XT_New/routers"

+ 4 - 4
utils/tools.go Zobrazit soubor

72
 	return ""
72
 	return ""
73
 }
73
 }
74
 
74
 
75
-//Signature sha1签名
75
+// Signature sha1签名
76
 func Signature(params ...string) string {
76
 func Signature(params ...string) string {
77
 	sort.Strings(params)
77
 	sort.Strings(params)
78
 	h := sha1.New()
78
 	h := sha1.New()
82
 	return fmt.Sprintf("%x", h.Sum(nil))
82
 	return fmt.Sprintf("%x", h.Sum(nil))
83
 }
83
 }
84
 
84
 
85
-//RandomStr 随机生成字符串
85
+// RandomStr 随机生成字符串
86
 func RandomStr(length int) string {
86
 func RandomStr(length int) string {
87
 	str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
87
 	str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
88
 	bytes := []byte(str)
88
 	bytes := []byte(str)
94
 	return string(result)
94
 	return string(result)
95
 }
95
 }
96
 
96
 
97
-//GetCurrTs return current timestamps
97
+// GetCurrTs return current timestamps
98
 func GetCurrTs() int64 {
98
 func GetCurrTs() int64 {
99
 	return time.Now().Unix()
99
 	return time.Now().Unix()
100
 }
100
 }
154
 	Signature string `json:"signature"`
154
 	Signature string `json:"signature"`
155
 }
155
 }
156
 
156
 
157
-//GetAJTConfig jsapi_ticket config
157
+// GetAJTConfig jsapi_ticket config
158
 func GetAJTConfig(jsapiTicket, uri string) (jSapiConfig, error) {
158
 func GetAJTConfig(jsapiTicket, uri string) (jSapiConfig, error) {
159
 	var config jSapiConfig
159
 	var config jSapiConfig
160
 	nonceStr := RandomStr(16)
160
 	nonceStr := RandomStr(16)