Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 years ago
parent
commit
a446a5d346
4 changed files with 54 additions and 22 deletions
  1. 23 10
      controllers/zh/zh_his_api_controller.go
  2. 2 0
      models/his_models.go
  3. 26 9
      service/gdyb_service.go
  4. 3 3
      service/his_service.go

+ 23 - 10
controllers/zh/zh_his_api_controller.go View File

949
 				for _, subItem := range item.HisPrescriptionProject {
949
 				for _, subItem := range item.HisPrescriptionProject {
950
 					//var randNum int
950
 					//var randNum int
951
 					//randNum = rand.Intn(10000) + 1000
951
 					//randNum = rand.Intn(10000) + 1000
952
-					if len(subItem.HisProject.MedicalCode) > 0 {
953
-
954
-						cus := &models.NewCustom{
955
-							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
956
-							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
957
-							FeedetlSn:        subItem.FeedetlSn,
958
-							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
959
-							MedListCodg:      subItem.HisProject.MedicalCode,
960
-							HospApprFlag:     -1,
952
+					if subItem.Type == 2 {
953
+						if len(subItem.HisProject.MedicalCode) > 0 {
954
+							cus := &models.NewCustom{
955
+								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
956
+								Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
957
+								FeedetlSn:        subItem.FeedetlSn,
958
+								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
959
+								MedListCodg:      subItem.HisProject.MedicalCode,
960
+								HospApprFlag:     -1,
961
+							}
962
+							customs = append(customs, cus)
963
+						}
964
+					} else if subItem.Type == 3 {
965
+						if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
966
+							cus := &models.NewCustom{
967
+								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
968
+								Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
969
+								FeedetlSn:        subItem.FeedetlSn,
970
+								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
971
+								MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
972
+								HospApprFlag:     -1,
973
+							}
974
+							customs = append(customs, cus)
961
 						}
975
 						}
962
-						customs = append(customs, cus)
963
 					}
976
 					}
964
 				}
977
 				}
965
 			}
978
 			}

+ 2 - 0
models/his_models.go View File

500
 	ExecutionFrequency string     `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
500
 	ExecutionFrequency string     `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
501
 	Day                string     `gorm:"column:day" json:"day" form:"day"`
501
 	Day                string     `gorm:"column:day" json:"day" form:"day"`
502
 	HisProject         HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
502
 	HisProject         HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
503
+	GoodInfo           GoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
504
+	Type               int64      `gorm:"column:type" json:"type" form:"type"`
503
 	Remark             string     `gorm:"column:remark" json:"remark" form:"remark"`
505
 	Remark             string     `gorm:"column:remark" json:"remark" form:"remark"`
504
 	Unit               string     `gorm:"column:unit" json:"unit" form:"unit"`
506
 	Unit               string     `gorm:"column:unit" json:"unit" form:"unit"`
505
 }
507
 }

+ 26 - 9
service/gdyb_service.go View File

644
 			for _, subItem := range item.HisPrescriptionProject {
644
 			for _, subItem := range item.HisPrescriptionProject {
645
 				//var randNum int
645
 				//var randNum int
646
 				//randNum = rand.Intn(10000) + 1000
646
 				//randNum = rand.Intn(10000) + 1000
647
-				if len(subItem.HisProject.MedicalCode) > 0 {
647
+				if subItem.Type == 2 {
648
+					if len(subItem.HisProject.MedicalCode) > 0 {
649
+
650
+						cus := &Custom{
651
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
652
+							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
653
+							FeedetlSn:        subItem.FeedetlSn,
654
+							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
655
+							MedListCodg:      subItem.HisProject.MedicalCode,
656
+							HospApprFlag:     -1,
657
+						}
658
+						customs = append(customs, cus)
659
+					}
648
 
660
 
649
-					cus := &Custom{
650
-						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
651
-						Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
652
-						FeedetlSn:        subItem.FeedetlSn,
653
-						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
654
-						MedListCodg:      subItem.HisProject.MedicalCode,
655
-						HospApprFlag:     -1,
661
+				} else if subItem.Type == 3 {
662
+					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
663
+						cus := &Custom{
664
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
665
+							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
666
+							FeedetlSn:        subItem.FeedetlSn,
667
+							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
668
+							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
669
+							HospApprFlag:     -1,
670
+						}
671
+						customs = append(customs, cus)
656
 					}
672
 					}
657
-					customs = append(customs, cus)
673
+
658
 				}
674
 				}
675
+
659
 			}
676
 			}
660
 		}
677
 		}
661
 
678
 

+ 3 - 3
service/his_service.go View File

305
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
305
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
306
 		}).
306
 		}).
307
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
307
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
308
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
308
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1").Preload("GoodType", "status=1")
309
 		}).
309
 		}).
310
 		Where("user_org_id = ? AND status = 1 AND record_date = ? AND his_patient_id = ? AND order_status <> 2 AND p_type <> 1", org_id, record_date, his_patient_id).
310
 		Where("user_org_id = ? AND status = 1 AND record_date = ? AND his_patient_id = ? AND order_status <> 2 AND p_type <> 1", org_id, record_date, his_patient_id).
311
 		Find(&prescription).Error
311
 		Find(&prescription).Error
940
 func GetHisOrderInfoByNumberTwo(order_number string) (order []*models.HisOrderInfo, err error) {
940
 func GetHisOrderInfoByNumberTwo(order_number string) (order []*models.HisOrderInfo, err error) {
941
 	db := readDb.Model(&models.HisOrderInfo{})
941
 	db := readDb.Model(&models.HisOrderInfo{})
942
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
942
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
943
-		return db.Preload("HisProject", "status = 1").Where("status = 1")
943
+		return db.Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
944
 	})
944
 	})
945
 	err = db.Where("order_number = ? AND status = 1 AND project_id > 0", order_number).Find(&order).Error
945
 	err = db.Where("order_number = ? AND status = 1 AND project_id > 0", order_number).Find(&order).Error
946
 	return
946
 	return
1031
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
1031
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
1032
 		}).
1032
 		}).
1033
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1033
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1034
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
1034
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1").Preload("GoodType", "status=1")
1035
 		}).
1035
 		}).
1036
 		Where("user_org_id = ? AND record_date >= ? AND record_date <= ? AND patient_id = ? AND order_status <> 2 AND status = 1  AND p_type <> 1", org_id, start_time, end_time, patient_id).
1036
 		Where("user_org_id = ? AND record_date >= ? AND record_date <= ? AND patient_id = ? AND order_status <> 2 AND status = 1  AND p_type <> 1", org_id, start_time, end_time, patient_id).
1037
 		Find(&prescription).Error
1037
 		Find(&prescription).Error