csx 4 years ago
parent
commit
5f6a1481ac
4 changed files with 75 additions and 58 deletions
  1. 2 2
      controllers/his_api_controller.go
  2. 51 50
      models/his_models.go
  3. 16 4
      service/gdyb_service.go
  4. 6 2
      service/his_service.go

+ 2 - 2
controllers/his_api_controller.go View File

@@ -42,7 +42,7 @@ func HisManagerApiRegistRouters() {
42 42
 	beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
43 43
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
44 44
 
45
-	beego.Router("/api/code/get", &HisApiController{}, "get:GetCode")
45
+	//beego.Router("/api/code/get", &HisApiController{}, "get:GetCode")
46 46
 
47 47
 	beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
48 48
 
@@ -1993,7 +1993,7 @@ func (c *HisApiController) GetCode() {
1993 1993
 		user_name = role.UserName
1994 1994
 	}
1995 1995
 
1996
-	baseParams := models.BaseParams{
1996
+	baseParams := &models.BaseParams{
1997 1997
 		SecretKey:      miConfig.SecretKey,
1998 1998
 		FixmedinsCode:  miConfig.Code,
1999 1999
 		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,

+ 51 - 50
models/his_models.go View File

@@ -167,56 +167,57 @@ func (HisCaseHistoryTemplate) TableName() string {
167 167
 }
168 168
 
169 169
 type HisDoctorAdviceInfo struct {
170
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
171
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
172
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
173
-	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
174
-	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
175
-	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
176
-	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
177
-	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
178
-	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
179
-	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
180
-	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
181
-	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
182
-	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
183
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
184
-	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
185
-	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
186
-	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
187
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
188
-	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
189
-	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
190
-	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
191
-	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
192
-	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
193
-	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
194
-	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
195
-	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
196
-	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
197
-	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
198
-	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
199
-	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
200
-	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
201
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
202
-	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
203
-	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
204
-	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
205
-	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
206
-	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
207
-	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
208
-	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
209
-	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
210
-	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
211
-	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
212
-	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
213
-	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
214
-	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
215
-	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
216
-	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
217
-	MedListCodg           string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
218
-	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
219
-	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
170
+	ID                    int64       `gorm:"column:id" json:"id" form:"id"`
171
+	UserOrgId             int64       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
172
+	PatientId             int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
173
+	HisPatientId          int64       `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
174
+	AdviceType            int64       `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
175
+	AdviceDate            int64       `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
176
+	StartTime             int64       `gorm:"column:start_time" json:"start_time" form:"start_time"`
177
+	AdviceName            string      `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
178
+	AdviceDesc            string      `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
179
+	ReminderDate          int64       `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
180
+	SingleDose            float64     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
181
+	SingleDoseUnit        string      `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
182
+	PrescribingNumber     float64     `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
183
+	PrescribingNumberUnit string      `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
184
+	DeliveryWay           string      `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
185
+	ExecutionFrequency    string      `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
186
+	AdviceDoctor          int64       `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
187
+	Status                int64       `gorm:"column:status" json:"status" form:"status"`
188
+	CreatedTime           int64       `gorm:"column:created_time" json:"created_time" form:"created_time"`
189
+	UpdatedTime           int64       `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
190
+	AdviceAffirm          string      `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
191
+	Remark                string      `gorm:"column:remark" json:"remark" form:"remark"`
192
+	StopTime              int64       `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
193
+	StopReason            string      `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
194
+	StopDoctor            int64       `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
195
+	StopState             int64       `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
196
+	ParentId              int64       `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
197
+	ExecutionTime         int64       `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
198
+	ExecutionStaff        int64       `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
199
+	ExecutionState        int64       `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
200
+	Checker               int64       `gorm:"column:checker" json:"checker" form:"checker"`
201
+	RecordDate            int64       `gorm:"column:record_date" json:"record_date" form:"record_date"`
202
+	DialysisOrderId       int64       `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
203
+	CheckTime             int64       `gorm:"column:check_time" json:"check_time" form:"check_time"`
204
+	CheckState            int64       `gorm:"column:check_state" json:"check_state" form:"check_state"`
205
+	DrugSpec              float64     `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
206
+	DrugSpecUnit          string      `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
207
+	Groupno               int64       `gorm:"column:groupno" json:"groupno" form:"groupno"`
208
+	RemindType            int64       `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
209
+	FrequencyType         int64       `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
210
+	DayCount              int64       `gorm:"column:day_count" json:"day_count" form:"day_count"`
211
+	WeekDay               string      `gorm:"column:week_day" json:"week_day" form:"week_day"`
212
+	TemplateId            string      `gorm:"column:template_id" json:"template_id" form:"template_id"`
213
+	Modifier              int64       `gorm:"column:modifier" json:"modifier" form:"modifier"`
214
+	DrugId                int64       `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
215
+	Price                 float64     `gorm:"column:price" json:"price" form:"price"`
216
+	PrescriptionId        int64       `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
217
+	MedListCodg           string      `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
218
+	FeedetlSn             string      `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
219
+	Day                   int64       `gorm:"column:day" json:"day" form:"day"`
220
+	BaseDrugLib           BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
220 221
 }
221 222
 
222 223
 func (HisDoctorAdviceInfo) TableName() string {

+ 16 - 4
service/gdyb_service.go View File

@@ -370,7 +370,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
370 370
 						Cut:              fmt.Sprintf("%.2f", subItem.PrescribingNumber),
371 371
 						FeedetlSn:        subItem.FeedetlSn,
372 372
 						Price:            fmt.Sprintf("%.2f", subItem.Price),
373
-						MedListCodg:      subItem.MedListCodg,
373
+						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
374 374
 					}
375 375
 
376 376
 					customs = append(customs, cus)
@@ -389,7 +389,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
389 389
 						Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
390 390
 						FeedetlSn:        subItem.FeedetlSn,
391 391
 						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
392
-						MedListCodg:      subItem.MedListCodg,
392
+						MedListCodg:      subItem.HisProject.MedicalCode,
393 393
 					}
394 394
 					customs = append(customs, cus)
395 395
 				}
@@ -1047,7 +1047,7 @@ func Gdyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
1047 1047
 	return str
1048 1048
 }
1049 1049
 
1050
-func Gdyb3301(baseParams models.BaseParams, name string, codg string) string {
1050
+func Gdyb3301(baseParams *models.BaseParams, name string, codg string) string {
1051 1051
 	// 生成签名
1052 1052
 	nonce := GetRandomString(32)
1053 1053
 	timestamp := time.Now().Unix()
@@ -1058,13 +1058,25 @@ func Gdyb3301(baseParams models.BaseParams, name string, codg string) string {
1058 1058
 	input := make(map[string]interface{})
1059 1059
 	inputData := make(map[string]interface{})
1060 1060
 	inputMessage["infno"] = "3301" // 交易编码
1061
+
1061 1062
 	inputData["fixmedins_hilist_id"] = baseParams.FixmedinsCode
1063
+
1062 1064
 	inputData["fixmedins_hilist_name"] = name
1063 1065
 	inputData["list_type"] = "西药"
1064 1066
 	inputData["med_list_codg"] = codg
1065 1067
 	inputData["begndate"] = "2021-01-01"
1066 1068
 	inputData["enddate"] = "2021-01-07"
1067
-	input["data"] = inputData
1069
+
1070
+	inputData["aprvno"] = ""
1071
+	inputData["dosform"] = ""
1072
+	inputData["exct_cont"] = ""
1073
+	inputData["item_cont"] = ""
1074
+	inputData["prcunt"] = ""
1075
+	inputData["spec"] = ""
1076
+	inputData["pacspec"] = ""
1077
+	inputData["memo"] = ""
1078
+
1079
+	input["catalogcompin"] = inputData
1068 1080
 	inputMessage["input"] = input //交易输入
1069 1081
 	bytesData, err := json.Marshal(inputMessage)
1070 1082
 	fmt.Println(string(bytesData))

+ 6 - 2
service/his_service.go View File

@@ -196,8 +196,12 @@ func DelelteProject(id int64, user_org_id int64) (err error) {
196 196
 
197 197
 func GetHisPrescription(org_id int64, patient_id int64, record_date int64) (prescription []*models.HisPrescription, err error) {
198 198
 	err = readDb.Model(&models.HisPrescription{}).
199
-		Preload("HisAdditionalCharge", "status = 1 AND user_org_id = ?", org_id).
200
-		Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
199
+		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
200
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
201
+		}).
202
+		Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", func(db *gorm.DB) *gorm.DB {
203
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
204
+		}).
201 205
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
202 206
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
203 207
 		}).