陈少旭 1 month ago
parent
commit
7bbacc3cbf
2 changed files with 366 additions and 865 deletions
  1. 343 841
      controllers/sg/his_api_controller.go
  2. 23 24
      service/his_service.go

File diff suppressed because it is too large
+ 343 - 841
controllers/sg/his_api_controller.go


+ 23 - 24
service/his_service.go View File

@@ -598,22 +598,22 @@ func UpDateHisPrescriptionInfoNumber(user_org_id int64, his_patient_id int64, nu
598 598
 }
599 599
 
600 600
 type HisOrder struct {
601
-	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
602
-	UserOrgId               int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
603
-	HisPatientId            int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
604
-	SettleAccountsDate      int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
605
-	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
606
-	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
607
-	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
608
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
609
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
610
-	MedfeeSumamt            float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
611
-	OrderStatus             float64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
612
-	PayWay                  int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
613
-	PayPrice                float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
614
-	PayCardNo               string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
615
-	Certno                  string    `gorm:"column:certno" json:"certno" form:"certno"`
616
-	PsnName                 string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
601
+	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
602
+	UserOrgId          int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
603
+	HisPatientId       int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
604
+	SettleAccountsDate int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
605
+	Ctime              int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
606
+	Mtime              int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
607
+	Status             int64   `gorm:"column:status" json:"status" form:"status"`
608
+	Number             string  `gorm:"column:number" json:"number" form:"number"`
609
+	PatientId          int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
610
+	MedfeeSumamt       float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
611
+	OrderStatus        float64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
612
+	PayWay             int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
613
+	PayPrice           float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
614
+	PayCardNo          string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
615
+	Certno             string  `gorm:"column:certno" json:"certno" form:"certno"`
616
+	PsnName            string  `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
617 617
 
618 618
 	DiscountPrice           float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
619 619
 	PreferentialPrice       float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
@@ -1434,7 +1434,6 @@ func UpdateHisPatient123(his *Patients) {
1434 1434
 	writeDb.Save(&his)
1435 1435
 }
1436 1436
 
1437
-
1438 1437
 func GetLastHisOrder(org_id int64) (his models.HisOrder, err error) {
1439 1438
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND order_status = 2 AND fa_piao_code <> '' AND fa_piao_number <> ''", org_id).Last(&his).Error
1440 1439
 	return
@@ -1541,6 +1540,7 @@ func GetHisPatientByPatientId(patient_id int64) (psn models.HisPatient, err erro
1541 1540
 	err = readDb.Model(&models.HisPatient{}).Where("patient_id = ?", patient_id).Last(&psn).Error
1542 1541
 	return
1543 1542
 }
1543
+
1544 1544
 //func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
1545 1545
 //	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
1546 1546
 //	return
@@ -1744,9 +1744,8 @@ func GetNewDrugWarehouseInfo(org_id int64, id_arr []string) (newDrugWarehouse []
1744 1744
 	return
1745 1745
 }
1746 1746
 
1747
-
1748
-func GetNewDrugWarehouseInfobytime(org_id int64, s_time int64,e_time int64 ) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1749
-	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and ctime > ? and ctime < ? and drug_code <> '' ", org_id, s_time,e_time).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&newDrugWarehouse)
1747
+func GetNewDrugWarehouseInfobytime(org_id int64, s_time int64, e_time int64) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1748
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and ctime > ? and ctime < ? and drug_code <> '' ", org_id, s_time, e_time).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&newDrugWarehouse)
1750 1749
 	return
1751 1750
 }
1752 1751
 
@@ -1792,15 +1791,15 @@ func GetNewDrugFlowInfothree123() (flows []*models.DrugFlow, err error) {
1792 1791
 	return
1793 1792
 }
1794 1793
 
1795
-func GetNewDrugFlowInforTen(system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1796
-	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1794
+func GetNewDrugFlowInforTen(system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1795
+	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id, system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1797 1796
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1798 1797
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1799 1798
 	return
1800 1799
 }
1801 1800
 
1802
-func GetNewDrugFlowInforTenone(start_system_time int64,end_system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1803
-	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time >= ? and xt_drug_flow.system_time <= ?", org_id,start_system_time,end_system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1801
+func GetNewDrugFlowInforTenone(start_system_time int64, end_system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1802
+	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time >= ? and xt_drug_flow.system_time <= ?", org_id, start_system_time, end_system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1804 1803
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1805 1804
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1806 1805
 	return