瀏覽代碼

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

csx 4 年之前
父節點
當前提交
e072757a84

+ 3 - 0
controllers/dialysis_record_api_controller.go 查看文件

265
 
265
 
266
 	_, record := service.FindAutomaticReduceRecordByOrgId(adminInfo.CurrentOrgId)
266
 	_, record := service.FindAutomaticReduceRecordByOrgId(adminInfo.CurrentOrgId)
267
 
267
 
268
+	his_advices, _ := service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
269
+
268
 	returnData := map[string]interface{}{
270
 	returnData := map[string]interface{}{
269
 		"patient":                     patient,
271
 		"patient":                     patient,
270
 		"schedual":                    schedual,
272
 		"schedual":                    schedual,
289
 		"lastDryWeightDislysis":       lastDryWeightDislysis,
291
 		"lastDryWeightDislysis":       lastDryWeightDislysis,
290
 		"headNurses":                  headNurses,
292
 		"headNurses":                  headNurses,
291
 		"system_prescribe":            systemDialysisPrescribe,
293
 		"system_prescribe":            systemDialysisPrescribe,
294
+		"his_advices":                 his_advices,
292
 	}
295
 	}
293
 	this.ServeSuccessJSON(returnData)
296
 	this.ServeSuccessJSON(returnData)
294
 
297
 

+ 47 - 24
controllers/gdyb_controller.go 查看文件

25
 	beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight")
25
 	beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight")
26
 	beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine")
26
 	beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine")
27
 
27
 
28
-	beego.Router("/gdyb/tem", &GdybController{}, "get:PostTen")
28
+	//beego.Router("/gdyb/tem", &GdybController{}, "get:PostTen")
29
 
29
 
30
 }
30
 }
31
 
31
 
68
 
68
 
69
 func (c *GdybController) PostOne() {
69
 func (c *GdybController) PostOne() {
70
 	certNo := c.GetString("cert_no")
70
 	certNo := c.GetString("cert_no")
71
-	result := service.Gdyb1101(certNo)
71
+	org_name := c.GetString("org_name")
72
+	doctor := c.GetString("doctor")
73
+
74
+	result := service.Gdyb1101(certNo, org_name, doctor)
72
 
75
 
73
 	var dat map[string]interface{}
76
 	var dat map[string]interface{}
74
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
77
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
75
-		fmt.Println("11111")
76
-		fmt.Println(dat)
77
-		//fmt.Println(dat["status"])
78
 	} else {
78
 	} else {
79
-		fmt.Println(err)
80
 	}
79
 	}
81
 
80
 
82
 	c.ServeSuccessJSON(map[string]interface{}{
81
 	c.ServeSuccessJSON(map[string]interface{}{
88
 	psnNo := c.GetString("psn_no")
87
 	psnNo := c.GetString("psn_no")
89
 	insutype := c.GetString("insutype")
88
 	insutype := c.GetString("insutype")
90
 	certNo := c.GetString("cert_no")
89
 	certNo := c.GetString("cert_no")
91
-	result := service.Gdyb2201(psnNo, insutype, certNo)
90
+	org_name := c.GetString("org_name")
91
+	doctor := c.GetString("doctor")
92
+	ipt_otp_no := c.GetString("ipt_otp_no")
93
+	dept := c.GetString("dept")
94
+
95
+	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept)
92
 
96
 
93
 	var dat map[string]interface{}
97
 	var dat map[string]interface{}
94
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
98
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
95
-		fmt.Println("22222222")
96
-		fmt.Println(dat)
97
 		//fmt.Println(dat["status"])
99
 		//fmt.Println(dat["status"])
98
 	} else {
100
 	} else {
99
-		fmt.Println(err)
100
 	}
101
 	}
101
 
102
 
102
 	c.ServeSuccessJSON(map[string]interface{}{
103
 	c.ServeSuccessJSON(map[string]interface{}{
107
 func (c *GdybController) PostThree() {
108
 func (c *GdybController) PostThree() {
108
 	psnNo := c.GetString("psn_no")
109
 	psnNo := c.GetString("psn_no")
109
 	mdtrtId := c.GetString("mdtrt_id")
110
 	mdtrtId := c.GetString("mdtrt_id")
110
-	result := service.Gdyb2202(psnNo, mdtrtId)
111
+	iptOtpNo := c.GetString("ipt_otp_no")
112
+	org_name := c.GetString("org_name")
113
+	doctor := c.GetString("doctor")
114
+
115
+	result := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor)
111
 	c.ServeSuccessJSON(map[string]interface{}{
116
 	c.ServeSuccessJSON(map[string]interface{}{
112
 		"pre": result,
117
 		"pre": result,
113
 	})
118
 	})
116
 func (c *GdybController) PostFour() {
121
 func (c *GdybController) PostFour() {
117
 	psnNo := c.GetString("psn_no")
122
 	psnNo := c.GetString("psn_no")
118
 	mdtrtId := c.GetString("mdtrt_id")
123
 	mdtrtId := c.GetString("mdtrt_id")
119
-	result := service.Gdyb2203(psnNo, mdtrtId)
124
+	doctor := c.GetString("doctor")
125
+	department := c.GetString("department")
126
+	diag := c.GetString("diag")
127
+	org_name := c.GetString("org_name")
128
+
129
+	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name)
120
 	c.ServeSuccessJSON(map[string]interface{}{
130
 	c.ServeSuccessJSON(map[string]interface{}{
121
 		"pre": result,
131
 		"pre": result,
122
 	})
132
 	})
159
 		utils.ErrorLog("解析失败:%v", err)
169
 		utils.ErrorLog("解析失败:%v", err)
160
 		return
170
 		return
161
 	}
171
 	}
162
-	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string))
172
+	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string), respJSON["doctor"].(string), respJSON["dept"].(string))
163
 
173
 
164
 	var dat map[string]interface{}
174
 	var dat map[string]interface{}
165
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
175
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
176
 	psnNo := c.GetString("psn_no")
186
 	psnNo := c.GetString("psn_no")
177
 	mdtrtId := c.GetString("mdtrt_id")
187
 	mdtrtId := c.GetString("mdtrt_id")
178
 	chrgBchno := c.GetString("chrg_bchno")
188
 	chrgBchno := c.GetString("chrg_bchno")
179
-	result := service.Gdyb2205(psnNo, mdtrtId, chrgBchno)
189
+	org_name := c.GetString("org_name")
190
+	doctor := c.GetString("doctor")
191
+
192
+	result := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor)
180
 
