csx il y a 4 ans
Parent
révision
9d90a4b0e7
4 fichiers modifiés avec 129 ajouts et 4 suppressions
  1. 17 0
      controllers/his_api_controller.go
  2. 4 4
      models/his_models.go
  3. 18 0
      service/app_version.go
  4. 90 0
      service/his_service.go

+ 17 - 0
controllers/his_api_controller.go Voir le fichier

@@ -76,6 +76,7 @@ func HisManagerApiRegistRouters() {
76 76
 	beego.Router("/api/unregister/list", &HisApiController{}, "get:GetHisUnRegisterPatientList")
77 77
 
78 78
 	beego.Router("/api/orderdetail/get", &HisApiController{}, "get:GetAllOrderDetail")
79
+	beego.Router("/api/orderdetaicollect/get", &HisApiController{}, "get:GetAllOrderDetailCollect")
79 80
 
80 81
 }
81 82
 
@@ -2706,3 +2707,19 @@ func (c *HisApiController) GetAllOrderDetail() {
2706 2707
 	return
2707 2708
 
2708 2709
 }
2710
+
2711
+func (c *HisApiController) GetAllOrderDetailCollect() {
2712
+	order_id, _ := c.GetInt64("order_id", 0)
2713
+	order, _ := service.GetHisOrderByID(order_id)
2714
+	if order.ID == 0 {
2715
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2716
+		return
2717
+	}
2718
+	order_info, _ := service.GetHisOrderInfoByNumber(order.Number)
2719
+
2720
+	c.ServeSuccessJSON(map[string]interface{}{
2721
+		"order":      order,
2722
+		"order_info": order_info,
2723
+	})
2724
+	return
2725
+}

+ 4 - 4
models/his_models.go Voir le fichier

@@ -225,6 +225,10 @@ type HisDoctorAdviceInfo struct {
225 225
 	Drug                  Drug                   `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
226 226
 }
227 227
 
228
+func (HisDoctorAdviceInfo) TableName() string {
229
+	return "his_doctor_advice_info"
230
+}
231
+
228 232
 type Drug struct {
229 233
 	ID                     int64  `gorm:"column:id" json:"id" form:"id"`
230 234
 	DrugName               string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
@@ -246,10 +250,6 @@ func (Drug) TableName() string {
246 250
 	return "xt_base_drug"
247 251
 }
248 252
 
249
-func (HisDoctorAdviceInfo) TableName() string {
250
-	return "his_doctor_advice_info"
251
-}
252
-
253 253
 type HisGroupAdvice struct {
254 254
 	HisDoctorAdviceInfo
255 255
 	Children []*HisGroupAdvice

+ 18 - 0
service/app_version.go Voir le fichier

@@ -238,3 +238,21 @@ func FindAllPrescription(org_id int64) (prescription []*models.DialysisPrescript
238 238
 func AddSigleDialysisBeforePre(before *models.DialysisBeforePrepare) {
239 239
 	writeDb.Create(&before)
240 240
 }
241
+
242
+func GetAllHisDoctorInfo(org_id int64) (his []*models.HisDoctorAdviceInfo, err error) {
243
+	err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
244
+	return
245
+}
246
+
247
+func GetAllHisInfo(org_id int64) (his []*models.HisPrescriptionProject, err error) {
248
+	err = readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
249
+	return
250
+}
251
+
252
+func UpDateHis(his *models.HisDoctorAdviceInfo) {
253
+	writeDb.Save(&his)
254
+}
255
+
256
+func UpDateHis2(his *models.HisPrescriptionProject) {
257
+	writeDb.Save(&his)
258
+}

+ 90 - 0
service/his_service.go Voir le fichier

@@ -1137,3 +1137,93 @@ func GetAllProjectTeamList(orgid int64) (project []*VMHisProjectTeam, err error)
1137 1137
 	}
1138 1138
 	return
1139 1139
 }
1140
+
1141
+type HisDoctorAdviceInfo struct {
1142
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
1143
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1144
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1145
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
1146
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
1147
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
1148
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1149
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
1150
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
1151
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
1152
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1153
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1154
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
1155
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
1156
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1157
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
1158
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
1159
+	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
1160
+	Drug                  Drug    `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
1161
+}
1162
+
1163
+func (HisDoctorAdviceInfo) TableName() string {
1164
+	return "his_doctor_advice_info"
1165
+}
1166
+
1167
+type HisPrescriptionProject struct {
1168
+	ID                 int64        `gorm:"column:id" json:"id" form:"id"`
1169
+	ProjectId          int64        `gorm:"column:project_id" json:"project_id" form:"project_id"`
1170
+	Price              float64      `gorm:"column:price" json:"price" form:"price"`
1171
+	UserOrgId          int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1172
+	Status             int64        `gorm:"column:status" json:"status" form:"status"`
1173
+	Ctime              int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
1174
+	Mtime              int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
1175
+	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1176
+	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1177
+	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1178
+	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1179
+	Count              int64        `gorm:"column:count" json:"count" form:"count"`
1180
+	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1181
+	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1182
+	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1183
+	DeliveryWay        string       `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1184
+	ExecutionFrequency string       `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1185
+	Day                string       `gorm:"column:day" json:"day" form:"day"`
1186
+	VMHisProject       VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
1187
+	Remark             string       `gorm:"column:remark" json:"remark" form:"remark"`
1188
+	Unit               string       `gorm:"column:unit" json:"unit" form:"unit"`
1189
+}
1190
+
1191
+func (HisPrescriptionProject) TableName() string {
1192
+	return "his_prescription_project"
1193
+}
1194
+
1195
+type HisOrderInfo struct {
1196
+	ID                     int64                  `gorm:"column:id" json:"id" form:"id"`
1197
+	OrderNumber            string                 `gorm:"column:order_number" json:"order_number" form:"order_number"`
1198
+	UploadDate             int64                  `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1199
+	AdviceId               int64                  `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1200
+	DetItemFeeSumamt       float64                `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1201
+	Cnt                    float64                `gorm:"column:cnt" json:"cnt" form:"cnt"`
1202
+	Pric                   float64                `gorm:"column:pric" json:"pric" form:"pric"`
1203
+	PatientId              int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1204
+	MedChrgitmType         string                 `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1205
+	Status                 int64                  `gorm:"column:status" json:"status" form:"status"`
1206
+	FeedetlSn              string                 `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1207
+	ChldMedcFlag           string                 `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1208
+	ChrgitmLv              string                 `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1209
+	UserOrgId              int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1210
+	ProjectId              int64                  `gorm:"column:project_id" json:"project_id" form:"project_id"`
1211
+	ItemId                 int64                  `gorm:"column:item_id" json:"item_id" form:"item_id"`
1212
+	HisPrescriptionProject HisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1213
+	HisDoctorAdviceInfo    HisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
1214
+}
1215
+
1216
+func (HisOrderInfo) TableName() string {
1217
+	return "his_order_info"
1218
+}
1219
+
1220
+func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
1221
+	err = readDb.Model(&HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1222
+		return db.Where("status = 1 AND user_org_id = ?", org_id).
1223
+			Preload("VMHisProject", "status = 1 AND user_org_id = ?", org_id)
1224
+	}).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1225
+		return db.Where("status = 1 AND user_org_id = ?", org_id).
1226
+			Preload("Drug", "status = 1 AND user_org_id = ?", org_id)
1227
+	}).Find(&order).Error
1228
+	return
1229
+}