|
|
|
|
598
|
}
|
598
|
}
|
599
|
|
599
|
|
600
|
type HisOrder struct {
|
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
|
DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
|
618
|
DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
|
619
|
PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
|
619
|
PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
|
|
|
|
|
1434
|
writeDb.Save(&his)
|
1434
|
writeDb.Save(&his)
|
1435
|
}
|
1435
|
}
|
1436
|
|
1436
|
|
1437
|
-
|
|
|
1438
|
func GetLastHisOrder(org_id int64) (his models.HisOrder, err error) {
|
1437
|
func GetLastHisOrder(org_id int64) (his models.HisOrder, err error) {
|
1439
|
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
|
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
|
return
|
1439
|
return
|
|
|
|
|
1541
|
err = readDb.Model(&models.HisPatient{}).Where("patient_id = ?", patient_id).Last(&psn).Error
|
1540
|
err = readDb.Model(&models.HisPatient{}).Where("patient_id = ?", patient_id).Last(&psn).Error
|
1542
|
return
|
1541
|
return
|
1543
|
}
|
1542
|
}
|
|
|
1543
|
+
|
1544
|
//func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
|
1544
|
//func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
|
1545
|
// err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
|
1545
|
// err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
|
1546
|
// return
|
1546
|
// return
|
|
|
|
|
1744
|
return
|
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
|
return
|
1749
|
return
|
1751
|
}
|
1750
|
}
|
1752
|
|
1751
|
|
|
|
|
|
1792
|
return
|
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
|
return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
|
1796
|
return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
|
1798
|
}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
|
1797
|
}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
|
1799
|
return
|
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
|
return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
|
1803
|
return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
|
1805
|
}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
|
1804
|
}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
|
1806
|
return
|
1805
|
return
|