Selaa lähdekoodia

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 7 kuukautta sitten
vanhempi
commit
7835fb5d92
2 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 1 0
      models/his_charge_models.go
  2. 4 3
      service/his_charge_service.go

+ 1 - 0
models/his_charge_models.go Näytä tiedosto

@@ -499,4 +499,5 @@ type NewPDetail struct {
499 499
 	AdviceId     string  `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
500 500
 	ProjectId    string  `gorm:"column:project_id" json:"project_id" form:"project_id"`
501 501
 	ItemId       string  `gorm:"column:item_id" json:"item_id" form:"item_id"`
502
+	//SetlTime     string  `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
502 503
 }

+ 4 - 3
service/his_charge_service.go Näytä tiedosto

@@ -1068,7 +1068,7 @@ func GetAllLisDataFor10191(org_id int64) (list []models.HisLabelPrintStatusInfo,
1068 1068
 }
1069 1069
 
1070 1070
 func GetHisPrescriptionDrugDetails(org_id int64, start_time_str string, end_time_str string, start_time int64, end_time int64, patient_id int64, item_type int64) (patients []*models.NewPDetail, err error) {
1071
-	db := readDb.Table("his_doctor_advice_info as oi").Select("drug.id as item_id,1 as p_type,oi.id as advice_id,0 as project_id,pp.id as p_id,pp.name as p_name,FROM_UNIXTIME(o.`record_date`, '%Y-%m-%d') as record_date, drug.drug_type as item_cost_type,o.med_type as med_type,oi.`prescribing_number` as cnt,oi.`price` as pric,drug.drug_name as item_name,CONCAT(drug.dose, \"\", drug.dose_unit, \"*\", drug.min_number, \"\", drug.min_unit, \"/\", drug.max_unit) as spec,o.order_status as order_status,oi.`prescribing_number_unit` as unit").
1071
+	db := readDb.Table("his_doctor_advice_info as oi").Select("oo.setl_time as setl_time, drug.id as item_id,1 as p_type,oi.id as advice_id,0 as project_id,pp.id as p_id,pp.name as p_name,FROM_UNIXTIME(o.`record_date`, '%Y-%m-%d') as record_date, drug.drug_type as item_cost_type,o.med_type as med_type,oi.`prescribing_number` as cnt,oi.`price` as pric,drug.drug_name as item_name,CONCAT(drug.dose, \"\", drug.dose_unit, \"*\", drug.min_number, \"\", drug.min_unit, \"/\", drug.max_unit) as spec,o.order_status as order_status,oi.`prescribing_number_unit` as unit").
1072 1072
 		Joins("JOIN xt_base_drug drug ON oi.drug_id = drug.id ")
1073 1073
 	if patient_id == 0 {
1074 1074
 		db = db.Joins("JOIN xt_patients pp on oi.patient_id = pp.id")
@@ -1077,7 +1077,6 @@ func GetHisPrescriptionDrugDetails(org_id int64, start_time_str string, end_time
1077 1077
 		db = db.Joins("JOIN xt_patients pp on oi.patient_id = pp.id and pp.id = ?", patient_id)
1078 1078
 
1079 1079
 	}
1080
-
1081 1080
 	if item_type == 0 {
1082 1081
 		db = db.Joins("JOIN `his_prescription` o ON oi.`prescription_id` = o.id and   FROM_UNIXTIME(o.record_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ?  and o.status = 1", start_time_str, end_time_str)
1083 1082
 	} else {
@@ -1087,6 +1086,7 @@ func GetHisPrescriptionDrugDetails(org_id int64, start_time_str string, end_time
1087 1086
 			db = db.Joins("JOIN `his_prescription` o ON oi.`prescription_id` = o.id and   FROM_UNIXTIME(o.record_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ?  and o.status = 1 and o.order_status <> 2", start_time_str, end_time_str)
1088 1087
 		}
1089 1088
 	}
1089
+	db = db.Joins("JOIN `his_order` oo on oo.`number` = o.`batch_number` and oo.user_org_id = ?", org_id)
1090 1090
 
1091 1091
 	err = db.Where(" oi.user_org_id = ?  AND o.record_date >= ? AND o.record_date <= ? AND oi.status = 1", org_id, start_time, end_time).Scan(&patients).Error
1092 1092
 
@@ -1094,7 +1094,7 @@ func GetHisPrescriptionDrugDetails(org_id int64, start_time_str string, end_time
1094 1094
 }
1095 1095
 
1096 1096
 func GetHisPrescriptionProjectDetails(org_id int64, start_time_str string, end_time_str string, start_time int64, end_time int64, patient_id int64, item_type int64) (patients []*models.NewPDetail, err error) {
1097
-	db := readDb.Table("`his_prescription_project` AS oi").Select("(case oi.type\n\t\t\tWHEN 2 THEN\n\t\t\tproject.id\n\t\t\tWHEN 3 THEN\n\t\t\tgood.id END) AS item_id,oi.type as p_type,oi.id as project_id,0 as advice_id,pp.id as p_id,(case oi.type\n\t\t\tWHEN 2 THEN\n\t\t\tproject.`cost_classify`\n\t\t\tWHEN 3 THEN\n\t\t\t-100 END) AS item_cost_type,\n\t o.med_type as med_type,\n\t oi.count AS cnt,\n \t oi.price AS pric,\n \t pp.name AS p_name, \n \tFROM_UNIXTIME(o.`record_date`,'%Y-%m-%d') as record_date,\n\t\t (case oi.type\n\tWHEN 2 THEN\n\tproject.project_name\n\tWHEN 3 THEN\n\tgood.good_name END) AS item_name,\n\t\t (case oi.type\n\tWHEN 2 THEN\n\t\"\"\n\tWHEN 3 THEN\n\tgood.`specification_name` END) AS spec,\n\toi.`unit`  as unit,o.order_status as order_status")
1097
+	db := readDb.Table("`his_prescription_project` AS oi").Select("oo.setl_time as setl_time,(case oi.type\n\t\t\tWHEN 2 THEN\n\t\t\tproject.id\n\t\t\tWHEN 3 THEN\n\t\t\tgood.id END) AS item_id,oi.type as p_type,oi.id as project_id,0 as advice_id,pp.id as p_id,(case oi.type\n\t\t\tWHEN 2 THEN\n\t\t\tproject.`cost_classify`\n\t\t\tWHEN 3 THEN\n\t\t\t-100 END) AS item_cost_type,\n\t o.med_type as med_type,\n\t oi.count AS cnt,\n \t oi.price AS pric,\n \t pp.name AS p_name, \n \tFROM_UNIXTIME(o.`record_date`,'%Y-%m-%d') as record_date,\n\t\t (case oi.type\n\tWHEN 2 THEN\n\tproject.project_name\n\tWHEN 3 THEN\n\tgood.good_name END) AS item_name,\n\t\t (case oi.type\n\tWHEN 2 THEN\n\t\"\"\n\tWHEN 3 THEN\n\tgood.`specification_name` END) AS spec,\n\toi.`unit`  as unit,o.order_status as order_status")
1098 1098
 	db = db.Joins("LEFT JOIN xt_his_project project\n\tON oi.project_id = project.id").
1099 1099
 		Joins("LEFT JOIN xt_good_information good\n\tON oi.project_id = good.id\n")
1100 1100
 	//Joins("JOIN his_order ord ON o.batch_number = ord.number ")
@@ -1113,6 +1113,7 @@ func GetHisPrescriptionProjectDetails(org_id int64, start_time_str string, end_t
1113 1113
 	} else {
1114 1114
 		db = db.Joins("JOIN `his_prescription` o ON oi.`prescription_id` = o.id and   FROM_UNIXTIME(o.record_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ?  and o.status = 1", start_time_str, end_time_str)
1115 1115
 	}
1116
+	db = db.Joins("JOIN `his_order` oo on oo.`number` = o.`batch_number` and oo.user_org_id = ?", org_id)
1116 1117
 
1117 1118
 	err = db.Where(" oi.user_org_id = ?  AND o.record_date >= ? AND o.record_date <= ? AND oi.status = 1", org_id, start_time, end_time).Scan(&patients).Error
1118 1119
 	return