Browse Source

历史排班

28169 9 months ago
parent
commit
39efafe6e3
2 changed files with 8 additions and 9 deletions
  1. 3 4
      controllers/his_api_controller.go
  2. 5 5
      service/his_service.go

+ 3 - 4
controllers/his_api_controller.go View File

@@ -1648,11 +1648,10 @@ func (c *HisApiController) GetHisPatientInfo() {
1648 1648
 				if info.RetailPrice > 0 {
1649 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 1653
 					service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1654 1654
 
1655
-					fmt.Println("haaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
1656 1655
 				}
1657 1656
 			}
1658 1657
 		}
@@ -1666,10 +1665,10 @@ func (c *HisApiController) GetHisPatientInfo() {
1666 1665
 					if info.Price > 0 {
1667 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 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 View File

@@ -3048,10 +3048,10 @@ func GetBatchHisProjectByIDs(ids []int64) (list []*models.HisPrescriptionProject
3048 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 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 3055
 	return adviceTemplate, err
3056 3056
 }
3057 3057
 
@@ -3063,11 +3063,11 @@ func UpdateBaseMinPrice(drug_id int64, user_org_id int64, retial_price float64)
3063 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 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 3072
 	return projectTemplate, err
3073 3073
 }
@@ -3076,7 +3076,7 @@ func UpdateGood(good_id int64, user_org_id int64, packing_price float64) (models
3076 3076
 
3077 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 3081
 	return goodInfo, err
3082 3082
 }