193
 
181
 	c.ServeSuccessJSON(map[string]interface{}{
194
 	c.ServeSuccessJSON(map[string]interface{}{
182
 		"pre": result,
195
 		"pre": result,
190
 	certNo := c.GetString("cert_no")
203
 	certNo := c.GetString("cert_no")
191
 	insutype := c.GetString("insutype")
204
 	insutype := c.GetString("insutype")
192
 	total := c.GetString("total")
205
 	total := c.GetString("total")
206
+	org_name := c.GetString("org_name")
207
+	doctor := c.GetString("doctor")
193
 
208
 
194
-	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total)
209
+	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor)
195
 	var dat map[string]interface{}
210
 	var dat map[string]interface{}
196
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
211
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
197
 		fmt.Println(dat)
212
 		fmt.Println(dat)
210
 	certNo := c.GetString("cert_no")
225
 	certNo := c.GetString("cert_no")
211
 	insutype := c.GetString("insutype")
226
 	insutype := c.GetString("insutype")
212
 	total := c.GetString("total")
227
 	total := c.GetString("total")
213
-	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total)
228
+	org_name := c.GetString("org_name")
229
+	doctor := c.GetString("doctor")
230
+
231
+	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor)
214
 	var dat map[string]interface{}
232
 	var dat map[string]interface{}
215
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
233
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
216
 		fmt.Println(dat)
234
 		fmt.Println(dat)
227
 	psnNo := c.GetString("psn_no")
245
 	psnNo := c.GetString("psn_no")
228
 	mdtrtId := c.GetString("mdtrt_id")
246
 	mdtrtId := c.GetString("mdtrt_id")
229
 	setlId := c.GetString("setl_id")
247
 	setlId := c.GetString("setl_id")
230
-	result := service.Gdyb2208(psnNo, mdtrtId, setlId)
231
-	c.ServeSuccessJSON(map[string]interface{}{
232
-		"pre": result,
233
-	})
234
-}
248
+	org_name := c.GetString("org_name")
249
+	doctor := c.GetString("doctor")
235
 
250
 
236
-func (c *GdybController) PostTen() {
237
-	fixmedins_type := c.GetString("fixmedins_type")
238
-	result := service.Gdyb1201(fixmedins_type)
251
+	result := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor)
239
 	c.ServeSuccessJSON(map[string]interface{}{
252
 	c.ServeSuccessJSON(map[string]interface{}{
240
 		"pre": result,
253
 		"pre": result,
241
 	})
254
 	})
242
 }
255
 }
256
+
257
+//func (c *GdybController) PostTen() {
258
+//	fixmedins_type := c.GetString("fixmedins_type")
259
+//	//fixmedins_type := c.GetString("org_name")
260
+//
261
+//	result := service.Gdyb1201(fixmedins_type)
262
+//	c.ServeSuccessJSON(map[string]interface{}{
263
+//		"pre": result,
264
+//	})
265
+//}

