Ver código fonte

提交代码

陈少旭 2 meses atrás
pai
commit
01a1287602
2 arquivos alterados com 13 adições e 17 exclusões
  1. 11 15
      controllers/his_api_controller.go
  2. 2 2
      service/his_service.go

+ 11 - 15
controllers/his_api_controller.go Ver arquivo

@@ -1824,7 +1824,6 @@ func (c *HisApiController) CreateHisPrescription() {
1824 1824
 	edit, src := GetCompareData(dataBody)
1825 1825
 	drugResult := ComparePrescriptions(src.adviceList, edit.adviceList)
1826 1826
 	goodResult := CompareGoodPrescriptions(src.projectList, edit.projectList)
1827
-
1828 1827
 	fmt.Println(drugResult)
1829 1828
 	fmt.Println(goodResult)
1830 1829
 
@@ -11849,18 +11848,18 @@ func (c *HisApiController) GetHisMonthChargePatientList() {
11849 11848
 
11850 11849
 // PrescriptionDifference 医嘱数量差值结构体
11851 11850
 type PrescriptionDrugDifference struct {
11852
-	DrugID     int64
11853
-	ID         int64
11854
-	Difference float64
11855
-	Unit       string
11851
+	DrugID     int64   //基础库药品id
11852
+	ID         int64   //医嘱id
11853
+	Difference float64 //差值
11854
+	Unit       string  //单位
11856 11855
 }
11857 11856
 
11858 11857
 type PrescriptionGoodDifference struct {
11859
-	GoodID     int64
11860
-	ID         int64
11861
-	Difference int64
11862
-	Unit       string
11863
-	Type       int64
11858
+	GoodID     int64  //基础库项目耗材id
11859
+	ID         int64  //医嘱id
11860
+	Difference int64  //差值
11861
+	Unit       string //单位
11862
+	Type       int64  //类型
11864 11863
 }
11865 11864
 
11866 11865
 type EditCustomData struct {
@@ -11935,7 +11934,7 @@ func GetCompareData(dataBody map[string]interface{}) (editCustomData EditCustomD
11935 11934
 
11936 11935
 	if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
11937 11936
 		prescriptions, _ := dataBody["prescriptions"].([]interface{})
11938
-		var tempPrescription *models.HisPrescription
11937
+		//var tempPrescription *models.HisPrescriptionProjectscription
11939 11938
 		if len(prescriptions) > 0 {
11940 11939
 			for _, item := range prescriptions {
11941 11940
 				items := item.(map[string]interface{})
@@ -11949,12 +11948,10 @@ func GetCompareData(dataBody map[string]interface{}) (editCustomData EditCustomD
11949 11948
 					if len(advices) > 0 {
11950 11949
 						for _, advice := range advices {
11951 11950
 							var s models.HisDoctorAdviceInfo
11952
-							s.PrescriptionId = tempPrescription.ID
11953 11951
 							s.AdviceType = 2
11954 11952
 							s.StopState = 2
11955 11953
 							s.ExecutionState = 2
11956 11954
 							s.Status = 1
11957
-							s.StartTime = tempPrescription.PreTime
11958 11955
 							s.Groupno = groupNo
11959 11956
 							s.CreatedTime = ctime
11960 11957
 							s.UpdatedTime = mtime
@@ -11973,7 +11970,6 @@ func GetCompareData(dataBody map[string]interface{}) (editCustomData EditCustomD
11973 11970
 					if len(projects) > 0 {
11974 11971
 						for _, project := range projects {
11975 11972
 							var p models.HisPrescriptionProject
11976
-							p.PrescriptionId = tempPrescription.ID
11977 11973
 							p.Ctime = time.Now().Unix()
11978 11974
 							p.Mtime = time.Now().Unix()
11979 11975
 							p.Status = 1
@@ -11993,7 +11989,7 @@ func GetCompareData(dataBody map[string]interface{}) (editCustomData EditCustomD
11993 11989
 	editCustomData.adviceList = adviceList
11994 11990
 
11995 11991
 	list, _ := service.GetBatchHisDoctorAdviceByIDs(advice_ids)
11996
-	list2, _ := service.GetBatchHisProjectByIDs(advice_ids)
11992
+	list2, _ := service.GetBatchHisProjectByIDs(project_ids)
11997 11993
 
11998 11994
 	srcCustomData.adviceList = list
11999 11995
 	srcCustomData.projectList = list2

+ 2 - 2
service/his_service.go Ver arquivo

@@ -2953,11 +2953,11 @@ func GetHisPrescriptionByHisPatientID(record_date int64, org_id int64, patient_i
2953 2953
 }
2954 2954
 
2955 2955
 func GetBatchHisDoctorAdviceByIDs(ids []int64) (list []*models.HisDoctorAdviceInfo, err error) {
2956
-	err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("id in (?) and status = 1", ids).Where(&list).Error
2956
+	err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("id in (?) and status = 1", ids).Find(&list).Error
2957 2957
 	return
2958 2958
 }
2959 2959
 
2960 2960
 func GetBatchHisProjectByIDs(ids []int64) (list []*models.HisPrescriptionProject, err error) {
2961
-	err = readDb.Model(&models.HisPrescriptionProject{}).Where("id in (?) and status = 1", ids).Where(&list).Error
2961
+	err = readDb.Model(&models.HisPrescriptionProject{}).Where("id in (?) and status = 1", ids).Find(&list).Error
2962 2962
 	return
2963 2963
 }