Browse Source

历史排班

28169 1 year ago
parent
commit
f2aa754814

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -402,7 +402,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
402 402
 			if adminUserInfo.Org.Id == 10121 {
403 403
 				newprescribe.DialysisDurationHour = 4
404 404
 				newprescribe.DialysisDurationMinute = 0
405
-				newprescribe.BloodAccess = 0
405
+				newprescribe.BloodAccess = dialysisSolution.BloodAccess
406 406
 			}
407 407
 			//插入透析处方
408 408
 			err := service.AddSigleRecord(&newprescribe)
@@ -481,7 +481,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
481 481
 				if adminUserInfo.Org.Id == 10121 {
482 482
 					newprescribe.DialysisDurationHour = 4
483 483
 					newprescribe.DialysisDurationMinute = 0
484
-					newprescribe.BloodAccess = 0
484
+					newprescribe.BloodAccess = dialysisSolution.BloodAccess
485 485
 				}
486 486
 				err := service.AddSigleRecord(&newprescribe)
487 487
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -555,7 +555,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
555 555
 				if adminUserInfo.Org.Id == 10121 {
556 556
 					newprescribe.DialysisDurationHour = 4
557 557
 					newprescribe.DialysisDurationMinute = 0
558
-					newprescribe.BloodAccess = 0
558
+					newprescribe.BloodAccess = dialysisSolution.BloodAccess
559 559
 				}
560 560
 				err := service.AddSigleRecord(&newprescribe)
561 561
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"

+ 19 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -655,7 +655,17 @@ func (c *PatientApiController) ExecDoctorAdvice() {
655 655
 
656 656
 		if groupno > 0 {
657 657
 			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
658
+
658 659
 			for _, item := range advices {
660
+				//恒泰中医院
661
+				if item.UserOrgId == 10490 {
662
+					if item.DrugId == 0 || item.DrugNameId == 0 {
663
+						//从字典里面查找
664
+						drug, _ := service.GetBaseDrugByName(item.AdviceName, item.UserOrgId)
665
+						service.UpdateDoctorAdviceByGoroupNo(item.ID, drug.ID)
666
+
667
+					}
668
+				}
659 669
 				if item.ExecutionState == 2 {
660 670
 					advice = item
661 671
 				}
@@ -663,6 +673,15 @@ func (c *PatientApiController) ExecDoctorAdvice() {
663 673
 		} else {
664 674
 			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
665 675
 			for _, item := range advices {
676
+				//恒泰中医院
677
+				if item.UserOrgId == 10490 {
678
+					if item.DrugId == 0 || item.DrugNameId == 0 {
679
+						//从字典里面查找
680
+						drug, _ := service.GetBaseDrugByName(item.AdviceName, item.UserOrgId)
681
+						service.UpdateDoctorAdviceByGoroupNo(item.ID, drug.ID)
682
+
683
+					}
684
+				}
666 685
 				if item.ExecutionState == 2 {
667 686
 					advice = item
668 687
 				}

+ 1 - 0
models/drug.go View File

@@ -94,6 +94,7 @@ type BaseDrugLibSeven struct {
94 94
 	SumCount   int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
95 95
 	IsUse      int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
96 96
 	IsPharmacy int64  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
97
+	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
97 98
 }
98 99
 
99 100
 func (BaseDrugLibSeven) TableName() string {

+ 15 - 0
service/patient_service.go View File

@@ -1654,6 +1654,12 @@ func FindAllDoctorAdviceByGoroupNo(orgID int64, groupno int64) (advice []models.
1654 1654
 	return
1655 1655
 }
1656 1656
 
1657
+func UpdateDoctorAdviceByGoroupNo(id int64, drug_id int64) error {
1658
+
1659
+	err := XTWriteDB().Model(&models.DoctorAdvice{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"drug_id": drug_id, "drug_name_id": drug_id, "way": 1}).Error
1660
+	return err
1661
+}
1662
+
1657 1663
 func FindAllDoctorAdviceByGoroupNoTwety(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1658 1664
 	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 and (drug_id >0 or drug_name_id >0)", orgID, groupno).Find(&advice).Error
1659 1665
 	return
@@ -3052,3 +3058,12 @@ func GetNewAllMonitorList(orgID int64, scheduleDate int64, pat_type int64) (moni
3052 3058
 	}
3053 3059
 	return monitor, err
3054 3060
 }
3061
+
3062
+func GetBaseDrugByName(drug_name string, org_id int64) (models.BaseDrugLibSeven, error) {
3063
+
3064
+	libSeven := models.BaseDrugLibSeven{}
3065
+
3066
+	err := XTReadDB().Where("drug_name= ? and org_id = ? and status=1", drug_name, org_id).First(&libSeven).Error
3067
+
3068
+	return libSeven, err
3069
+}

+ 1 - 1
service/stock_service.go View File

@@ -6109,7 +6109,7 @@ func GetInventoryDetailList(keyword string, limit int64, page int64, orgid int64
6109 6109
 	if storehouse_id > 0 {
6110 6110
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
6111 6111
 	}
6112
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id,x.ctime").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
6112
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id,x.ctime").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Order("x.id desc").Scan(&list).Error
6113 6113
 	return list, total, err
6114 6114
 }
6115 6115