csx 4 anni fa
parent
commit
6e09cee939
3 ha cambiato i file con 60 aggiunte e 33 eliminazioni
  1. 14 6
      controllers/his_api_controller.go
  2. 1 0
      models/his_models.go
  3. 45 27
      service/his_service.go

+ 14 - 6
controllers/his_api_controller.go Vedi File

@@ -2692,34 +2692,42 @@ func (c *HisApiController) GetHisChargePatientInfo() {
2692 2692
 }
2693 2693
 
2694 2694
 func (c *HisApiController) GetAllOrderDetail() {
2695
-	order_id, _ := c.GetInt64("order_id", 0)
2695
+	order_id, _ := c.GetInt64("id", 0)
2696 2696
 	order, _ := service.GetHisOrderByID(order_id)
2697 2697
 	if order.ID == 0 {
2698 2698
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2699 2699
 		return
2700 2700
 	}
2701
-	order_info, _ := service.GetHisOrderInfoByNumber(order.Number)
2702
-
2701
+	org_id := c.GetAdminUserInfo().CurrentOrgId
2702
+	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
2703
+	patient, _ := service.GetPatientByID(org_id, order.PatientId)
2704
+	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
2703 2705
 	c.ServeSuccessJSON(map[string]interface{}{
2704 2706
 		"order":      order,
2705 2707
 		"order_info": order_info,
2708
+		"patient":    patient,
2709
+		"admin_info": adminInfo,
2706 2710
 	})
2707 2711
 	return
2708 2712
 
2709 2713
 }
2710 2714
 
2711 2715
 func (c *HisApiController) GetAllOrderDetailCollect() {
2712
-	order_id, _ := c.GetInt64("order_id", 0)
2716
+	order_id, _ := c.GetInt64("id", 0)
2713 2717
 	order, _ := service.GetHisOrderByID(order_id)
2714 2718
 	if order.ID == 0 {
2715 2719
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2716 2720
 		return
2717 2721
 	}
2718
-	order_info, _ := service.GetHisOrderInfoByNumber(order.Number)
2719
-
2722
+	org_id := c.GetAdminUserInfo().CurrentOrgId
2723
+	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
2724
+	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
2725
+	patient, _ := service.GetPatientByID(org_id, order.PatientId)
2720 2726
 	c.ServeSuccessJSON(map[string]interface{}{
2721 2727
 		"order":      order,
2722 2728
 		"order_info": order_info,
2729
+		"patient":    patient,
2730
+		"admin_info": adminInfo,
2723 2731
 	})
2724 2732
 	return
2725 2733
 }

+ 1 - 0
models/his_models.go Vedi File

@@ -683,6 +683,7 @@ type HisOrder struct {
683 683
 	PrivatePrice          float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
684 684
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
685 685
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
686
+	Creator               int64     `gorm:"column:creator" json:"creator" form:"creator"`
686 687
 
687 688
 	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
688 689
 	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`

+ 45 - 27
service/his_service.go Vedi File

@@ -101,6 +101,7 @@ type VMHisOrder struct {
101 101
 	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
102 102
 	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
103 103
 	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
104
+	Creator               int64   `gorm:"column:creator" json:"creator" form:"creator"`
104 105
 }
105 106
 
106 107
 func (VMHisOrder) TableName() string {
@@ -1125,6 +1126,20 @@ func (VMHisProject) TableName() string {
1125 1126
 	return "xt_his_project"
1126 1127
 }
1127 1128
 
1129
+type VMHisPrescriptionTwo struct {
1130
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1131
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1132
+	PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1133
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1134
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1135
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1136
+	Type      int64 `gorm:"column:type" json:"type" form:"type"`
1137
+}
1138
+
1139
+func (VMHisPrescriptionTwo) TableName() string {
1140
+	return "his_prescription"
1141
+}
1142
+
1128 1143
 func GetAllProjectTeamList(orgid int64) (project []*VMHisProjectTeam, err error) {
1129 1144
 	err = XTReadDB().Model(&VMHisProjectTeam{}).Where("user_org_id = ? and status = 1", orgid).Find(&project).Error
1130 1145
 	for _, item := range project {
@@ -1156,8 +1171,12 @@ type HisDoctorAdviceInfo struct {
1156 1171
 	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1157 1172
 	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
1158 1173
 	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"`
1174
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1175
+
1176
+	Price                float64              `gorm:"column:price" json:"price" form:"price"`
1177
+	DrugId               int64                `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1178
+	Drug                 Drug                 `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
1179
+	VMHisPrescriptionTwo VMHisPrescriptionTwo `gorm:"ForeignKey:ID;AssociationForeignKey:PrescriptionId" json:"prescription"`
1161 1180
 }
1162 1181
 
1163 1182
 func (HisDoctorAdviceInfo) TableName() string {
@@ -1165,27 +1184,28 @@ func (HisDoctorAdviceInfo) TableName() string {
1165 1184
 }
1166 1185
 
1167 1186
 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"`
1187
+	ID                   int64                `gorm:"column:id" json:"id" form:"id"`
1188
+	ProjectId            int64                `gorm:"column:project_id" json:"project_id" form:"project_id"`
1189
+	Price                float64              `gorm:"column:price" json:"price" form:"price"`
1190
+	UserOrgId            int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1191
+	Status               int64                `gorm:"column:status" json:"status" form:"status"`
1192
+	Ctime                int64                `gorm:"column:ctime" json:"ctime" form:"ctime"`
1193
+	Mtime                int64                `gorm:"column:mtime" json:"mtime" form:"mtime"`
1194
+	PatientId            int64                `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1195
+	HisPatientId         int64                `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1196
+	RecordDate           int64                `gorm:"column:record_date" json:"record_date" form:"record_date"`
1197
+	PrescriptionId       int64                `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1198
+	Count                int64                `gorm:"column:count" json:"count" form:"count"`
1199
+	FeedetlSn            string               `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1200
+	MedListCodg          string               `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1201
+	SingleDose           string               `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1202
+	DeliveryWay          string               `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1203
+	ExecutionFrequency   string               `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1204
+	Day                  string               `gorm:"column:day" json:"day" form:"day"`
1205
+	VMHisProject         VMHisProject         `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
1206
+	Remark               string               `gorm:"column:remark" json:"remark" form:"remark"`
1207
+	Unit                 string               `gorm:"column:unit" json:"unit" form:"unit"`
1208
+	VMHisPrescriptionTwo VMHisPrescriptionTwo `gorm:"ForeignKey:ID;AssociationForeignKey:PrescriptionId" json:"prescription"`
1189 1209
 }
1190 1210
 
1191 1211
 func (HisPrescriptionProject) TableName() string {
@@ -1219,11 +1239,9 @@ func (HisOrderInfo) TableName() string {
1219 1239
 
1220 1240
 func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
1221 1241
 	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)
1242
+		return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("VMHisProject", "status = 1 AND user_org_id = ?", org_id)
1224 1243
 	}).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)
1244
+		return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status = 1 AND org_id = ?", org_id)
1227 1245
 	}).Find(&order).Error
1228 1246
 	return
1229 1247
 }