Browse Source

11月9日库存管理

XMLWAN 2 years ago
parent
commit
a29ae08cfa

+ 28 - 0
controllers/dialysis_api_controller.go View File

@@ -93,6 +93,8 @@ func DialysisApiRegistRouters() {
93 93
 	beego.Router("/api/patient/savehisdialysis", &DialysisApiController{}, "Get:SaveHisDialysis")
94 94
 
95 95
 	beego.Router("/api/patient/gethisdialysisgoodcount", &DialysisApiController{}, "Get:GetHisDialysisGoodCount")
96
+
97
+	beego.Router("/api/schedule/getpatientshedule", &DialysisApiController{}, "Get:GetPatientSchedule")
96 98
 }
97 99
 
98 100
 func (c *DialysisApiController) GetQueueCall() {
@@ -301,6 +303,9 @@ func (c *DialysisApiController) PostPrescription() {
301 303
 	epo_count, _ := c.GetFloat("epo_count", 0)
302 304
 	max_ultrafiltration_rate, _ := c.GetFloat("max_ultrafiltration_rate")
303 305
 	admin_user_id, _ := c.GetInt64("admin_user_id")
306
+	is_water, _ := c.GetInt64("is_water")
307
+	drhy_water := c.GetString("drhy_water")
308
+	dry_water_hour := c.GetString("dry_water_hour")
304 309
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
305 310
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
306 311
 
@@ -402,6 +407,9 @@ func (c *DialysisApiController) PostPrescription() {
402 407
 		EpoCount:                   epo_count,
403 408
 		MaxUltrafiltrationRate:     max_ultrafiltration_rate,
404 409
 		AdminUserId:                admin_user_id,
410
+		IsWater:                    is_water,
411
+		DrhyWater:                  drhy_water,
412
+		DryWaterHour:               dry_water_hour,
405 413
 	}
406 414
 
407 415
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -627,6 +635,9 @@ func (c *DialysisApiController) PostSoulution() {
627 635
 	preImpules, parseDateErr := strconv.ParseFloat(impulse, 64)
628 636
 	admin_user_id, _ := c.GetInt64("admin_user_id")
629 637
 	fmt.Println("", preImpules)
638
+	is_water, _ := c.GetInt64("is_water")
639
+	dry_water_hour := c.GetString("dry_water_hour")
640
+	drhy_water := c.GetString("drhy_water")
630 641
 	var prescription_doctor int64
631 642
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
632 643
 
@@ -740,6 +751,9 @@ func (c *DialysisApiController) PostSoulution() {
740 751
 		MaxUltrafiltrationRate:     max_ultrafiltration_rate,
741 752
 		PreImpulse:                 preImpules,
742 753
 		AdminUserId:                admin_user_id,
754
+		IsWater:                    is_water,
755
+		DryWaterHour:               dry_water_hour,
756
+		DrhyWater:                  drhy_water,
743 757
 	}
744 758
 
745 759
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -4608,3 +4622,17 @@ func (this *DialysisApiController) GetHisDialysisGoodCount() {
4608 4622
 	})
4609 4623
 	return
4610 4624
 }
4625
+
4626
+func (this *DialysisApiController) GetPatientSchedule() {
4627
+
4628
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4629
+
4630
+	patient_id, _ := this.GetInt64("patient_id")
4631
+	schedule_date, _ := this.GetInt64("schedule_date")
4632
+
4633
+	schedulePatient, _ := service.GetScheduleByPatient(patient_id, schedule_date, orgId)
4634
+
4635
+	this.ServeSuccessJSON(map[string]interface{}{
4636
+		"schedulePatient": schedulePatient,
4637
+	})
4638
+}

+ 53 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1358,6 +1358,21 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1358 1358
 
1359 1359
 	max_ultrafiltration_rate, _ := c.GetFloat("max_ultrafiltration_rate")
1360 1360
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1361
+
1362
+	is_water := c.GetString("is_water")
1363
+	var is_war int64
1364
+	if is_water == "是" {
1365
+		is_war = 1
1366
+	}
1367
+	if is_water == "否" {
1368
+		is_war = 2
1369
+	}
1370
+	if is_water == "请选择" {
1371
+		is_war = 0
1372
+	}
1373
+	drhy_water := c.GetString("drhy_water")
1374
+
1375
+	dry_water_hour := c.GetString("dry_water_hour")
1361 1376
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1362 1377
 
1363 1378
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -1464,6 +1479,9 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1464 1479
 		EpoCount:                   epo_count,
1465 1480
 		MaxUltrafiltrationRate:     max_ultrafiltration_rate,
1466 1481
 		AdminUserId:                admin_user_id,
1482
+		IsWater:                    is_war,
1483
+		DrhyWater:                  drhy_water,
1484
+		DryWaterHour:               dry_water_hour,
1467 1485
 	}
