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

+ 10 - 2
controllers/dialysis_api_controller.go View File

@@ -5877,9 +5877,17 @@ func (this *DialysisApiController) GetTodayMonitor() {
5877 5877
 
5878 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 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,8 +5291,16 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5291 5291
 
5292 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 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,6 +576,13 @@ func (this *PharmacyController) DrugWithdrawal() {
576 576
 	}
577 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 586
 	if err != nil {
580 587
 		utils.ErrorLog(err.Error())
581 588
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())

+ 21 - 10
service/pharmacy_service.go View File

@@ -614,27 +614,25 @@ func GetManyDrugs(orgid int64, keyword string) (map[int64]models.PharmacyBaseDru
614 614
 // 查询(
615 615
 func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (finlly []*models.ListOfDrugs, err error) {
616 616
 	InitDrugidIsNil(orgid, stime, etime)
617
-
618
-	fmt.Println("startime==========================", stime)
619 617
 	var tmp []*models.TmpLLL
620 618
 	if is_medicine == 0 {
621 619
 		if keyword != "" {
622 620
 			keyword = "%" + keyword + "%"
623 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 623
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
626 624
 				"union "+
627 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 627
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
630 628
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
631 629
 		} else {
632 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 632
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) "+
635 633
 				"union "+
636 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 636
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) ",
639 637
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
640 638
 		}
@@ -645,20 +643,20 @@ func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (f
645 643
 		if keyword != "" {
646 644
 			keyword = "%" + keyword + "%"
647 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 647
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
650 648
 				"union "+
651 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 651
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
654 652
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
655 653
 		} else {
656 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 656
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) "+
659 657
 				"union "+
660 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 660
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) ",
663 661
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
664 662
 		}
@@ -1065,6 +1063,19 @@ func UpdateIsAdvice(id int64) (err error) {
1065 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 1080
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
1070 1081
 	//开事务