|
@@ -988,7 +988,9 @@ func GetHisPrescriptionByType(change_type int64, record_time int64, org_id int64
|
988
|
988
|
err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patient_id, org_id, Id.RecordDate).
|
989
|
989
|
Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
|
990
|
990
|
return db.Where("status = 1 AND user_org_id = ?", org_id).
|
991
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
|
|
991
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
992
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
993
|
+ }).
|
992
|
994
|
Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
993
|
995
|
return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
|
994
|
996
|
})
|
|
@@ -1000,7 +1002,9 @@ func GetHisPrescriptionByType(change_type int64, record_time int64, org_id int64
|
1000
|
1002
|
err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patient_id, org_id, Id.RecordDate).
|
1001
|
1003
|
Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
|
1002
|
1004
|
return db.Where("status = 1 AND user_org_id = ?", org_id).
|
1003
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
|
|
1005
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
1006
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
1007
|
+ }).
|
1004
|
1008
|
Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
1005
|
1009
|
return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
|
1006
|
1010
|
})
|
|
@@ -1013,7 +1017,9 @@ func GetCallHisPrescriptions(start_time int64, end_time int64, org_id int64, pat
|
1013
|
1017
|
err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date >= ? AND record_date <= ?", patient_id, org_id, start_time, end_time).
|
1014
|
1018
|
Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
|
1015
|
1019
|
return db.Where("status = 1 AND user_org_id = ?", org_id).
|
1016
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
|
|
1020
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
1021
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
1022
|
+ }).
|
1017
|
1023
|
Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
1018
|
1024
|
return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
|
1019
|
1025
|
})
|
|
@@ -1253,3 +1259,38 @@ func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisO
|
1253
|
1259
|
}).Find(&order).Error
|
1254
|
1260
|
return
|
1255
|
1261
|
}
|
|
1262
|
+
|
|
1263
|
+type MedicalInsuranceCostCompare struct {
|
|
1264
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
1265
|
+ StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
|
|
1266
|
+ EndTime int64 `gorm:"column:end_time" json:"end_time" form:"end_time"`
|
|
1267
|
+ Insutype string `gorm:"column:insutype" json:"insutype" form:"insutype"`
|
|
1268
|
+ CheckType int64 `gorm:"column:check_type" json:"check_type" form:"check_type"`
|
|
1269
|
+ Num int64 `gorm:"column:num" json:"num" form:"num"`
|
|
1270
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
1271
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
1272
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
1273
|
+ CostTotal float64 `gorm:"column:cost_total" json:"cost_total" form:"cost_total"`
|
|
1274
|
+ FuncTotal float64 `gorm:"column:func_total" json:"func_total" form:"func_total"`
|
|
1275
|
+ PsnPay float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
|
|
1276
|
+ Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
|
|
1277
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
1278
|
+}
|
|
1279
|
+
|
|
1280
|
+func (MedicalInsuranceCostCompare) TableName() string {
|
|
1281
|
+ return "medical_insurance_cost_compare"
|
|
1282
|
+}
|
|
1283
|
+
|
|
1284
|
+func GetMedicalInsuranceCostCompareList(orgID, page, limit int64, keywords string) (list []*MedicalInsuranceCostCompare, total int, err error) {
|
|
1285
|
+ offset := (page - 1) * limit
|
|
1286
|
+ db := readDb.Model(&MedicalInsuranceCostCompare{}).Where("user_org_id = ?", orgID)
|
|
1287
|
+
|
|
1288
|
+ if len(keywords) == 0 {
|
|
1289
|
+ db = db.Where("status=1")
|
|
1290
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
|
|
1291
|
+ } else {
|
|
1292
|
+ db = db.Where("status=1")
|
|
1293
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
|
|
1294
|
+ }
|
|
1295
|
+ return
|
|
1296
|
+}
|