+ 38 - 12
controllers/his_api_controller.go 查看文件

105
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
105
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
106
 	prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
106
 	prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
107
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
107
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
108
+	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
109
+
108
 	c.ServeSuccessJSON(map[string]interface{}{
110
 	c.ServeSuccessJSON(map[string]interface{}{
109
 		"his_info":     his_patient_info,
111
 		"his_info":     his_patient_info,
110
 		"xt_info":      xt_patient_info,
112
 		"xt_info":      xt_patient_info,
111
 		"prescription": prescriptions,
113
 		"prescription": prescriptions,
112
 		"case_history": case_history,
114
 		"case_history": case_history,
115
+		"info":         patientPrescriptionInfo,
113
 	})
116
 	})
114
 	return
117
 	return
115
 
118
 
144
 
147
 
145
 	diagnose := c.GetString("diagnose")
148
 	diagnose := c.GetString("diagnose")
146
 	sick_history := c.GetString("sick_history")
149
 	sick_history := c.GetString("sick_history")
147
-	doctor, _ := c.GetInt64("doctor")
148
-	department, _ := c.GetInt64("department")
150
+	doctor := c.GetString("doctor")
151
+	department := c.GetString("department")
149
 	his_patient_id, _ := c.GetInt64("his_patient_id")
152
 	his_patient_id, _ := c.GetInt64("his_patient_id")
150
 	dataBody := make(map[string]interface{}, 0)
153
 	dataBody := make(map[string]interface{}, 0)
151
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
154
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
658
 	id, _ := c.GetInt64("id")
661
 	id, _ := c.GetInt64("id")
659
 	record_time := c.GetString("record_time")
662
 	record_time := c.GetString("record_time")
660
 
663
 
664
+	timeLayout := "2006-01-02"
665
+	loc, _ := time.LoadLocation("Local")
666
+
667
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
668
+	if err != nil {
669
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
670
+		return
671
+	}
672
+	recordDateTime := theTime.Unix()
673
+
661
 	adminInfo := c.GetAdminUserInfo()
674
 	adminInfo := c.GetAdminUserInfo()
662
 	patient, _ := service.GetPatientByID(adminInfo.CurrentOrgId, id)
675
 	patient, _ := service.GetPatientByID(adminInfo.CurrentOrgId, id)
676
+	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
663
 
677
 
664
 	if patient == nil {
678
 	if patient == nil {
665
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
679
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
670
 		return
684
 		return
671
 	}
685
 	}
672
 
686
 
673
-	timeLayout := "2006-01-02"
674
-	loc, _ := time.LoadLocation("Local")
675
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
676
-	if err != nil {
677
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
678
-		return
679
-	}
687
+	org, _ := service.GetOrgById(adminInfo.CurrentOrgId)
680
 
688
 
681
-	api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo
689
+	api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor
682
 	resp, requestErr := http.Get(api)
690
 	resp, requestErr := http.Get(api)
683
 
691
 
684
 	if requestErr != nil {
692
 	if requestErr != nil {
734
 		return
742
 		return
735
 	}
743
 	}
736
 
744
 
745
+	timestamp := time.Now().Unix()
746
+	tempTime := time.Unix(timestamp, 0)
747
+	timeFormat := tempTime.Format("20060102150405")
748
+	chrgBchno := rand.Intn(100000) + 10000
749
+	ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
750
+
737
 	count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
751
 	count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
738
 	if count <= 0 {
752
 	if count <= 0 {
739
-		api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" + res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo
753
+		api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
754
+			res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
755
+			"&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
756
+			"&dept=" + patientPrescription.Departments
740
 		resp, requestErr := http.Get(api)
757
 		resp, requestErr := http.Get(api)
741
 		if requestErr != nil {
758
 		if requestErr != nil {
742
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
759
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
978
 	chrgBchno := rand.Intn(100000) + 10000
995
 	chrgBchno := rand.Intn(100000) + 10000
979
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
996
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
980
 
997
 
998
+	org, _ := service.GetOrgById(adminUser.CurrentOrgId)
999
+	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1000
+
981
 	client := &http.Client{}
1001
 	client := &http.Client{}
982
 	data := make(map[string]interface{})
1002
 	data := make(map[string]interface{})
983
 	data["psn_no"] = his.PsnNo
1003
 	data["psn_no"] = his.PsnNo
984
 	data["mdtrt_id"] = his.Number
1004
 	data["mdtrt_id"] = his.Number
985
 	data["pre"] = prescriptions
1005
 	data["pre"] = prescriptions
986
 	data["chrg_bchno"] = chrg_bchno
1006
 	data["chrg_bchno"] = chrg_bchno
1007
+	data["org_name"] = org.OrgName
1008
+	data["doctor"] = patientPrescription.Doctor
1009
+	data["dept"] = patientPrescription.Departments
1010
+
987
 	bytesData, _ := json.Marshal(data)
1011
 	bytesData, _ := json.Marshal(data)
988
 	req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
1012
 	req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
989
 	resp, _ := client.Do(req)
1013
 	resp, _ := client.Do(req)
1102
 			}
1126
 			}
1103
 		}
1127
 		}
