Kaynağa Gözat

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

张保健 3 yıl önce
ebeveyn
işleme
c3753478aa
34 değiştirilmiş dosya ile 1839 ekleme ve 612 silme
  1. 1 1
      conf/app.conf
  2. 5 12
      controllers/data_api_controller.go
  3. 63 1
      controllers/dialysis_api_controller.go
  4. 84 69
      controllers/dialysis_record_api_controller.go
  5. 79 43
      controllers/doctors_api_controller.go
  6. 11 0
      controllers/gobal_config_api_controller.go
  7. 93 92
      controllers/manage_api_controller.go
  8. 69 6
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 47 39
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  10. 1 1
      controllers/mobile_api_controllers/doctor_advice_api_controller.go
  11. 16 0
      controllers/mobile_api_controllers/patient_api_controller.go
  12. 45 24
      controllers/new_mobile_api_controllers/common_api_controller.go
  13. 4 2
      controllers/new_mobile_api_controllers/good_types.json
  14. 40 17
      controllers/new_mobile_api_controllers/new_common_api_controller.go
  15. 10 0
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  16. 92 80
      controllers/patient_api_controller.go
  17. 442 7
      controllers/schedule_api_controller.go
  18. 13 0
      controllers/stock_in_api_controller.go
  19. 32 0
      models/device_models.go
  20. 136 121
      models/dialysis.go
  21. 1 0
      models/doctor_advice_models.go
  22. 13 0
      models/patient_models.go
  23. 58 17
      models/schedule_models.go
  24. 1 0
      routers/router.go
  25. 197 34
      service/common_service.go
  26. 1 1
      service/dialysis_service.go
  27. 5 0
      service/doctor_advice_service.go
  28. 6 0
      service/gobal_config_service.go
  29. 73 31
      service/mobile_dialysis_service.go
  30. 1 1
      service/patient_service.go
  31. 36 2
      service/patientmanage_service.go
  32. 7 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  33. 151 11
      service/schedule_service.go
  34. 6 0
      service/stock_service.go

+ 1 - 1
conf/app.conf Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 #

+ 5 - 12
controllers/data_api_controller.go Dosyayı Görüntüle

