Browse Source

历史排班

28169 1 year ago
parent
commit
c3638e4294

+ 137 - 0
controllers/dialysis_api_controller.go View File

@@ -135,6 +135,12 @@ func DialysisApiRegistRouters() {
135 135
 	beego.Router("/api/patient/getmonitorloglist", &DialysisApiController{}, "Get:GetMonitorLogList")
136 136
 
137 137
 	beego.Router("/api/patient/getafterloglist", &DialysisApiController{}, "Get:GetAfterLogList")
138
+
139
+	beego.Router("/api/patient/savegathersetting", &DialysisApiController{}, "Get:SaveGatherSetting")
140
+
141
+	beego.Router("/api/patient/getgathersetting", &DialysisApiController{}, "Get:GetGatherSetting")
142
+
143
+	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
138 144
 }
139 145
 
140 146
 func (c *DialysisApiController) GetQueueCall() {
@@ -7463,3 +7469,134 @@ func (this *DialysisApiController) GetAfterLogList() {
7463 7469
 		return
7464 7470
 	}
7465 7471
 }
7472
+
7473
+func (this *DialysisApiController) SaveGatherSetting() {
7474
+
7475
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7476
+	is_index_number, _ := this.GetInt64("is_index_number")
7477
+	fmt.Println("this,23o2332232323232332", is_index_number)
7478
+	is_zone, _ := this.GetInt64("is_zone")
7479
+	is_number, _ := this.GetInt64("is_number")
7480
+	is_birth, _ := this.GetInt64("is_birth")
7481
+	is_age, _ := this.GetInt64("is_age")
7482
+	is_name, _ := this.GetInt64("is_name")
7483
+	is_mode_type, _ := this.GetInt64("is_mode_type")
7484
+	is_prescription_status, _ := this.GetInt64("is_prescription_status")
7485
+	is_admission_number, _ := this.GetInt64("is_admission_number")
7486
+	is_dialysis_no, _ := this.GetInt64("is_dialysis_no")
7487
+	is_dry_weight, _ := this.GetInt64("is_dry_weight")
7488
+	is_dialysis_dialyszers, _ := this.GetInt64("is_dialysis_dialyszers")
7489
+	is_dialysis_strainer, _ := this.GetInt64("is_dialysis_strainer")
7490
+	is_dialysis_irrigation, _ := this.GetInt64("is_dialysis_irrigation")
7491
+	is_calcium, _ := this.GetInt64("is_calcium")
7492
+	is_kalium, _ := this.GetInt64("is_kalium")
7493
+	is_change_nurse, _ := this.GetInt64("is_change_nurse")
7494
+	is_puncture_needle, _ := this.GetInt64("is_puncture_needle")
7495
+	is_anticoagulant, _ := this.GetInt64("is_anticoagulant")
7496
+	is_tube, _ := this.GetInt64("is_tube")
7497
+	is_cuhong, _ := this.GetInt64("is_cuhong")
7498
+	is_zuoka, _ := this.GetInt64("is_zuoka")
7499
+	is_zhetangtie, _ := this.GetInt64("is_zhetangtie")
7500
+	is_paligu, _ := this.GetInt64("is_paligu")
7501
+	is_guhuachun, _ := this.GetInt64("is_guhuachun")
7502
+	is_niaojimei, _ := this.GetInt64("is_niaojimei")
7503
+	is_putaosuangai, _ := this.GetInt64("is_putaosuangai")
7504
+	is_jiaguan, _ := this.GetInt64("is_jiaguan")
7505
+	is_xiongxiewutai, _ := this.GetInt64("is_xiongxiewutai")
7506
+
7507
+	gatherSetting := models.XtDialysisGatherSetting{
7508
+		UserOrgId:          orgId,
7509
+		IndexNumber:        is_index_number,
7510
+		Zone:               is_zone,
7511
+		Number:             is_number,
7512
+		Birth:              is_birth,
7513
+		Name:               is_name,
7514
+		Age:                is_age,
7515
+		ModeType:           is_mode_type,
7516
+		PrescriptionStatus: is_prescription_status,
7517
+		AdmissionNumber:    is_admission_number,
7518
+		DialysisNo:         is_dialysis_no,
7519
+		DryWeight:          is_dry_weight,
7520
+		DialysisDialyszers: is_dialysis_dialyszers,
7521
+		DialysisStrainer:   is_dialysis_strainer,
7522
+		DialysisIrrigation: is_dialysis_irrigation,
7523
+		Calcium:            is_calcium,
7524
+		Kalium:             is_kalium,
7525
+		ChangeNurse:        is_change_nurse,
7526
+		PunctureNeedle:     is_puncture_needle,
7527
+		Anticoagulant:      is_anticoagulant,
7528
+		Tube:               is_tube,
7529
+		Cuhong:             is_cuhong,
7530
+		Zuoka:              is_zuoka,
7531
+		Zhetangtie:         is_zhetangtie,
7532
+		Paligu:             is_paligu,
7533
+		Guhuachun:          is_guhuachun,
7534
+		Niaojimei:          is_niaojimei,
7535
+		Putaosuangai:       is_putaosuangai,
7536
+		Jiaguan:            is_jiaguan,
7537
+		Xiongxiewutai:      is_xiongxiewutai,
7538
+		Ctime:              time.Now().Unix(),
7539
+		Mtime:              time.Now().Unix(),
7540
+		Status:             1,
7541
+	}
7542
+	//查询该机构有没有设置
7543
+	gatherSettingOne, _ := service.GetGatherSettingByOrgId(orgId)
7544
+	if gatherSettingOne.ID == 0 {
7545
+		service.CreateGather(gatherSetting)
7546
+	} else {
7547
+		gatherSetting.ID = gatherSettingOne.ID
7548
+		service.SaveGather(gatherSetting)
7549
+	}
7550
+
7551
+	this.ServeSuccessJSON(map[string]interface{}{
7552
+		"gatherSetting": gatherSetting,
7553
+	})
7554
+	return
7555
+}
7556
+
7557
+func (this *DialysisApiController) GetGatherSetting() {
7558
+
7559
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7560
+
7561
+	gatherSetting, _ := service.GetGatherSetting(orgId)
7562
+
7563
+	this.ServeSuccessJSON(map[string]interface{}{
7564
+		"gatherSetting": gatherSetting,
7565
+	})
7566
+	return
7567
+}
7568
+
7569
+func (this *DialysisApiController) GetDialysisGatherList() {
7570
+
7571
+	keyword := this.GetString("keywords")
7572
+
7573
+	limit, _ := this.GetInt64("limit")
7574
+
7575
+	page, _ := this.GetInt64("page")
7576
+
7577
+	partion_type := this.GetString("partition_id")
7578
+	idSplit := strings.Split(partion_type, ",")
7579
+	schedule_type, _ := this.GetInt64("schedule_type")
7580
+
7581
+	start_time := this.GetString("schedule_date")
7582
+	timeLayout := "2006-01-02"
7583
+	loc, _ := time.LoadLocation("Local")
7584
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7585
+
7586
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7587
+
7588
+	scheduids := this.GetString("ids")
7589
+	var ids []string
7590
+	if scheduids != "" {
7591
+		ids = strings.Split(scheduids, ",")
7592
+	}
7593
+
7594
+	list, total, _ := service.GetDialysisGatherList(keyword, limit, page, idSplit, schedule_type, startTime.Unix(), orgId, ids)
7595
+	gatherSetting, _ := service.GetGatherSetting(orgId)
7596
+	this.ServeSuccessJSON(map[string]interface{}{
7597
+		"list":          list,
7598
+		"total":         total,
7599
+		"gatherSetting": gatherSetting,
7600
+	})
7601
+	return
7602
+}