1104
 
1128
 
1129
+		org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1130
+		patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1105
 		allTotal := fmt.Sprintf("%.2f", total)
1131
 		allTotal := fmt.Sprintf("%.2f", total)
1106
 		if res.Infcode == 0 {
1132
 		if res.Infcode == 0 {
1107
 			var rf []*ResultFive
1133
 			var rf []*ResultFive
1113
 			insutype := rf[0].Insutype
1139
 			insutype := rf[0].Insutype
1114
 			api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1140
 			api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1115
 				insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1141
 				insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1116
-				"&total=" + allTotal
1142
+				"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor
1117
 			resp, requestErr := http.Get(api)
1143
 			resp, requestErr := http.Get(api)
1118
 
1144
 
1119
 			if requestErr != nil {
1145
 			if requestErr != nil {

+ 3 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

367
 
367
 
368
 	//operators, _ := service.GetAllAdminUserES(adminInfo.Org.Id, adminInfo.App.Id)
368
 	//operators, _ := service.GetAllAdminUserES(adminInfo.Org.Id, adminInfo.App.Id)
369
 
369
 
370
+	his_advices, _ := service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
371
+
370
 	if getLPEErr != nil {
372
 	if getLPEErr != nil {
371
 		this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
373
 		this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
372
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
374
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
412
 		"config":                         gobalConfig,
414
 		"config":                         gobalConfig,
413
 		"dry_weight":                     lastDryWeightDislysis,
415
 		"dry_weight":                     lastDryWeightDislysis,
414
 		"system_prescription":            systemDialysisPrescribe,
416
 		"system_prescription":            systemDialysisPrescribe,
417
+		"his_advices":                    his_advices,
415
 	}
418
 	}
416
 	this.ServeSuccessJSON(returnData)
419
 	this.ServeSuccessJSON(returnData)
417
 }
420
 }

+ 3 - 3
models/his_models.go 查看文件

251
 	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
251
 	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
252
 	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
252
 	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
253
 	RegisterType int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
253
 	RegisterType int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
254
-	Doctor       int64  `gorm:"column:doctor" json:"doctor" form:"doctor"`
255
-	Departments  int64  `gorm:"column:departments" json:"departments" form:"departments"`
254
+	Doctor       string `gorm:"column:doctor" json:"doctor" form:"doctor"`
255
+	Departments  string `gorm:"column:departments" json:"departments" form:"departments"`
256
 	SickHistory  string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
256
 	SickHistory  string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
257
 }
257
 }
258
 
258
 
271
 	Mtime                  int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
271
 	Mtime                  int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
272
 	Number                 string                    `gorm:"column:number" json:"number" form:"number"`
272
 	Number                 string                    `gorm:"column:number" json:"number" form:"number"`
273
 	Type                   int64                     `gorm:"column:type" json:"type" form:"type"`
273
 	Type                   int64                     `gorm:"column:type" json:"type" form:"type"`
274
-	Doctor                 int64                     `gorm:"column:doctor" json:"doctor" form:"doctor"`
274
+	Doctor                 string                    `gorm:"column:doctor" json:"doctor" form:"doctor"`
275
 	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
275
 	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
276
 	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
276
 	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
277
 	IsFinish               int64                     `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`
277
 	IsFinish               int64                     `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`

+ 39 - 38
service/gdyb_service.go 查看文件

17
 
17
 
18
 const (
18
 const (
19
 	SceretKey     = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" //     secretKey 私钥
19
 	SceretKey     = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" //     secretKey 私钥
20
-	FixmedinsCOde = "H44020500197"                     // 定点医药机构编号
20
+	FixmedinsCOde = "H44022900158"                     // 定点医药机构编号
21
 )
21
 )
22
 
22
 
23
 // 人员基本信息
23
 // 人员基本信息