1468 1486
 
1469 1487
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1814,7 +1832,7 @@ func (c *DialysisAPIController) Finish() {
1814 1832
 
1815 1833
 	}
1816 1834
 
1817
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 {
1835
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 {
1818 1836
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1819 1837
 		if evaluation.SystolicBloodPressure == 0 {
1820 1838
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -2404,6 +2422,10 @@ func (this *DialysisAPIController) StartDialysis() {
2404 2422
 	if newdialysisRecord.ID > 0 {
2405 2423
 		if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 9675 {
2406 2424
 			record.Temperature = 36.5
2425
+			//var pressure string
2426
+			//pressure = "-"
2427
+			//floatPressure, _ := strconv.ParseFloat(pressure, 64)
2428
+			//record.ArterialPressure = floatPressure
2407 2429
 		}
2408 2430
 		err := service.CreateMonitor(&record)
2409 2431
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
@@ -2551,6 +2573,21 @@ func (c *DialysisAPIController) PostSolution() {
2551 2573
 	pre_impulse := c.GetString("pre_impulse")
2552 2574
 	impulse, _ := strconv.ParseFloat(pre_impulse, 64)
2553 2575
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2576
+
2577
+	is_water := c.GetString("is_water")
2578
+	var is_war int64
2579
+	if is_water == "是" {
2580
+		is_war = 1
2581
+	}
2582
+	if is_water == "否" {
2583
+		is_war = 2
2584
+	}
2585
+	if is_water == "请选择" {
2586
+		is_war = 0
2587
+	}
2588
+	drhy_water := c.GetString("drhy_water")
2589
+	dry_water_hour := c.GetString("dry_water_hour")
2590
+
2554 2591
 	if mode_id > 0 {
2555 2592
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
2556 2593
 	}
@@ -2658,6 +2695,9 @@ func (c *DialysisAPIController) PostSolution() {
2658 2695
 		MaxUltrafiltrationRate:     max_ultrafiltration_rate,
2659 2696
 		PreImpulse:                 impulse,
2660 2697
 		AdminUserId:                admin_user_id,
2698
+		IsWater:                    is_war,
2699
+		DrhyWater:                  drhy_water,
2700
+		DryWaterHour:               dry_water_hour,
2661 2701
 	}
2662 2702
 
2663 2703
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -6904,3 +6944,15 @@ func (this *DialysisAPIController) GetPatientSign() {
6904 6944
 		"dialysisOrder": dialysisOrder,
6905 6945
 	})
6906 6946
 }
6947
+
6948
+func (this *DialysisAPIController) GetScheduleByPatient() {
6949
+
6950
+	patient_id, _ := this.GetInt64("patient_id")
6951
+	schedule_date, _ := this.GetInt64("schedule_date")
6952
+	orgid := this.GetMobileAdminUserInfo().Org.Id
6953
+	schedule, _ := service.GetScheduleByPatient(patient_id, schedule_date, orgid)
6954
+	this.ServeSuccessJSON(map[string]interface{}{
6955
+		"schedule": schedule,
6956
+	})
6957
+
6958
+}

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

@@ -170,4 +170,6 @@ func MobileAPIControllersRegisterRouters() {
170 170
 	beego.Router("/m/api/savepatientsign", &DialysisAPIController{}, "Post:SavePatientSign")
171 171
 	beego.Router("/m/api/getpatientsign", &DialysisAPIController{}, "Get:GetPatientSign")
172 172
 
173
+	beego.Router("/m/api/patient/getschedulebypatient", &DialysisAPIController{}, "Get:GetScheduleByPatient")
174
+
173 175
 }

+ 1 - 2
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -518,8 +518,7 @@ func (this *StaffScheduleApiController) GetSchedulePatient() {
518 518
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
519 519
 	weekStart := theStarTime.Unix()
520 520
 	weekEnd := theEndTime.Unix()
521
-
522
-	patients, _ := service.GetPatientWithScheduleAndSolution(adminInfo.Org.Id, keywords, weekStart, weekEnd, schedule, contagion)
521
+	patients, _ := service.GetPatientWithScheduleAndSolutionTwo(adminInfo.Org.Id, keywords, weekStart, weekEnd, schedule, contagion)
523 522
 
524 523
 	this.ServeSuccessJSON(map[string]interface{}{
525 524
 		"patients": patients,

+ 21 - 0
models/device_models.go View File

@@ -1153,3 +1153,24 @@ type SgjDeviceNumber struct {
1153 1153
 func (SgjDeviceNumber) TableName() string {
1154 1154
 	return "xt_device_number"
1155 1155
 }
1156
+
1157
+type XtScheduleSix struct {
1158
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1159
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1160
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1161
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1162
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1163
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1164
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1165
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1166
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1167
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1168
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
1169
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1170
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
1171
+}
1172
+
1173
+func (XtScheduleSix) TableName() string {
1174
+
1175
+	return "xt_schedule"
1176
+}

+ 3 - 0
models/patient_models.go View File

@@ -322,6 +322,9 @@ type DialysisPrescription struct {
322 322
 	EpoCount                   float64       `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
323 323
 	MaxUltrafiltrationRate     float64       `gorm:"column:max_ultrafiltration_rate" json:"max_ultrafiltration_rate" form:"max_ultrafiltration_rate"`
324 324
 	AdminUserId                int64         `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
325
+	IsWater                    int64         `gorm:"column:is_water" json:"is_water" form:"is_water"`
326
+	DrhyWater                  string        `gorm:"column:drhy_water" json:"drhy_water" form:"drhy_water"`
327
+	DryWaterHour               string        `gorm:"column:dry_water_hour" json:"dry_water_hour" form:"dry_water_hour"`
325 328
 }
326 329
 
327 330
 func (DialysisPrescription) TableName() string {

+ 7 - 0
service/dialysis_service.go View File

@@ -1805,3 +1805,10 @@ func GetPatientSign(patient_id int64, dialysis_date int64, orgid int64) (models.
1805 1805
 	err := XTReadDB().Where("patient_id=? and dialysis_date = ? and user_org_id = ? and status = 1", patient_id, dialysis_date, orgid).Find(&order).Error
1806 1806
 	return order, err
1807 1807
 }
1808
+
1809
+func GetScheduleByPatient(patient_id int64, schedule_date int64, orgid int64) (models.XtScheduleSix, error) {
1810
+
1811
+	schedule := models.XtScheduleSix{}
1812
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, orgid).Find(&schedule).Error
1813
+	return schedule, err
1814
+}

+ 14 - 0
service/schedule_service.go View File

@@ -66,6 +66,20 @@ func GetPatientWithScheduleAndSolution(orgID int64, keywords string, weekStart,
66 66
 	return
67 67
 }
68 68
 
69
+func GetPatientWithScheduleAndSolutionTwo(orgID int64, keywords string, weekStart, weekEnd, schedule, contagion int64) (patients []*models.Patients, err error) {
70
+	db := readDb.Table("xt_patients as p").
71
+		Preload("DialysisSolutions", "user_org_id=? and initiate_mode=1 and affirm_state=1 and parent_id=0 and status=1", orgID).
72
+		//Preload("Schedules", "user_org_id=? and schedule_date>=? and schedule_date<= ? and status=1", orgID, weekStart, weekEnd).
73
+		Where("p.user_org_id=? and p.lapseto=1 and p.status=1", orgID)
74
+	if len(keywords) > 0 {
75
+		likeKey := "%" + keywords + "%"
76
+		db = db.Where("p.name LIKE ?", likeKey)
77
+	}
78
+
79
+	err = db.Find(&patients).Error
80
+	return
81
+}
82
+
69 83
 func GetWeekSchedule(orgID int64, start, end int64) (schedules []*models.Schedule, err error) {
70 84
 
71 85
 	err = readDb.Table("xt_schedule as s").Preload("PatientInfectiousDiseases", "status = 1 ").