Ver código fonte

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

XMLWAN 4 anos atrás
pai
commit
cd4bd251aa

+ 2 - 4
controllers/gdyb_controller.go Ver arquivo

70
 	org_name := c.GetString("org_name")
70
 	org_name := c.GetString("org_name")
71
 	doctor := c.GetString("doctor")
71
 	doctor := c.GetString("doctor")
72
 	fixmedins_code := c.GetString("fixmedins_code")
72
 	fixmedins_code := c.GetString("fixmedins_code")
73
-
74
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
73
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
75
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
74
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
76
-
77
 	secret_key := c.GetString("secret_key")
75
 	secret_key := c.GetString("secret_key")
78
-
79
 	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
76
 	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
80
-
81
 	var dat map[string]interface{}
77
 	var dat map[string]interface{}
82
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
78
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
79
+
83
 	} else {
80
 	} else {
81
+
84
 	}
82
 	}
85
 
83
 
86
 	c.ServeSuccessJSON(map[string]interface{}{
84
 	c.ServeSuccessJSON(map[string]interface{}{

+ 14 - 6
controllers/his_api_controller.go Ver arquivo

2692
 }
2692
 }
2693
 
2693
 
2694
 func (c *HisApiController) GetAllOrderDetail() {
2694
 func (c *HisApiController) GetAllOrderDetail() {
2695
-	order_id, _ := c.GetInt64("order_id", 0)
2695
+	order_id, _ := c.GetInt64("id", 0)
2696
 	order, _ := service.GetHisOrderByID(order_id)
2696
 	order, _ := service.GetHisOrderByID(order_id)
2697
 	if order.ID == 0 {
2697
 	if order.ID == 0 {
2698
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2698
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2699
 		return
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
 	c.ServeSuccessJSON(map[string]interface{}{
2705
 	c.ServeSuccessJSON(map[string]interface{}{
2704
 		"order":      order,
2706
 		"order":      order,
2705
 		"order_info": order_info,
2707
 		"order_info": order_info,
2708
+		"patient":    patient,
2709
+		"admin_info": adminInfo,
2706
 	})
2710
 	})
2707
 	return
2711
 	return
2708
 
2712
 
2709
 }
2713
 }
2710
 
2714
 
2711
 func (c *HisApiController) GetAllOrderDetailCollect() {
2715
 func (c *HisApiController) GetAllOrderDetailCollect() {
2712
-	order_id, _ := c.GetInt64("order_id", 0)
2716
+	order_id, _ := c.GetInt64("id", 0)
2713
 	order, _ := service.GetHisOrderByID(order_id)
2717
 	order, _ := service.GetHisOrderByID(order_id)
2714
 	if order.ID == 0 {
2718
 	if order.ID == 0 {
2715
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2719
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2716
 		return
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
 	c.ServeSuccessJSON(map[string]interface{}{
2726
 	c.ServeSuccessJSON(map[string]interface{}{
2721
 		"order":      order,
2727
 		"order":      order,
2722
 		"order_info": order_info,
2728
 		"order_info": order_info,
2729
+		"patient":    patient,
2730
+		"admin_info": adminInfo,
2723
 	})
2731
 	})
2724
 	return
2732
 	return
2725
 }
2733
 }

+ 40 - 35
models/his_models.go Ver arquivo

1
 package models
1
 package models
2
 
2
 
3
-import "time"
3
+import (
4
+	"gdyb/models"
5
+	"time"
6
+)
4
 
7
 
5
 type XtHisProject struct {
8
 type XtHisProject struct {
6
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
9
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
572
 }
575
 }
573
 
576
 
574
 type XtHisPatient struct {
577
 type XtHisPatient struct {
575
-	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
576
-	BalanceAccountsType    int64   `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
577
-	MedicalInsuranceNumber string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
578
-	Name                   string  `gorm:"column:name" json:"name" form:"name"`
579
-	Gender                 int64   `gorm:"column:gender" json:"gender" form:"gender"`
580
-	IdType                 int64   `gorm:"column:id_type" json:"id_type" form:"id_type"`
581
-	MedicalTreatmentType   int64   `gorm:"column:medical_treatment_type" json:"medical_treatment_type" form:"medical_treatment_type"`
582
-	Birthday               int64   `gorm:"column:birthday" json:"birthday" form:"birthday"`
583
-	RecordDate             int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
584
-	Age                    int64   `gorm:"column:age" json:"age" form:"age"`
585
-	PhoneNumber            string  `gorm:"column:phone_number" json:"phone_number" form:"phone_number"`
586
-	IdCardNo               string  `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
587
-	RegisterType           int64   `gorm:"column:register_type" json:"register_type" form:"register_type"`
588
-	AdminUserId            int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
589
-	Departments            int64   `gorm:"column:departments" json:"departments" form:"departments"`
590
-	IsNeedCostOfProduction int64   `gorm:"column:is_need_cost_of_production" json:"is_need_cost_of_production" form:"is_need_cost_of_production"`
591
-	RegisterCost           float64 `gorm:"column:register_cost" json:"register_cost" form:"register_cost"`
592
-	TreatmentCost          float64 `gorm:"column:treatment_cost" json:"treatment_cost" form:"treatment_cost"`
593
-	CostOfProduction       float64 `gorm:"column:cost_of_production" json:"cost_of_production" form:"cost_of_production"`
594
-	Total                  float64 `gorm:"column:total" json:"total" form:"total"`
595
-	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
596
-	Status                 int64   `gorm:"column:status" json:"status" form:"status"`
597
-	Ctime                  int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
598
-	Mtime                  int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
599
-	PatientId              int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
600
-	Number                 string  `gorm:"column:number" json:"number" form:"number"`
601
-	Doctor                 int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
602
-	IsReturn               int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
603
-	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
604
-	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
605
-	IdCardType             int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
606
-	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
607
-	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
608
-	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
578
+	ID                     int64           `gorm:"column:id" json:"id" form:"id"`
579
+	BalanceAccountsType    int64           `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
580
+	MedicalInsuranceNumber string          `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
581
+	Name                   string          `gorm:"column:name" json:"name" form:"name"`
582
+	Gender                 int64           `gorm:"column:gender" json:"gender" form:"gender"`
583
+	IdType                 int64           `gorm:"column:id_type" json:"id_type" form:"id_type"`
584
+	MedicalTreatmentType   int64           `gorm:"column:medical_treatment_type" json:"medical_treatment_type" form:"medical_treatment_type"`
585
+	Birthday               int64           `gorm:"column:birthday" json:"birthday" form:"birthday"`
586
+	RecordDate             int64           `gorm:"column:record_date" json:"record_date" form:"record_date"`
587
+	Age                    int64           `gorm:"column:age" json:"age" form:"age"`
588
+	PhoneNumber            string          `gorm:"column:phone_number" json:"phone_number" form:"phone_number"`
589
+	IdCardNo               string          `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
590
+	RegisterType           int64           `gorm:"column:register_type" json:"register_type" form:"register_type"`
591
+	AdminUserId            int64           `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
592
+	Departments            int64           `gorm:"column:departments" json:"departments" form:"departments"`
593
+	IsNeedCostOfProduction int64           `gorm:"column:is_need_cost_of_production" json:"is_need_cost_of_production" form:"is_need_cost_of_production"`
594
+	RegisterCost           float64         `gorm:"column:register_cost" json:"register_cost" form:"register_cost"`
595
+	TreatmentCost          float64         `gorm:"column:treatment_cost" json:"treatment_cost" form:"treatment_cost"`
596
+	CostOfProduction       float64         `gorm:"column:cost_of_production" json:"cost_of_production" form:"cost_of_production"`
597
+	Total                  float64         `gorm:"column:total" json:"total" form:"total"`
598
+	UserOrgId              int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
599
+	Status                 int64           `gorm:"column:status" json:"status" form:"status"`
600
+	Ctime                  int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
601
+	Mtime                  int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
602
+	PatientId              int64           `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
603
+	Number                 string          `gorm:"column:number" json:"number" form:"number"`
604
+	Doctor                 int64           `gorm:"column:doctor" json:"doctor" form:"doctor"`
605
+	IsReturn               int64           `gorm:"column:is_return" json:"is_return" form:"is_return"`
606
+	Phone                  string          `gorm:"column:phone" json:"phone" form:"phone"`
607
+	SocialType             int64           `gorm:"column:social_type" json:"social_type" form:"social_type"`
608
+	IdCardType             int64           `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
609
+	PType                  string          `gorm:"column:p_type" json:"p_type" form:"p_type"`
610
+	Diagnosis              int64           `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
611
+	SickType               int64           `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
612
+	HisOrder               models.HisOrder `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,SettleAccountsDate" json:"order"`
609
 }
613
 }
610
 
614
 
611
 func (XtHisPatient) TableName() string {
615
 func (XtHisPatient) TableName() string {
683
 	PrivatePrice          float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
687
 	PrivatePrice          float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
684
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
688
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
685
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
689
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
690
+	Creator               int64     `gorm:"column:creator" json:"creator" form:"creator"`
686
 
691
 
687
 	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
692
 	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
688
 	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
693
 	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`

+ 1 - 0
service/his_project_service.go Ver arquivo

304
 	if orgid > 0 {
304
 	if orgid > 0 {
305
 		db = db.Where("x.user_org_id = ?", orgid)
305
 		db = db.Where("x.user_org_id = ?", orgid)
306
 	}
306
 	}
307
+	db = db.Preload("HisOrder", "status = 1 AND user_org_id = ?", orgid)
307
 	err = db.Select("x.id,x.balance_accounts_type,x.medical_insurance_number,x.name,x.gender,x.id_type,x.medical_treatment_type,x.birthday,x.record_date,x.age,x.phone_number,x.id_card_no,x.register_type,x.admin_user_id,x.departments,x.is_need_cost_of_production,x.register_cost,x.treatment_cost,x.cost_of_production,x.total,x.user_org_id,x.patient_id,x.number,x.is_return,x.doctor,x.ctime,x.social_type,x.phone").Count(&total).Offset(offset).Limit(limit).Order("x.id desc").Find(&hisPatient).Error
308
 	err = db.Select("x.id,x.balance_accounts_type,x.medical_insurance_number,x.name,x.gender,x.id_type,x.medical_treatment_type,x.birthday,x.record_date,x.age,x.phone_number,x.id_card_no,x.register_type,x.admin_user_id,x.departments,x.is_need_cost_of_production,x.register_cost,x.treatment_cost,x.cost_of_production,x.total,x.user_org_id,x.patient_id,x.number,x.is_return,x.doctor,x.ctime,x.social_type,x.phone").Count(&total).Offset(offset).Limit(limit).Order("x.id desc").Find(&hisPatient).Error
308
 	return hisPatient, total, err
309
 	return hisPatient, total, err
309
 }
310
 }

+ 45 - 27
service/his_service.go Ver arquivo

101
 	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
101
 	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
102
 	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
102
 	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
103
 	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
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
 func (VMHisOrder) TableName() string {
107
 func (VMHisOrder) TableName() string {
1125
 	return "xt_his_project"
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
 func GetAllProjectTeamList(orgid int64) (project []*VMHisProjectTeam, err error) {
1143
 func GetAllProjectTeamList(orgid int64) (project []*VMHisProjectTeam, err error) {
1129
 	err = XTReadDB().Model(&VMHisProjectTeam{}).Where("user_org_id = ? and status = 1", orgid).Find(&project).Error
1144
 	err = XTReadDB().Model(&VMHisProjectTeam{}).Where("user_org_id = ? and status = 1", orgid).Find(&project).Error
1130
 	for _, item := range project {
1145
 	for _, item := range project {
1156
 	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1171
 	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"`
1172
 	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"`
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
 func (HisDoctorAdviceInfo) TableName() string {
1182
 func (HisDoctorAdviceInfo) TableName() string {
1165
 }
1184
 }
1166
 
1185
 
1167
 type HisPrescriptionProject struct {
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
 func (HisPrescriptionProject) TableName() string {
1211
 func (HisPrescriptionProject) TableName() string {
1219
 
1239
 
1220
 func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
1240
 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 {
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
 	}).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
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
 	}).Find(&order).Error
1245
 	}).Find(&order).Error
1228
 	return
1246
 	return
1229
 }
1247
 }