24
-func Gdyb1101(certNo string) string {
24
+func Gdyb1101(certNo string, org_name string, doctor string) string {
25
 	// 生成签名
25
 	// 生成签名
26
 	nonce := GetRandomString(32)
26
 	nonce := GetRandomString(32)
27
 	timestamp := time.Now().Unix()
27
 	timestamp := time.Now().Unix()
28
 	signature := setSignature(timestamp, nonce)
28
 	signature := setSignature(timestamp, nonce)
29
 
29
 
30
 	// 生成输入报文
30
 	// 生成输入报文
31
-	inputMessage := SetInputMessage(nonce, timestamp)
31
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
32
 	input := make(map[string]interface{})
32
 	input := make(map[string]interface{})
33
 	inputData := make(map[string]interface{})
33
 	inputData := make(map[string]interface{})
34
 	inputMessage["infno"] = "1101"      // 交易编码
34
 	inputMessage["infno"] = "1101"      // 交易编码
80
 }
80
 }
81
 
81
 
82
 // 门诊挂号
82
 // 门诊挂号
83
-func Gdyb2201(psnNo string, insutype string, certNo string) string {
83
+func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string) string {
84
 	// 生成签名
84
 	// 生成签名
85
 	nonce := GetRandomString(32)
85
 	nonce := GetRandomString(32)
86
 	timestamp := time.Now().Unix()
86
 	timestamp := time.Now().Unix()
89
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
89
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
90
 
90
 
91
 	// 生成输入报文
91
 	// 生成输入报文
92
-	inputMessage := SetInputMessage(nonce, timestamp)
92
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
93
 	input := make(map[string]interface{})
93
 	input := make(map[string]interface{})
94
 	inputData := make(map[string]interface{})
94
 	inputData := make(map[string]interface{})
95
 	inputMessage["infno"] = "2201"        // 交易编码
95
 	inputMessage["infno"] = "2201"        // 交易编码
98
 	inputData["begntime"] = timeFormatOne // 开始时间
98
 	inputData["begntime"] = timeFormatOne // 开始时间
99
 	inputData["mdtrt_cert_type"] = "02"   // 就诊凭证类型
99
 	inputData["mdtrt_cert_type"] = "02"   // 就诊凭证类型
100
 	inputData["mdtrt_cert_no"] = certNo   // 就诊凭证编号
100
 	inputData["mdtrt_cert_no"] = certNo   // 就诊凭证编号
101
-	inputData["ipt_otp_no"] = "10000110"  // 住院/门诊号
101
+	inputData["ipt_otp_no"] = ipt_otp_no  // 住院/门诊号
102
 	inputData["atddr_no"] = "1002"        // 医师编码
102
 	inputData["atddr_no"] = "1002"        // 医师编码
103
-	inputData["dr_name"] = "刘志刚"          // 医师姓名
103
+	inputData["dr_name"] = doctor         // 医师姓名
104
 	inputData["dept_code"] = "3002"       // 科室编码
104
 	inputData["dept_code"] = "3002"       // 科室编码
105
-	inputData["dept_name"] = "血透中心"       // 科室名称
105
+	inputData["dept_name"] = dept         // 科室名称
106
 	inputData["caty"] = "A03.06"          // 科别
106
 	inputData["caty"] = "A03.06"          // 科别
107
 
107
 
108
 	input["data"] = inputData
108
 	input["data"] = inputData
146
 }
146
 }
147
 
147
 
148
 // 门诊挂号撤销
148
 // 门诊挂号撤销
149
-func Gdyb2202(psnNo string, mdtrtId string) string {
149
+func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string) string {
150
 	// 生成签名
150
 	// 生成签名
151
 	nonce := GetRandomString(32)
151
 	nonce := GetRandomString(32)
152
 	timestamp := time.Now().Unix()
152
 	timestamp := time.Now().Unix()
153
 	signature := setSignature(timestamp, nonce)
153
 	signature := setSignature(timestamp, nonce)
154
 
154
 
155
 	// 生成输入报文
155
 	// 生成输入报文
156
-	inputMessage := SetInputMessage(nonce, timestamp)
156
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
157
 	input := make(map[string]interface{})
157
 	input := make(map[string]interface{})
158
 	inputData := make(map[string]interface{})
158
 	inputData := make(map[string]interface{})
159
 	inputMessage["infno"] = "2202"       // 交易编码
159
 	inputMessage["infno"] = "2202"       // 交易编码
160
 	inputData["psn_no"] = psnNo          // 人员编号 (来自1101接口返回)
160
 	inputData["psn_no"] = psnNo          // 人员编号 (来自1101接口返回)
161
 	inputData["mdtrt_id"] = mdtrtId      // 就诊 ID(来自2201接口返回)
161
 	inputData["mdtrt_id"] = mdtrtId      // 就诊 ID(来自2201接口返回)
162
-	inputData["ipt_otp_no"] = "10000110" // 住院/门诊号
162
+	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
163
 
163
 
164
 	input["data"] = inputData
164
 	input["data"] = inputData
165
 	inputMessage["input"] = input //交易输入
165
 	inputMessage["input"] = input //交易输入
202
 }
