Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
e4b5842859

+ 4 - 0
controllers/dialysis_api_controller.go View File

@@ -254,6 +254,7 @@ func (c *DialysisApiController) PostPrescription() {
254 254
 	single_time := c.GetString("single_time")
255 255
 	single_water := c.GetString("single_water")
256 256
 	replacement_flow := c.GetString("replacement_flow")
257
+	plasma_separator := c.GetString("plasma_separator")
257 258
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
258 259
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
259 260
 
@@ -342,6 +343,7 @@ func (c *DialysisApiController) PostPrescription() {
342 343
 		SingleTime:                 single_time,
343 344
 		SingleWater:                single_water,
344 345
 		ReplacementFlow:            replacement_flow,
346
+		PlasmaSeparator:            plasma_separator,
345 347
 	}
346 348
 
347 349
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -582,6 +584,7 @@ func (c *DialysisApiController) PostSoulution() {
582 584
 	single_time := c.GetString("single_time")
583 585
 	single_water := c.GetString("single_water")
584 586
 	replacement_flow := c.GetString("replacement_flow")
587
+	plasma_separator := c.GetString("plasma_separator")
585 588
 	var prescription_doctor int64
586 589
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
587 590
 
@@ -681,6 +684,7 @@ func (c *DialysisApiController) PostSoulution() {
681 684
 		SingleTime:                single_time,
682 685
 		SingleWater:               single_water,
683 686
 		ReplacementFlow:           replacement_flow,
687
+		PlasmaSeparator:           plasma_separator,
684 688
 	}
685 689
 
686 690
 	//查询最近透析准备表里是否存在 透析器 灌流器

+ 4 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1099,6 +1099,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1099 1099
 	single_time := c.GetString("single_time")
1100 1100
 	single_water := c.GetString("single_water")
1101 1101
 	replacement_flow := c.GetString("replacement_flow")
1102
+	plasma_separator := c.GetString("plasma_separator")
1102 1103
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1103 1104
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1104 1105
 	//
@@ -1191,6 +1192,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1191 1192
 		SingleTime:                 single_time,
1192 1193
 		SingleWater:                single_water,
1193 1194
 		ReplacementFlow:            replacement_flow,
1195
+		PlasmaSeparator:            plasma_separator,
1194 1196
 	}
1195 1197
 
1196 1198
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1989,6 +1991,7 @@ func (c *DialysisAPIController) PostSolution() {
1989 1991
 	single_time := c.GetString("single_time")
1990 1992
 	single_water := c.GetString("single_water")
1991 1993
 	replacement_flow := c.GetString("replacement_flow")
1994
+	plasma_separator := c.GetString("plasma_separator")
1992 1995
 	if mode_id > 0 {
1993 1996
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1994 1997
 	}
@@ -2082,6 +2085,7 @@ func (c *DialysisAPIController) PostSolution() {
2082 2085
 		SingleWater:               single_water,
2083 2086
 		SingleTime:                single_time,
2084 2087
 		ReplacementFlow:           replacement_flow,
2088
+		PlasmaSeparator:           plasma_separator,
2085 2089
 	}
2086 2090
 
2087 2091
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)

+ 86 - 80
controllers/patient_api_controller.go View File

@@ -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,7 @@ func (c *PatientApiController) UpdateDialysisSolution() {
856 856
 		DialysateTemperature:       solution.DialysateTemperature,
857 857
 		DialysisIrrigation:         solution.DialysisIrrigation,
858 858
 		DialysisDialyszers:         solution.DialysisDialyszers,
859
+		PlasmaSeparator:            solution.PlasmaSeparator,
859 860
 	}
860 861
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
861 862
 	if err != nil {
@@ -3410,6 +3411,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
3410 3411
 		solution.DialysisIrrigation = dialysisIrrigation
3411 3412
 	}
3412 3413
 
3414
+	if dataBody["plasma_separator"] != nil && reflect.TypeOf(dataBody["plasma_separator"]).String() == "string" {
3415
+		plasmaSeparator := dataBody["plasma_separator"].(string)
3416
+		solution.PlasmaSeparator = plasmaSeparator
3417
+	}
3418
+
3413 3419
 	return
3414 3420
 }
3415 3421
 

+ 38 - 0
controllers/schedule_api_controller.go View File

@@ -62,6 +62,8 @@ func ScheduleApiRegistRouters() {
62 62
 
63 63
 	beego.Router("/api/schedule/weekpanelone", &ScheduleApiController{}, "Get:GetWeekPanelsOne")
64 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")
65 67
 }
66 68
 
67 69
 func (c *ScheduleApiController) GetWeekPanels() {
@@ -2585,3 +2587,39 @@ func (c *ScheduleApiController) GetScheduleOne() {
2585 2587
 	})
2586 2588
 	return
2587 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
+}

+ 2 - 0
models/patient_models.go View File

@@ -235,6 +235,7 @@ type DialysisPrescription struct {
235 235
 	SingleTime                 string        `gorm:"column:single_time" json:"single_time" form:"single_time"`
236 236
 	SingleWater                string        `gorm:"column:single_water" json:"single_water" form:"single_water"`
237 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"`
238 239
 }
239 240
 
240 241
 func (DialysisPrescription) TableName() string {
@@ -338,6 +339,7 @@ type DialysisSolution struct {
338 339
 	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
339 340
 	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
340 341
 	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
342
+	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
341 343
 }
342 344
 
343 345
 func (DialysisSolution) TableName() string {

+ 13 - 0
models/schedule_models.go View File

@@ -142,3 +142,16 @@ type WeekSchedule struct {
142 142
 func (WeekSchedule) TableName() string {
143 143
 	return "xt_schedule"
144 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 - 1
service/patient_service.go View File

@@ -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}).Error
1495 1495
 	return err
1496 1496
 }
1497 1497
 

+ 32 - 0
service/schedule_service.go View File

@@ -877,3 +877,35 @@ func GetRemindPrintList(id int64) (models.XtRemindPrintSetting, error) {
877 877
 	err := XTReadDB().Model(&setting).Where("user_org_id = ? and status =1", id).Find(&setting).Error
878 878
 	return setting, err
879 879
 }
880
+
881
+func GetScheudleTemplateById(orgid int64) (*models.ScheduleTemplate, error) {
882
+
883
+	schedule := models.ScheduleTemplate{}
884
+	err := XTReadDB().Model(&schedule).Where("user_org_id = ? and status = 1", orgid).Find(&schedule).Error
885
+	if err == gorm.ErrRecordNotFound {
886
+		return nil, err
887
+	}
888
+	if err != nil {
889
+		return nil, err
890
+	}
891
+	return &schedule, nil
892
+}
893
+
894
+func CreateXtscheduleTemplate(template *models.ScheduleTemplate) error {
895
+
896
+	err := XTWriteDB().Create(&template).Error
897
+	return err
898
+}
899
+
900
+func UpdateXtScheduleTemplate(template *models.ScheduleTemplate, orgid int64) error {
901
+
902
+	err := XTWriteDB().Model(&template).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"template_id": template.TemplateId}).Error
903
+	return err
904
+}
905
+
906
+func GetScheduleTemplate(orgid int64) (models.ScheduleTemplate, error) {
907
+
908
+	template := models.ScheduleTemplate{}
909
+	err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&template).Error
910
+	return template, err
911
+}