28169 1 gadu atpakaļ
vecāks
revīzija
39efafe6e3
2 mainītis faili ar 8 papildinājumiem un 9 dzēšanām
  1. 3 4
      controllers/his_api_controller.go
  2. 5 5
      service/his_service.go

+ 3 - 4
controllers/his_api_controller.go Parādīt failu

1648
 				if info.RetailPrice > 0 {
1648
 				if info.RetailPrice > 0 {
1649
 					subItem.Drug.MinPrice = info.RetailPrice
1649
 					subItem.Drug.MinPrice = info.RetailPrice
1650
 
1650
 
1651
-					service.UpdatePrescriptionAdvice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1651
+					service.UpdatePrescriptionAdvice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice, subItem.PatientId)
1652
 
1652
 
1653
 					service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1653
 					service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1654
 
1654
 
1655
-					fmt.Println("haaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
1656
 				}
1655
 				}
1657
 			}
1656
 			}
1658
 		}
1657
 		}
1666
 					if info.Price > 0 {
1665
 					if info.Price > 0 {
1667
 						subItem.GoodInfo.PackingPrice = info.Price
1666
 						subItem.GoodInfo.PackingPrice = info.Price
1668
 
1667
 
1669
-						service.UpdatePrescriptionProject(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1668
+						service.UpdatePrescriptionProject(subItem.ProjectId, admin.CurrentOrgId, info.Price, subItem.PatientId)
1670
 
1669
 
1671
 						service.UpdateGood(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1670
 						service.UpdateGood(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1672
-						fmt.Println("baaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
1671
+
1673
 					}
1672
 					}
1674
 				}
1673
 				}
1675
 			}
1674
 			}

+ 5 - 5
service/his_service.go Parādīt failu

3048
 	return
3048
 	return
3049
 }
3049
 }
3050
 
3050
 
3051
-func UpdatePrescriptionAdvice(drug_id int64, user_org_id int64, price float64) (models.HisPrescriptionAdviceTemplate, error) {
3051
+func UpdatePrescriptionAdvice(drug_id int64, user_org_id int64, price float64, patient_id int64) (models.HisPrescriptionAdviceTemplate, error) {
3052
 
3052
 
3053
 	adviceTemplate := models.HisPrescriptionAdviceTemplate{}
3053
 	adviceTemplate := models.HisPrescriptionAdviceTemplate{}
3054
-	err := XTWriteDB().Model(&adviceTemplate).Where("drug_id = ? and user_org_id =? and status =1", drug_id, user_org_id).Updates(map[string]interface{}{"price": price}).Error
3054
+	err := XTWriteDB().Model(&adviceTemplate).Where("drug_id = ? and user_org_id =? and status =1 and patient_id =?", drug_id, user_org_id, patient_id).Updates(map[string]interface{}{"price": price}).Error
3055
 	return adviceTemplate, err
3055
 	return adviceTemplate, err
3056
 }
3056
 }
3057
 
3057
 
3063
 	return lib, err
3063
 	return lib, err
3064
 }
3064
 }
3065
 
3065
 
3066
-func UpdatePrescriptionProject(good_id int64, user_org_id int64, packing_price float64) (models.HisPrescriptionProjectTemplate, error) {
3066
+func UpdatePrescriptionProject(good_id int64, user_org_id int64, packing_price float64, patient_id int64) (models.HisPrescriptionProjectTemplate, error) {
3067
 
3067
 
3068
 	projectTemplate := models.HisPrescriptionProjectTemplate{}
3068
 	projectTemplate := models.HisPrescriptionProjectTemplate{}
3069
 
3069
 
3070
-	err := XTWriteDB().Model(&projectTemplate).Where("project_id = ? and status=1 and user_org_id =?", good_id, user_org_id).Updates(map[string]interface{}{"price": packing_price}).Error
3070
+	err := XTWriteDB().Model(&projectTemplate).Where("project_id = ? and status=1 and user_org_id =? and patient_id =?", good_id, user_org_id, patient_id).Updates(map[string]interface{}{"price": packing_price}).Error
3071
 
3071
 
3072
 	return projectTemplate, err
3072
 	return projectTemplate, err
3073
 }
3073
 }
3076
 
3076
 
3077
 	goodInfo := models.GoodInfo{}
3077
 	goodInfo := models.GoodInfo{}
3078
 
3078
 
3079
-	err := XTWriteDB().Where("id = ? and user_org_id = ? and status=1", good_id, user_org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
3079
+	err := XTWriteDB().Model(&goodInfo).Where("id = ? and org_id = ? and status=1", good_id, user_org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
3080
 
3080
 
3081
 	return goodInfo, err
3081
 	return goodInfo, err
3082
 }
3082
 }