202
 }
203
 
203
 
204
 // 门诊就诊信息上传
204
 // 门诊就诊信息上传
205
-func Gdyb2203(psnNo string, mdtrtId string) string {
205
+func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string) string {
206
 	// 生成签名
206
 	// 生成签名
207
 	nonce := GetRandomString(32)
207
 	nonce := GetRandomString(32)
208
 	timestamp := time.Now().Unix()
208
 	timestamp := time.Now().Unix()
211
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
211
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
212
 
212
 
213
 	// 生成输入报文
213
 	// 生成输入报文
214
-	inputMessage := SetInputMessage(nonce, timestamp)
214
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
215
 	input := make(map[string]interface{})
215
 	input := make(map[string]interface{})
216
 	inputData := make(map[string]interface{})
216
 	inputData := make(map[string]interface{})
217
 	diseinfo := make([]map[string]interface{}, 0)
217
 	diseinfo := make([]map[string]interface{}, 0)
231
 	diseinfo_sun["diag_type"] = "1"           // 诊断类别
231
 	diseinfo_sun["diag_type"] = "1"           // 诊断类别
232
 	diseinfo_sun["diag_srt_no"] = "1"         // 诊断排序号
232
 	diseinfo_sun["diag_srt_no"] = "1"         // 诊断排序号
233
 	diseinfo_sun["diag_code"] = "A04.902"     // 诊断代码
233
 	diseinfo_sun["diag_code"] = "A04.902"     // 诊断代码
234
-	diseinfo_sun["diag_name"] = "细菌性腹泻"       // 诊断名称
235
-	diseinfo_sun["diag_dept"] = "肾内科"         // 诊断科室
234
+	diseinfo_sun["diag_name"] = diag          // 诊断名称
235
+	diseinfo_sun["diag_dept"] = department    // 诊断科室
236
 	diseinfo_sun["dise_dor_no"] = "1002"      // 诊断医生编码
236
 	diseinfo_sun["dise_dor_no"] = "1002"      // 诊断医生编码
237
-	diseinfo_sun["dise_dor_name"] = "马桂平"     // 诊断医生姓名
237
+	diseinfo_sun["dise_dor_name"] = doctor    // 诊断医生姓名
238
 	diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
238
 	diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
239
 	diseinfo_sun["vali_flag"] = "1"           // 有效标志
239
 	diseinfo_sun["vali_flag"] = "1"           // 有效标志
240
 
240
 
335
 }
335
 }
336
 
336
 
337
 //  门诊费用明细信息上传
337
 //  门诊费用明细信息上传
338
-func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string) string {
338
+func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string) string {
339
 	// 生成签名
339
 	// 生成签名
340
 	nonce := GetRandomString(32)
340
 	nonce := GetRandomString(32)
341
 	timestamp := time.Now().Unix()
341
 	timestamp := time.Now().Unix()
374
 					Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
374
 					Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
375
 					FeedetlSn:        subItem.FeedetlSn,
375
 					FeedetlSn:        subItem.FeedetlSn,
376
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
376
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
377
+					MedListCodg:      subItem.MedListCodg,
377
 				}
378
 				}
378
 				fmt.Println(cus.FeedetlSn)
379
 				fmt.Println(cus.FeedetlSn)
379
 
380
 
385
 	fmt.Println(customs)
386
 	fmt.Println(customs)
386
 
387
 
387
 	// 生成输入报文
388
 	// 生成输入报文
388
-	inputMessage := SetInputMessage(nonce, timestamp)
389
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
389
 	input := make(map[string]interface{})
390
 	input := make(map[string]interface{})
390
 	feedetail := make([]map[string]interface{}, 0)
391
 	feedetail := make([]map[string]interface{}, 0)
391
 	inputMessage["infno"] = "2204" // 交易编码
392
 	inputMessage["infno"] = "2204" // 交易编码
411
 		feedetailInfo["prd_days"] = "0"                              // 周期天数
412
 		feedetailInfo["prd_days"] = "0"                              // 周期天数
412
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
413
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
413
 		feedetailInfo["bilg_dept_codg"] = "3002"                     // 开单科室编码
414
 		feedetailInfo["bilg_dept_codg"] = "3002"                     // 开单科室编码
414
-		feedetailInfo["bilg_dept_name"] = "血透中心"                     // 开单科室名称
415
+		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
415
 		feedetailInfo["bilg_dr_codg"] = "1002"                       // 开单医生编码
