浏览代码

历史排班

28169 1年前
父节点
当前提交
f2aa754814

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

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

655
 
655
 
656
 		if groupno > 0 {
656
 		if groupno > 0 {
657
 			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
657
 			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
658
+
658
 			for _, item := range advices {
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
 				if item.ExecutionState == 2 {
669
 				if item.ExecutionState == 2 {
660
 					advice = item
670
 					advice = item
661
 				}
671
 				}
663
 		} else {
673
 		} else {
664
 			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
674
 			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
665
 			for _, item := range advices {
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
 				if item.ExecutionState == 2 {
685
 				if item.ExecutionState == 2 {
667
 					advice = item
686
 					advice = item
668
 				}
687
 				}

+ 1 - 0
models/drug.go 查看文件

94
 	SumCount   int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
94
 	SumCount   int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
95
 	IsUse      int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
95
 	IsUse      int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
96
 	IsPharmacy int64  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
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
 func (BaseDrugLibSeven) TableName() string {
100
 func (BaseDrugLibSeven) TableName() string {

+ 15 - 0
service/patient_service.go 查看文件

1654
 	return
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
 func FindAllDoctorAdviceByGoroupNoTwety(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1663
 func FindAllDoctorAdviceByGoroupNoTwety(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1658
 	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
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
 	return
1665
 	return
3052
 	}
3058
 	}
3053
 	return monitor, err
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 查看文件

6109
 	if storehouse_id > 0 {
6109
 	if storehouse_id > 0 {
6110
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
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
 	return list, total, err
6113
 	return list, total, err
6114
 }
6114
 }
6115
 
6115