Browse Source

2024/6/17

28169 2 weeks ago
parent
commit
9a6d0659d8

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10164 //机构id
86
+		subscibe.OrgId = 10028 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10028 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 12123 //4
97
 		adminUserInfo.CurrentAppId = 12123 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10164 //机构id小英9675或4
332
+		subscibe.OrgId = 10028 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10028 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 12123 //4
343
 		adminUserInfo.CurrentAppId = 12123 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 10 - 2
controllers/dialysis_api_controller.go View File

5877
 
5877
 
5878
 	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 {
5878
 	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 {
5879
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
5879
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
5880
-			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5881
 
5880
 
5882
-			record.UltrafiltrationVolume = ultrafiltration_volume
5881
+			if adminInfo.CurrentOrgId != 10735 {
5882
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5883
+				record.UltrafiltrationVolume = ultrafiltration_volume
5884
+			}
5885
+
5886
+			if adminInfo.CurrentOrgId == 10735 {
5887
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5888
+				record.UltrafiltrationVolume = ultrafiltration_volume / 2
5889
+			}
5890
+
5883
 		}
5891
 		}
5884
 
5892
 
5885
 	}
5893
 	}

+ 10 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go View File

5291
 
5291
 
5292
 	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 || adminInfo.Org.Id == 10599 { //adminInfo.Org.Id == 9538
5292
 	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 || adminInfo.Org.Id == 10599 { //adminInfo.Org.Id == 9538
5293
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5293
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5294
-			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5295
-			record.UltrafiltrationVolume = ultrafiltration_volume
5294
+
5295
+			if adminInfo.Org.Id != 10735 {
5296
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5297
+				record.UltrafiltrationVolume = ultrafiltration_volume
5298
+			}
5299
+			//胶州少海医院
5300
+			if adminInfo.Org.Id == 10735 {
5301
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5302
+				record.UltrafiltrationVolume = ultrafiltration_volume / 2
5303
+			}
5296
 
5304
 
5297
 		}
5305
 		}
5298
 	}
5306
 	}

+ 7 - 0
controllers/pharmacy_controller.go View File

576
 	}
576
 	}
577
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
577
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
578
 
578
 
579
+	prescriptionList, _ := service.GetHisPrescriptionByStartTime(orgid, patient_id, stime, etime)
580
+	if len(prescriptionList) > 0 {
581
+		for _, item := range prescriptionList {
582
+			service.ModiftyPrescpiton(item.ID)
583
+		}
584
+	}
585
+
579
 	if err != nil {
586
 	if err != nil {
580
 		utils.ErrorLog(err.Error())
587
 		utils.ErrorLog(err.Error())
581
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
588
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())

+ 21 - 10
service/pharmacy_service.go View File

614
 // 查询(
614
 // 查询(
615
 func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (finlly []*models.ListOfDrugs, err error) {
615
 func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (finlly []*models.ListOfDrugs, err error) {
616
 	InitDrugidIsNil(orgid, stime, etime)
616
 	InitDrugidIsNil(orgid, stime, etime)
617
-
618
-	fmt.Println("startime==========================", stime)
619
 	var tmp []*models.TmpLLL
617
 	var tmp []*models.TmpLLL
620
 	if is_medicine == 0 {
618
 	if is_medicine == 0 {
621
 		if keyword != "" {
619
 		if keyword != "" {
622
 			keyword = "%" + keyword + "%"
620
 			keyword = "%" + keyword + "%"
623
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
621
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
624
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
622
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
625
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
623
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
626
 				"union "+
624
 				"union "+
627
 				"select distinct drug_id from xt_doctor_advice where "+
625
 				"select distinct drug_id from xt_doctor_advice where "+
628
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
626
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
629
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
627
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
630
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
628
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
631
 		} else {
629
 		} else {
632
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
630
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
633
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
631
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
634
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) "+
632
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) "+
635
 				"union "+
633
 				"union "+
636
 				"select distinct drug_id from xt_doctor_advice where "+
634
 				"select distinct drug_id from xt_doctor_advice where "+
637
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
635
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
638
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) ",
636
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) ",
639
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
637
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
640
 		}
638
 		}
645
 		if keyword != "" {
643
 		if keyword != "" {
646
 			keyword = "%" + keyword + "%"
644
 			keyword = "%" + keyword + "%"
647
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
645
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
648
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
646
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
649
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
647
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
650
 				"union "+
648
 				"union "+
651
 				"select distinct drug_id from xt_doctor_advice where "+
649
 				"select distinct drug_id from xt_doctor_advice where "+
652
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
650
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
653
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
651
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
654
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
652
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
655
 		} else {
653
 		} else {
656
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
654
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
657
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
655
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
658
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) "+
656
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) "+
659
 				"union "+
657
 				"union "+
660
 				"select distinct drug_id from xt_doctor_advice where "+
658
 				"select distinct drug_id from xt_doctor_advice where "+
661
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
659
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
662
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) ",
660
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) ",
663
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
661
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
664
 		}
662
 		}
1065
 	return err
1063
 	return err
1066
 }
1064
 }
1067
 
1065
 
1066
+func GetHisPrescriptionByStartTime(org_id int64, patient_id int64, start_time int64, end_time int64) (prescription []*models.HisPrescription, err error) {
1067
+
1068
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date>=? and record_date<=? and status=1 and is_medicine =1", org_id, patient_id, start_time, end_time).Find(&prescription).Error
1069
+	return prescription, err
1070
+}
1071
+
1072
+func ModiftyPrescpiton(id int64) (models.HisPrescription, error) {
1073
+
1074
+	prescription := models.HisPrescription{}
1075
+	err := XTWriteDB().Model(&prescription).Where("id = ? and status=1", id).Updates(map[string]interface{}{"is_medicine": 0}).Error
1076
+	return prescription, err
1077
+}
1078
+
1068
 // 患者退药按钮点击
1079
 // 患者退药按钮点击
1069
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
1080
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
1070
 	//开事务
1081
 	//开事务