Browse Source

提交代码

陈少旭 1 year ago
parent
commit
01a1287602
2 changed files with 13 additions and 17 deletions
  1. 11 15
      controllers/his_api_controller.go
  2. 2 2
      service/his_service.go

+ 11 - 15
controllers/his_api_controller.go View File

1824
 	edit, src := GetCompareData(dataBody)
1824
 	edit, src := GetCompareData(dataBody)
1825
 	drugResult := ComparePrescriptions(src.adviceList, edit.adviceList)
1825
 	drugResult := ComparePrescriptions(src.adviceList, edit.adviceList)
1826
 	goodResult := CompareGoodPrescriptions(src.projectList, edit.projectList)
1826
 	goodResult := CompareGoodPrescriptions(src.projectList, edit.projectList)
1827
-
1828
 	fmt.Println(drugResult)
1827
 	fmt.Println(drugResult)
1829
 	fmt.Println(goodResult)
1828
 	fmt.Println(goodResult)
1830
 
1829
 
11849
 
11848
 
11850
 // PrescriptionDifference 医嘱数量差值结构体
11849
 // PrescriptionDifference 医嘱数量差值结构体
11851
 type PrescriptionDrugDifference struct {
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
 type PrescriptionGoodDifference struct {
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
 type EditCustomData struct {
11865
 type EditCustomData struct {
11935
 
11934
 
11936
 	if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
11935
 	if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
11937
 		prescriptions, _ := dataBody["prescriptions"].([]interface{})
11936
 		prescriptions, _ := dataBody["prescriptions"].([]interface{})
11938
-		var tempPrescription *models.HisPrescription
11937
+		//var tempPrescription *models.HisPrescriptionProjectscription
11939
 		if len(prescriptions) > 0 {
11938
 		if len(prescriptions) > 0 {
11940
 			for _, item := range prescriptions {
11939
 			for _, item := range prescriptions {
11941
 				items := item.(map[string]interface{})
11940
 				items := item.(map[string]interface{})
11949
 					if len(advices) > 0 {
11948
 					if len(advices) > 0 {
11950
 						for _, advice := range advices {
11949
 						for _, advice := range advices {
11951
 							var s models.HisDoctorAdviceInfo
11950
 							var s models.HisDoctorAdviceInfo
11952
-							s.PrescriptionId = tempPrescription.ID
11953
 							s.AdviceType = 2
11951
 							s.AdviceType = 2
11954
 							s.StopState = 2
11952
 							s.StopState = 2
11955
 							s.ExecutionState = 2
11953
 							s.ExecutionState = 2
11956
 							s.Status = 1
11954
 							s.Status = 1
11957
-							s.StartTime = tempPrescription.PreTime
11958
 							s.Groupno = groupNo
11955
 							s.Groupno = groupNo
11959
 							s.CreatedTime = ctime
11956
 							s.CreatedTime = ctime
11960
 							s.UpdatedTime = mtime
11957
 							s.UpdatedTime = mtime
11973
 					if len(projects) > 0 {
11970
 					if len(projects) > 0 {
11974
 						for _, project := range projects {
11971
 						for _, project := range projects {
11975
 							var p models.HisPrescriptionProject
11972
 							var p models.HisPrescriptionProject
11976
-							p.PrescriptionId = tempPrescription.ID
11977
 							p.Ctime = time.Now().Unix()
11973
 							p.Ctime = time.Now().Unix()
11978
 							p.Mtime = time.Now().Unix()
11974
 							p.Mtime = time.Now().Unix()
11979
 							p.Status = 1
11975
 							p.Status = 1
11993
 	editCustomData.adviceList = adviceList
11989
 	editCustomData.adviceList = adviceList
11994
 
11990
 
11995
 	list, _ := service.GetBatchHisDoctorAdviceByIDs(advice_ids)
11991
 	list, _ := service.GetBatchHisDoctorAdviceByIDs(advice_ids)
11996
-	list2, _ := service.GetBatchHisProjectByIDs(advice_ids)
11992
+	list2, _ := service.GetBatchHisProjectByIDs(project_ids)
11997
 
11993
 
11998
 	srcCustomData.adviceList = list
11994
 	srcCustomData.adviceList = list
11999
 	srcCustomData.projectList = list2
11995
 	srcCustomData.projectList = list2

+ 2 - 2
service/his_service.go View File

2953
 }
2953
 }
2954
 
2954
 
2955
 func GetBatchHisDoctorAdviceByIDs(ids []int64) (list []*models.HisDoctorAdviceInfo, err error) {
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
 	return
2957
 	return
2958
 }
2958
 }
2959
 
2959
 
2960
 func GetBatchHisProjectByIDs(ids []int64) (list []*models.HisPrescriptionProject, err error) {
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
 	return
2962
 	return
2963
 }
2963
 }