416
 		feedetailInfo["bilg_dr_codg"] = "1002"                       // 开单医生编码
416
-		feedetailInfo["bilg_dr_name"] = "刘志刚"                        // 开单医师姓名
417
+		feedetailInfo["bilg_dr_name"] = doctor                       // 开单医师姓名
417
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
418
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
418
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
419
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
419
 		feedetailInfo["orders_dr_code"] = ""                         // 受单医生编码
420
 		feedetailInfo["orders_dr_code"] = ""                         // 受单医生编码
471
 }
472
 }
472
 
473
 
473
 //  门诊费用明细信息撤销
474
 //  门诊费用明细信息撤销
474
-func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string) string {
475
+func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string) string {
475
 	// 生成签名
476
 	// 生成签名
476
 	nonce := GetRandomString(32)
477
 	nonce := GetRandomString(32)
477
 	timestamp := time.Now().Unix()
478
 	timestamp := time.Now().Unix()
478
 	signature := setSignature(timestamp, nonce)
479
 	signature := setSignature(timestamp, nonce)
479
 
480
 
480
 	// 生成输入报文
481
 	// 生成输入报文
481
-	inputMessage := SetInputMessage(nonce, timestamp)
482
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
482
 	input := make(map[string]interface{})
483
 	input := make(map[string]interface{})
483
 	inputData := make(map[string]interface{})
484
 	inputData := make(map[string]interface{})
484
 	inputMessage["infno"] = "2205" // 交易编码
485
 	inputMessage["infno"] = "2205" // 交易编码
531
 }
532
 }
532
 
533
 
533
 //  门诊预结算
534
 //  门诊预结算
534
-func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string) string {
535
+func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string) string {
535
 	// 生成签名
536
 	// 生成签名
536
 	nonce := GetRandomString(32)
537
 	nonce := GetRandomString(32)
537
 	timestamp := time.Now().Unix()
538
 	timestamp := time.Now().Unix()
538
 	signature := setSignature(timestamp, nonce)
539
 	signature := setSignature(timestamp, nonce)
539
 
540
 
540
 	// 生成输入报文
541
 	// 生成输入报文
541
-	inputMessage := SetInputMessage(nonce, timestamp)
542
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
542
 	input := make(map[string]interface{})
543
 	input := make(map[string]interface{})
543
 	inputData := make(map[string]interface{})
544
 	inputData := make(map[string]interface{})
544
 	inputMessage["infno"] = "2206" // 交易编码
545
 	inputMessage["infno"] = "2206" // 交易编码
545
 
546
 
546
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
547
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
547
-	inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
548
+	inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型,
548
 	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
549
 	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
549
 	inputData["med_type"] = "11"        // 医疗类别 11 普通门诊  12 门诊挂号
550
 	inputData["med_type"] = "11"        // 医疗类别 11 普通门诊  12 门诊挂号
550
 	inputData["medfee_sumamt"] = total  // 医疗费总额
551
 	inputData["medfee_sumamt"] = total  // 医疗费总额
595
 }
596
 }
596
 
597
 
597
 //  门诊结算
598
 //  门诊结算
598
-func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string) string {
599
+func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string) string {
599
 	// 生成签名
600
 	// 生成签名
600
 	nonce := GetRandomString(32)
601
 	nonce := GetRandomString(32)
601
 	timestamp := time.Now().Unix()
602
 	timestamp := time.Now().Unix()
602
 	signature := setSignature(timestamp, nonce)
603
 	signature := setSignature(timestamp, nonce)
603
 
604
 
604
 	// 生成输入报文
605
 	// 生成输入报文
605
-	inputMessage := SetInputMessage(nonce, timestamp)
606
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
606
 	input := make(map[string]interface{})
607
 	input := make(map[string]interface{})
607
 	inputData := make(map[string]interface{})
608
 	inputData := make(map[string]interface{})
608
 	inputMessage["infno"] = "2207" // 交易编码
609
 	inputMessage["infno"] = "2207" // 交易编码
660
 }
661
 }
661
 
662
 
662
 //  门诊结算撤销
663
 //  门诊结算撤销
663
-func Gdyb2208(psnNo string, mdtrtId string, setlId string) string {
664
+func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string) string {
664
 	// 生成签名
665
 	// 生成签名
665
 	nonce := GetRandomString(32)
666
 	nonce := GetRandomString(32)
666
 	timestamp := time.Now().Unix()
667
 	timestamp := time.Now().Unix()
667
 	signature := setSignature(timestamp, nonce)
668
 	signature := setSignature(timestamp, nonce)
668
 
669
 
669
 	// 生成输入报文
670
 	// 生成输入报文
670
-	inputMessage := SetInputMessage(nonce, timestamp)
671
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
671
 	input := make(map[string]interface{})
672
 	input := make(map[string]interface{})
672
 	inputData := make(map[string]interface{})
673
 	inputData := make(map[string]interface{})
673
 	inputMessage["infno"] = "2208" // 交易编码
674
 	inputMessage["infno"] = "2208" // 交易编码
743
 }