+ 5 - 0
controllers/patient_api_controller.go View File

@@ -4607,6 +4607,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
4607 4607
 		chaptalization := dataBody["chaptalization"].(string)
4608 4608
 		solution.Chaptalization = chaptalization
4609 4609
 	}
4610
+
4611
+	if dataBody["blood_access_part_id"] != nil && reflect.TypeOf(dataBody["blood_access_part_id"]).String() == "string" {
4612
+		blood_access_part_id := dataBody["blood_access_part_id"].(string)
4613
+		solution.BloodAccessPartId = blood_access_part_id
4614
+	}
4610 4615
 	return
4611 4616
 }
4612 4617
 

+ 1 - 2
controllers/sign_api_controller.go View File

@@ -662,8 +662,7 @@ func (this *SignApiController) GetEnterPriseDetail() {
662 662
 
663 663
 func (this *SignApiController) UploadPrintOrder() {
664 664
 
665
-	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
666
-	list, _ := service.GetAllPatientNew(10587)
665
+	list, _ := service.GetAllPatientNew(10567)
667 666
 	for _, item := range list {
668 667
 
669 668
 		hans := item.Name // 要转换的汉字字符串

+ 41 - 0
models/role_models.go View File

@@ -153,3 +153,44 @@ type Roles struct {
153 153
 func (Roles) TableName() string {
154 154
 	return "sgj_user_role"
155 155
 }
156
+
157
+type XtDialysisGatherSetting struct {
158
+	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
159
+	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
160
+	IndexNumber        int64 `gorm:"column:index_number" json:"index_number" form:"index_number"`
161
+	Zone               int64 `gorm:"column:zone" json:"zone" form:"zone"`
162
+	Number             int64 `gorm:"column:number" json:"number" form:"number"`
163
+	Birth              int64 `gorm:"column:birth" json:"birth" form:"birth"`
164
+	Name               int64 `gorm:"column:name" json:"name" form:"name"`
165
+	Age                int64 `gorm:"column:age" json:"age" form:"age"`
166
+	ModeType           int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
167
+	PrescriptionStatus int64 `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
168
+	AdmissionNumber    int64 `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
169
+	DialysisNo         int64 `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
170
+	DryWeight          int64 `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
171
+	DialysisDialyszers int64 `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
172
+	DialysisStrainer   int64 `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
173
+	DialysisIrrigation int64 `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
174
+	Calcium            int64 `gorm:"column:calcium" json:"calcium" form:"calcium"`
175
+	Kalium             int64 `gorm:"column:kalium" json:"kalium" form:"kalium"`
176
+	ChangeNurse        int64 `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
177
+	PunctureNeedle     int64 `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
178
+	Anticoagulant      int64 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
179
+	Tube               int64 `gorm:"column:tube" json:"tube" form:"tube"`
180
+	Cuhong             int64 `gorm:"column:cuhong" json:"cuhong" form:"cuhong"`
181
+	Zuoka              int64 `gorm:"column:zuoka" json:"zuoka" form:"zuoka"`
182
+	Zhetangtie         int64 `gorm:"column:zhetangtie" json:"zhetangtie" form:"zhetangtie"`
183
+	Paligu             int64 `gorm:"column:paligu" json:"paligu" form:"paligu"`
184
+	Guhuachun          int64 `gorm:"column:guhuachun" json:"guhuachun" form:"guhuachun"`
185
+	Niaojimei          int64 `gorm:"column:niaojimei" json:"niaojimei" form:"niaojimei"`
186
+	Putaosuangai       int64 `gorm:"column:putaosuangai" json:"putaosuangai" form:"putaosuangai"`
187
+	Jiaguan            int64 `gorm:"column:jiaguan" json:"jiaguan" form:"jiaguan"`
188
+	Xiongxiewutai      int64 `gorm:"column:xiongxiewutai" json:"xiongxiewutai" form:"xiongxiewutai"`
189
+	Ctime              int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
190
+	Mtime              int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
191
+	Status             int64 `gorm:"column:status" json:"status" form:"status"`
192
+}
193
+
194
+func (XtDialysisGatherSetting) TableName() string {
195
+	return "xt_dialysis_gather_setting"
196
+}

+ 1 - 0
models/schedule_models.go View File

@@ -423,6 +423,7 @@ type NewMSchedualPatientVMList struct {
423 423
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
424 424
 	TrobleShoot        int64  `gorm:"column:troble_shoot" json:"troble_shoot" form:"troble_shoot"`
425 425
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
426
+	AdmissionNumber    string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
426 427
 }
427 428
 
428 429
 func (NewMSchedualPatientVMList) TableName() string {

+ 56 - 0
service/dialysis_solution_service.go View File

@@ -586,3 +586,59 @@ func GetLongDialysisAdviceToday(orgID int64, schedule_type int64, partition_id [
586 586
 	return schedule, err
587 587
 
588 588
 }
589
+
590
+func GetDialysisGatherList(keywords string, limit int64, page int64, partition_id []string, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
591
+	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
592
+	offset := (page - 1) * limit
593
+	if scheduleDate > 0 {
594
+		db = db.Where("xt_schedule.schedule_date = ?", scheduleDate)
595
+	}
596
+	if schedule_type > 0 {
597
+		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
598
+	}
599
+	//if partition_id > 0 {
600
+	//	db = db.Where("xt_schedule.partition_id = ?", partition_id)
601
+	//}
602
+	if len(partition_id) > 0 {
603
+		db = db.Where("xt_schedule.partition_id in(?)", partition_id)
604
+	}
605
+	if orgID > 0 {
606
+		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
607
+	}
608
+	if len(ids) >= 1 {
609
+		db = db.Where("xt_schedule.id in(?)", ids)
610
+	}
611
+
612
+	if len(keywords) > 0 {
613
+		keywords = "%" + keywords + "%"
614
+		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
615
+		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
616
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
617
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).
618
+			Preload("DialysisPrescription", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
619
+			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
620
+			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
621
+			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
622
+			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
623
+				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
624
+			}).
625
+			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
626
+			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
627
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
628
+	} else {
629
+		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
630
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
631
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).
632
+			Preload("DialysisPrescription", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
633
+			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
634
+			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
635
+			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
636
+			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
637
+			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
638
+			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
639
+				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
640
+			}).Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
641
+	}
642
+
643
+	return schedule, total, err
644
+}

+ 29 - 0
service/gobal_config_service.go View File

@@ -1322,3 +1322,32 @@ func GetAfterLogList(patient_id int64, page int64, limit int64, record_date int6
1322 1322
 
1323 1323
 	return afterlist, total, err
1324 1324
 }
1325
+
1326
+func GetGatherSettingByOrgId(user_org_id int64) (models.XtDialysisGatherSetting, error) {
1327
+
1328
+	gatherSetting := models.XtDialysisGatherSetting{}
1329
+	err := XTReadDB().Where("user_org_id =? and status =1", user_org_id).Find(&gatherSetting).Error
1330
+	return gatherSetting, err
1331
+}
1332
+
1333
+func CreateGather(setting models.XtDialysisGatherSetting) error {
1334
+
1335
+	err := XTWriteDB().Create(&setting).Error
1336
+	return err
1337
+}
1338
+
1339
+func SaveGather(setting models.XtDialysisGatherSetting) error {
1340
+
1341
+	err := XTWriteDB().Save(&setting).Error
1342
+
1343
+	return err
1344
+}
1345
+
1346
+func GetGatherSetting(user_org_id int64) (models.XtDialysisGatherSetting, error) {
1347
+
1348
+	gatherSetting := models.XtDialysisGatherSetting{}
1349
+
1350
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&gatherSetting).Error
1351
+
1352
+	return gatherSetting, err
1353
+}

+ 2 - 2
service/inspection_service.go View File

@@ -169,7 +169,7 @@ func DeletePatientInspection(orgId, patientId, projectId, date int64) (err error
169 169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
170 170
 
171 171
 	var projectCount models.UserInspectionProjectCount
172
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("created_time desc").Scan(&projectCount).Error
172
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("inspect_date desc").Scan(&projectCount).Error
173 173
 
174 174
 	if err != nil {
175 175
 		return
@@ -181,7 +181,7 @@ func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections
181 181
 	}
182 182
 
183 183
 	var Id models.InspectionDate
184
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("inspect_date").Group("inspect_date").Order("created_time desc").Offset(page - 1).Limit(1).Scan(&Id).Error
184
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("inspect_date").Group("inspect_date").Order("inspect_date desc").Offset(page - 1).Limit(1).Scan(&Id).Error
185 185
 	if err != nil {
186 186
 		return
187 187
 	}

+ 1 - 1
service/schedule_service.go View File

@@ -243,7 +243,7 @@ func GetNextSchedule(orgID, end, patientID int64) (schedules []*models.PatientSc
243 243
 func GetNextScheduleByList(patient_id int64, schedule_date int64, user_org_id int64) (models.SchedulePatientsOne, error) {
244 244
 
245 245
 	patientsOne := models.SchedulePatientsOne{}
246
-	err := XTReadDB().Where("patient_id = ? and schedule_date >? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).First(&patientsOne).Error
246
+	err := XTReadDB().Where("patient_id = ? and schedule_date >? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Order("schedule_date asc").First(&patientsOne).Error
247 247
 	return patientsOne, err
248 248
 }
249 249