28169 před 1 rokem
rodič
revize
33d533c34e

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

@@ -3649,6 +3649,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3649 3649
 
3650 3650
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
3651 3651
 	fmt.Println(evaluation)
3652
+
3652 3653
 	if prescription.ID > 0 {
3653 3654
 
3654 3655
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
@@ -3700,9 +3701,11 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3700 3701
 			}
3701 3702
 
3702 3703
 			if adminInfo.Org.Id == 10469 {
3704
+
3703 3705
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 60 / 1000 / float64(totalMin) * 1000)
3704 3706
 
3705 3707
 				record.UltrafiltrationRate = ultrafiltration_rate
3708
+
3706 3709
 			}
3707 3710
 
3708 3711
 			if adminInfo.Org.Id == 10471 {

+ 9 - 9
service/data.go Zobrazit soubor

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

+ 4 - 4
service/stock_service.go Zobrazit soubor

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