744
 }
744
 
745
 
745
 // 生成基础报文
746
 // 生成基础报文
746
-func SetInputMessage(nonce string, timestamp int64) map[string]interface{} {
747
+func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string) map[string]interface{} {
747
 	// 生成签名
748
 	// 生成签名
748
 	tempTime := time.Unix(timestamp, 0)
749
 	tempTime := time.Unix(timestamp, 0)
749
 	timeFormat := tempTime.Format("20060102150405")
750
 	timeFormat := tempTime.Format("20060102150405")
765
 	inputMessage["infver"] = "V1.1"                                                            // 接收方系统代码
766
 	inputMessage["infver"] = "V1.1"                                                            // 接收方系统代码
766
 	inputMessage["opter_type"] = "1"                                                           // 经办人类别
767
 	inputMessage["opter_type"] = "1"                                                           // 经办人类别
767
 	inputMessage["opter"] = "mockuser"                                                         // 经办人
768
 	inputMessage["opter"] = "mockuser"                                                         // 经办人
768
-	inputMessage["opter_name"] = "测试用户"                                                        // 经办人姓名
769
+	inputMessage["opter_name"] = doctor                                                        // 经办人姓名
769
 	inputMessage["inf_time"] = timeFormatOne                                                   // 交易时间
770
 	inputMessage["inf_time"] = timeFormatOne                                                   // 交易时间
770
 	inputMessage["fixmedins_code"] = FixmedinsCOde                                             // 定点医药机构编号
771
 	inputMessage["fixmedins_code"] = FixmedinsCOde                                             // 定点医药机构编号
771
-	inputMessage["fixmedins_name"] = "韶关市曲江区小坑镇卫生院"                                            //定点医药机构名称
772
+	inputMessage["fixmedins_name"] = org_name                                                  //定点医药机构名称
772
 	inputMessage["sign_no"] = ""                                                               //交易签到流水号
773
 	inputMessage["sign_no"] = ""                                                               //交易签到流水号
773
 	return inputMessage
774
 	return inputMessage
774
 }
775
 }
780
 	return
781
 	return
781
 }
782
 }
782
 
783
 
783
-func Gdyb1201(psnNo string) string {
784
+func Gdyb1201(psnNo string, org_name string, doctor string) string {
784
 	// 生成签名
785
 	// 生成签名
785
 	nonce := GetRandomString(32)
786
 	nonce := GetRandomString(32)
786
 	timestamp := time.Now().Unix()
787
 	timestamp := time.Now().Unix()
787
 	signature := setSignature(timestamp, nonce)
788
 	signature := setSignature(timestamp, nonce)
788
 
789
 
789
 	// 生成输入报文
790
 	// 生成输入报文
790
-	inputMessage := SetInputMessage(nonce, timestamp)
791
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
791
 	input := make(map[string]interface{})
792
 	input := make(map[string]interface{})
792
 	inputData := make(map[string]interface{})
793
 	inputData := make(map[string]interface{})
793
-	inputMessage["infno"] = "1201"      // 交易编码
794
-	inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
795
-	inputData["fixmedins_name"] = "韶关"  // 人员编号 (来自1101接口返回)
796
-	inputData["fixmedins_code"] = ""    // 人员编号 (来自1101接口返回)
794
+	inputMessage["infno"] = "1201"             // 交易编码
795
+	inputData["fixmedins_type"] = psnNo        // 人员编号 (来自1101接口返回)
796
+	inputData["fixmedins_name"] = "翁源沅胜血液透析中心" // 人员编号 (来自1101接口返回)
797
+	inputData["fixmedins_code"] = ""           // 人员编号 (来自1101接口返回)
797
 
798
 
798
 	input["medinsinfo"] = inputData
799
 	input["medinsinfo"] = inputData
799
 	inputMessage["input"] = input //交易输入
800
 	inputMessage["input"] = input //交易输入

+ 6 - 0
service/mobile_dialysis_service.go 查看文件

1611
 	}
1611
 	}
1612
 	return &evaluation, nil
1612
 	return &evaluation, nil
1613
 }
1613
 }
1614
+
1615
+func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his []*models.HisDoctorAdviceInfo, err error) {
1616
+	err = readDb.Model(&models.DialysisBeforePrepare{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Find(&his).Error
1617
+	return
1618
+
1619
+}