@@ -892,8 +892,7 @@ func (c *DataApiController) DeleteExecutionFrequency() {
892 892
 func (c *DataApiController) CreateAdviceTemplate() {
893 893
 	templateName := c.GetString("template_name")
894 894
 	advice_type, _ := c.GetInt64("advice_type")
895
-
896
-	fmt.Println(templateName)
895
+	sort, _ := c.GetInt64("sort")
897 896
 
898 897
 	if templateName == "" {
899 898
 		utils.ErrorLog("模版名称不能为空")
@@ -921,13 +920,6 @@ func (c *DataApiController) CreateAdviceTemplate() {
921 920
 		}
922 921
 	}
923 922
 
924
-	//total := service.FindTemplateRecordByName(adminUserInfo.CurrentOrgId, templateName);
925
-	//if total > 0 {
926
-	//	utils.ErrorLog("模版名称已经存在")
927
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameWrong)
928
-	//	return
929
-	//}
930
-
931 923
 	template := &models.DoctorAdviceParentTemplate{
932 924
 		Name:        templateName,
933 925
 		OrgId:       adminUserInfo.CurrentOrgId,
@@ -935,6 +927,7 @@ func (c *DataApiController) CreateAdviceTemplate() {
935 927
 		CreatedTime: time.Now().Unix(),
936 928
 		UpdatedTime: time.Now().Unix(),
937 929
 		AdviceType:  advice_type,
930
+		Sort:        sort,
938 931
 	}
939 932
 
940 933
 	createErr := service.CreateTemplate(template)
@@ -1326,7 +1319,7 @@ func (c *DataApiController) CreateSubAdviceTemplate() {
1326 1319
 func (this *DataApiController) ModifyTemplateName() {
1327 1320
 	template_name := this.GetString("template_name")
1328 1321
 	template_id, _ := this.GetInt64("template_id", 0)
1329
-
1322
+	sort, _ := this.GetInt64("sort")
1330 1323
 	if len(template_name) <= 0 {
1331 1324
 		utils.ErrorLog("模版名字不能为空")
1332 1325
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamEmptyWrong)
@@ -1344,7 +1337,7 @@ func (this *DataApiController) ModifyTemplateName() {
1344 1337
 	template, _ := service.FindParentTemplateRecordById(adminUserInfo.CurrentOrgId, template_id)
1345 1338
 	var err error
1346 1339
 	if template.Name == template_name {
1347
-		err = service.ModifyTemplateName(template_id, template_name)
1340
+		err = service.ModifyTemplateNameOne(template_id, template_name, sort)
1348 1341
 		if err != nil {
1349 1342
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
1350 1343
 			return
@@ -1356,7 +1349,7 @@ func (this *DataApiController) ModifyTemplateName() {
1356 1349
 		//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameWrong)
1357 1350
 		//	return
1358 1351
 		//}
1359
-		err = service.ModifyTemplateName(template_id, template_name)
1352
+		err = service.ModifyTemplateNameOne(template_id, template_name, sort)
1360 1353
 
1361 1354
 		if err != nil {
1362 1355
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)

+ 63 - 1
controllers/dialysis_api_controller.go Dosyayı Görüntüle

@@ -249,6 +249,14 @@ func (c *DialysisApiController) PostPrescription() {
249 249
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
250 250
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
251 251
 	displace_speed := c.GetString("displace_speed")
252
+	illness, _ := c.GetInt64("illness")
253
+	amylaceum := c.GetString("amylaceum")
254
+	single_time := c.GetString("single_time")
255
+	single_water := c.GetString("single_water")
256
+	replacement_flow := c.GetString("replacement_flow")
257
+	plasma_separator := c.GetString("plasma_separator")
258
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
259
+
252 260
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
253 261
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
254 262
 
@@ -332,6 +340,13 @@ func (c *DialysisApiController) PostPrescription() {
332 340
 		DialysisIrrigation:         dialysis_irrigation,
333 341
 		AntioxidantCommodityName:   antioxidant_commodity_name,
334 342
 		DisplaceSpeed:              displace_speed,
343
+		Illness:                    illness,
344
+		Amylaceum:                  amylaceum,
345
+		SingleTime:                 single_time,
346
+		SingleWater:                single_water,
347
+		ReplacementFlow:            replacement_flow,
348
+		PlasmaSeparator:            plasma_separator,
349
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
335 350
 	}
336 351
 
337 352
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -567,6 +582,13 @@ func (c *DialysisApiController) PostSoulution() {
567 582
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
568 583
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
569 584
 	displace_speed := c.GetString("displace_speed")
585
+	illness, _ := c.GetInt64("illness")
586
+	amylaceum := c.GetString("amylaceum")
587
+	single_time := c.GetString("single_time")
588
+	single_water := c.GetString("single_water")
589
+	replacement_flow := c.GetString("replacement_flow")
590
+	plasma_separator := c.GetString("plasma_separator")
591
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
570 592
 	var prescription_doctor int64
571 593
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
572 594
 
@@ -661,6 +683,13 @@ func (c *DialysisApiController) PostSoulution() {
661 683
 		DialysisDialyszers:        dialysis_dialyszers,
662 684
 		AntioxidantCommodityName:  antioxidant_commodity_name,
663 685
 		DisplaceSpeed:             displace_speed,
686
+		Illness:                   illness,
687
+		Amylaceum:                 amylaceum,
688
+		SingleTime:                single_time,
689
+		SingleWater:               single_water,
690
+		ReplacementFlow:           replacement_flow,
691
+		PlasmaSeparator:           plasma_separator,
692
+		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
664 693
 	}
665 694
 
666 695
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -971,7 +1000,7 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
971 1000
 	precaution_other := c.GetString("precaution_other")
972 1001
 	psychological_other := c.GetString("psychological_other")
973 1002
 	admission_number := c.GetString("admission_number")
974
-
1003
+	tumble, _ := c.GetInt64("tumble")
975 1004
 	if id <= 0 {
976 1005
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
977 1006
 		return
@@ -1019,6 +1048,7 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1019 1048
 		PrecautionOther:              precaution_other,
1020 1049
 		PsychologicalOther:           psychological_other,
1021 1050
 		AdmissionNumber:              admission_number,
1051
+		Tumble:                       tumble,
1022 1052
 	}
1023 1053
 
1024 1054
 	if receiveTreatment.ID == 0 { //新增
@@ -1066,6 +1096,7 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1066 1096
 }
1067 1097
 
1068 1098
 func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1099
+
1069 1100
 	patient, _ := c.GetInt64("patient", 0)
1070 1101
 	recordDateStr := c.GetString("record_date")
1071 1102
 	fmt.Println(recordDateStr)
@@ -1164,6 +1195,14 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1164 1195
 	assessment.AdditionalWeight = data.AdditionalWeight
1165 1196
 	assessment.OtherComplication = data.OtherComplication
1166 1197
 	assessment.Ktv = data.Ktv
1198
+
1199
+	assessment.Urr = data.Urr
1200
+	assessment.Hypertenison = data.Hypertenison
1201
+	assessment.Hypopiesia = data.Hypopiesia
1202
+	assessment.LeaveOfficeMethod = data.LeaveOfficeMethod
1203
+	assessment.Lapse = data.Lapse
1204
+	assessment.Consciousness = data.Consciousness
1205
+	assessment.Fallrisk = data.Fallrisk
1167 1206
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1168 1207
 
1169 1208
 	if assessment.ID > 0 {
@@ -1295,6 +1334,10 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1295 1334
 	thrombus_av := c.GetString("thrombus_av")
1296 1335
 	thrombus_v := c.GetString("thromubus_v")
1297 1336
 	dehydration := c.GetString("dehydration")
1337
+	pre_dialysis_drugs := c.GetString("pre_dialysis_drugs")
1338
+	period, _ := c.GetInt64("period")
1339
+	estimated_food_intake := c.GetString("estimated_food_intake")
1340
+	blood_pressure_during_dialysis := c.GetString("blood_pressure_during_dialysis")
1298 1341
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1299 1342
 		DialysisCount:                  dialysis_count,
1300 1343
 		EmergencyTreatment:             emergency_treatment,
@@ -1357,6 +1400,10 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1357 1400
 		ThromubusA:                     thrombus_a,
1358 1401
 		ThromubusV:                     thrombus_v,
1359 1402
 		Dehydration:                    dehydration,
1403
+		PreDialysisDrugs:               pre_dialysis_drugs,
1404
+		Period:                         period,
1405
+		EstimatedFoodIntake:            estimated_food_intake,
1406
+		BloodPressureDuringDialysis:    blood_pressure_during_dialysis,
1360 1407
 	}
1361 1408
 
1362 1409
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -3047,6 +3094,11 @@ func (this *DialysisApiController) GetTodayMonitor() {
3047 3094
 
3048 3095
 	var ultrafiltration_rate float64
3049 3096
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.CurrentOrgId)
3097
+	//针对福建医师汇 获取透前评估预增脱水量
3098
+
3099
+	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.CurrentOrgId)
3100
+	fmt.Println("透前评估数据", evaluation)
3101
+
3050 3102
 	if prescription.ID > 0 {
3051 3103
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3052 3104
 
@@ -3055,6 +3107,13 @@ func (this *DialysisApiController) GetTodayMonitor() {
3055 3107
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3056 3108
 				record.UltrafiltrationRate = ultrafiltration_rate
3057 3109
 			}
3110
+			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 9671 {
3111
+
3112
+				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3113
+				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
3114
+
3115
+				record.UltrafiltrationRate = ultrafiltration_rate
3116
+			}
3058 3117
 
3059 3118
 			if template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 { //adminInfo.CurrentOrgId == 9538
3060 3119
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
@@ -3070,7 +3129,9 @@ func (this *DialysisApiController) GetTodayMonitor() {
3070 3129
 		}
3071 3130
 	}
3072 3131
 	// record.UltrafiltrationRate = ultrafiltration_rate
3132
+
3073 3133
 	record.UltrafiltrationVolume = 0
3134
+
3074 3135
 	if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
3075 3136
 		if ultrafiltration_rate > 0 {
3076 3137
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
@@ -3083,6 +3144,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3083 3144
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
3084 3145
 			record.UltrafiltrationVolume = ultrafiltration_volume
3085 3146
 		}
3147
+
3086 3148
 	}
3087 3149
 
3088 3150
 	this.ServeSuccessJSON(map[string]interface{}{

+ 84 - 69
controllers/dialysis_record_api_controller.go Dosyayı Görüntüle

@@ -322,37 +322,39 @@ type EditMonitorParamObject struct {
322 322
 	MonitoringDate int64 `json:"monitoring_date"`
323 323
 	OperateTime    int64 `json:"operate_time"`
324 324
 	// MonitoringTime        string  `json:"monitoring_time"`
325
-	SystolicBP                float64 `json:"systolic_bp"`
326
-	DiastolicBP               float64 `json:"diastolic_bp"`
327
-	PulseFrequency            float64 `json:"pulse_frequency"`
328
-	BreathingRated            float64 `json:"breathing_rated"`
329
-	BloodFlowVolume           float64 `json:"blood_flow_volume"`
330
-	VenousPressure            float64 `json:"venous_pressure"`
331
-	VenousPressureType        int64   `json:"venous_pressure_type"`
332
-	TransmembranePressure     float64 `json:"transmembrane_pressure"`
333
-	TransmembranePressureType int64   `json:"transmembrane_pressure_type"`
334
-	UltrafiltrationVolume     float64 `json:"ultrafiltration_volume"`
335
-	UltrafiltrationRate       float64 `json:"ultrafiltration_rate"`
336
-	ArterialPressure          float64 `json:"arterial_pressure"`
337
-	ArterialPressureType      int64   `json:"arterial_pressure_type"`
338
-	SodiumConcentration       float64 `json:"sodium_concentration"`
339
-	DialysateTemperature      float64 `json:"dialysate_temperature"`
340
-	Temperature               float64 `json:"temperature"`
341
-	ReplacementRate           float64 `json:"replacement_rate"`
342
-	DisplacementQuantity      float64 `json:"displacement_quantity"`
343
-	KTV                       float64 `json:"ktv"`
344
-	Symptom                   string  `json:"symptom"`
345
-	Dispose                   string  `json:"dispose"`
346
-	Result                    string  `json:"result"`
347
-	Conductivity              float64 `json:"conductivity"`
348
-	DisplacementFlowQuantity  float64 `json:"displacement_flow_quantity"`
349
-	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
350
-	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
351
-	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
352
-	Urr                       string  `gorm:"column:urr" json:"urr" form:"urr"`
353
-	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
354
-	MonitorAnticoagulant      int64   `gorm:"column:monitor_anticoagulant" json:"monitor_anticoagulant" form:"monitor_anticoagulant"`
355
-	MonitorAnticoagulantValue string  `gorm:"column:monitor_anticoagulant_value" json:"monitor_anticoagulant_value" form:"monitor_anticoagulant_value"`
325
+	SystolicBP                  float64 `json:"systolic_bp"`
326
+	DiastolicBP                 float64 `json:"diastolic_bp"`
327
+	PulseFrequency              float64 `json:"pulse_frequency"`
328
+	BreathingRated              float64 `json:"breathing_rated"`
329
+	BloodFlowVolume             float64 `json:"blood_flow_volume"`
330
+	VenousPressure              float64 `json:"venous_pressure"`
331
+	VenousPressureType          int64   `json:"venous_pressure_type"`
332
+	TransmembranePressure       float64 `json:"transmembrane_pressure"`
333
+	TransmembranePressureType   int64   `json:"transmembrane_pressure_type"`
334
+	UltrafiltrationVolume       float64 `json:"ultrafiltration_volume"`
335
+	UltrafiltrationRate         float64 `json:"ultrafiltration_rate"`
336
+	ArterialPressure            float64 `json:"arterial_pressure"`
337
+	ArterialPressureType        int64   `json:"arterial_pressure_type"`
338
+	SodiumConcentration         float64 `json:"sodium_concentration"`
339
+	DialysateTemperature        float64 `json:"dialysate_temperature"`
340
+	Temperature                 float64 `json:"temperature"`
341
+	ReplacementRate             float64 `json:"replacement_rate"`
342
+	DisplacementQuantity        float64 `json:"displacement_quantity"`
343
+	KTV                         float64 `json:"ktv"`
344
+	Symptom                     string  `json:"symptom"`
345
+	Dispose                     string  `json:"dispose"`
346
+	Result                      string  `json:"result"`
347
+	Conductivity                float64 `json:"conductivity"`
348
+	DisplacementFlowQuantity    float64 `json:"displacement_flow_quantity"`
349
+	BloodOxygenSaturation       string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
350
+	Heparin                     float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
351
+	DialysateFlow               float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
352
+	Urr                         string  `gorm:"column:urr" json:"urr" form:"urr"`
353
+	BloodSugar                  float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
354
+	MonitorAnticoagulant        int64   `gorm:"column:monitor_anticoagulant" json:"monitor_anticoagulant" form:"monitor_anticoagulant"`
355
+	MonitorAnticoagulantValue   string  `gorm:"column:monitor_anticoagulant_value" json:"monitor_anticoagulant_value" form:"monitor_anticoagulant_value"`
356
+	BloodPressureMonitoringSite int64   `gorm:"column:blood_pressure_monitoring_site" json:"blood_pressure_monitoring_site" form:"blood_pressure_monitoring_site"`
357
+	Complication                int64   `gorm:"column:complication" json:"complication" form:"complication"`
356 358
 }
357 359
 
358 360
 // /api/dislysis/monitor/edit [post]
@@ -429,42 +431,44 @@ func (this *DialysisRecordAPIController) EditMonitor() {
429 431
 			MonitoringDate:  monitorParam.MonitoringDate,
430 432
 			OperateTime:     monitorParam.OperateTime,
431 433
 			// MonitoringTime:         monitorParam.MonitoringTime,
432
-			PulseFrequency:            monitorParam.PulseFrequency,
433
-			BreathingRate:             monitorParam.BreathingRated,
434
-			SystolicBloodPressure:     monitorParam.SystolicBP,
435
-			DiastolicBloodPressure:    monitorParam.DiastolicBP,
436
-			BloodFlowVolume:           monitorParam.BloodFlowVolume,
437
-			VenousPressure:            monitorParam.VenousPressure,
438
-			VenousPressureType:        monitorParam.VenousPressureType,
439
-			ArterialPressure:          monitorParam.ArterialPressure,
440
-			ArterialPressureType:      monitorParam.ArterialPressureType,
441
-			TransmembranePressure:     monitorParam.TransmembranePressure,
442
-			TransmembranePressureType: monitorParam.TransmembranePressureType,
443
-			UltrafiltrationRate:       monitorParam.UltrafiltrationRate,
444
-			UltrafiltrationVolume:     monitorParam.UltrafiltrationVolume,
445
-			SodiumConcentration:       monitorParam.SodiumConcentration,
446
-			DialysateTemperature:      monitorParam.DialysateTemperature,
447
-			Temperature:               monitorParam.Temperature,
448
-			ReplacementRate:           monitorParam.ReplacementRate,
449
-			DisplacementQuantity:      monitorParam.DisplacementQuantity,
450
-			Ktv:                       monitorParam.KTV,
451
-			Symptom:                   monitorParam.Symptom,
452
-			Dispose:                   monitorParam.Dispose,
453
-			Result:                    monitorParam.Result,
454
-			MonitoringNurse:           adminUserInfo.AdminUser.Id,
455
-			Conductivity:              monitorParam.Conductivity,
456
-			DisplacementFlowQuantity:  monitorParam.DisplacementFlowQuantity,
457
-			Status:                    1,
458
-			CreatedTime:               time.Now().Unix(),
459
-			UpdatedTime:               time.Now().Unix(),
460
-			BloodOxygenSaturation:     monitorParam.BloodOxygenSaturation,
461
-			Creator:                   adminUserInfo.AdminUser.Id,
462
-			Heparin:                   monitorParam.Heparin,
463
-			DialysateFlow:             monitorParam.DialysateFlow,
464
-			Urr:                       monitorParam.Urr,
465
-			BloodSugar:                monitorParam.BloodSugar,
466
-			MonitorAnticoagulant:      monitorParam.MonitorAnticoagulant,
467
-			MonitorAnticoagulantValue: monitorParam.MonitorAnticoagulantValue,
434
+			PulseFrequency:              monitorParam.PulseFrequency,
435
+			BreathingRate:               monitorParam.BreathingRated,
436
+			SystolicBloodPressure:       monitorParam.SystolicBP,
437
+			DiastolicBloodPressure:      monitorParam.DiastolicBP,
438
+			BloodFlowVolume:             monitorParam.BloodFlowVolume,
439
+			VenousPressure:              monitorParam.VenousPressure,
440
+			VenousPressureType:          monitorParam.VenousPressureType,
441
+			ArterialPressure:            monitorParam.ArterialPressure,
442
+			ArterialPressureType:        monitorParam.ArterialPressureType,
443
+			TransmembranePressure:       monitorParam.TransmembranePressure,
444
+			TransmembranePressureType:   monitorParam.TransmembranePressureType,
445
+			UltrafiltrationRate:         monitorParam.UltrafiltrationRate,
446
+			UltrafiltrationVolume:       monitorParam.UltrafiltrationVolume,
447
+			SodiumConcentration:         monitorParam.SodiumConcentration,
448
+			DialysateTemperature:        monitorParam.DialysateTemperature,
449
+			Temperature:                 monitorParam.Temperature,
450
+			ReplacementRate:             monitorParam.ReplacementRate,
451
+			DisplacementQuantity:        monitorParam.DisplacementQuantity,
452
+			Ktv:                         monitorParam.KTV,
453
+			Symptom:                     monitorParam.Symptom,
454
+			Dispose:                     monitorParam.Dispose,
455
+			Result:                      monitorParam.Result,
456
+			MonitoringNurse:             adminUserInfo.AdminUser.Id,
457
+			Conductivity:                monitorParam.Conductivity,
458
+			DisplacementFlowQuantity:    monitorParam.DisplacementFlowQuantity,
459
+			Status:                      1,
460
+			CreatedTime:                 time.Now().Unix(),
461
+			UpdatedTime:                 time.Now().Unix(),
462
+			BloodOxygenSaturation:       monitorParam.BloodOxygenSaturation,
463
+			Creator:                     adminUserInfo.AdminUser.Id,
464
+			Heparin:                     monitorParam.Heparin,
465
+			DialysateFlow:               monitorParam.DialysateFlow,
466
+			Urr:                         monitorParam.Urr,
467
+			BloodSugar:                  monitorParam.BloodSugar,
468
+			MonitorAnticoagulant:        monitorParam.MonitorAnticoagulant,
469
+			MonitorAnticoagulantValue:   monitorParam.MonitorAnticoagulantValue,
470
+			BloodPressureMonitoringSite: monitorParam.BloodPressureMonitoringSite,
471
+			Complication:                monitorParam.Complication,
468 472
 		}
469 473
 		createErr := service.CreateMonitor(&monitor)
470 474
 		if createErr != nil {
@@ -553,7 +557,6 @@ func (this *DialysisRecordAPIController) EditMonitor() {
553 557
 func (this *DialysisRecordAPIController) StartDialysis() {
554 558
 	patientID, _ := this.GetInt64("patient_id")
555 559
 	recordDateStr := this.GetString("date")
556
-	fmt.Println("上机日期222222222222222222222222", recordDateStr)
557 560
 	nurseID, _ := this.GetInt64("nurse")
558 561
 	punctureNurseId, _ := this.GetInt64("puncture_nurse")
559 562
 	startDateStr := this.GetString("start_time")
@@ -758,13 +761,25 @@ func (this *DialysisRecordAPIController) StartDialysis() {
758 761
 
759 762
 		var ultrafiltration_rate float64
760 763
 		_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.CurrentOrgId)
764
+
765
+		//获取预增水量
766
+		_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.CurrentOrgId)
761 767
 		if prescription.ID > 0 {
762 768
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
763 769
 
764 770
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
765
-				if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 36 {
771
+				if (template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 36) && adminUserInfo.CurrentOrgId != 9671 {
766 772
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
767 773
 				}
774
+
775
+				//针对福建医师汇
776
+				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 9671 {
777
+					if evaluation.ID > 0 {
778
+						dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
779
+						ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
780
+					}
781
+				}
782
+
768 783
 				// 只针对方济医院
769 784
 				if template.TemplateId == 1 && adminUserInfo.CurrentOrgId != 9849 {
770 785
 					value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)

+ 79 - 43
controllers/doctors_api_controller.go Dosyayı Görüntüle

@@ -351,39 +351,66 @@ func (this *DoctorsApiController) SaveVasularAccess() {
351 351
 	creator := adminUserInfo.AdminUser.Id
352 352
 
353 353
 	//查询改日期是否存在
354
-	_, errcode := service.GetDialysisDateByDate(startTime.Unix(), patient_id, orgId)
355
-	if errcode == gorm.ErrRecordNotFound {
356
-		access := models.XtPatientVascularAccess{
357
-			AccessProject:          access_project,
358
-			BloodAccessPartId:      blood_access_part_id,
359
-			BloodAccessPartOperaId: blood_access_part_opera_id,
360
-			FirstStartTime:         firstStartTime.Unix(),
361
-			InflowPass:             inflow_pass,
362
-			Remark:                 remark,
363
-			StartTime:              startTime.Unix(),
364
-			StopReason:             stop_reason,
365
-			UserStatus:             user_status,
366
-			Creator:                creator,
367
-			UserOrgId:              orgId,
368
-			Status:                 1,
369
-			Ctime:                  time.Now().Unix(),
370
-			StopTime:               stopTime.Unix(),
371
-			PatientId:              patient_id,
372
-			OtherVascular:          other_vascular,
373
-			CiType:                 ci_type,
374
-			BloodCultupe:           blood_cultupe,
375
-			SequelaeType:           sequelae_type,
376
-		}
377
-		err := service.SaveVascularAccess(&access)
378
-		if err == nil {
379
-			this.ServeSuccessJSON(map[string]interface{}{
380
-				"access": access,
381
-			})
382
-			return
383
-		}
384
-	} else if errcode == nil {
385
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
354
+	access := models.XtPatientVascularAccess{
355
+		AccessProject:          access_project,
356
+		BloodAccessPartId:      blood_access_part_id,
357
+		BloodAccessPartOperaId: blood_access_part_opera_id,
358
+		FirstStartTime:         firstStartTime.Unix(),
359
+		InflowPass:             inflow_pass,
360
+		Remark:                 remark,
361
+		StartTime:              startTime.Unix(),
362
+		StopReason:             stop_reason,
363
+		UserStatus:             user_status,
364
+		Creator:                creator,
365
+		UserOrgId:              orgId,
366
+		Status:                 1,
367
+		Ctime:                  time.Now().Unix(),
368
+		StopTime:               stopTime.Unix(),
369
+		PatientId:              patient_id,
370
+		OtherVascular:          other_vascular,
371
+		CiType:                 ci_type,
372
+		BloodCultupe:           blood_cultupe,
373
+		SequelaeType:           sequelae_type,
374
+	}
375
+	err := service.SaveVascularAccess(&access)
376
+	if err == nil {
377
+		this.ServeSuccessJSON(map[string]interface{}{
378
+			"access": access,
379
+		})
386 380
 		return
381
+		//_, errcode := service.GetDialysisDateByDate(startTime.Unix(), patient_id, orgId)
382
+		//if errcode == gorm.ErrRecordNotFound {
383
+		//	access := models.XtPatientVascularAccess{
384
+		//		AccessProject:          access_project,
385
+		//		BloodAccessPartId:      blood_access_part_id,
386
+		//		BloodAccessPartOperaId: blood_access_part_opera_id,
387
+		//		FirstStartTime:         firstStartTime.Unix(),
388
+		//		InflowPass:             inflow_pass,
389
+		//		Remark:                 remark,
390
+		//		StartTime:              startTime.Unix(),
391
+		//		StopReason:             stop_reason,
392
+		//		UserStatus:             user_status,
393
+		//		Creator:                creator,
394
+		//		UserOrgId:              orgId,
395
+		//		Status:                 1,
396
+		//		Ctime:                  time.Now().Unix(),
397
+		//		StopTime:               stopTime.Unix(),
398
+		//		PatientId:              patient_id,
399
+		//		OtherVascular:          other_vascular,
400
+		//		CiType:                 ci_type,
401
+		//		BloodCultupe:           blood_cultupe,
402
+		//		SequelaeType:           sequelae_type,
403
+		//	}
404
+		//	err := service.SaveVascularAccess(&access)
405
+		//	if err == nil {
406
+		//		this.ServeSuccessJSON(map[string]interface{}{
407
+		//			"access": access,
408
+		//		})
409
+		//		return
410
+		//	}
411
+		//} else if errcode == nil {
412
+		//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
413
+		//	return
387 414
 	}
388 415
 
389 416
 }
@@ -467,20 +494,29 @@ func (this *DoctorsApiController) UpdateVasularAccess() {
467 494
 		CiType:                 ci_type,
468 495
 		BloodCultupe:           blood_cultupe,
469 496
 		SequelaeType:           sequelae_type,
497
+		PatientId:              patientId,
470 498
 	}
471
-	_, errcode := service.GetDialysisDateByDateOne(startTime.Unix(), patientId, orgId, id)
472
-	if errcode == gorm.ErrRecordNotFound {
473
-		err := service.UpdateVascularAccess(&access, id)
474
-		if err == nil {
475
-			this.ServeSuccessJSON(map[string]interface{}{
476
-				"access": access,
477
-			})
478
-			return
479
-		}
480
-	} else if errcode == nil {
481
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
499
+
500
+	err := service.UpdateVascularAccess(&access, id)
501
+	if err == nil {
502
+		this.ServeSuccessJSON(map[string]interface{}{
503
+			"access": access,
504
+		})
482 505
 		return
483 506
 	}
507
+	//_, errcode := service.GetDialysisDateByDateOne(startTime.Unix(), patientId, orgId, id)
508
+	//if errcode == gorm.ErrRecordNotFound {
509
+	//	err := service.UpdateVascularAccess(&access, id)
510
+	//	if err == nil {
511
+	//		this.ServeSuccessJSON(map[string]interface{}{
512
+	//			"access": access,
513
+	//		})
514
+	//		return
515
+	//	}
516
+	//} else if errcode == nil {
517
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
518
+	//	return
519
+	//}
484 520
 
485 521
 }
486 522
 

+ 11 - 0
controllers/gobal_config_api_controller.go Dosyayı Görüntüle

@@ -85,6 +85,7 @@ func GobalConfigRegistRouters() {
85 85
 	beego.Router("/api/order/addorderconfig", &GobalConfigApiController{}, "Get:AddOrderConfig")
86 86
 	beego.Router("/api/order/getorderconfig", &GobalConfigApiController{}, "Get:GetOrderConfig")
87 87
 	beego.Router("/api/drugstock/getdrugautomaticlist", &GobalConfigApiController{}, "Get:GetDrugAutoMaticList")
88
+	beego.Router("/api/drugstock/getdrugwarehouseorderinfo", &GobalConfigApiController{}, "Get:GetDrugWarehuseOrderInfo")
88 89
 }
89 90
 
90 91
 //provinces, _ := service.GetDistrictsByUpid(0)21
@@ -1721,3 +1722,13 @@ func (c *GobalConfigApiController) GetDrugAutoMaticList() {
1721 1722
 		"drugList":   drugList,
1722 1723
 	})
1723 1724
 }
1725
+
1726
+func (c *GobalConfigApiController) GetDrugWarehuseOrderInfo() {
1727
+
1728
+	adminUserInfo := c.GetAdminUserInfo()
1729
+	orgId := adminUserInfo.CurrentOrgId
1730
+	list, _ := service.GetDrugWarehuseOrderInfo(orgId)
1731
+	c.ServeSuccessJSON(map[string]interface{}{
1732
+		"list": list,
1733
+	})
1734
+}

+ 93 - 92
controllers/manage_api_controller.go Dosyayı Görüntüle

@@ -123,6 +123,7 @@ func ManageRouters() {
123 123
 	beego.Router("/api/manage/deletehadwater", &MachineApiController{}, "Get:DeleteHadWater")
124 124
 	beego.Router("/api/manage/deletewater", &MachineApiController{}, "Get:DeleteWater")
125 125
 	beego.Router("/api/manage/deletedeviceph", &MachineApiController{}, "Get:DeleteDevicePh")
126
+
126 127
 }
127 128
 
128 129
 func (this *MachineApiController) SaveManageInfo() {
@@ -1192,35 +1193,35 @@ func (this *MachineApiController) SaveInformation() {
1192 1193
 			Date:  startdate,
1193 1194
 			Class: classtype,
1194 1195
 			//	Zone:                  zone,
1195
-			BedNumber:           bednumber,
1196
-			PatientId:           patient_time,
1197
-			Contagion:           contagion,
1198
-			DialysisMode:        dialysis_mode,
1199
-			StartTime:           startDate.Unix(),
1200
-			EndTime:             endDate.Unix(),
1201
-			DialysisHour:        dialysis_time,
1202
-			Hyperfiltratio:      hyperfiletration,
1203
-			WeightLoss:          weight_loss,
1204
-			WarningValue:        warining_value,
1205
-			UserTotal:           user_total,
1206
-			Move:                run,
1207
-			FailureStage:        failure_stage,
1208
-			FaultDescription:    falult_desciription,
1209
-			CodeInformation:     code_information,
1210
-			DisinfectantType:    disinfectant_type,
1211
-			DisinfectType:       disinfect_type,
1212
-			Disinfection:        disinfection,
1213
-			MachineRun:          machine_run,
1214
-			FluidPath:           fluid_path,
1215
-			Disinfectant:        disinfectant,
1216
-			DisinfectionStatus:  disinfection_status,
1217
-			DisinfectionResidue: disinfection_residue,
1218
-			LongTime:            longtime,
1219
-			DisinfecStartime:    start_Date.Unix(),
1220
-			DisinfecEndtime:     end_Date.Unix(),
1221
-			DialysisChecked:     dialysis_checked,
1222
-			DialysisName:        dialysis_name,
1223
-			Norms:               norms,
1196
+			BedNumber:             bednumber,
1197
+			PatientId:             patient_time,
1198
+			Contagion:             contagion,
1199
+			DialysisMode:          dialysis_mode,
1200
+			StartTime:             startDate.Unix(),
1201
+			EndTime:               endDate.Unix(),
1202
+			DialysisHour:          dialysis_time,
1203
+			Hyperfiltratio:        hyperfiletration,
1204
+			WeightLoss:            weight_loss,
1205
+			WarningValue:          warining_value,
1206
+			UserTotal:             user_total,
1207
+			Move:                  run,
1208
+			FailureStage:          failure_stage,
1209
+			FaultDescription:      falult_desciription,
1210
+			CodeInformation:       code_information,
1211
+			DisinfectantType:      disinfectant_type,
1212
+			DisinfectType:         disinfect_type,
1213
+			Disinfection:          disinfection,
1214
+			MachineRun:            machine_run,
1215
+			FluidPath:             fluid_path,
1216
+			Disinfectant:          disinfectant,
1217
+			DisinfectionStatus:    disinfection_status,
1218
+			DisinfectionResidue:   disinfection_residue,
1219
+			LongTime:              longtime,
1220
+			DisinfecStartime:      start_Date.Unix(),
1221
+			DisinfecEndtime:       end_Date.Unix(),
1222
+			DialysisChecked:       dialysis_checked,
1223
+			DialysisName:          dialysis_name,
1224
+			Norms:                 norms,
1224 1225
 			DialysisConcentration: dialysis_concentration,
1225 1226
 			GermChecked:           germ_checked,
1226 1227
 			GermName:              germ_name,
@@ -1241,38 +1242,38 @@ func (this *MachineApiController) SaveInformation() {
1241 1242
 		})
1242 1243
 	} else if errinfor == nil {
1243 1244
 		infor := models.DeviceInformation{
1244
-			Date:                startdate,
1245
-			Class:               classtype,
1246
-			Zone:                zone,
1247
-			BedNumber:           bednumber,
1248
-			PatientId:           patient_time,
1249
-			Contagion:           contagion,
1250
-			DialysisMode:        dialysis_mode,
1251
-			StartTime:           startDate.Unix(),
1252
-			EndTime:             endDate.Unix(),
1253
-			DialysisHour:        dialysis_time,
1254
-			Hyperfiltratio:      hyperfiletration,
1255
-			WeightLoss:          weight_loss,
1256
-			WarningValue:        warining_value,
1257
-			UserTotal:           user_total,
1258
-			Move:                run,
1259
-			FailureStage:        failure_stage,
1260
-			FaultDescription:    falult_desciription,
1261
-			CodeInformation:     code_information,
1262
-			DisinfectantType:    disinfectant_type,
1263
-			DisinfectType:       disinfect_type,
1264
-			Disinfection:        disinfection,
1265
-			MachineRun:          machine_run,
1266
-			FluidPath:           fluid_path,
1267
-			Disinfectant:        disinfectant,
1268
-			DisinfectionStatus:  disinfection_status,
1269
-			DisinfectionResidue: disinfection_residue,
1270
-			LongTime:            longtime,
1271
-			DisinfecStartime:    start_Date.Unix(),
1272
-			DisinfecEndtime:     end_Date.Unix(),
1273
-			DialysisChecked:     dialysis_checked,
1274
-			DialysisName:        dialysis_name,
1275
-			Norms:               norms,
1245
+			Date:                  startdate,
1246
+			Class:                 classtype,
1247
+			Zone:                  zone,
1248
+			BedNumber:             bednumber,
1249
+			PatientId:             patient_time,
1250
+			Contagion:             contagion,
1251
+			DialysisMode:          dialysis_mode,
1252
+			StartTime:             startDate.Unix(),
1253
+			EndTime:               endDate.Unix(),
1254
+			DialysisHour:          dialysis_time,
1255
+			Hyperfiltratio:        hyperfiletration,
1256
+			WeightLoss:            weight_loss,
1257
+			WarningValue:          warining_value,
1258
+			UserTotal:             user_total,
1259
+			Move:                  run,
1260
+			FailureStage:          failure_stage,
1261
+			FaultDescription:      falult_desciription,
1262
+			CodeInformation:       code_information,
1263
+			DisinfectantType:      disinfectant_type,
1264
+			DisinfectType:         disinfect_type,
1265
+			Disinfection:          disinfection,
1266
+			MachineRun:            machine_run,
1267
+			FluidPath:             fluid_path,
1268
+			Disinfectant:          disinfectant,
1269
+			DisinfectionStatus:    disinfection_status,
1270
+			DisinfectionResidue:   disinfection_residue,
1271
+			LongTime:              longtime,
1272
+			DisinfecStartime:      start_Date.Unix(),
1273
+			DisinfecEndtime:       end_Date.Unix(),
1274
+			DialysisChecked:       dialysis_checked,
1275
+			DialysisName:          dialysis_name,
1276
+			Norms:                 norms,
1276 1277
 			DialysisConcentration: dialysis_concentration,
1277 1278
 			GermChecked:           germ_checked,
1278 1279
 			GermName:              germ_name,
@@ -2488,37 +2489,37 @@ func (this *MachineApiController) UpdateForm() {
2488 2489
 	err = service.UpdatedZoneID(bednumber, orgid, &deviceNumber)
2489 2490
 	fmt.Println("更新区号失败", err)
2490 2491
 	information := models.DeviceInformation{
2491
-		Date:                startdate,
2492
-		Class:               classtype,
2493
-		Zone:                zone,
2494
-		BedNumber:           bednumber,
2495
-		Contagion:           contagion,
2496
-		DialysisMode:        dialysis_mode,
2497
-		StartTime:           startDate.Unix(),
2498
-		EndTime:             endDate.Unix(),
2499
-		DialysisHour:        dialysis_time,
2500
-		Hyperfiltratio:      hyperfiletration,
2501
-		WeightLoss:          weight_loss,
2502
-		WarningValue:        warining_value,
2503
-		UserTotal:           user_total,
2504
-		Move:                run,
2505
-		FailureStage:        failure_stage,
2506
-		FaultDescription:    falult_desciription,
2507
-		CodeInformation:     code_information,
2508
-		DisinfectantType:    disinfectant_type,
2509
-		DisinfectType:       disinfect_type,
2510
-		Disinfection:        disinfection,
2511
-		MachineRun:          machine_run,
2512
-		FluidPath:           fluid_path,
2513
-		Disinfectant:        disinfectant,
2514
-		DisinfectionStatus:  disinfection_status,
2515
-		DisinfectionResidue: disinfection_residue,
2516
-		LongTime:            longtime,
2517
-		DisinfecStartime:    distartime,
2518
-		DisinfecEndtime:     diendtime,
2519
-		DialysisChecked:     dialysis_checked,
2520
-		DialysisName:        dialysis_name,
2521
-		Norms:               norms,
2492
+		Date:                  startdate,
2493
+		Class:                 classtype,
2494
+		Zone:                  zone,
2495
+		BedNumber:             bednumber,
2496
+		Contagion:             contagion,
2497
+		DialysisMode:          dialysis_mode,
2498
+		StartTime:             startDate.Unix(),
2499
+		EndTime:               endDate.Unix(),
2500
+		DialysisHour:          dialysis_time,
2501
+		Hyperfiltratio:        hyperfiletration,
2502
+		WeightLoss:            weight_loss,
2503
+		WarningValue:          warining_value,
2504
+		UserTotal:             user_total,
2505
+		Move:                  run,
2506
+		FailureStage:          failure_stage,
2507
+		FaultDescription:      falult_desciription,
2508
+		CodeInformation:       code_information,
2509
+		DisinfectantType:      disinfectant_type,
2510
+		DisinfectType:         disinfect_type,
2511
+		Disinfection:          disinfection,
2512
+		MachineRun:            machine_run,
2513
+		FluidPath:             fluid_path,
2514
+		Disinfectant:          disinfectant,
2515
+		DisinfectionStatus:    disinfection_status,
2516
+		DisinfectionResidue:   disinfection_residue,
2517
+		LongTime:              longtime,
2518
+		DisinfecStartime:      distartime,
2519
+		DisinfecEndtime:       diendtime,
2520
+		DialysisChecked:       dialysis_checked,
2521
+		DialysisName:          dialysis_name,
2522
+		Norms:                 norms,
2522 2523
 		DialysisConcentration: dialysis_concentration,
2523 2524
 		GermChecked:           germ_checked,
2524 2525
 		GermName:              germ_name,

+ 69 - 6
controllers/mobile_api_controllers/dialysis_api_controller.go Dosyayı Görüntüle

@@ -688,6 +688,7 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
688 688
 	psychological_other := c.GetString("psychological_other")
689 689
 
690 690
 	admission_number := c.GetString("admission_number")
691
+	tumble, _ := c.GetInt64("tumble")
691 692
 
692 693
 	if id <= 0 {
693 694
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -741,6 +742,7 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
741 742
 		PrecautionOther:              precaution_other,
742 743
 		PsychologicalOther:           psychological_other,
743 744
 		AdmissionNumber:              admission_number,
745
+		Tumble:                       tumble,
744 746
 	}
745 747
 
746 748
 	if receiveTreatment.ID == 0 { //新增
@@ -847,6 +849,13 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
847 849
 	diastolic_pressure := c.GetString("diastolic_pressure")
848 850
 	other_complication := c.GetString("other_complication")
849 851
 	ktv := c.GetString("ktv")
852
+	urr := c.GetString("urr")
853
+	hypertenison, _ := c.GetInt64("hypertenison")
854
+	hypopiesia, _ := c.GetInt64("hypopiesia")
855
+	leave_office_method, _ := c.GetInt64("leave_office_method")
856
+	lapse, _ := c.GetInt64("lapse")
857
+	consciousness, _ := c.GetInt64("consciousness")
858
+	fallrisk, _ := c.GetInt64("fallrisk")
850 859
 	if id <= 0 {
851 860
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
852 861
 		return
@@ -940,6 +949,13 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
940 949
 		DiastolicPressure:            diastolic_pressure,
941 950
 		OtherComplication:            other_complication,
942 951
 		Ktv:                          ktv,
952
+		Urr:                          urr,
953
+		Hypopiesia:                   hypopiesia,
954
+		Hypertenison:                 hypertenison,
955
+		Lapse:                        lapse,
956
+		LeaveOfficeMethod:            leave_office_method,
957
+		Consciousness:                consciousness,
958
+		Fallrisk:                     fallrisk,
943 959
 	}
944 960
 
945 961
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
@@ -1078,6 +1094,13 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1078 1094
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
1079 1095
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
1080 1096
 	displace_speed := c.GetString("displace_speed")
1097
+	illness, _ := c.GetInt64("illness")
1098
+	amylaceum := c.GetString("amylaceum")
1099
+	single_time := c.GetString("single_time")
1100
+	single_water := c.GetString("single_water")
1101
+	replacement_flow := c.GetString("replacement_flow")
1102
+	plasma_separator := c.GetString("plasma_separator")
1103
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1081 1104
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1082 1105
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1083 1106
 	//
@@ -1165,6 +1188,13 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1165 1188
 		DialysisIrrigation:         dialysis_irrigation,
1166 1189
 		AntioxidantCommodityName:   antioxidant_commodity_name,
1167 1190
 		DisplaceSpeed:              displace_speed,
1191
+		Illness:                    illness,
1192
+		Amylaceum:                  amylaceum,
1193
+		SingleTime:                 single_time,
1194
+		SingleWater:                single_water,
1195
+		ReplacementFlow:            replacement_flow,
1196
+		PlasmaSeparator:            plasma_separator,
1197
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
1168 1198
 	}
1169 1199
 
1170 1200
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1788,14 +1818,23 @@ func (this *DialysisAPIController) StartDialysis() {
1788 1818
 
1789 1819
 	var ultrafiltration_rate float64
1790 1820
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
1821
+	//后期预增脱水量
1822
+	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
1823
+	fmt.Println(evaluation)
1791 1824
 	if prescription.ID > 0 {
1792 1825
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
1793 1826
 
1794 1827
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
1795
-			if template.TemplateId == 6 || template.TemplateId == 32 { //adminUserInfo.Org.Id == 9538
1828
+			if (template.TemplateId == 6 || template.TemplateId == 32) && adminUserInfo.Org.Id != 9671 { //adminUserInfo.Org.Id == 9538
1796 1829
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
1797 1830
 			}
1798 1831
 
1832
+			//针对医师汇
1833
+			if template.TemplateId == 6 && adminUserInfo.Org.Id == 9671 {
1834
+				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
1835
+				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
1836
+			}
1837
+
1799 1838
 			if template.TemplateId == 20 || template.TemplateId == 22 { //adminUserInfo.Org.Id == 9538
1800 1839
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
1801 1840
 			}
@@ -1958,6 +1997,13 @@ func (c *DialysisAPIController) PostSolution() {
1958 1997
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
1959 1998
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
1960 1999
 	displace_speed := c.GetString("displace_speed")
2000
+	illness, _ := c.GetInt64("illness")
2001
+	amylaceum := c.GetString("amylaceum")
2002
+	single_time := c.GetString("single_time")
2003
+	single_water := c.GetString("single_water")
2004
+	replacement_flow := c.GetString("replacement_flow")
2005
+	plasma_separator := c.GetString("plasma_separator")
2006
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1961 2007
 	if mode_id > 0 {
1962 2008
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1963 2009
 	}
@@ -2046,6 +2092,13 @@ func (c *DialysisAPIController) PostSolution() {
2046 2092
 		DialysisIrrigation:        dialysis_irrigation,
2047 2093
 		AntioxidantCommodityName:  antioxidant_commodity_name,
2048 2094
 		DisplaceSpeed:             displace_speed,
2095
+		Illness:                   illness,
2096
+		Amylaceum:                 amylaceum,
2097
+		SingleWater:               single_water,
2098
+		SingleTime:                single_time,
2099
+		ReplacementFlow:           replacement_flow,
2100
+		PlasmaSeparator:           plasma_separator,
2101
+		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
2049 2102
 	}
2050 2103
 
2051 2104
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2276,16 +2329,24 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2276 2329
 
2277 2330
 	var ultrafiltration_rate float64
2278 2331
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
2332
+
2333
+	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
2334
+	fmt.Println(evaluation)
2279 2335
 	if prescription.ID > 0 {
2280 2336
 
2281 2337
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2282 2338
 
2283 2339
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2284
-			if template.TemplateId == 6 {
2340
+			if template.TemplateId == 6 && adminInfo.Org.Id != 9671 {
2285 2341
 
2286 2342
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2287 2343
 				record.UltrafiltrationRate = ultrafiltration_rate
2288 2344
 			}
2345
+			//if template.TemplateId == 6 && adminInfo.Org.Id ==9671{
2346
+			//  dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
2347
+			//  ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
2348
+			//  record.UltrafiltrationRate = ultrafiltration_rate
2349
+			//}
2289 2350
 
2290 2351
 			if template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 {
2291 2352
 
@@ -2307,7 +2368,9 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2307 2368
 		}
2308 2369
 	}
2309 2370
 	// record.UltrafiltrationRate = ultrafiltration_rate
2371
+
2310 2372
 	record.UltrafiltrationVolume = 0
2373
+
2311 2374
 	if template.TemplateId == 1 && adminInfo.Org.Id != 9849 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
2312 2375
 		if ultrafiltration_rate > 0 {
2313 2376
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
@@ -3555,7 +3618,7 @@ func (c *DialysisAPIController) EditConsumables() {
3555 3618
 		if dataBody["goods"] != nil && reflect.TypeOf(dataBody["goods"]).String() == "[]interface {}" {
3556 3619
 
3557 3620
 			goods, _ := dataBody["goods"].([]interface{})
3558
-			fmt.Println("goods2222222222222", goods)
3621
+
3559 3622
 			if len(goods) > 0 {
3560 3623
 				for _, item := range goods {
3561 3624
 					items := item.(map[string]interface{})
@@ -3639,7 +3702,7 @@ func (c *DialysisAPIController) EditConsumables() {
3639 3702
 				}
3640 3703
 			}
3641 3704
 		}
3642
-		fmt.Println("hhhhhhhhhhhhhhhhhhhh", beforePrepares)
3705
+
3643 3706
 		//查询今日患者出库列表
3644 3707
 		consumables_source, _ := service.FindConsumablesByDate(adminInfo.Org.Id, patient_id, record_time)
3645 3708
 
@@ -3699,7 +3762,7 @@ func (c *DialysisAPIController) EditConsumables() {
3699 3762
 
3700 3763
 		//查询是否有出库单
3701 3764
 		out, err := service.FindStockOutByIsSys(adminInfo.Org.Id, 1, record_time)
3702
-		fmt.Println("是否有出库单22222222222222222222222", err)
3765
+
3703 3766
 		if err == gorm.ErrRecordNotFound {
3704 3767
 			//没有记录,则创建出库单
3705 3768
 			timeStr := time.Now().Format("2006-01-02")
@@ -3848,7 +3911,7 @@ func (c *DialysisAPIController) EditConsumables() {
3848 3911
 							}
3849 3912
 							service.AddSigleAutoReduceRecordInfo(details)
3850 3913
 						} else if count == 1 {
3851
-							fmt.Println("llllllllllllllllllllll")
3914
+
3852 3915
 							service.UpdateUserInfoDetails(item.GoodTypeId, item.GoodId, record_time, adminInfo.Org.Id, patient_id, item.Count, &outInfo)
3853 3916
 						}
3854 3917
 						//details := &models.AutomaticReduceDetail{

+ 47 - 39
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Dosyayı Görüntüle

@@ -80,7 +80,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
80 80
 	replacementRate, _ := this.GetFloat("replacement_rate")
81 81
 	displacementQuantity, _ := this.GetFloat("displacement_quantity")
82 82
 	ktv, _ := this.GetFloat("ktv")
83
-	fmt.Println("ktv -------------------", ktv)
83
+
84 84
 	symptom := this.GetString("symptom")
85 85
 	dispose := this.GetString("dispose")
86 86
 	conductivity, _ := this.GetFloat("conductivity")
@@ -94,6 +94,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
94 94
 	blood_sugar, _ := this.GetFloat("blood_sugar")
95 95
 	monitor_anticoagulant, _ := this.GetInt64("monitor_anticoagulant")
96 96
 	monitor_anticoagulant_value := this.GetString("monitor_anticoagulant_value")
97
+	blood_pressure_monitoring_site, _ := this.GetInt64("blood_pressure_monitoring_site")
98
+	complication, _ := this.GetInt64("complication")
97 99
 	adminInfo := this.GetMobileAdminUserInfo()
98 100
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
99 101
 	if getPatientErr != nil {
@@ -112,44 +114,46 @@ func (this *DialysisAPIController) AddMonitorRecord() {
112 114
 		MonitoringDate:  date,
113 115
 		OperateTime:     operateTime,
114 116
 		// MonitoringTime:            recordTime,
115
-		PulseFrequency:            pulseFrequency,
116
-		BreathingRate:             breathingRated,
117
-		SystolicBloodPressure:     systolicBP,
118
-		DiastolicBloodPressure:    diastolicBP,
119
-		BloodPressureType:         int64(BPType),
120
-		BloodFlowVolume:           bloodFlowVolume,
121
-		VenousPressure:            venousPressure,
122
-		VenousPressureType:        venousPressureType,
123
-		ArterialPressure:          arterialPressure,
124
-		ArterialPressureType:      arterialPressureType,
125
-		TransmembranePressure:     transmembranePressure,
126
-		TransmembranePressureType: transmembranePressureType,
127
-		UltrafiltrationRate:       ultrafiltrationRate,
128
-		UltrafiltrationVolume:     ultrafiltrationVolume,
129
-		SodiumConcentration:       sodiumConcentration,
130
-		DialysateTemperature:      dialysateTemperature,
131
-		Temperature:               temperature,
132
-		ReplacementRate:           replacementRate,
133
-		DisplacementQuantity:      displacementQuantity,
134
-		Ktv:                       ktv,
135
-		Symptom:                   symptom,
136
-		Dispose:                   dispose,
137
-		Result:                    result,
138
-		MonitoringNurse:           monitoringNurse,
139
-		Status:                    1,
140
-		CreatedTime:               time.Now().Unix(),
141
-		UpdatedTime:               time.Now().Unix(),
142
-		Conductivity:              conductivity,
143
-		DisplacementFlowQuantity:  displacement_flow_quantity,
144
-		BloodOxygenSaturation:     blood_oxygen_saturation,
145
-		Creator:                   adminInfo.AdminUser.Id,
146
-		Modify:                    0,
147
-		Heparin:                   heparin,
148
-		DialysateFlow:             dialysate_flow,
149
-		Urr:                       urr,
150
-		BloodSugar:                blood_sugar,
151
-		MonitorAnticoagulant:      monitor_anticoagulant,
152
-		MonitorAnticoagulantValue: monitor_anticoagulant_value,
117
+		PulseFrequency:              pulseFrequency,
118
+		BreathingRate:               breathingRated,
119
+		SystolicBloodPressure:       systolicBP,
120
+		DiastolicBloodPressure:      diastolicBP,
121
+		BloodPressureType:           int64(BPType),
122
+		BloodFlowVolume:             bloodFlowVolume,
123
+		VenousPressure:              venousPressure,
124
+		VenousPressureType:          venousPressureType,
125
+		ArterialPressure:            arterialPressure,
126
+		ArterialPressureType:        arterialPressureType,
127
+		TransmembranePressure:       transmembranePressure,
128
+		TransmembranePressureType:   transmembranePressureType,
129
+		UltrafiltrationRate:         ultrafiltrationRate,
130
+		UltrafiltrationVolume:       ultrafiltrationVolume,
131
+		SodiumConcentration:         sodiumConcentration,
132
+		DialysateTemperature:        dialysateTemperature,
133
+		Temperature:                 temperature,
134
+		ReplacementRate:             replacementRate,
135
+		DisplacementQuantity:        displacementQuantity,
136
+		Ktv:                         ktv,
137
+		Symptom:                     symptom,
138
+		Dispose:                     dispose,
139
+		Result:                      result,
140
+		MonitoringNurse:             monitoringNurse,
141
+		Status:                      1,
142
+		CreatedTime:                 time.Now().Unix(),
143
+		UpdatedTime:                 time.Now().Unix(),
144
+		Conductivity:                conductivity,
145
+		DisplacementFlowQuantity:    displacement_flow_quantity,
146
+		BloodOxygenSaturation:       blood_oxygen_saturation,
147
+		Creator:                     adminInfo.AdminUser.Id,
148
+		Modify:                      0,
149
+		Heparin:                     heparin,
150
+		DialysateFlow:               dialysate_flow,
151
+		Urr:                         urr,
152
+		BloodSugar:                  blood_sugar,
153
+		MonitorAnticoagulant:        monitor_anticoagulant,
154
+		MonitorAnticoagulantValue:   monitor_anticoagulant_value,
155
+		BloodPressureMonitoringSite: blood_pressure_monitoring_site,
156
+		Complication:                complication,
153 157
 	}
154 158
 
155 159
 	err := service.CreateMonitor(&record)
@@ -246,6 +250,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
246 250
 	adminInfo := this.GetMobileAdminUserInfo()
247 251
 	monitor_anticoagulant, _ := this.GetInt64("monitor_anticoagulant")
248 252
 	monitor_anticoagulant_value := this.GetString("monitor_anticoagulant_value")
253
+	blood_pressure_monitoring_site, _ := this.GetInt64("blood_pressure_monitoring_site")
254
+	complication, _ := this.GetInt64("complication")
249 255
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
250 256
 	if err != nil {
251 257
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -295,6 +301,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
295 301
 	monitor.BloodSugar = blood_sugar
296 302
 	monitor.MonitorAnticoagulant = monitor_anticoagulant
297 303
 	monitor.MonitorAnticoagulantValue = monitor_anticoagulant_value
304
+	monitor.BloodPressureMonitoringSite = blood_pressure_monitoring_site
305
+	monitor.Complication = complication
298 306
 	err = service.UpdateMonitor(monitor)
299 307
 	if err != nil {
300 308
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorUpdate)

+ 1 - 1
controllers/mobile_api_controllers/doctor_advice_api_controller.go Dosyayı Görüntüle

@@ -41,7 +41,7 @@ func (this *DoctorAdviceAPIController) ScheduleAdvices() {
41 41
 	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id, delivery_way)
42 42
 	//获取his医嘱数据
43 43
 	fmt.Println("date.un222222", date.Unix())
44
-	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix(), delivery_way)
44
+	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)
45 45
 	config, _ := service.GetHisDoctorConfig(orgID)
46 46
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminInfo.App.Id)
47 47
 	if err != nil {

+ 16 - 0
controllers/mobile_api_controllers/patient_api_controller.go Dosyayı Görüntüle

@@ -2407,6 +2407,22 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2407 2407
 		dehydration := dataBody["dehydration"].(string)
2408 2408
 		evaluation.Dehydration = dehydration
2409 2409
 	}
2410
+
2411
+	if dataBody["period"] != nil && reflect.TypeOf(dataBody["period"]).String() == "float64" {
2412
+		period := int64(dataBody["period"].(float64))
2413
+		evaluation.Period = period
2414
+	}
2415
+
2416
+	if dataBody["estimated_food_intake"] != nil && reflect.TypeOf(dataBody["estimated_food_intake"]).String() == "string" {
2417
+		estimated_food_intake := dataBody["estimated_food_intake"].(string)
2418
+		evaluation.EstimatedFoodIntake = estimated_food_intake
2419
+	}
2420
+
2421
+	if dataBody["blood_pressure_during_dialysis"] != nil && reflect.TypeOf(dataBody["blood_pressure_during_dialysis"]).String() == "string" {
2422
+		blood_pressure_during_dialysis := dataBody["blood_pressure_during_dialysis"].(string)
2423
+		evaluation.BloodPressureDuringDialysis = blood_pressure_during_dialysis
2424
+	}
2425
+
2410 2426
 	return
2411 2427
 }
2412 2428
 

+ 45 - 24
controllers/new_mobile_api_controllers/common_api_controller.go Dosyayı Görüntüle

@@ -220,7 +220,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
220 220
 		}
221 221
 		this.ServeSuccessJSON(map[string]interface{}{
222 222
 			"configurationdetail": detail,
223
-			"vid": vid,
223
+			"vid":                 vid,
224 224
 		})
225 225
 	} else {
226 226
 		itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
@@ -230,7 +230,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
230 230
 		}
231 231
 		this.ServeSuccessJSON(map[string]interface{}{
232 232
 			"configurationdetail": detail,
233
-			"vid": itemId.ID,
233
+			"vid":                 itemId.ID,
234 234
 		})
235 235
 	}
236 236
 
@@ -513,19 +513,23 @@ func (this *CommonApiController) GetDialysisModeType() {
513 513
 	loc, _ := time.LoadLocation("Local")
514 514
 	startime := this.GetString("startime")
515 515
 	endtime := this.GetString("endtime")
516
-	//fmt.Println("endtime", endtime)
516
+
517 517
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
518 518
 	startimes := startTimes.Unix()
519
-	// fmt.Println("startime",startimes)
519
+
520 520
 	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
521 521
 	endtimeData := endtimes.Unix()
522
-	// fmt.Println("结束日期",endtimeData)
522
+
523
+	lapsetotype, _ := this.GetInt64("lapsetotype")
524
+	sourcetype, _ := this.GetInt64("sourcetype")
525
+
523 526
 	adminUser := this.GetAdminUserInfo()
524 527
 	orgid := adminUser.CurrentOrgId
525 528
 	//统计透析总量
526
-	_, total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid)
527
-
528
-	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid)
529
+	total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)
530
+	fmt.Println("total3333333333333", total)
531
+	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)
532
+	fmt.Println("modetype555555555555555", modeType)
529 533
 	if err != nil {
530 534
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
531 535
 		return
@@ -547,19 +551,21 @@ func (this *CommonApiController) GetTotalLapseCount() {
547 551
 	endtime := this.GetString("endtime")
548 552
 	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
549 553
 	endunix := endtimes.Unix()
550
-
554
+	lapsetotype, _ := this.GetInt64("lapsetotype")
555
+	sourcetype, _ := this.GetInt64("sourcetype")
551 556
 	//统计该机构的转出人数
552
-	patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix)
557
+	patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix, lapsetotype, sourcetype)
558
+
553 559
 	//统计该机构转出病人
554
-	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startnunix, endunix)
555
-	count := service.GetPatientTotalCount(orgid)
560
+	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startnunix, endunix, lapsetotype, sourcetype)
561
+	count := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
556 562
 	if err != nil {
557 563
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
558 564
 		return
559 565
 	}
560 566
 
561 567
 	//统计当前机构转出的人数
562
-	rollout, err := service.GetCountRollout(orgid, startnunix, endunix)
568
+	rollout, err := service.GetCountRollout(orgid, startnunix, endunix, lapsetotype, sourcetype)
563 569
 	this.ServeSuccessJSON(map[string]interface{}{
564 570
 		"patients":   patients,
565 571
 		"count":      count,
@@ -576,17 +582,22 @@ func (this *CommonApiController) GetTotalSexCount() {
576 582
 	fmt.Println("开始时间", startime)
577 583
 	endtime, _ := this.GetInt64("endtime")
578 584
 	fmt.Println("结束时间", endtime)
579
-	total := service.GetPatientTotalCount(orgid)
585
+	lapsetotype, _ := this.GetInt64("lapsetotype")
586
+	sourcetype, _ := this.GetInt64("sourcetype")
587
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
588
+
589
+	_, totalSex, err := service.GetManPatientTotal(orgid, lapsetotype, sourcetype)
580 590
 
581
-	_, totalSex, err := service.GetManPatientTotal(orgid)
591
+	_, totalWoman, err := service.GetWoManPatientTotal(orgid, lapsetotype, sourcetype)
582 592
 
583 593
 	if err != nil {
584 594
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
585 595
 		return
586 596
 	}
587 597
 	this.ServeSuccessJSON(map[string]interface{}{
588
-		"total":    total,
589
-		"totalSex": totalSex,
598
+		"total":      total,
599
+		"totalSex":   totalSex,
600
+		"totalWoman": totalWoman,
590 601
 	})
591 602
 }
592 603
 
@@ -602,10 +613,13 @@ func (this *CommonApiController) GetTotalInfectiouscount() {
602 613
 	endtime := this.GetString("endtime")
603 614
 	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
604 615
 	endunix := endtimes.Unix()
616
+	lapsetotype, _ := this.GetInt64("lapsetotype")
617
+	sourcetype, _ := this.GetInt64("sourcetype")
618
+
605 619
 	//统计透析总人数
606
-	total := service.GetPatientTotalCount(orgid)
620
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
607 621
 	//统计透析人数传染病所占比例
608
-	count, err := service.GetPatientInfectiousCount(orgid, startnunix, endunix)
622
+	count, err := service.GetPatientInfectiousCount(orgid, startnunix, endunix, lapsetotype, sourcetype)
609 623
 	//统计其他
610 624
 	_, otherTotal, err := service.GetPatientOtherInfectious(orgid)
611 625
 	if err != nil {
@@ -627,9 +641,12 @@ func (this *CommonApiController) GetTotalAgeCount() {
627 641
 	fmt.Println("开始时间", startime)
628 642
 	endtime, _ := this.GetInt64("endtime")
629 643
 	fmt.Println("结束时间", endtime)
644
+	lapsetotype, _ := this.GetInt64("lapsetotype")
645
+	sourcetype, _ := this.GetInt64("sourcetype")
630 646
 	//统计透析总人数
631
-	total := service.GetPatientTotalCount(orgid)
632
-	agecount, err := service.GetTotalAgeCount(orgid)
647
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
648
+	agecount, err := service.GetTotalAgeCount(orgid, lapsetotype, sourcetype)
649
+	fmt.Println("ageCount22222222222", agecount)
633 650
 	//two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
634 651
 	if err != nil {
635 652
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -653,15 +670,17 @@ func (this *CommonApiController) GetTotalDialysisCount() {
653 670
 	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
654 671
 	fmt.Println("parseDateErr", parseDateErr)
655 672
 	nowtime := recordDate.Unix()
673
+	lapsetotype, _ := this.GetInt64("lapsetotype")
674
+	sourcetype, _ := this.GetInt64("sourcetype")
656 675
 	//统计透析总人数
657
-	total := service.GetPatientTotalCount(orgid)
676
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
658 677
 	fmt.Println("total", total)
659 678
 	//获取该机构下的所有病人数据
660 679
 	patients, err := service.GetTotalDialysisAgeCount(orgid)
661 680
 	fmt.Println("patients", patients)
662 681
 
663 682
 	//统计透年龄
664
-	dataage, _ := service.GetDialysisAgeData(orgid)
683
+	dataage, _ := service.GetDialysisAgeData(orgid, lapsetotype, sourcetype)
665 684
 	if err != nil {
666 685
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
667 686
 		return
@@ -2104,11 +2123,13 @@ func (this *CommonApiController) GetRolloutCount() {
2104 2123
 
2105 2124
 	start_time, _ := this.GetInt64("start_time")
2106 2125
 	end_time, _ := this.GetInt64("end_time")
2126
+	lapsetotype, _ := this.GetInt64("lapsetotype")
2127
+	sourcetype, _ := this.GetInt64("sourcetype")
2107 2128
 	adminUserInfo := this.GetAdminUserInfo()
2108 2129
 	orgId := adminUserInfo.CurrentOrgId
2109 2130
 
2110 2131
 	//统计当前机构转出的人数
2111
-	rollout, err := service.GetCountRollout(orgId, start_time, end_time)
2132
+	rollout, err := service.GetCountRollout(orgId, start_time, end_time, lapsetotype, sourcetype)
2112 2133
 
2113 2134
 	if err != nil {
2114 2135
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)

+ 4 - 2
controllers/new_mobile_api_controllers/good_types.json Dosyayı Görüntüle

@@ -28,7 +28,8 @@
28 28
       "status": 1,
29 29
       "type": 1,
30 30
       "number": 2,
31
-      "out_stock": 1
31
+      "out_stock": 1,
32
+      "stock_attribute": 2,
32 33
     },
33 34
     {
34 35
       "id": 10002,
@@ -43,7 +44,8 @@
43 44
       "status": 1,
44 45
       "type": 1,
45 46
       "number": 3,
46
-      "out_stock": 1
47
+      "out_stock": 1,
48
+      "stock_attribute": 3,
47 49
     },
48 50
     {
49 51
       "id": 10003,

+ 40 - 17
controllers/new_mobile_api_controllers/new_common_api_controller.go Dosyayı Görüntüle

@@ -31,10 +31,14 @@ func (this *NewCommonApiController) GetTotalDialysis() {
31 31
 	adminUser := this.GetMobileAdminUserInfo()
32 32
 	orgid := adminUser.Org.Id
33 33
 
34
+	lapsetotype, _ := this.GetInt64("lapsetotype")
35
+	sourcetype, _ := this.GetInt64("sourcetype")
36
+
34 37
 	//统计透析总量
35
-	_, total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid)
38
+	total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)
39
+
40
+	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)
36 41
 
37
-	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid)
38 42
 	if err != nil {
39 43
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
40 44
 		return
@@ -52,10 +56,16 @@ func (this *NewCommonApiController) GetMobileTotalLapseCount() {
52 56
 
53 57
 	adminUser := this.GetMobileAdminUserInfo()
54 58
 	orgid := adminUser.Org.Id
59
+	lapsetotype, _ := this.GetInt64("lapsetotype")
60
+	sourcetype, _ := this.GetInt64("sourcetype")
55 61
 	//统计转出的病人
56
-	patient, err := service.GetTotalRollOutPatients(orgid, startime, endtime)
57
-	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startime, endtime)
58
-	count := service.GetPatientTotalCount(orgid)
62
+	patient, err := service.GetTotalRollOutPatients(orgid, startime, endtime, lapsetotype, sourcetype)
63
+
64
+	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startime, endtime, lapsetotype, sourcetype)
65
+	count := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
66
+	//统计当前机构转出的人数
67
+	rollout, err := service.GetCountRollout(orgid, startime, endtime, lapsetotype, sourcetype)
68
+	fmt.Println("roullout", rollout)
59 69
 	if err != nil {
60 70
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
61 71
 		return
@@ -64,6 +74,7 @@ func (this *NewCommonApiController) GetMobileTotalLapseCount() {
64 74
 		"patient":    patient,
65 75
 		"count":      count,
66 76
 		"patienttwo": patienttwo,
77
+		"rollout":    rollout,
67 78
 	})
68 79
 }
69 80
 
@@ -72,17 +83,21 @@ func (this *NewCommonApiController) GetMobileTotalSexCount() {
72 83
 	//fmt.Println("startime", startime)
73 84
 	//endtime, _ := this.GetInt64("endtime")
74 85
 	//fmt.Println("endtime", endtime)
86
+	lapsetotype, _ := this.GetInt64("lapsetotype")
87
+	sourcetype, _ := this.GetInt64("sourcetype")
75 88
 	adminUser := this.GetMobileAdminUserInfo()
76 89
 	orgid := adminUser.Org.Id
77
-	total := service.GetPatientTotalCount(orgid)
78
-	_, totalSex, err := service.GetManPatientTotal(orgid)
90
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
91
+	_, totalSex, err := service.GetManPatientTotal(orgid, lapsetotype, sourcetype)
92
+	_, totalWoman, err := service.GetWoManPatientTotal(orgid, lapsetotype, sourcetype)
79 93
 	if err != nil {
80 94
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
81 95
 		return
82 96
 	}
83 97
 	this.ServeSuccessJSON(map[string]interface{}{
84
-		"total":    total,
85
-		"totalSex": totalSex,
98
+		"total":      total,
99
+		"totalSex":   totalSex,
100
+		"totalWoman": totalWoman,
86 101
 	})
87 102
 }
88 103
 
@@ -93,10 +108,13 @@ func (this *NewCommonApiController) GetMobileTotalInfectiousCout() {
93 108
 
94 109
 	adminUser := this.GetMobileAdminUserInfo()
95 110
 	orgid := adminUser.Org.Id
111
+	lapsetotype, _ := this.GetInt64("lapsetotype")
112
+	sourcetype, _ := this.GetInt64("sourcetype")
113
+
96 114
 	//统计透析总人数
97
-	total := service.GetPatientTotalCount(orgid)
115
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
98 116
 	//统计透析人数传染病所占比例
99
-	count, err := service.GetPatientInfectiousCount(orgid, startime, endtime)
117
+	count, err := service.GetPatientInfectiousCount(orgid, startime, endtime, lapsetotype, sourcetype)
100 118
 	//统计其他
101 119
 	_, otherTotal, err := service.GetPatientOtherInfectious(orgid)
102 120
 	if err != nil {
@@ -114,11 +132,12 @@ func (this *NewCommonApiController) GetMobileTotalAgeCount() {
114 132
 	//startime, _ := this.GetInt64("startime")
115 133
 	//
116 134
 	//endtime, _ := this.GetInt64("endtime")
117
-
135
+	lapsetotype, _ := this.GetInt64("lapsetotype")
136
+	sourcetype, _ := this.GetInt64("sourcetype")
118 137
 	adminUser := this.GetMobileAdminUserInfo()
119 138
 	orgid := adminUser.Org.Id
120
-	total := service.GetPatientTotalCount(orgid)
121
-	agecount, err := service.GetTotalAgeCount(orgid)
139
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
140
+	agecount, err := service.GetTotalAgeCount(orgid, lapsetotype, sourcetype)
122 141
 	//two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
123 142
 	if err != nil {
124 143
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -141,10 +160,12 @@ func (this *NewCommonApiController) GetMobileTotalDialysisCount() {
141 160
 	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
142 161
 	fmt.Println(parseDateErr)
143 162
 	nowtime := recordDate.Unix()
163
+	lapsetotype, _ := this.GetInt64("lapsetotype")
164
+	sourcetype, _ := this.GetInt64("sourcetype")
144 165
 	//统计透析总人数
145
-	total := service.GetPatientTotalCount(orgid)
166
+	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
146 167
 	//获取该机构下的所有病人数据
147
-	ageData, err := service.GetDialysisAgeData(orgid)
168
+	ageData, err := service.GetDialysisAgeData(orgid, lapsetotype, sourcetype)
148 169
 
149 170
 	if err != nil {
150 171
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -2123,8 +2144,10 @@ func (this *NewCommonApiController) GetMobileRolloutCount() {
2123 2144
 
2124 2145
 	adminUserInfo := this.GetMobileAdminUserInfo()
2125 2146
 	orgId := adminUserInfo.Org.Id
2147
+	lapsetotype, _ := this.GetInt64("lapsetotype")
2148
+	sourcetype, _ := this.GetInt64("sourcetype")
2126 2149
 	//统计当前机构转出的人数
2127
-	rollout, err := service.GetCountRollout(orgId, startimes, endtimeData)
2150
+	rollout, err := service.GetCountRollout(orgId, startimes, endtimeData, lapsetotype, sourcetype)
2128 2151
 
2129 2152
 	if err != nil {
2130 2153
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)

+ 10 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Dosyayı Görüntüle

@@ -172,6 +172,7 @@ func (this *NewDialysisApiController) SavePatient() {
172 172
 	birth := theTime.Unix()
173 173
 	fmt.Print(birth)
174 174
 	phone := dataBody["phone"].(string)
175
+	relative_phone := dataBody["relative_phone"].(string)
175 176
 	fmt.Print("电话号码", phone)
176 177
 	patientType := dataBody["result"].([]interface{})
177 178
 	fmt.Print("患者标签", patientType)
@@ -290,6 +291,7 @@ func (this *NewDialysisApiController) SavePatient() {
290 291
 			IdCardNo:          idCard,
291 292
 			IsInfectious:      is_infectious,
292 293
 			RegistrarsId:      adminInfo.AdminUser.Id,
294
+			RelativePhone:     relative_phone,
293 295
 		}
294 296
 		err = service.CreateOldPatient(&patients)
295 297
 		fmt.Print("报错", err)
@@ -331,6 +333,7 @@ func (this *NewDialysisApiController) SavePatient() {
331 333
 			IsInfectious:      is_infectious,
332 334
 			IdCardNo:          idCard,
333 335
 			RegistrarsId:      adminInfo.AdminUser.Id,
336
+			RelativePhone:     relative_phone,
334 337
 		}
335 338
 		err = service.CreateNewPatient(&patientsNew)
336 339
 		fmt.Print("报错", err)
@@ -455,6 +458,7 @@ func (this *NewDialysisApiController) SavePatient() {
455 458
 								MemberFistdate:    memtime,
456 459
 								MemberPatienttype: patient_type,
457 460
 								MemberTreatement:  treatmentmethod,
461
+								RelativePhone:     relative_phone,
458 462
 							}
459 463
 							err = service.CreateNewPatient(&patientsNew)
460 464
 							fmt.Print("报错", err)
@@ -541,6 +545,7 @@ func (this *NewDialysisApiController) SavePatient() {
541 545
 					MemberFistdate:    memtime,
542 546
 					MemberPatienttype: patient_type,
543 547
 					MemberTreatement:  treatmentmethod,
548
+					RelativePhone:     relative_phone,
544 549
 				}
545 550
 				err = service.CreateNewPatient(&patientsNew)
546 551
 				fmt.Print("报错", err)
@@ -1254,6 +1259,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1254 1259
 	fmt.Print(birth)
1255 1260
 	phone := dataBody["phone"].(string)
1256 1261
 	fmt.Print("电话号码", phone)
1262
+	relative_phone := dataBody["relative_phone"].(string)
1257 1263
 	patientType := dataBody["result"].([]interface{})
1258 1264
 	fmt.Print("患者标签", patientType)
1259 1265
 	dialysis := dataBody["dialysis"].(string)
@@ -1387,6 +1393,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1387 1393
 			Lapseto:           lapseto,
1388 1394
 			DeathTime:         death_time,
1389 1395
 			OutReason:         out_reason,
1396
+			RelativePhone:     relative_phone,
1390 1397
 		}
1391 1398
 		err = service.UpdatedPatient(patients, patient.BloodId)
1392 1399
 		//patientLapseto := models.PatientLapseto{
@@ -1417,6 +1424,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1417 1424
 			Lapseto:           lapseto,
1418 1425
 			OutReason:         out_reason,
1419 1426
 			DeathTime:         death_time,
1427
+			RelativePhone:     relative_phone,
1420 1428
 		}
1421 1429
 		err = service.UpdateXtPatientNew(patientsNew, id)
1422 1430
 		if err != nil {
@@ -1474,6 +1482,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1474 1482
 			EquitmentId:       requipmentId,
1475 1483
 			OutReason:         out_reason,
1476 1484
 			DeathTime:         death_time,
1485
+			RelativePhone:     relative_phone,
1477 1486
 		}
1478 1487
 		err = service.UpdateXtPatientNew(xtPatientsNew, id)
1479 1488
 		fmt.Print("更新失败", err)
@@ -1530,6 +1539,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1530 1539
 			MemberTreatement:  treatmentmethod,
1531 1540
 			OutReason:         out_reason,
1532 1541
 			DeathTime:         death_time,
1542
+			RelativePhone:     relative_phone,
1533 1543
 		}
1534 1544
 		err = service.UpdateXtPatientNewOne(patientsNew, id)
1535 1545
 		if err != nil {

+ 92 - 80
controllers/patient_api_controller.go Dosyayı Görüntüle

@@ -254,29 +254,29 @@ func (c *PatientApiController) CreatePatient() {
254 254
 	//获取老表的最后一条数据
255 255
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
256 256
 	patientsNew := models.XtPatientsNew{
257
-		UserOrgId:          adminUserInfo.CurrentOrgId,
258
-		UserId:             0,
259
-		Avatar:             patients.Avatar,
260
-		PatientType:        patients.PatientType,
261
-		DialysisNo:         patients.DialysisNo,
262
-		AdmissionNumber:    patients.AdmissionNumber,
263
-		Source:             patients.Source,
264
-		Lapseto:            patients.Lapseto,
265
-		PartitionId:        patients.PartitionId,
266
-		BedId:              patients.BedId,
267
-		Name:               patients.Name,
268
-		Alias:              patients.Alias,
269
-		Gender:             patients.Gender,
270
-		MaritalStatus:      patients.MaritalStatus,
271
-		IdCardNo:           patients.IdCardNo,
272
-		Birthday:           patients.Birthday,
273
-		ReimbursementWayId: patients.ReimbursementWayId,
274
-		HealthCareType:     patients.HealthCareType,
275
-		HealthCareNo:       patients.HealthCareNo,
276
-		HealthCareDueDate:  patients.HealthCareDueDate,
277
-		Height:             patients.Height,
278
-		BloodType:          patients.BloodType,
279
-		Rh:                 patients.Rh,
257
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
258
+		UserId:                       0,
259
+		Avatar:                       patients.Avatar,
260
+		PatientType:                  patients.PatientType,
261
+		DialysisNo:                   patients.DialysisNo,
262
+		AdmissionNumber:              patients.AdmissionNumber,
263
+		Source:                       patients.Source,
264
+		Lapseto:                      patients.Lapseto,
265
+		PartitionId:                  patients.PartitionId,
266
+		BedId:                        patients.BedId,
267
+		Name:                         patients.Name,
268
+		Alias:                        patients.Alias,
269
+		Gender:                       patients.Gender,
270
+		MaritalStatus:                patients.MaritalStatus,
271
+		IdCardNo:                     patients.IdCardNo,
272
+		Birthday:                     patients.Birthday,
273
+		ReimbursementWayId:           patients.ReimbursementWayId,
274
+		HealthCareType:               patients.HealthCareType,
275
+		HealthCareNo:                 patients.HealthCareNo,
276
+		HealthCareDueDate:            patients.HealthCareDueDate,
277
+		Height:                       patients.Height,
278
+		BloodType:                    patients.BloodType,
279
+		Rh:                           patients.Rh,
280 280
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
281 281
 		EducationLevel:               patients.EducationLevel,
282 282
 		Profession:                   patients.Profession,
@@ -322,28 +322,28 @@ func (c *PatientApiController) CreatePatient() {
322 322
 		Nation:                       patients.Nation,
323 323
 		NativePlace:                  patients.NativePlace,
324 324
 		Age:                          patients.Age,
325
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
326
-		IsInfectious:             patients.IsInfectious,
327
-		RemindCycle:              patients.RemindCycle,
328
-		ResponseResult:           patients.ResponseResult,
329
-		IsOpenRemind:             patients.IsOpenRemind,
330
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
331
-		DialysisAge:              patients.DialysisAge,
332
-		ExpenseKind:              patients.ExpenseKind,
333
-		TellPhone:                patients.TellPhone,
334
-		ContactName:              patients.ContactName,
335
-		BloodPatients:            1,
336
-		SlowPatients:             0,
337
-		MemberPatients:           0,
338
-		EcommerPatients:          "",
339
-		BloodId:                  patients.ID,
340
-		SlowId:                   0,
341
-		MemberId:                 0,
342
-		MemberFistdate:           0,
343
-		MemberPatienttype:        0,
344
-		MemberTreatement:         0,
345
-		EquitmentId:              "",
346
-		UserSysBeforeCount:       patient.UserSysBeforeCount,
325
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
326
+		IsInfectious:                 patients.IsInfectious,
327
+		RemindCycle:                  patients.RemindCycle,
328
+		ResponseResult:               patients.ResponseResult,
329
+		IsOpenRemind:                 patients.IsOpenRemind,
330
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
331
+		DialysisAge:                  patients.DialysisAge,
332
+		ExpenseKind:                  patients.ExpenseKind,
333
+		TellPhone:                    patients.TellPhone,
334
+		ContactName:                  patients.ContactName,
335
+		BloodPatients:                1,
336
+		SlowPatients:                 0,
337
+		MemberPatients:               0,
338
+		EcommerPatients:              "",
339
+		BloodId:                      patients.ID,
340
+		SlowId:                       0,
341
+		MemberId:                     0,
342
+		MemberFistdate:               0,
343
+		MemberPatienttype:            0,
344
+		MemberTreatement:             0,
345
+		EquitmentId:                  "",
346
+		UserSysBeforeCount:           patient.UserSysBeforeCount,
347 347
 	}
348 348
 
349 349
 	err = service.CreatePatientsNew(&patientsNew)
@@ -481,28 +481,28 @@ func (c *PatientApiController) EditPatient() {
481 481
 		return
482 482
 	}
483 483
 	patientsNew := models.XtPatientsNew{
484
-		UserOrgId:          patient.UserOrgId,
485
-		UserId:             patient.UserId,
486
-		Avatar:             patient.Avatar,
487
-		PatientType:        patient.PatientType,
488
-		DialysisNo:         patient.DialysisNo,
489
-		AdmissionNumber:    patient.AdmissionNumber,
490
-		Source:             patient.Source,
491
-		PartitionId:        patient.PartitionId,
492
-		BedId:              patient.BedId,
493
-		Name:               patient.Name,
494
-		Alias:              patient.Alias,
495
-		Gender:             patient.Gender,
496
-		MaritalStatus:      patient.MaritalStatus,
497
-		IdCardNo:           patient.IdCardNo,
498
-		Birthday:           patient.Birthday,
499
-		ReimbursementWayId: patient.ReimbursementWayId,
500
-		HealthCareType:     patient.HealthCareType,
501
-		HealthCareNo:       patient.HealthCareNo,
502
-		HealthCareDueDate:  patient.HealthCareDueDate,
503
-		Height:             patient.Height,
504
-		BloodType:          patient.BloodType,
505
-		Rh:                 patient.Rh,
484
+		UserOrgId:                 patient.UserOrgId,
485
+		UserId:                    patient.UserId,
486
+		Avatar:                    patient.Avatar,
487
+		PatientType:               patient.PatientType,
488
+		DialysisNo:                patient.DialysisNo,
489
+		AdmissionNumber:           patient.AdmissionNumber,
490
+		Source:                    patient.Source,
491
+		PartitionId:               patient.PartitionId,
492
+		BedId:                     patient.BedId,
493
+		Name:                      patient.Name,
494
+		Alias:                     patient.Alias,
495
+		Gender:                    patient.Gender,
496
+		MaritalStatus:             patient.MaritalStatus,
497
+		IdCardNo:                  patient.IdCardNo,
498
+		Birthday:                  patient.Birthday,
499
+		ReimbursementWayId:        patient.ReimbursementWayId,
500
+		HealthCareType:            patient.HealthCareType,
501
+		HealthCareNo:              patient.HealthCareNo,
502
+		HealthCareDueDate:         patient.HealthCareDueDate,
503
+		Height:                    patient.Height,
504
+		BloodType:                 patient.BloodType,
505
+		Rh:                        patient.Rh,
506 506
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
507 507
 		EducationLevel:            patient.EducationLevel,
508 508
 		Profession:                patient.Profession,
@@ -544,19 +544,19 @@ func (c *PatientApiController) EditPatient() {
544 544
 		Nation:                    patient.Nation,
545 545
 		NativePlace:               patient.NativePlace,
546 546
 		Age:                       patient.Age,
547
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
548
-		IsInfectious:             patient.IsInfectious,
549
-		RemindCycle:              patient.RemindCycle,
550
-		ResponseResult:           patient.ResponseResult,
551
-		IsOpenRemind:             patient.IsOpenRemind,
552
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
553
-		DialysisAge:              patient.DialysisAge,
554
-		ExpenseKind:              patient.ExpenseKind,
555
-		TellPhone:                patient.TellPhone,
556
-		ContactName:              patient.ContactName,
557
-		UpdatedTime:              time.Now().Unix(),
558
-		BloodPatients:            1,
559
-		Lapseto:                  patient.Lapseto,
547
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
548
+		IsInfectious:              patient.IsInfectious,
549
+		RemindCycle:               patient.RemindCycle,
550
+		ResponseResult:            patient.ResponseResult,
551
+		IsOpenRemind:              patient.IsOpenRemind,
552
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
553
+		DialysisAge:               patient.DialysisAge,
554
+		ExpenseKind:               patient.ExpenseKind,
555
+		TellPhone:                 patient.TellPhone,
556
+		ContactName:               patient.ContactName,
557
+		UpdatedTime:               time.Now().Unix(),
558
+		BloodPatients:             1,
559
+		Lapseto:                   patient.Lapseto,
560 560
 	}
561 561
 	//	//更新病人ID获取新表病人ID
562 562
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -856,6 +856,8 @@ func (c *PatientApiController) UpdateDialysisSolution() {
856 856
 		DialysateTemperature:       solution.DialysateTemperature,
857 857
 		DialysisIrrigation:         solution.DialysisIrrigation,
858 858
 		DialysisDialyszers:         solution.DialysisDialyszers,
859
+		PlasmaSeparator:            solution.PlasmaSeparator,
860
+		BilirubinAdsorptionColumn:  solution.BilirubinAdsorptionColumn,
859 861
 	}
860 862
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
861 863
 	if err != nil {
@@ -3410,6 +3412,16 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
3410 3412
 		solution.DialysisIrrigation = dialysisIrrigation
3411 3413
 	}
3412 3414
 
3415
+	if dataBody["plasma_separator"] != nil && reflect.TypeOf(dataBody["plasma_separator"]).String() == "string" {
3416
+		plasmaSeparator := dataBody["plasma_separator"].(string)
3417
+		solution.PlasmaSeparator = plasmaSeparator
3418
+	}
3419
+
3420
+	if dataBody["bilirubin_adsorption_column"] != nil && reflect.TypeOf(dataBody["bilirubin_adsorption_column"]).String() == "string" {
3421
+		bilirubinAdsorptionColumn := dataBody["bilirubin_adsorption_column"].(string)
3422
+		solution.BilirubinAdsorptionColumn = bilirubinAdsorptionColumn
3423
+	}
3424
+
3413 3425
 	return
3414 3426
 }
3415 3427
 

+ 442 - 7
controllers/schedule_api_controller.go Dosyayı Görüntüle

@@ -22,6 +22,7 @@ type ScheduleApiController struct {
22 22
 
23 23
 func ScheduleApiRegistRouters() {
24 24
 	beego.Router("/api/schedule/weekpanel", &ScheduleApiController{}, "Get:GetWeekPanels")
25
+
25 26
 	beego.Router("/api/schedule/schedules", &ScheduleApiController{}, "Get:GetSchedules")
26 27
 	beego.Router("/api/excel_date/init", &ScheduleApiController{}, "Get:GetInitExcelInitDate")
27 28
 
@@ -46,6 +47,23 @@ func ScheduleApiRegistRouters() {
46 47
 	beego.Router("/api/schedule/getallzones", &ScheduleApiController{}, "Get:GetAllZones")
47 48
 
48 49
 	beego.Router("/api/schedule/copypatientschedules", &ScheduleApiController{}, "Get:GetCopyPatientSchedules")
50
+
51
+	beego.Router("/api/schedule/saveremindprint", &ScheduleApiController{}, "Get:SaveRemindPrint")
52
+
53
+	beego.Router("/api/schedule/getremindprintlist", &ScheduleApiController{}, "Get:GetRemindPrintList")
54
+
55
+	beego.Router("/api/schedule/getbloodschedulelist", &ScheduleApiController{}, "Get:GetBloodScheduleList")
56
+
57
+	beego.Router("/api/schedule/getprintlist", &ScheduleApiController{}, "Get:GetPrintList")
58
+
59
+	beego.Router("/api/schedule/getallzonelist", &ScheduleApiController{}, "Get:GetAllZoneList")
60
+
61
+	beego.Router("/api/schedule/getpatientschedulecount", &ScheduleApiController{}, "Get:GetPatientScheduleCount")
62
+
63
+	beego.Router("/api/schedule/weekpanelone", &ScheduleApiController{}, "Get:GetWeekPanelsOne")
64
+	beego.Router("/api/schedule/schedulesone", &ScheduleApiController{}, "Get:GetScheduleOne")
65
+	beego.Router("/api/schedule/postscheduletemplate", &ScheduleApiController{}, "Get:SaveScheduleTemplate")
66
+	beego.Router("/api/schedule/getscheduletemplate", &ScheduleApiController{}, "Get:GetScheduleTemplate")
49 67
 }
50 68
 
51 69
 func (c *ScheduleApiController) GetWeekPanels() {
@@ -790,6 +808,7 @@ func (this *ScheduleApiController) SearchSchedulePatients() {
790 808
 func (this *ScheduleApiController) GetWeekDaySchedule() {
791 809
 	week_type, _ := this.GetInt64("week_type", -1)
792 810
 	week_time, _ := this.GetInt64("week_time")
811
+
793 812
 	thisTime := time.Now()
794 813
 	weekDay := int(thisTime.Weekday())
795 814
 	if weekDay == 0 {
@@ -810,7 +829,14 @@ func (this *ScheduleApiController) GetWeekDaySchedule() {
810 829
 	fmt.Println(days)
811 830
 
812 831
 	var targetDayStr string
832
+	var startTime string
833
+	var endTime string
813 834
 	switch week_type {
835
+	case 0:
836
+		{
837
+			startTime = days[0]
838
+			endTime = days[6]
839
+		}
814 840
 	case 1:
815 841
 		targetDayStr = days[0]
816 842
 		break
@@ -840,14 +866,17 @@ func (this *ScheduleApiController) GetWeekDaySchedule() {
840 866
 		break
841 867
 	}
842 868
 	targetDay, parseErr := utils.ParseTimeStringToTime("2006-01-02", targetDayStr)
843
-
869
+	startDay, _ := utils.ParseTimeStringToTime("2006-01-02", startTime)
870
+	endDay, _ := utils.ParseTimeStringToTime("2006-01-02", endTime)
871
+	fmt.Println(startDay, endDay)
844 872
 	if parseErr != nil {
845 873
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
846 874
 		return
847 875
 	}
848 876
 
849
-	adminUserInfo := this.GetAdminUserInfo()
850
-	list, _ := service.GetWeekDayScheduleTwo(adminUserInfo.CurrentOrgId, targetDay.Unix(), targetDay, week_time)
877
+	orgId := this.GetAdminUserInfo().CurrentOrgId
878
+
879
+	list, _ := service.GetWeekDayScheduleTwo(orgId, targetDay.Unix(), targetDay, week_time)
851 880
 
852 881
 	this.ServeSuccessJSON(map[string]interface{}{
853 882
 		"schdules": list,
@@ -1324,10 +1353,11 @@ func (this *ScheduleApiController) ExportSchedule() {
1324 1353
 			if err == nil {
1325 1354
 				for _, item := range schedules {
1326 1355
 					//查找当天日期是否存在
1327
-					_, errcode := service.GetTodayScheduleIsExist(item.PatientId, item.ScheduleDate, item.UserOrgId)
1356
+					_, errcode := service.GetTodayScheduleIsExist(item.PatientId, item.ScheduleDate, item.UserOrgId, item.ModeId, item.ScheduleType)
1328 1357
 					if errcode == gorm.ErrRecordNotFound {
1329 1358
 						service.CreateSchedule(item)
1330 1359
 					} else if errcode == nil {
1360
+
1331 1361
 						schedule := models.XtSchedule{
1332 1362
 							PartitionId:  item.PartitionId,
1333 1363
 							BedId:        item.BedId,
@@ -1338,7 +1368,8 @@ func (this *ScheduleApiController) ExportSchedule() {
1338 1368
 							ModeId:       item.ModeId,
1339 1369
 							Status:       1,
1340 1370
 						}
1341
-						service.UpdateScheduleByOrgId(item.PatientId, item.ScheduleDate, item.UserOrgId, &schedule)
1371
+
1372
+						service.UpdateScheduleByOrgId(item.PatientId, item.ScheduleDate, item.UserOrgId, item.ModeId, item.ScheduleType, &schedule)
1342 1373
 					}
1343 1374
 
1344 1375
 				}
@@ -1947,10 +1978,10 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
1947 1978
 	week_time, _ := this.GetInt64("week_time")
1948 1979
 	start_time, _ := this.GetInt64("start_time")
1949 1980
 	end_time, _ := this.GetInt64("end_time")
1950
-
1981
+	zone, _ := this.GetInt64("zone")
1951 1982
 	adminUserInfo := this.GetAdminUserInfo()
1952 1983
 
1953
-	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId)
1984
+	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone)
1954 1985
 	if err != nil {
1955 1986
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1956 1987
 		return
@@ -2188,3 +2219,407 @@ func (this *ScheduleApiController) GetCopyPatientSchedules() {
2188 2219
 	//	}
2189 2220
 	//}
2190 2221
 }
2222
+
2223
+func (this *ScheduleApiController) SaveRemindPrint() {
2224
+
2225
+	id, _ := this.GetInt64("id")
2226
+	anticoagulants, _ := this.GetInt64("anticoagulant")
2227
+	anticoagulant_zongliang, _ := this.GetInt64("anticoagulant_zongliang")
2228
+	classes, _ := this.GetInt64("classes")
2229
+	dialyzers, _ := this.GetInt64("dialyzers")
2230
+	doctor_advice, _ := this.GetInt64("doctor_advice")
2231
+	mode, _ := this.GetInt64("mode")
2232
+	name, _ := this.GetInt64("name")
2233
+	number, _ := this.GetInt64("number")
2234
+	perfusion_apparatus, _ := this.GetInt64("perfusion_apparatus")
2235
+	prescription_status, _ := this.GetInt64("prescription_status")
2236
+	week, _ := this.GetInt64("week")
2237
+	zone, _ := this.GetInt64("zone")
2238
+	adminUserInfo := this.GetAdminUserInfo()
2239
+	orgId := adminUserInfo.CurrentOrgId
2240
+	setting := models.XtRemindPrintSetting{
2241
+		Anticoagulant:          anticoagulants,
2242
+		Classes:                classes,
2243
+		AnticoagulantZongliang: anticoagulant_zongliang,
2244
+		Dialyzers:              dialyzers,
2245
+		DoctorAdvice:           doctor_advice,
2246
+		Mode:                   mode,
2247
+		Name:                   name,
2248
+		Number:                 number,
2249
+		PerfusionApparatus:     perfusion_apparatus,
2250
+		PrescriptionStatus:     prescription_status,
2251
+		Week:                   week,
2252
+		Zone:                   zone,
2253
+		UserOrgId:              orgId,
2254
+		Status:                 1,
2255
+		Ctime:                  time.Now().Unix(),
2256
+	}
2257
+	_, errcode := service.GetSettingById(id)
2258
+	if errcode == gorm.ErrRecordNotFound {
2259
+		err := service.CreateSetting(&setting)
2260
+		if err != nil {
2261
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2262
+			return
2263
+		}
2264
+
2265
+		this.ServeSuccessJSON(map[string]interface{}{
2266
+			"setting": setting,
2267
+		})
2268
+	} else if errcode == nil {
2269
+		err := service.UpdatedRemindPrint(&setting, id)
2270
+		if err != nil {
2271
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2272
+			return
2273
+		}
2274
+
2275
+		this.ServeSuccessJSON(map[string]interface{}{
2276
+			"setting": setting,
2277
+		})
2278
+	}
2279
+
2280
+}
2281
+func (this *ScheduleApiController) GetRemindPrintList() {
2282
+
2283
+	adminUserInfo := this.GetAdminUserInfo()
2284
+	orgId := adminUserInfo.CurrentOrgId
2285
+	list, err := service.GetRemindPrintList(orgId)
2286
+	if err != nil {
2287
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2288
+		return
2289
+	}
2290
+
2291
+	this.ServeSuccessJSON(map[string]interface{}{
2292
+		"list": list,
2293
+	})
2294
+}
2295
+
2296
+func (this *ScheduleApiController) GetBloodScheduleList() {
2297
+
2298
+	week_type, _ := this.GetInt64("week_type", -1)
2299
+	week_time, _ := this.GetInt64("week_time")
2300
+	zone, _ := this.GetInt64("zone")
2301
+	thisTime := time.Now()
2302
+	weekDay := int(thisTime.Weekday())
2303
+	if weekDay == 0 {
2304
+		weekDay = 7
2305
+	}
2306
+	weekEnd := 7 - weekDay
2307
+	weekStart := weekEnd - 6
2308
+	weekTitle := make([]string, 0)
2309
+	days := make([]string, 0)
2310
+	for index := weekStart; index <= weekEnd; index++ {
2311
+		theDay := thisTime.AddDate(0, 0, index)
2312
+		indexYear, indexMonthTime, indexDay := theDay.Date()
2313
+		indexMonth := int(indexMonthTime)
2314
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
2315
+		weekTitle = append(weekTitle, indexWeek)
2316
+		days = append(days, theDay.Format("2006-01-02"))
2317
+	}
2318
+	fmt.Println(days)
2319
+
2320
+	var targetDayStr string
2321
+	var startTime string
2322
+	switch week_type {
2323
+	case 0:
2324
+		startTime = days[0]
2325
+		targetDayStr = days[6]
2326
+		break
2327
+	case 1:
2328
+		targetDayStr = days[0]
2329
+		break
2330
+	case 2:
2331
+		targetDayStr = days[1]
2332
+
2333
+		break
2334
+	case 3:
2335
+		targetDayStr = days[2]
2336
+
2337
+		break
2338
+	case 4:
2339
+		targetDayStr = days[3]
2340
+
2341
+		break
2342
+	case 5:
2343
+		targetDayStr = days[4]
2344
+
2345
+		break
2346
+	case 6:
2347
+		targetDayStr = days[5]
2348
+
2349
+		break
2350
+	case 7:
2351
+		targetDayStr = days[6]
2352
+
2353
+		break
2354
+	}
2355
+	targetDay, parseErr := utils.ParseTimeStringToTime("2006-01-02", targetDayStr)
2356
+
2357
+	if parseErr != nil {
2358
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2359
+		return
2360
+	}
2361
+
2362
+	orgId := this.GetAdminUserInfo().CurrentOrgId
2363
+	if week_type > 0 {
2364
+		list, err := service.GetWeekDayScheduleById(orgId, targetDay.Unix(), week_time)
2365
+		if err != nil {
2366
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2367
+			return
2368
+		}
2369
+
2370
+		this.ServeSuccessJSON(map[string]interface{}{
2371
+			"list": list,
2372
+			"day":  targetDayStr,
2373
+		})
2374
+	}
2375
+
2376
+	if week_type == 0 {
2377
+		startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startTime)
2378
+		list, err := service.GetWeekDayScheduleByIdTwo(orgId, targetDay.Unix(), week_time, startDate.Unix(), zone)
2379
+		if err != nil {
2380
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2381
+			return
2382
+		}
2383
+
2384
+		this.ServeSuccessJSON(map[string]interface{}{
2385
+			"list": list,
2386
+			"day":  targetDayStr,
2387
+		})
2388
+	}
2389
+
2390
+}
2391
+
2392
+func (this *ScheduleApiController) GetPrintList() {
2393
+
2394
+	adminUserInfo := this.GetAdminUserInfo()
2395
+	orgId := adminUserInfo.CurrentOrgId
2396
+
2397
+	list, err := service.GetRemindPrintList(orgId)
2398
+	if err != nil {
2399
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2400
+		return
2401
+	}
2402
+
2403
+	this.ServeSuccessJSON(map[string]interface{}{
2404
+		"list": list,
2405
+	})
2406
+}
2407
+
2408
+func (this *ScheduleApiController) GetAllZoneList() {
2409
+
2410
+	adminUserInfo := this.GetAdminUserInfo()
2411
+	orgId := adminUserInfo.CurrentOrgId
2412
+	zoneList, err := service.GetAllZoneOne(orgId)
2413
+	if err != nil {
2414
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2415
+		return
2416
+	}
2417
+
2418
+	this.ServeSuccessJSON(map[string]interface{}{
2419
+		"zoneList": zoneList,
2420
+	})
2421
+}
2422
+
2423
+func (this *ScheduleApiController) GetPatientScheduleCount() {
2424
+	patitionIdStr := this.GetString("partition_id")
2425
+	week, _ := this.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
2426
+	ids := strings.Split(patitionIdStr, ",")
2427
+	adminUserInfo := this.GetAdminUserInfo()
2428
+	orgId := adminUserInfo.CurrentOrgId
2429
+	thisTime := time.Now()
2430
+	weekDay := int(thisTime.Weekday())
2431
+	if week < 1 || week > 4 {
2432
+		week = 2
2433
+	}
2434
+	if week == 1 {
2435
+		thisTime = thisTime.AddDate(0, 0, -7)
2436
+	} else if week == 3 {
2437
+		thisTime = thisTime.AddDate(0, 0, 7)
2438
+	} else if week == 4 {
2439
+		thisTime = thisTime.AddDate(0, 0, 14)
2440
+	}
2441
+	if weekDay == 0 {
2442
+		weekDay = 7
2443
+	}
2444
+	weekEnd := 7 - weekDay
2445
+	weekStart := weekEnd - 6
2446
+	weekTitle := make([]string, 0)
2447
+	days := make([]string, 0)
2448
+	for index := weekStart; index <= weekEnd; index++ {
2449
+		theDay := thisTime.AddDate(0, 0, index)
2450
+		indexYear, indexMonthTime, indexDay := theDay.Date()
2451
+		indexMonth := int(indexMonthTime)
2452
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
2453
+		weekTitle = append(weekTitle, indexWeek)
2454
+		days = append(days, theDay.Format("2006-01-02"))
2455
+	}
2456
+
2457
+	weekStartDay := thisTime.AddDate(0, 0, weekStart)
2458
+	weekEndDay := thisTime.AddDate(0, 0, weekEnd)
2459
+	weekStartTime := weekStartDay.Format("2006-01-02") + " 00:00:00"
2460
+	weekEndTime := weekEndDay.Format("2006-01-02") + " 23:59:59"
2461
+
2462
+	timeLayout := "2006-01-02 15:04:05"
2463
+	loc, _ := time.LoadLocation("Local")
2464
+	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
2465
+	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
2466
+	weekStartPoint := theStarTime.Unix()
2467
+	weekEndPoint := theEndTime.Unix()
2468
+	fmt.Println("startTime222222222222222", weekStartPoint)
2469
+	fmt.Println("endtime33333333333333", weekEndPoint)
2470
+	list, err := service.GetPatientScheduleCount(orgId, weekStartPoint, weekEndPoint, ids)
2471
+	_, total, _ := service.GetTotalBedNumber(orgId, ids)
2472
+	if err != nil {
2473
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2474
+		return
2475
+	}
2476
+
2477
+	this.ServeSuccessJSON(map[string]interface{}{
2478
+		"list":  list,
2479
+		"total": total,
2480
+	})
2481
+}
2482
+
2483
+func (c *ScheduleApiController) GetWeekPanelsOne() {
2484
+
2485
+	data, _ := c.GetInt64("data", 1)
2486
+	patitionIdStr := c.GetString("patitionid")
2487
+
2488
+	ids := strings.Split(patitionIdStr, ",")
2489
+
2490
+	adminInfo := c.GetAdminUserInfo()
2491
+	thisTime := time.Now()
2492
+	year, monthTime, day := thisTime.Date()
2493
+	month := int(monthTime)
2494
+	_, theWeek := thisTime.ISOWeek()
2495
+	weekDay := int(thisTime.Weekday())
2496
+	if weekDay == 0 {
2497
+		weekDay = 7
2498
+	}
2499
+	weekEnd := 7 - weekDay
2500
+	weekStart := weekEnd - 6
2501
+	weekDays := make([]string, 0)
2502
+	for index := weekStart; index <= weekEnd; index++ {
2503
+		theDay := thisTime.AddDate(0, 0, index)
2504
+		indexYear, indexMonthTime, indexDay := theDay.Date()
2505
+		indexMonth := int(indexMonthTime)
2506
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
2507
+		weekDays = append(weekDays, indexWeek)
2508
+	}
2509
+
2510
+	returnData := map[string]interface{}{
2511
+		"year":     year,
2512
+		"month":    month,
2513
+		"day":      day,
2514
+		"theWeek":  theWeek,
2515
+		"weekDay":  weekDay,
2516
+		"weekDays": weekDays,
2517
+	}
2518
+
2519
+	if data == 1 {
2520
+		partitions, _ := service.GetSchedulePartitionPanelTwo(adminInfo.CurrentOrgId, ids)
2521
+		returnData["partitions"] = partitions
2522
+	}
2523
+
2524
+	c.ServeSuccessJSON(returnData)
2525
+	return
2526
+}
2527
+
2528
+func (c *ScheduleApiController) GetScheduleOne() {
2529
+
2530
+	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
2531
+	patitionIdStr := c.GetString("patitionid")
2532
+
2533
+	ids := strings.Split(patitionIdStr, ",")
2534
+	fmt.Println("patitonStr", ids)
2535
+	schedule_type, _ := c.GetInt64("schedule_type")
2536
+
2537
+	adminInfo := c.GetAdminUserInfo()
2538
+
2539
+	thisTime := time.Now()
2540
+	today := thisTime.Format("2006-01-02")
2541
+	if week < 1 || week > 4 {
2542
+		week = 2
2543
+	}
2544
+	if week == 1 {
2545
+		thisTime = thisTime.AddDate(0, 0, -7)
2546
+	} else if week == 3 {
2547
+		thisTime = thisTime.AddDate(0, 0, 7)
2548
+	} else if week == 4 {
2549
+		thisTime = thisTime.AddDate(0, 0, 14)
2550
+	}
2551
+
2552
+	weekDay := int(thisTime.Weekday())
2553
+	if weekDay == 0 {
2554
+		weekDay = 7
2555
+	}
2556
+	weekEnd := 7 - weekDay
2557
+	weekStart := weekEnd - 6
2558
+	weekTitle := make([]string, 0)
2559
+	days := make([]string, 0)
2560
+	for index := weekStart; index <= weekEnd; index++ {
2561
+		theDay := thisTime.AddDate(0, 0, index)
2562
+		indexYear, indexMonthTime, indexDay := theDay.Date()
2563
+		indexMonth := int(indexMonthTime)
2564
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
2565
+		weekTitle = append(weekTitle, indexWeek)
2566
+		days = append(days, theDay.Format("2006-01-02"))
2567
+	}
2568
+
2569
+	weekStartDay := thisTime.AddDate(0, 0, weekStart)
2570
+	weekEndDay := thisTime.AddDate(0, 0, weekEnd)
2571
+	weekStartTime := weekStartDay.Format("2006-01-02") + " 00:00:00"
2572
+	weekEndTime := weekEndDay.Format("2006-01-02") + " 23:59:59"
2573
+
2574
+	timeLayout := "2006-01-02 15:04:05"
2575
+	loc, _ := time.LoadLocation("Local")
2576
+	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
2577
+	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
2578
+	weekStartPoint := theStarTime.Unix()
2579
+	weekEndPoint := theEndTime.Unix()
2580
+
2581
+	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
2582
+	c.ServeSuccessJSON(map[string]interface{}{
2583
+		"days":      days,
2584
+		"weekTitle": weekTitle,
2585
+		"schdules":  schdules,
2586
+		"today":     today,
2587
+	})
2588
+	return
2589
+}
2590
+
2591
+func (c *ScheduleApiController) SaveScheduleTemplate() {
2592
+
2593
+	template_id, _ := c.GetInt64("template_id")
2594
+	orgId := c.GetAdminUserInfo().CurrentOrgId
2595
+	template := models.ScheduleTemplate{
2596
+		TemplateId: template_id,
2597
+		UserOrgId:  orgId,
2598
+		Status:     1,
2599
+		Ctime:      time.Now().Unix(),
2600
+	}
2601
+
2602
+	_, errcodes := service.GetScheudleTemplateById(orgId)
2603
+	if errcodes == gorm.ErrRecordNotFound {
2604
+		service.CreateXtscheduleTemplate(&template)
2605
+	} else if errcodes == nil {
2606
+		service.UpdateXtScheduleTemplate(&template, orgId)
2607
+	}
2608
+
2609
+	c.ServeSuccessJSON(map[string]interface{}{
2610
+		"template": template,
2611
+	})
2612
+	return
2613
+
2614
+}
2615
+
2616
+func (c *ScheduleApiController) GetScheduleTemplate() {
2617
+
2618
+	adminUserInfo := c.GetAdminUserInfo()
2619
+	orgId := adminUserInfo.CurrentOrgId
2620
+	template, _ := service.GetScheduleTemplate(orgId)
2621
+	c.ServeSuccessJSON(map[string]interface{}{
2622
+		"template": template,
2623
+	})
2624
+	return
2625
+}

+ 13 - 0
controllers/stock_in_api_controller.go Dosyayı Görüntüle

@@ -74,6 +74,8 @@ func StockManagerApiRegistRouters() {
74 74
 	beego.Router("/api/good/postdruginformation", &StockManagerApiController{}, "Post:AddDrugInformation")
75 75
 
76 76
 	beego.Router("/api/good/initializtion", &StockManagerApiController{}, "Get:GetInitializtion")
77
+
78
+	beego.Router("/api/good/getwarehouseorderinfolist", &StockManagerApiController{}, "Get:GetWarehouseOrderInfolist")
77 79
 }
78 80
 
79 81
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -3475,3 +3477,14 @@ func (this *StockManagerApiController) GetInitializtion() {
3475 3477
 		"costClassifyList":          costClassifyList,
3476 3478
 	})
3477 3479
 }
3480
+
3481
+func (this *StockManagerApiController) GetWarehouseOrderInfolist() {
3482
+
3483
+	adminUserInfo := this.GetAdminUserInfo()
3484
+	orgId := adminUserInfo.CurrentOrgId
3485
+	list, _ := service.GetWarehouseOrderInfoList(orgId)
3486
+
3487
+	this.ServeSuccessJSON(map[string]interface{}{
3488
+		"list": list,
3489
+	})
3490
+}

+ 32 - 0
models/device_models.go Dosyayı Görüntüle

@@ -1022,3 +1022,35 @@ func (XtDevicePh) TableName() string {
1022 1022
 
1023 1023
 	return "xt_device_ph"
1024 1024
 }
1025
+
1026
+type XtRemindPrintSetting struct {
1027
+	ID                     int64 `gorm:"column:id" json:"id" form:"id"`
1028
+	PrescriptionStatus     int64 `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
1029
+	Week                   int64 `gorm:"column:week" json:"week" form:"week"`
1030
+	Name                   int64 `gorm:"column:name" json:"name" form:"name"`
1031
+	Zone                   int64 `gorm:"column:zone" json:"zone" form:"zone"`
1032
+	Classes                int64 `gorm:"column:classes" json:"classes" form:"classes"`
1033
+	Number                 int64 `gorm:"column:number" json:"number" form:"number"`
1034
+	Mode                   int64 `gorm:"column:mode" json:"mode" form:"mode"`
1035
+	Dialyzers              int64 `gorm:"column:dialyzers" json:"dialyzers" form:"dialyzers"`
1036
+	PerfusionApparatus     int64 `gorm:"column:perfusion_apparatus" json:"perfusion_apparatus" form:"perfusion_apparatus"`
1037
+	Anticoagulant          int64 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1038
+	DoctorAdvice           int64 `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
1039
+	UserOrgId              int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1040
+	Status                 int64 `gorm:"column:status" json:"status" form:"status"`
1041
+	Ctime                  int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1042
+	Mtime                  int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1043
+	AnticoagulantZongliang int64 `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
1044
+}
1045
+
1046
+func (XtRemindPrintSetting) TableName() string {
1047
+
1048
+	return "xt_remind_print_setting"
1049
+}
1050
+
1051
+type VmXtSchedule struct {
1052
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1053
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1054
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1055
+	Count        int64
1056
+}

+ 136 - 121
models/dialysis.go Dosyayı Görüntüle

@@ -84,81 +84,82 @@ func (SchedualPatient) TableName() string {
84 84
 }
85 85
 
86 86
 type SchedualPatient2 struct {
87
-	ID                      int64                `gorm:"column:id" json:"id" form:"id"`
88
-	UserOrgId               int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
89
-	UserId                  int64                `gorm:"column:user_id" json:"user_id" form:"user_id"`
90
-	PatientType             int64                `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
91
-	Avatar                  string               `gorm:"column:avatar" json:"avatar" form:"avatar"`
92
-	DialysisNo              string               `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
93
-	AdmissionNumber         string               `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
94
-	Source                  int64                `gorm:"column:source" json:"source" form:"source"`
95
-	Lapseto                 int64                `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
96
-	PartitionId             int64                `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
97
-	BedId                   int64                `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
98
-	Name                    string               `gorm:"column:name" json:"name" form:"name"`
99
-	Alias                   string               `gorm:"column:alias" json:"alias" form:"alias"`
100
-	Gender                  int64                `gorm:"column:gender" json:"gender" form:"gender"`
101
-	Nation                  string               `gorm:"column:nation" json:"nation" form:"nation"`
102
-	NativePlace             string               `gorm:"column:native_place" json:"native_place" form:"native_place"`
103
-	MaritalStatus           int64                `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
104
-	IdCardNo                string               `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
105
-	Birthday                int64                `gorm:"column:birthday" json:"birthday" form:"birthday"`
106
-	ReimbursementWayId      int64                `gorm:"column:reimbursement_way_id" json:"reimbursement_way_id" form:"reimbursement_way_id"`
107
-	HealthCareType          int64                `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
108
-	HealthCareNo            string               `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
109
-	HealthCareDueDate       int64                `gorm:"column:health_care_due_date" json:"health_care_due_date" form:"health_care_due_date"`
110
-	Height                  int64                `gorm:"column:height" json:"height" form:"height"`
111
-	BloodType               int64                `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
112
-	Rh                      int64                `gorm:"column:rh" json:"rh" form:"rh"`
113
-	HealthCareDueAlertDate  int64                `gorm:"column:health_care_due_alert_date" json:"health_care_due_alert_date" form:"health_care_due_alert_date"`
114
-	EducationLevel          int64                `gorm:"column:education_level" json:"education_level" form:"education_level"`
115
-	Profession              int64                `gorm:"column:profession" json:"profession" form:"profession"`
116
-	Phone                   string               `gorm:"column:phone" json:"phone" form:"phone"`
117
-	HomeTelephone           string               `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
118
-	RelativePhone           string               `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
119
-	RelativeRelations       string               `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
120
-	HomeAddress             string               `gorm:"column:home_address" json:"home_address" form:"home_address"`
121
-	WorkUnit                string               `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
122
-	UnitAddress             string               `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
123
-	Children                int64                `gorm:"column:children" json:"children" form:"children"`
124
-	ReceivingDate           int64                `gorm:"column:receiving_date" json:"receiving_date" form:"receiving_date"`
125
-	IsHospitalFirstDialysis int64                `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
126
-	FirstDialysisDate       int64                `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
127
-	FirstDialysisHospital   string               `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
128
-	InductionPeriod         int64                `gorm:"column:induction_period" json:"induction_period" form:"induction_period"`
129
-	InitialDialysis         int64                `gorm:"column:initial_dialysis" json:"initial_dialysis" form:"initial_dialysis"`
130
-	TotalDialysis           int64                `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
131
-	AttendingDoctorId       int64                `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
132
-	HeadNurseId             int64                `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
133
-	Evaluate                string               `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
134
-	Diagnose                string               `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
135
-	Remark                  string               `gorm:"column:remark" json:"remark" form:"remark"`
136
-	RegistrarsId            int64                `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
137
-	Registrars              string               `gorm:"column:registrars" json:"registrars" form:"registrars"`
138
-	QrCode                  string               `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
139
-	BindingState            int64                `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
140
-	PatientComplains        string               `gorm:"column:patient_complains" json:"patient_complains"` // 主诉
141
-	PresentHistory          string               `gorm:"column:present_history" json:"present_history"`     // 现病史
142
-	PastHistory             string               `gorm:"column:past_history" json:"past_history"`           // 既往史
143
-	Temperature             float64              `gorm:"column:temperature" json:"temperature"`             // 体格检查-体温
144
-	Pulse                   int64                `gorm:"column:pulse" json:"pulse"`                         // 体格检查-脉搏
145
-	Respiratory             int64                `gorm:"column:respiratory" json:"respiratory"`             // 体格检查-呼吸频率
146
-	SBP                     int64                `gorm:"column:sbp" json:"sbp"`                             // 体格检查-收缩压
147
-	DBP                     int64                `gorm:"column:dbp" json:"dbp"`                             // 体格检查-舒张压
148
-	Status                  int64                `gorm:"column:status" json:"status" form:"status"`
149
-	CreatedTime             int64                `gorm:"column:created_time" json:"created_time" form:"created_time"`
150
-	UpdatedTime             int64                `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
151
-	DialysisSchedule        DialysisSchedule     `gorm:"ForeignKey:PatientId"`
152
-	InfectiousDiseases      []InfectiousDiseases `gorm:"ForeignKey:PatientId"`
153
-	Age                     int64                `gorm:"column:age" json:"age"`
154
-	IsOpenRemind            int64                `gorm:"column:is_open_remind" json:"is_open_remind"`
155
-	DialysisAge             int64                `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
156
-	ExpenseKind             int64                `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
157
-	TellPhone               string               `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
158
-	FirstTreatmentDate      int64                `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
159
-	ContactName             string               `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
160
-	UserSysBeforeCount      int64                `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
161
-	SchRemark               string               `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
87
+	ID                        int64                `gorm:"column:id" json:"id" form:"id"`
88
+	UserOrgId                 int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
89
+	UserId                    int64                `gorm:"column:user_id" json:"user_id" form:"user_id"`
90
+	PatientType               int64                `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
91
+	Avatar                    string               `gorm:"column:avatar" json:"avatar" form:"avatar"`
92
+	DialysisNo                string               `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
93
+	AdmissionNumber           string               `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
94
+	Source                    int64                `gorm:"column:source" json:"source" form:"source"`
95
+	Lapseto                   int64                `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
96
+	PartitionId               int64                `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
97
+	BedId                     int64                `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
98
+	Name                      string               `gorm:"column:name" json:"name" form:"name"`
99
+	Alias                     string               `gorm:"column:alias" json:"alias" form:"alias"`
100
+	Gender                    int64                `gorm:"column:gender" json:"gender" form:"gender"`
101
+	Nation                    string               `gorm:"column:nation" json:"nation" form:"nation"`
102
+	NativePlace               string               `gorm:"column:native_place" json:"native_place" form:"native_place"`
103
+	MaritalStatus             int64                `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
104
+	IdCardNo                  string               `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
105
+	Birthday                  int64                `gorm:"column:birthday" json:"birthday" form:"birthday"`
106
+	ReimbursementWayId        int64                `gorm:"column:reimbursement_way_id" json:"reimbursement_way_id" form:"reimbursement_way_id"`
107
+	HealthCareType            int64                `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
108
+	HealthCareNo              string               `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
109
+	HealthCareDueDate         int64                `gorm:"column:health_care_due_date" json:"health_care_due_date" form:"health_care_due_date"`
110
+	Height                    int64                `gorm:"column:height" json:"height" form:"height"`
111
+	BloodType                 int64                `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
112
+	Rh                        int64                `gorm:"column:rh" json:"rh" form:"rh"`
113
+	HealthCareDueAlertDate    int64                `gorm:"column:health_care_due_alert_date" json:"health_care_due_alert_date" form:"health_care_due_alert_date"`
114
+	EducationLevel            int64                `gorm:"column:education_level" json:"education_level" form:"education_level"`
115
+	Profession                int64                `gorm:"column:profession" json:"profession" form:"profession"`
116
+	Phone                     string               `gorm:"column:phone" json:"phone" form:"phone"`
117
+	HomeTelephone             string               `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
118
+	RelativePhone             string               `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
119
+	RelativeRelations         string               `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
120
+	HomeAddress               string               `gorm:"column:home_address" json:"home_address" form:"home_address"`
121
+	WorkUnit                  string               `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
122
+	UnitAddress               string               `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
123
+	Children                  int64                `gorm:"column:children" json:"children" form:"children"`
124
+	ReceivingDate             int64                `gorm:"column:receiving_date" json:"receiving_date" form:"receiving_date"`
125
+	IsHospitalFirstDialysis   int64                `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
126
+	FirstDialysisDate         int64                `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
127
+	FirstDialysisHospital     string               `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
128
+	InductionPeriod           int64                `gorm:"column:induction_period" json:"induction_period" form:"induction_period"`
129
+	InitialDialysis           int64                `gorm:"column:initial_dialysis" json:"initial_dialysis" form:"initial_dialysis"`
130
+	TotalDialysis             int64                `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
131
+	AttendingDoctorId         int64                `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
132
+	HeadNurseId               int64                `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
133
+	Evaluate                  string               `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
134
+	Diagnose                  string               `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
135
+	Remark                    string               `gorm:"column:remark" json:"remark" form:"remark"`
136
+	RegistrarsId              int64                `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
137
+	Registrars                string               `gorm:"column:registrars" json:"registrars" form:"registrars"`
138
+	QrCode                    string               `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
139
+	BindingState              int64                `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
140
+	PatientComplains          string               `gorm:"column:patient_complains" json:"patient_complains"` // 主诉
141
+	PresentHistory            string               `gorm:"column:present_history" json:"present_history"`     // 现病史
142
+	PastHistory               string               `gorm:"column:past_history" json:"past_history"`           // 既往史
143
+	Temperature               float64              `gorm:"column:temperature" json:"temperature"`             // 体格检查-体温
144
+	Pulse                     int64                `gorm:"column:pulse" json:"pulse"`                         // 体格检查-脉搏
145
+	Respiratory               int64                `gorm:"column:respiratory" json:"respiratory"`             // 体格检查-呼吸频率
146
+	SBP                       int64                `gorm:"column:sbp" json:"sbp"`                             // 体格检查-收缩压
147
+	DBP                       int64                `gorm:"column:dbp" json:"dbp"`                             // 体格检查-舒张压
148
+	Status                    int64                `gorm:"column:status" json:"status" form:"status"`
149
+	CreatedTime               int64                `gorm:"column:created_time" json:"created_time" form:"created_time"`
150
+	UpdatedTime               int64                `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
151
+	DialysisSchedule          DialysisSchedule     `gorm:"ForeignKey:PatientId"`
152
+	InfectiousDiseases        []InfectiousDiseases `gorm:"ForeignKey:PatientId"`
153
+	Age                       int64                `gorm:"column:age" json:"age"`
154
+	IsOpenRemind              int64                `gorm:"column:is_open_remind" json:"is_open_remind"`
155
+	DialysisAge               int64                `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
156
+	ExpenseKind               int64                `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
157
+	TellPhone                 string               `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
158
+	FirstTreatmentDate        int64                `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
159
+	ContactName               string               `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
160
+	UserSysBeforeCount        int64                `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
161
+	SchRemark                 string               `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
162
+	HospitalFirstDialysisDate int64                `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
162 163
 }
163 164
 
164 165
 func (SchedualPatient2) TableName() string {
@@ -281,6 +282,10 @@ type PredialysisEvaluation struct {
281 282
 	ThromubusA                     string  `gorm:"column:thromubus_a" json:"thromubus_a" form:"thromubus_a"`
282 283
 	ThromubusV                     string  `gorm:"column:thromubus_v" json:"thromubus_v" form:"thromubus_v"`
283 284
 	Dehydration                    string  `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
285
+	PreDialysisDrugs               string  `gorm:"column:pre_dialysis_drugs" json:"pre_dialysis_drugs" form:"pre_dialysis_drugs"`
286
+	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
287
+	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
288
+	BloodPressureDuringDialysis    string  `gorm:"column:blood_pressure_during_dialysis" json:"blood_pressure_during_dialysis" form:"blood_pressure_during_dialysis"`
284 289
 }
285 290
 
286 291
 func (PredialysisEvaluation) TableName() string {
@@ -587,6 +592,13 @@ type AssessmentAfterDislysis struct {
587 592
 	DiastolicPressure               string  `gorm:"column:diastolic_pressure" json:"diastolic_pressure" form:"diastolic_pressure"`
588 593
 	OtherComplication               string  `gorm:"column:other_complication" json:"other_complication" form:"other_complication"`
589 594
 	Ktv                             string  `gorm:"column:ktv" json:"ktv" form:"ktv"`
595
+	Urr                             string  `gorm:"column:urr" json:"urr" form:"urr"`
596
+	Hypertenison                    int64   `gorm:"column:hypertenison" json:"hypertenison" form:"hypertenison"`
597
+	Hypopiesia                      int64   `gorm:"column:hypopiesia" json:"hypopiesia" form:"hypopiesia"`
598
+	LeaveOfficeMethod               int64   `gorm:"column:leave_office_method" json:"leave_office_method" form:"leave_office_method"`
599
+	Lapse                           int64   `gorm:"column:lapse" json:"lapse" form:"lapse"`
600
+	Consciousness                   int64   `gorm:"column:consciousness" json:"consciousness" form:"consciousness"`
601
+	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
590 602
 }
591 603
 
592 604
 func (AssessmentAfterDislysis) TableName() string {
@@ -643,52 +655,54 @@ func (DryWeightAdjust) TableName() string {
643 655
 }
644 656
 
645 657
 type MonitoringRecord struct {
646
-	ID                        int64   `gorm:"column:id" json:"id"`
647
-	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id"`
648
-	PatientId                 int64   `gorm:"column:patient_id" json:"patient_id"`
649
-	DialysisOrderId           int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
650
-	MonitoringDate            int64   `gorm:"column:monitoring_date" json:"monitoring_date"`
651
-	OperateTime               int64   `gorm:"column:operate_time" json:"operate_time"`
652
-	MonitoringTime            string  `gorm:"column:monitoring_time" json:"monitoring_time"`
653
-	PulseFrequency            float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
654
-	BreathingRate             float64 `gorm:"column:breathing_rate" json:"breathing_rate"`
655
-	SystolicBloodPressure     float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
656
-	DiastolicBloodPressure    float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
657
-	BloodPressureType         int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
658
-	Pic                       string  `gorm:"column:pic" json:"pic"`
659
-	BloodFlowVolume           float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume"`
660
-	VenousPressure            float64 `gorm:"column:venous_pressure" json:"venous_pressure"`
661
-	VenousPressureType        int64   `gorm:"column:venous_pressure_type" json:"venous_pressure_type"`
662
-	ArterialPressure          float64 `gorm:"column:arterial_pressure" json:"arterial_pressure"`
663
-	ArterialPressureType      int64   `gorm:"column:arterial_pressure_type" json:"arterial_pressure_type"`
664
-	TransmembranePressure     float64 `gorm:"column:transmembrane_pressure" json:"transmembrane_pressure"`
665
-	TransmembranePressureType int64   `gorm:"column:transmembrane_pressure_type" json:"transmembrane_pressure_type"`
666
-	UltrafiltrationRate       float64 `gorm:"column:ultrafiltration_rate" json:"ultrafiltration_rate"`
667
-	UltrafiltrationVolume     float64 `gorm:"column:ultrafiltration_volume" json:"ultrafiltration_volume"`
668
-	SodiumConcentration       float64 `gorm:"column:sodium_concentration" json:"sodium_concentration"`
669
-	DialysateTemperature      float64 `gorm:"column:dialysate_temperature" json:"dialysate_temperature"`
670
-	Temperature               float64 `gorm:"column:temperature" json:"temperature"`
671
-	ReplacementRate           float64 `gorm:"column:replacement_rate" json:"replacement_rate"`
672
-	DisplacementQuantity      float64 `gorm:"column:displacement_quantity" json:"displacement_quantity"`
673
-	Ktv                       float64 `gorm:"column:ktv" json:"ktv"`
674
-	Symptom                   string  `gorm:"column:symptom" json:"symptom"`
675
-	Dispose                   string  `gorm:"column:dispose" json:"dispose"`
676
-	Result                    string  `gorm:"column:result" json:"result"`
677
-	MonitoringNurse           int64   `gorm:"column:monitoring_nurse" json:"monitoring_nurse"`
678
-	Status                    int64   `gorm:"column:status" json:"status"`
679
-	CreatedTime               int64   `gorm:"column:created_time" json:"created_time"`
680
-	UpdatedTime               int64   `gorm:"column:updated_time" json:"updated_time"`
681
-	Conductivity              float64 `gorm:"column:conductivity" json:"conductivity"`
682
-	DisplacementFlowQuantity  float64 `gorm:"column:displacement_flow_quantity" json:"displacement_flow_quantity"`
683
-	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
684
-	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
685
-	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
686
-	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
687
-	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
688
-	Urr                       string  `gorm:"column:urr" json:"urr"`
689
-	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
690
-	MonitorAnticoagulant      int64   `gorm:"column:monitor_anticoagulant" json:"monitor_anticoagulant" form:"monitor_anticoagulant"`
691
-	MonitorAnticoagulantValue string  `gorm:"column:monitor_anticoagulant_value" json:"monitor_anticoagulant_value" form:"monitor_anticoagulant_value"`
658
+	ID                          int64   `gorm:"column:id" json:"id"`
659
+	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id"`
660
+	PatientId                   int64   `gorm:"column:patient_id" json:"patient_id"`
661
+	DialysisOrderId             int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
662
+	MonitoringDate              int64   `gorm:"column:monitoring_date" json:"monitoring_date"`
663
+	OperateTime                 int64   `gorm:"column:operate_time" json:"operate_time"`
664
+	MonitoringTime              string  `gorm:"column:monitoring_time" json:"monitoring_time"`
665
+	PulseFrequency              float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
666
+	BreathingRate               float64 `gorm:"column:breathing_rate" json:"breathing_rate"`
667
+	SystolicBloodPressure       float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
668
+	DiastolicBloodPressure      float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
669
+	BloodPressureType           int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
670
+	Pic                         string  `gorm:"column:pic" json:"pic"`
671
+	BloodFlowVolume             float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume"`
672
+	VenousPressure              float64 `gorm:"column:venous_pressure" json:"venous_pressure"`
673
+	VenousPressureType          int64   `gorm:"column:venous_pressure_type" json:"venous_pressure_type"`
674
+	ArterialPressure            float64 `gorm:"column:arterial_pressure" json:"arterial_pressure"`
675
+	ArterialPressureType        int64   `gorm:"column:arterial_pressure_type" json:"arterial_pressure_type"`
676
+	TransmembranePressure       float64 `gorm:"column:transmembrane_pressure" json:"transmembrane_pressure"`
677
+	TransmembranePressureType   int64   `gorm:"column:transmembrane_pressure_type" json:"transmembrane_pressure_type"`
678
+	UltrafiltrationRate         float64 `gorm:"column:ultrafiltration_rate" json:"ultrafiltration_rate"`
679
+	UltrafiltrationVolume       float64 `gorm:"column:ultrafiltration_volume" json:"ultrafiltration_volume"`
680
+	SodiumConcentration         float64 `gorm:"column:sodium_concentration" json:"sodium_concentration"`
681
+	DialysateTemperature        float64 `gorm:"column:dialysate_temperature" json:"dialysate_temperature"`
682
+	Temperature                 float64 `gorm:"column:temperature" json:"temperature"`
683
+	ReplacementRate             float64 `gorm:"column:replacement_rate" json:"replacement_rate"`
684
+	DisplacementQuantity        float64 `gorm:"column:displacement_quantity" json:"displacement_quantity"`
685
+	Ktv                         float64 `gorm:"column:ktv" json:"ktv"`
686
+	Symptom                     string  `gorm:"column:symptom" json:"symptom"`
687
+	Dispose                     string  `gorm:"column:dispose" json:"dispose"`
688
+	Result                      string  `gorm:"column:result" json:"result"`
689
+	MonitoringNurse             int64   `gorm:"column:monitoring_nurse" json:"monitoring_nurse"`
690
+	Status                      int64   `gorm:"column:status" json:"status"`
691
+	CreatedTime                 int64   `gorm:"column:created_time" json:"created_time"`
692
+	UpdatedTime                 int64   `gorm:"column:updated_time" json:"updated_time"`
693
+	Conductivity                float64 `gorm:"column:conductivity" json:"conductivity"`
694
+	DisplacementFlowQuantity    float64 `gorm:"column:displacement_flow_quantity" json:"displacement_flow_quantity"`
695
+	BloodOxygenSaturation       string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
696
+	Creator                     int64   `gorm:"column:creator" json:"creator" form:"creator"`
697
+	Modify                      int64   `gorm:"column:modify" json:"modify" form:"modify"`
698
+	Heparin                     float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
699
+	DialysateFlow               float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
700
+	Urr                         string  `gorm:"column:urr" json:"urr"`
701
+	BloodSugar                  float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
702
+	MonitorAnticoagulant        int64   `gorm:"column:monitor_anticoagulant" json:"monitor_anticoagulant" form:"monitor_anticoagulant"`
703
+	MonitorAnticoagulantValue   string  `gorm:"column:monitor_anticoagulant_value" json:"monitor_anticoagulant_value" form:"monitor_anticoagulant_value"`
704
+	BloodPressureMonitoringSite int64   `gorm:"column:blood_pressure_monitoring_site" json:"blood_pressure_monitoring_site" form:"blood_pressure_monitoring_site"`
705
+	Complication                int64   `gorm:"column:complication" json:"complication" form:"complication"`
692 706
 }
693 707
 
694 708
 func (MonitoringRecord) TableName() string {
@@ -868,6 +882,7 @@ type ReceiveTreatmentAsses struct {
868 882
 	PsychologicalOther           string `gorm:"column:psychological_other" json:"psychological_other"`
869 883
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
870 884
 	AdmissionNumber              string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
885
+	Tumble                       int64  `gorm:"column:tumble" json:"tumble" form:"tumble"`
871 886
 }
872 887
 
873 888
 func (ReceiveTreatmentAsses) TableName() string {

+ 1 - 0
models/doctor_advice_models.go Dosyayı Görüntüle

@@ -91,6 +91,7 @@ type DoctorAdviceParentTemplate struct {
91 91
 	UpdatedTime          int64                   `gorm:"column:updated_time" json:"updated_time"`
92 92
 	DoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:TemplateId;AssociationForeignKey:ID"`
93 93
 	AdviceType           int64                   `gorm:"column:advice_type" json:"advice_type"`
94
+	Sort                 int64                   `gorm:"column:sort" json:"sort" form:"sort"`
94 95
 }
95 96
 
96 97
 func (DoctorAdviceParentTemplate) TableName() string {

+ 13 - 0
models/patient_models.go Dosyayı Görüntüle

@@ -230,6 +230,13 @@ type DialysisPrescription struct {
230 230
 	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
231 231
 	AntioxidantCommodityName   string        `gorm:"column:antioxidant_commodity_name" json:"antioxidant_commodity_name" form:"antioxidant_commodity_name"`
232 232
 	DisplaceSpeed              string        `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
233
+	Illness                    int64         `gorm:"column:illness" json:"illness" form:"illness"`
234
+	Amylaceum                  string        `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
235
+	SingleTime                 string        `gorm:"column:single_time" json:"single_time" form:"single_time"`
236
+	SingleWater                string        `gorm:"column:single_water" json:"single_water" form:"single_water"`
237
+	ReplacementFlow            string        `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
238
+	PlasmaSeparator            string        `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
239
+	BilirubinAdsorptionColumn  string        `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
233 240
 }
234 241
 
235 242
 func (DialysisPrescription) TableName() string {
@@ -329,6 +336,12 @@ type DialysisSolution struct {
329 336
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv"`
330 337
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
331 338
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
339
+	AntioxidantCommodityName   string  `gorm:"column:antioxidant_commodity_name" json:"antioxidant_commodity_name" form:"antioxidant_commodity_name"`
340
+	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
341
+	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
342
+	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
343
+	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
344
+	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
332 345
 }
333 346
 
334 347
 func (DialysisSolution) TableName() string {

+ 58 - 17
models/schedule_models.go Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 package models
2 2
 
3
-type Schedule struct {
3
+type VmSchedules struct {
4 4
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
5 5
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6 6
 	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
@@ -15,20 +15,20 @@ type Schedule struct {
15 15
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
16 16
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
17 17
 
18
-	Patient       string        `gorm:"-" json:"patient" form:"patient"`
19
-	DeviceZone    DeviceZone    `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
20
-	DeviceNumber  DeviceNumber  `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
21
-	TreatmentMode TreatmentMode `json:"mode" gorm:"foreignkey:ModeId"`
22
-	DialysisOrder DialysisOrder `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
23
-
24
-	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
18
+	DeviceZone           DeviceZone             `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
19
+	DeviceNumber         DeviceNumber           `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
20
+	DialysisOrder        DialysisOrder          `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
21
+	XtPatients           XtPatients             `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
22
+	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
23
+	DialysisPrescription DialysisPrescription   `json:"prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
24
+	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
25 25
 }
26 26
 
27
-func (Schedule) TableName() string {
27
+func (VmSchedules) TableName() string {
28 28
 	return "xt_schedule"
29 29
 }
30 30
 
31
-type SchedulePatients struct {
31
+type Schedule struct {
32 32
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
33 33
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
34 34
 	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
@@ -42,13 +42,40 @@ type SchedulePatients struct {
42 42
 	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
43 43
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
44 44
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
45
-	Patient      PatientListForFace        `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
45
+
46
+	Patient       string        `gorm:"-" json:"patient" form:"patient"`
47
+	DeviceZone    DeviceZone    `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
48
+	DeviceNumber  DeviceNumber  `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
49
+	TreatmentMode TreatmentMode `json:"mode" gorm:"foreignkey:ModeId"`
50
+	DialysisOrder DialysisOrder `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
51
+
52
+	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
46 53
 }
47 54
 
48
-func (SchedulePatients) TableName() string {
55
+func (Schedule) TableName() string {
49 56
 	return "xt_schedule"
50 57
 }
51 58
 
59
+type SchedulePatients struct {
60
+	ID           int64              `gorm:"column:id" json:"id" form:"id"`
61
+	UserOrgId    int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
62
+	PartitionId  int64              `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
63
+	BedId        int64              `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
64
+	PatientId    int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
65
+	ScheduleDate int64              `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
66
+	ScheduleType int64              `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
67
+	ScheduleWeek int64              `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
68
+	ModeId       int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
69
+	Status       int64              `gorm:"column:status" json:"status" form:"status"`
70
+	CreatedTime  int64              `gorm:"column:created_time" json:"created_time" form:"created_time"`
71
+	UpdatedTime  int64              `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
72
+	IsExport     int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
73
+	Patient      PatientListForFace `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
74
+}
75
+
76
+func (SchedulePatients) TableName() string {
77
+	return "xt_schedule"
78
+}
52 79
 
53 80
 type PatientSchedule struct {
54 81
 	Schedule
@@ -104,13 +131,27 @@ type WeekSchedule struct {
104 131
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
105 132
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
106 133
 
107
-	Patient              string           `gorm:"-" json:"patient" form:"patient"`
108
-	DeviceZone           DeviceZone       `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
109
-	DeviceNumber         DeviceNumber     `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
110
-	DialysisPrescription DialysisSolution `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
111
-	DoctorAdvice         []*DoctorAdvice  `json:"doctor_advice" gorm:"-"`
134
+	Patient              string                 `gorm:"-" json:"patient" form:"patient"`
135
+	DeviceZone           DeviceZone             `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
136
+	DeviceNumber         DeviceNumber           `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
137
+	DialysisPrescription DialysisSolution       `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
138
+	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
139
+	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
112 140
 }
113 141
 
114 142
 func (WeekSchedule) TableName() string {
115 143
 	return "xt_schedule"
116 144
 }
145
+
146
+type ScheduleTemplate struct {
147
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
148
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
149
+	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
150
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
151
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
152
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
153
+}
154
+
155
+func (ScheduleTemplate) TableName() string {
156
+	return "xt_schedule_template"
157
+}

+ 1 - 0
routers/router.go Dosyayı Görüntüle

@@ -73,4 +73,5 @@ func init() {
73 73
 	new_m_api.NewDrugApiControllersRegisterRouters()
74 74
 	controllers.HisProjectRouters()
75 75
 	controllers.GdybRegistRouters()
76
+
76 77
 }

+ 197 - 34
service/common_service.go Dosyayı Görüntüle

@@ -204,19 +204,64 @@ func DeleteCheck(id int64) error {
204 204
 	return err
205 205
 }
206 206
 
207
-func GetDialysiTotal(startime int64, endtime int64, orgid int64) (order []*models.DialysisOrder, total int64, err error) {
208
-	err = XTReadDB().Model(&order).Where("dialysis_date >= ? and dialysis_date<=? and user_org_id = ?", startime, endtime, orgid).Count(&total).Find(&order).Error
209
-	return order, total, err
207
+//
208
+//func GetDialysiTotal(startime int64, endtime int64, orgid int64,lapsetotype int64,sourcetype int64) (order []*models.DialysisOrder, total int64, err error) {
209
+//	err = XTReadDB().Model(&order).Where("dialysis_date >= ? and dialysis_date<=? and user_org_id = ?", startime, endtime, orgid).Count(&total).Find(&order).Error
210
+//	return order, total, err
211
+//}
212
+
213
+func GetDialysiTotal(startime int64, endtime int64, orgid int64, lapsetotype int64, sourcetype int64) (models.PatientPrescriptionCountStruct, error) {
214
+	counts := models.PatientPrescriptionCountStruct{}
215
+
216
+	db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
217
+	table := XTReadDB().Table("xt_paitents as s").Where("s.status = 1")
218
+	fmt.Println(table)
219
+
220
+	if lapsetotype > 0 {
221
+		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? and s.lapseto = ?", startime, endtime, orgid, lapsetotype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
222
+	}
223
+	if lapsetotype == 0 {
224
+		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? ", startime, endtime, orgid).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
225
+	}
226
+
227
+	if sourcetype > 0 {
228
+		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? and s.source = ?", startime, endtime, orgid, sourcetype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
229
+	}
210 230
 
231
+	if sourcetype == 0 {
232
+		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ?", startime, endtime, orgid).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
233
+	}
234
+
235
+	return counts, err
211 236
 }
212 237
 
213
-func GetDialysisCountMode(starttime int64, endtime int64, orgid int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
214
-	//err = readDb.Table("xt_dialysis_prescription as p").Where("p.record_date>= ? and p.record_date<=? and p.user_org_id=?", starttime, endtime, orgid).Select("p.mode_id,count(p.mode_id) as count").Group("p.mode_id").Scan(&counts).Error
238
+func GetDialysisCountMode(starttime int64, endtime int64, orgid int64, lapsetotype int64, sourcetype int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
239
+
240
+	//err = readDb.Table("xt_dialysis_order as o left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and o.dialysis_date>=? and o.dialysis_date<=? and o.user_org_id = ? and o.status = 1 and s.status = 1", starttime, endtime, orgid).Select("s.mode_id,count(s.mode_id) as count").Group("s.mode_id").Scan(&counts).Error
215 241
 	//return counts, err
216 242
 
217
-	err = readDb.Table("xt_dialysis_order as o left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and o.dialysis_date>=? and o.dialysis_date<=? and o.user_org_id = ? and o.status = 1 and s.status = 1", starttime, endtime, orgid).Select("s.mode_id,count(s.mode_id) as count").Group("s.mode_id").Scan(&counts).Error
243
+	db := readDb.Table("xt_dialysis_order as o").Where("o.status = 1")
244
+	table := readDb.Table("xt_schedule as s").Where("s.status = 1")
245
+	fmt.Println(table)
246
+	p := readDb.Table("xt_patients as p").Where("p.status = 1")
247
+	fmt.Println(p)
248
+	if starttime > 0 {
249
+		db = db.Where("o.dialysis_date >=?", starttime)
250
+	}
251
+	if endtime > 0 {
252
+		db = db.Where("o.dialysis_date<=?", endtime)
253
+	}
254
+	if orgid > 0 {
255
+		db = db.Where("o.user_org_id = ?", orgid)
256
+	}
257
+	if lapsetotype > 0 {
258
+		db = db.Where("p.lapseto = ?", lapsetotype)
259
+	}
260
+	if sourcetype > 0 {
261
+		db = db.Where("p.source = ?", sourcetype)
262
+	}
263
+	err = db.Select("s.mode_id,count(s.mode_id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id and s.schedule_date = o.dialysis_date and s.status= 1").Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
218 264
 	return counts, err
219
-
220 265
 }
221 266
 
222 267
 func GetTotalRollOut(starttime int64, endtime int64, orgid int64) (counts []*models.PatientLapseto, total int64, err error) {
@@ -228,22 +273,41 @@ func GetTotalRollOut(starttime int64, endtime int64, orgid int64) (counts []*mod
228 273
 	return counts, total, err
229 274
 }
230 275
 
231
-func GetTotalRollOutPatients(orgid int64, startime int64, endtime int64) (patients []*models.XtPatients, err error) {
276
+func GetTotalRollOutPatients(orgid int64, startime int64, endtime int64, lapsetotype int64, sourcetype int64) (patients []*models.XtPatients, err error) {
277
+
278
+	db := XTReadDB().Table("xt_patients as x")
232 279
 
233
-	db := XTReadDB().Table("x.patients as x")
234
-	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 1 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
280
+	if sourcetype == 0 {
281
+		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 1 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
282
+	}
283
+	if sourcetype > 0 {
284
+		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 1 and x.status = 1 and x.source = ?", startime, endtime, orgid, sourcetype).Scan(&patients).Error
285
+	}
235 286
 	return patients, err
236 287
 }
237 288
 
238
-func GetTotalRollOutPatientsTwo(orgid int64, startime int64, endtime int64) (patients []*models.XtPatients, err error) {
289
+func GetTotalRollOutPatientsTwo(orgid int64, startime int64, endtime int64, lapsetotype int64, sourcetype int64) (patients []*models.XtPatients, err error) {
290
+
291
+	db := XTReadDB().Table("xt_patients as x")
292
+	if sourcetype == 0 {
293
+		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
239 294
 
240
-	db := XTReadDB().Table("x.patients as x")
241
-	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
295
+	}
296
+	if sourcetype > 0 {
297
+		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1 and x.source = ?", startime, endtime, orgid, sourcetype).Scan(&patients).Error
298
+	}
242 299
 	return patients, err
243 300
 }
244 301
 
245
-func GetPatientTotalCount(orgID int64) (total int64) {
246
-	readDb.Model(&models.XtPatients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
302
+func GetPatientTotalCount(orgID int64, lapsetotype int64, sourcetype int64) (total int64) {
303
+	db := readDb.Table("xt_patients as x")
304
+	//if lapsetotype > 0 {
305
+	// db = db.Where("x.lapseto = ?", lapsetotype)
306
+	//}
307
+	//if sourcetype > 0 {
308
+	// db = db.Where("x.source = ?", sourcetype)
309
+	//}
310
+	db.Where("x.user_org_id=? and x.status=1", orgID).Count(&total)
247 311
 	return
248 312
 }
249 313
 
@@ -263,9 +327,28 @@ func GetManPatientTotalCount(orgid int64, starttime int64, endtime int64) (dialy
263 327
 
264 328
 }
265 329
 
266
-func GetManPatientTotal(orgid int64) (patients []*models.XtPatients, total int64, err error) {
330
+func GetManPatientTotal(orgid int64, lapsetotype int64, sourcetype int64) (patients []*models.XtPatients, total int64, err error) {
267 331
 
268
-	err = XTReadDB().Model(&patients).Where("user_org_id = ? and status = 1 and gender = 1", orgid).Count(&total).Find(&patients).Error
332
+	db := XTReadDB().Table("xt_patients as x").Where("x.status  = 1")
333
+	if lapsetotype > 0 {
334
+		db = db.Where("x.lapseto = ?", lapsetotype)
335
+	}
336
+	if sourcetype > 0 {
337
+		db = db.Where("x.source = ?", sourcetype)
338
+	}
339
+	err = db.Where("x.user_org_id = ? and x.status = 1 and x.gender = 1", orgid).Count(&total).Find(&patients).Error
340
+	return patients, total, err
341
+}
342
+
343
+func GetWoManPatientTotal(orgid int64, lapsetotype int64, sourcetype int64) (patients []*models.XtPatients, total int64, err error) {
344
+	db := XTReadDB().Table("xt_patients as x").Where("x.status  = 1")
345
+	if lapsetotype > 0 {
346
+		db = db.Where("x.lapseto = ?", lapsetotype)
347
+	}
348
+	if sourcetype > 0 {
349
+		db = db.Where("x.source = ?", sourcetype)
350
+	}
351
+	err = db.Where("x.user_org_id = ? and x.status = 1 and x.gender = 2", orgid).Count(&total).Find(&patients).Error
269 352
 	return patients, total, err
270 353
 }
271 354
 
@@ -274,10 +357,25 @@ func GetManPatientTotal(orgid int64) (patients []*models.XtPatients, total int64
274 357
 //	return counts, err
275 358
 //}
276 359
 
277
-func GetPatientInfectiousCount(orgid int64, startime int64, endtime int64) (counts []*models.PatientContagionsCountStruct, err error) {
360
+func GetPatientInfectiousCount(orgid int64, startime int64, endtime int64, lapsetotype int64, sourcetype int64) (counts []*models.PatientContagionsCountStruct, err error) {
361
+
362
+	if lapsetotype == 0 {
363
+		err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=?", orgid, startime, endtime).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
364
+	}
365
+	if sourcetype == 0 {
366
+		err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=?", orgid, startime, endtime).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
367
+	}
368
+
369
+	if lapsetotype > 0 {
370
+		err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=? and s.lapseto = ?", orgid, startime, endtime, lapsetotype).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
371
+	}
372
+
373
+	if sourcetype > 0 {
374
+		err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=? and s.source = ?", orgid, startime, endtime, sourcetype).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
375
+	}
278 376
 
279
-	err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=?", orgid, startime, endtime).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
280 377
 	return counts, err
378
+
281 379
 }
282 380
 
283 381
 func GetPatientOtherInfectious(orgid int64) (patients []*models.XtPatients, total int64, err error) {
@@ -286,9 +384,10 @@ func GetPatientOtherInfectious(orgid int64) (patients []*models.XtPatients, tota
286 384
 	return patients, total, err
287 385
 }
288 386
 
289
-func GetTotalAgeCount(orgid int64) (counts []*models.PatientAgeCountStruct, err error) {
387
+func GetTotalAgeCount(orgid int64, lapsetotype int64, sourcetype int64) (counts []*models.PatientAgeCountStruct, err error) {
290 388
 
291
-	readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
389
+	if lapsetotype == 0 || sourcetype == 0 {
390
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
292 391
 	 SELECT
293 392
 	 CASE
294 393
 	  WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=20 THEN '20'
@@ -299,8 +398,39 @@ func GetTotalAgeCount(orgid int64) (counts []*models.PatientAgeCountStruct, err
299 398
 	 END
300 399
 	 AS nnd FROM xt_patients as s  where s.user_org_id=? and s.status=1
301 400
 	 )a GROUP BY nnd`, orgid).Scan(&counts)
302
-	return
303 401
 
402
+	}
403
+
404
+	if lapsetotype > 0 {
405
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
406
+	 SELECT
407
+	 CASE
408
+	  WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=20 THEN '20'
409
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=40 THEN '40'
410
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=60 THEN '60'
411
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=80 THEN '80'
412
+    ELSE '150'
413
+	 END
414
+	 AS nnd FROM xt_patients as s  where s.user_org_id=? and s.status=1 and s.lapseto = ?
415
+	 )a GROUP BY nnd`, orgid, lapsetotype).Scan(&counts)
416
+
417
+	}
418
+
419
+	if sourcetype > 0 {
420
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
421
+	 SELECT
422
+	 CASE
423
+	  WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=20 THEN '20'
424
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=40 THEN '40'
425
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=60 THEN '60'
426
+    WHEN ( substring( now( ), 1, 4 ) - substring( id_card_no, 7, 4 ) ) - ( substring( id_card_no, 11, 4 ) - date_format( now( ), '%m%d' ) > 0 )<=80 THEN '80'
427
+    ELSE '150'
428
+	 END
429
+	 AS nnd FROM xt_patients as s  where s.user_org_id=? and s.status=1 and s.source = ?
430
+	 )a GROUP BY nnd`, orgid, sourcetype).Scan(&counts)
431
+
432
+	}
433
+	return
304 434
 }
305 435
 
306 436
 func GetTotalAgeCountTwo(orgid int64, starttime int64, endtime int64) (counts []*models.PatientAgeCountStruct, err error) {
@@ -320,18 +450,42 @@ func GetTotalDialysisAgeCount(orgid int64) (patients []*models.XtPatients, err e
320 450
 	return patients, err
321 451
 }
322 452
 
323
-func GetDialysisAgeData(orgID int64) (counts []*models.DialysisAgePieDataStruct, err error) {
453
+func GetDialysisAgeData(orgID int64, lapsetotype int64, sourcetype int64) (counts []*models.DialysisAgePieDataStruct, err error) {
324 454
 
325
-	readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
326
-	SELECT
327
-	CASE
328
-	WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '1'
329
-  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '2'
330
-  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '3'
331
-  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60 THEN '4'
332
-  END AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1 and p.first_dialysis_date <> 0)a GROUP BY nnd`, orgID).Scan(&counts)
333
-	return
455
+	if lapsetotype == 0 || sourcetype == 0 {
456
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
457
+    SELECT
458
+    CASE
459
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '1'
460
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '2'
461
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '3'
462
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60 THEN '4'
463
+    END AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1 and p.first_dialysis_date <> 0)a GROUP BY nnd`, orgID).Scan(&counts)
464
+	}
465
+
466
+	if lapsetotype > 0 {
467
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
468
+    SELECT
469
+    CASE
470
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '1'
471
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '2'
472
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '3'
473
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60 THEN '4'
474
+    END AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1 and p.first_dialysis_date <> 0 and p.lapseto = ?)a GROUP BY nnd`, orgID, lapsetotype).Scan(&counts)
475
+	}
476
+
477
+	if sourcetype > 0 {
478
+		readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
479
+    SELECT
480
+    CASE
481
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '1'
482
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '2'
483
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '3'
484
+    WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60 THEN '4'
485
+    END AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1 and p.first_dialysis_date <> 0 and p.source = ?)a GROUP BY nnd`, orgID, sourcetype).Scan(&counts)
486
+	}
334 487
 
488
+	return
335 489
 }
336 490
 
337 491
 func GetCurentOrgPatients(orgid int64) (patients []*models.BloodXtPatients, err error) {
@@ -3375,7 +3529,7 @@ func GetCountModeId(startime int64, endtime int64, modeid int64, orgid int64) (o
3375 3529
 
3376 3530
 }
3377 3531
 
3378
-func GetCountRollout(orgid int64, startime int64, endtime int64) (lapseto []*models.BloodLapsetoCount, err error) {
3532
+func GetCountRollout(orgid int64, startime int64, endtime int64, lapsetotype int64, sourcetype int64) (lapseto []*models.BloodLapsetoCount, err error) {
3379 3533
 
3380 3534
 	table := XTReadDB().Table("xt_patients as s")
3381 3535
 	fmt.Println(table)
@@ -3386,6 +3540,15 @@ func GetCountRollout(orgid int64, startime int64, endtime int64) (lapseto []*mod
3386 3540
 	if endtime > 0 {
3387 3541
 		db = db.Where("x.lapseto_time<=?", endtime)
3388 3542
 	}
3389
-	err = db.Group("x.lapseto_time,x.lapseto_type").Select("count(x.id) as count,x.lapseto_type,x.lapseto_time").Joins("left join xt_patients as s  on s.id = x.patient_id").Where("s.user_org_id = ?", orgid).Scan(&lapseto).Error
3543
+	if lapsetotype == 0 || sourcetype == 0 {
3544
+		err = db.Group("x.lapseto_time,x.lapseto_type").Select("count(x.id) as count,x.lapseto_type,x.lapseto_time").Joins("left join xt_patients as s  on s.id = x.patient_id").Where("s.user_org_id = ?", orgid).Scan(&lapseto).Error
3545
+	}
3546
+
3547
+	if lapsetotype > 0 {
3548
+		err = db.Group("x.lapseto_time,x.lapseto_type").Select("count(x.id) as count,x.lapseto_type,x.lapseto_time").Joins("left join xt_patients as s  on s.id = x.patient_id").Where("s.user_org_id = ? and s.lapseto = ?", orgid, lapsetotype).Scan(&lapseto).Error
3549
+	}
3550
+	if sourcetype > 0 {
3551
+		err = db.Group("x.lapseto_time,x.lapseto_type").Select("count(x.id) as count,x.lapseto_type,x.lapseto_time").Joins("left join xt_patients as s  on s.id = x.patient_id").Where("s.user_org_id = ? and s.source = ?", orgid, sourcetype).Scan(&lapseto).Error
3552
+	}
3390 3553
 	return lapseto, err
3391 3554
 }

+ 1 - 1
service/dialysis_service.go Dosyayı Görüntüle

@@ -1101,7 +1101,7 @@ func UpdateDialysisBeforePrepareTwo(info *models.DialysisBeforePrepare) (err err
1101 1101
 
1102 1102
 func UpdateAutoReduceDetailSix(detail *models.AutomaticReduceDetail) (err error) {
1103 1103
 
1104
-	err = writeDb.Model(&models.AutomaticReduceDetail{}).Where("good_id = ? and good_type_id = ? And patient_id = ? and org_id =?", detail.GoodId, detail.GoodTypeId, detail.PatientId, detail.OrgId).Updates(map[string]interface{}{"count": detail.Count, "mtime": detail.Mtime, "status": 1}).Error
1104
+	err = writeDb.Model(&models.AutomaticReduceDetail{}).Where("good_id = ? and good_type_id = ? And patient_id = ? and org_id =? and record_time = ?", detail.GoodId, detail.GoodTypeId, detail.PatientId, detail.OrgId, detail.RecordTime).Updates(map[string]interface{}{"count": detail.Count, "mtime": detail.Mtime, "status": 1}).Error
1105 1105
 	return err
1106 1106
 }
1107 1107
 

+ 5 - 0
service/doctor_advice_service.go Dosyayı Görüntüle

@@ -360,6 +360,11 @@ func ModifyTemplateName(id int64, template_name string) (err error) {
360 360
 	return err
361 361
 }
362 362
 
363
+func ModifyTemplateNameOne(id int64, template_name string, sort int64) (err error) {
364
+	err = writeDb.Model(&models.DoctorAdviceParentTemplate{}).Where("status=1 AND id = ?", id).Updates(map[string]interface{}{"name": template_name, "updated_time": time.Now().Unix(), "sort": sort}).Error
365
+	return err
366
+}
367
+
363 368
 func ModifyHisTemplateName(id int64, template_name string) (err error) {
364 369
 	err = writeDb.Model(&models.HisDoctorAdviceParentTemplate{}).Where("status=1 AND id = ?", id).Updates(map[string]interface{}{"name": template_name, "updated_time": time.Now().Unix()}).Error
365 370
 	return err

+ 6 - 0
service/gobal_config_service.go Dosyayı Görüntüle

@@ -473,3 +473,9 @@ func GetAllBaseDrugList(orgid int64) (drug []*models.BaseDrugLib, err error) {
473 473
 	err = XTReadDB().Model(&drug).Where("org_id = ? and status = 1", orgid).Find(&drug).Error
474 474
 	return drug, err
475 475
 }
476
+
477
+func GetDrugWarehuseOrderInfo(orgid int64) (drug []*models.DrugWarehouseInfo, err error) {
478
+
479
+	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Group("drug_id").Find(&drug).Error
480
+	return drug, err
481
+}

+ 73 - 31
service/mobile_dialysis_service.go Dosyayı Görüntüle

@@ -852,13 +852,14 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
852 852
 		}
853 853
 
854 854
 	} else if adviceType == 2 && len(deliverWay) <= 0 {
855
+
855 856
 		if patientType == 0 {
856 857
 			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?"
857 858
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
858 859
 
859 860
 		} else if patientType == 1 {
860
-			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND advice_doctor = ?"
861
-			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId)
861
+			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND (advice_doctor = ? or execution_staff = ?)"
862
+			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId, adminUserId)
862 863
 		} else if patientType == 2 {
863 864
 			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0"
864 865
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
@@ -886,41 +887,82 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
886 887
 	return vms, err
887 888
 }
888 889
 
889
-func GetHisDoctorAdvices(orgID int64, scheduleDate int64, deliverWay string) ([]*HisMScheduleDoctorAdviceVM, error) {
890
+func GetHisDoctorAdvices(orgID int64, scheduleDate int64, deliverWay string, patientType int, adminUserId int64) ([]*HisMScheduleDoctorAdviceVM, error) {
890 891
 
891 892
 	var vms []*HisMScheduleDoctorAdviceVM
892 893
 	if len(deliverWay) > 0 {
893
-		db := readDb.
894
-			Table("xt_schedule").
895
-			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
896
-			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
897
-				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
898
-			}).
899
-			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
900
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
901
-			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
902
-			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
903
-			Where("status = 1 AND user_org_id = ?", orgID)
904
-		if scheduleDate != 0 {
905
-			db = db.Where("schedule_date = ?", scheduleDate)
894
+		if patientType == 0 {
895
+			db := readDb.
896
+				Table("xt_schedule").
897
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
898
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
899
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
900
+				}).
901
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
902
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
903
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
904
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
905
+				Where("status = 1 AND user_org_id = ?", orgID)
906
+			if scheduleDate != 0 {
907
+				db = db.Where("schedule_date = ?", scheduleDate)
908
+			}
909
+			err = db.Find(&vms).Error
906 910
 		}
907
-		err = db.Find(&vms).Error
911
+		if patientType > 0 {
912
+			db := readDb.
913
+				Table("xt_schedule").
914
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
915
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
916
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
917
+				}).
918
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
919
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
920
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
921
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and  (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
922
+				Where("status = 1 AND user_org_id = ?", orgID)
923
+			if scheduleDate != 0 {
924
+				db = db.Where("schedule_date = ?", scheduleDate)
925
+			}
926
+			err = db.Find(&vms).Error
927
+		}
928
+
908 929
 	} else {
909
-		db := readDb.
910
-			Table("xt_schedule").
911
-			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
912
-			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
913
-				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
914
-			}).
915
-			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
916
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
917
-			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
918
-			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).
919
-			Where("status = 1 AND user_org_id = ?", orgID)
920
-		if scheduleDate != 0 {
921
-			db = db.Where("schedule_date = ?", scheduleDate)
930
+		if patientType == 0 {
931
+			db := readDb.
932
+				Table("xt_schedule").
933
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
934
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
935
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
936
+				}).
937
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
938
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
939
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
940
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? ", orgID, scheduleDate).
941
+				Where("status = 1 AND user_org_id = ?", orgID)
942
+			if scheduleDate != 0 {
943
+				db = db.Where("schedule_date = ?", scheduleDate)
944
+			}
945
+			err = db.Find(&vms).Error
922 946
 		}
923
-		err = db.Find(&vms).Error
947
+		fmt.Println("patin34te2222222222222222222", patientType)
948
+		if patientType > 0 {
949
+			db := readDb.
950
+				Table("xt_schedule").
951
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
952
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
953
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
954
+				}).
955
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
956
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
957
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
958
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and  (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
959
+				Where("status = 1 AND user_org_id = ?", orgID)
960
+			if scheduleDate != 0 {
961
+				db = db.Where("schedule_date = ?", scheduleDate)
962
+			}
963
+			err = db.Find(&vms).Error
964
+		}
965
+
924 966
 	}
925 967
 
926 968
 	return vms, err

+ 1 - 1
service/patient_service.go Dosyayı Görüntüle

@@ -1491,7 +1491,7 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1491 1491
 
1492 1492
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1493 1493
 
1494
-	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation}).Error
1494
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn}).Error
1495 1495
 	return err
1496 1496
 }
1497 1497
 

+ 36 - 2
service/patientmanage_service.go Dosyayı Görüntüle

@@ -949,14 +949,14 @@ func GetNewPatient(id int64) (models.XtPatientsNew, error) {
949 949
 
950 950
 func UpdatedPatient(patients models.Patients, id int64) error {
951 951
 
952
-	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime}).Error
952
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone}).Error
953 953
 
954 954
 	return err
955 955
 }
956 956
 
957 957
 func UpdateXtPatientNew(patients models.XtPatientsNew, id int64) error {
958 958
 
959
-	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime}).Error
959
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone}).Error
960 960
 
961 961
 	return err
962 962
 }
@@ -1587,3 +1587,37 @@ func GetBloodAccess(orgid int64) (*models.Dataconfig, error) {
1587 1587
 	err := XTReadDB().Model(&dataconfig).Where("org_id = 0 and name = '血管通路部位' and status = 1 ").Find(&dataconfig).Error
1588 1588
 	return &dataconfig, err
1589 1589
 }
1590
+
1591
+func GetPatientScheduleCount(orgid int64, startTime int64, endTime int64, ids []string) (schedule []*models.VmXtSchedule, err error) {
1592
+
1593
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status =1")
1594
+	if orgid > 0 {
1595
+		db = db.Where("x.user_org_id = ?", orgid)
1596
+	}
1597
+	if startTime > 0 {
1598
+		db = db.Where("x.schedule_date >=?", startTime)
1599
+	}
1600
+	if endTime > 0 {
1601
+		db = db.Where("x.schedule_date<=?", endTime)
1602
+	}
1603
+	if len(ids) > 0 {
1604
+		db = db.Where("x.partition_id in (?)", ids)
1605
+	}
1606
+	err = db.Select("count(x.id) as count,x.schedule_type,x.schedule_week").Group("x.schedule_week,x.schedule_type").Scan(&schedule).Error
1607
+	return schedule, err
1608
+}
1609
+
1610
+func GetTotalBedNumber(orgid int64, ids []string) (list []*models.XtDeviceNumber, total int64, err error) {
1611
+
1612
+	//err = XTReadDB().Model(&list).Where("org_id = ? and status = 1 ",orgid).Count(&total).Find(&list).Error
1613
+	//return list,total,err
1614
+	db := XTReadDB().Table("xt_device_number as x").Where("x.status = 1")
1615
+	if orgid > 0 {
1616
+		db = db.Where("x.org_id = ?", orgid)
1617
+	}
1618
+	if len(ids) > 0 {
1619
+		db = db.Where("x.zone_id in (?)", ids)
1620
+	}
1621
+	err = db.Count(&total).Find(&list).Error
1622
+	return list, total, err
1623
+}

+ 7 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Dosyayı Görüntüle

@@ -196,6 +196,13 @@ type PrescriptionVM struct {
196 196
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
197 197
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
198 198
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
199
+	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
200
+	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
201
+	SingleTime                 string  `gorm:"column:single_time" json:"single_time" form:"single_time"`
202
+	SingleWater                string  `gorm:"column:single_water" json:"single_water" form:"single_water"`
203
+	ReplacementFlow            string  `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
204
+	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
205
+	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
199 206
 }
200 207
 
201 208
 func (PrescriptionVM) TableName() string {

+ 151 - 11
service/schedule_service.go Dosyayı Görüntüle

@@ -19,7 +19,7 @@ func GetSchedulePartitionPanel(orgID int64) (partitions []*models.Partition, err
19 19
 }
20 20
 
21 21
 func GetSchedulePartitionPanelOne(orgID int64, partionId int64) (partitions []*models.Partition, err error) {
22
-	fmt.Println("partionId3333333333333333", partionId)
22
+
23 23
 	if partionId > 0 {
24 24
 		err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1 and zone_id = ?", orgID, partionId).Where("org_id=? and status=1 and id = ?", orgID, partionId).Find(&partitions).Error
25 25
 	}
@@ -30,6 +30,18 @@ func GetSchedulePartitionPanelOne(orgID int64, partionId int64) (partitions []*m
30 30
 	return
31 31
 }
32 32
 
33
+func GetSchedulePartitionPanelTwo(orgID int64, schIDs []string) (partitions []*models.Partition, err error) {
34
+
35
+	if len(schIDs) == 0 {
36
+		err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Find(&partitions).Error
37
+	}
38
+	if len(schIDs) > 0 {
39
+		err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1 and zone_id in(?)", orgID, schIDs).Where("org_id=? and status=1 and id in(?)", orgID, schIDs).Find(&partitions).Error
40
+	}
41
+
42
+	return
43
+}
44
+
33 45
 func GetPatientWithScheduleAndSolution(orgID int64, keywords string, weekStart, weekEnd, schedule, contagion int64) (patients []*models.Patients, err error) {
34 46
 	db := readDb.Table("xt_patients as p").
35 47
 		Preload("DialysisSolutions", "user_org_id=? and initiate_mode=1 and affirm_state=1 and parent_id=0 and status=1", orgID).
@@ -83,6 +95,25 @@ func GetWeekScheduleOne(orgID int64, start, end int64, partionid int64, schedule
83 95
 	return
84 96
 }
85 97
 
98
+func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.Schedule, err error) {
99
+
100
+	db := readDb.Table("xt_schedule as s")
101
+	fmt.Println("schIds2222222")
102
+	if len(schIds) > 0 {
103
+		db = db.Where("s.partition_id in (?)", schIds)
104
+	}
105
+	if scheduletype > 0 {
106
+		db = db.Where("s.schedule_type = ?", scheduletype)
107
+	}
108
+	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
109
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
110
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
111
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
112
+		Order("updated_time asc").
113
+		Find(&schedules).Error
114
+	return
115
+}
116
+
86 117
 func GetDaySchedule(orgID, start, end, patientID int64) (schedule models.Schedule, err error) {
87 118
 	err = readDb.Model(&models.Schedule{}).Where("user_org_id=? and patient_id=? and schedule_date>=? and schedule_date<=? and status=1", orgID, patientID, start, end).First(&schedule).Error
88 119
 	return
@@ -133,10 +164,10 @@ func CreateSchedule(m *models.Schedule) error {
133 164
 	return writeDb.Model(&models.Schedule{}).Create(&m).Error
134 165
 }
135 166
 
136
-func GetTodayScheduleIsExist(patientid int64, schedudate int64, orgid int64) (*models.XtSchedule, error) {
167
+func GetTodayScheduleIsExist(patientid int64, schedudate int64, orgid int64, mode_id int64, schedule_type int64) (*models.XtSchedule, error) {
137 168
 	var scheudle models.XtSchedule
138 169
 	var err error
139
-	err = XTReadDB().Model(&scheudle).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1", patientid, schedudate, orgid).Find(&scheudle).Error
170
+	err = XTReadDB().Model(&scheudle).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1 and mode_id = ? and schedule_type = ?", patientid, schedudate, orgid, mode_id, schedule_type).Find(&scheudle).Error
140 171
 	if err == gorm.ErrRecordNotFound {
141 172
 		return nil, err
142 173
 	}
@@ -146,8 +177,8 @@ func GetTodayScheduleIsExist(patientid int64, schedudate int64, orgid int64) (*m
146 177
 	return &scheudle, nil
147 178
 }
148 179
 
149
-func UpdateScheduleByOrgId(patientid int64, scheduledate int64, orgid int64, sch *models.XtSchedule) error {
150
-	err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1", patientid, scheduledate, orgid).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix()}).Error
180
+func UpdateScheduleByOrgId(patientid int64, scheduledate int64, orgid int64, mode_id int64, schedule_type int64, sch *models.XtSchedule) error {
181
+	err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1 and mode_id = ? and schedule_type = ?", patientid, scheduledate, orgid, mode_id, schedule_type).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix()}).Error
151 182
 	return err
152 183
 }
153 184
 
@@ -385,8 +416,7 @@ func GetWeekDayScheduleTwo(orgID int64, scheduleDate int64, scheduleDates *time.
385 416
 				advice.IsCheck = 1
386 417
 				if advice.FrequencyType == 3 {
387 418
 					week := int(scheduleDates.Weekday())
388
-					fmt.Println("week-------", week)
389
-					fmt.Println(advice.WeekDay)
419
+
390 420
 					switch week {
391 421
 					case 1:
392 422
 						if strings.Index(advice.WeekDay, "周一") > -1 {
@@ -534,6 +564,49 @@ func GetWeekDaySchedule(orgID int64, scheduleDate int64, scheduleDates *time.Tim
534 564
 	return
535 565
 }
536 566
 
567
+func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64) (list []*models.VmSchedules, err error) {
568
+
569
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
570
+	if orgid > 0 {
571
+		db = db.Where("x.user_org_id = ?", orgid)
572
+	}
573
+	if scheduleDate > 0 {
574
+		db = db.Where("x.schedule_date = ?", scheduleDate)
575
+	}
576
+	if scheduleType > 0 {
577
+		db = db.Where("x.schedule_type = ?", scheduleType)
578
+	}
579
+
580
+	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
581
+		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
582
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
583
+
584
+	return list, err
585
+}
586
+
587
+func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone int64) (list []*models.VmSchedules, err error) {
588
+
589
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
590
+	if orgid > 0 {
591
+		db = db.Where("x.user_org_id = ?", orgid)
592
+	}
593
+	if scheduleDate > 0 {
594
+		db = db.Where("x.schedule_date >=? and x.schedule_date<=?", startDate, scheduleDate)
595
+	}
596
+	if scheduleType > 0 {
597
+		db = db.Where("x.schedule_type = ?", scheduleType)
598
+	}
599
+	if zone > 0 {
600
+		db = db.Where("s.partition_id = ?", zone)
601
+	}
602
+
603
+	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
604
+		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
605
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
606
+
607
+	return list, err
608
+}
609
+
537 610
 func RemoveRepeatedElement(arr []*models.DoctorAdvice) (newArr []*models.DoctorAdvice) {
538 611
 	newArr = make([]*models.DoctorAdvice, 0)
539 612
 	for i := 0; i < len(arr); i++ {
@@ -678,7 +751,7 @@ func UpdateNewScheduleTemplateStatus(id int64, org_id int64) (err error) {
678 751
 	return
679 752
 }
680 753
 
681
-func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64) (schedules []*models.WeekSchedule, err error) {
754
+func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone int64) (schedules []*models.WeekSchedule, err error) {
682 755
 
683 756
 	db := readDb.Table("xt_schedule as s ").Where("s.status =1")
684 757
 	if orgID > 0 {
@@ -696,14 +769,18 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
696 769
 	if weektype > 0 {
697 770
 		db = db.Where("s.schedule_week = ?", weektype)
698 771
 	}
772
+	if zone > 0 {
773
+		db = db.Where("s.partition_id = ?", zone)
774
+	}
699 775
 	err = db.
700 776
 		Preload("DeviceZone", "status = 1 ").
701 777
 		Preload("DeviceNumber", "status = 1 ").
702 778
 		Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
703 779
 			return db.Where("status = 1").Order("id asc")
704
-		}).
705
-		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
706
-		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
780
+		}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
781
+		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
782
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
783
+		Select("s.id,s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
707 784
 		Order("s.partition_id asc").
708 785
 		Find(&schedules).Error
709 786
 	return schedules, err
@@ -768,3 +845,66 @@ func UpdatePatientSchedule(orgid int64, startime int64, endtime int64) error {
768 845
 	err := XTWriteDB().Model(&schedule).Where("user_org_id = ? and schedule_date>=? and schedule_date<=? and status =1", orgid, startime, endtime).Updates(map[string]interface{}{"status": 0}).Error
769 846
 	return err
770 847
 }
848
+
849
+func GetSettingById(id int64) (*models.XtRemindPrintSetting, error) {
850
+	setting := models.XtRemindPrintSetting{}
851
+	err := XTReadDB().Model(&setting).Where("id = ? and status = 1", id).Find(&setting).Error
852
+	if err == gorm.ErrRecordNotFound {
853
+		return nil, err
854
+	}
855
+	if err != nil {
856
+		return nil, err
857
+	}
858
+	return &setting, nil
859
+}
860
+
861
+func CreateSetting(setting *models.XtRemindPrintSetting) error {
862
+
863
+	err := XTReadDB().Create(&setting).Error
864
+	return err
865
+}
866
+
867
+func UpdatedRemindPrint(set *models.XtRemindPrintSetting, id int64) error {
868
+
869
+	err := XTWriteDB().Model(&set).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"prescription_status": set.PrescriptionStatus, "week": set.Week, "name": set.Name, "zone": set.Zone, "classes": set.Classes, "number": set.Number, "mode": set.Mode, "dialyzers": set.Dialyzers, "perfusion_apparatus": set.PerfusionApparatus, "anticoagulant": set.Anticoagulant, "doctor_advice": set.DoctorAdvice, "anticoagulant_zongliang": set.AnticoagulantZongliang}).Error
870
+	return err
871
+}
872
+
873
+func GetRemindPrintList(id int64) (models.XtRemindPrintSetting, error) {
874
+
875
+	setting := models.XtRemindPrintSetting{}
876
+	err := XTReadDB().Model(&setting).Where("user_org_id = ? and status =1", id).Find(&setting).Error
877
+	return setting, err
878
+}
879
+
880
+func GetScheudleTemplateById(orgid int64) (*models.ScheduleTemplate, error) {
881
+
882
+	schedule := models.ScheduleTemplate{}
883
+	err := XTReadDB().Model(&schedule).Where("user_org_id = ? and status = 1", orgid).Find(&schedule).Error
884
+	if err == gorm.ErrRecordNotFound {
885
+		return nil, err
886
+	}
887
+	if err != nil {
888
+		return nil, err
889
+	}
890
+	return &schedule, nil
891
+}
892
+
893
+func CreateXtscheduleTemplate(template *models.ScheduleTemplate) error {
894
+
895
+	err := XTWriteDB().Create(&template).Error
896
+	return err
897
+}
898
+
899
+func UpdateXtScheduleTemplate(template *models.ScheduleTemplate, orgid int64) error {
900
+
901
+	err := XTWriteDB().Model(&template).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"template_id": template.TemplateId}).Error
902
+	return err
903
+}
904
+
905
+func GetScheduleTemplate(orgid int64) (models.ScheduleTemplate, error) {
906
+
907
+	template := models.ScheduleTemplate{}
908
+	err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&template).Error
909
+	return template, err
910
+}

+ 6 - 0
service/stock_service.go Dosyayı Görüntüle

@@ -2520,3 +2520,9 @@ func FindAllDataConfigList(orgid int64, parentId int64) (dataconfig []*models.Da
2520 2520
 	err = XTReadDB().Model(&dataconfig).Where("(org_id = ? or org_id = 0) and parent_id = ? and status = 1", orgid, parentId).Find(&dataconfig).Error
2521 2521
 	return dataconfig, err
2522 2522
 }
2523
+
2524
+func GetWarehouseOrderInfoList(orgid int64) (list []*models.WarehousingInfo, err error) {
2525
+
2526
+	err = XTReadDB().Model(&list).Where("org_id = ? and status = 1", orgid).Order("id asc").Group("good_id").Find(&list).Error
2527
+	return list, err
2528
+}