Преглед изворни кода

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

XMLWAN пре 4 година
родитељ
комит
cad428fae2

+ 3 - 0
controllers/dialysis_record_api_controller.go Прегледај датотеку

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

+ 50 - 16
controllers/gdyb_controller.go Прегледај датотеку

@@ -24,6 +24,9 @@ func GdybRegistRouters() {
24 24
 	beego.Router("/gdyb/seven", &GdybController{}, "get:PostSeven")
25 25
 	beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight")
26 26
 	beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine")
27
+
28
+	//beego.Router("/gdyb/tem", &GdybController{}, "get:PostTen")
29
+
27 30
 }
28 31
 
29 32
 //provinces, _ := service.GetDistrictsByUpid(0)21
@@ -65,15 +68,14 @@ type Result struct {
65 68
 
66 69
 func (c *GdybController) PostOne() {
67 70
 	certNo := c.GetString("cert_no")
68
-	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)
69 75
 
70 76
 	var dat map[string]interface{}
71 77
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
72
-		fmt.Println("11111")
73
-		fmt.Println(dat)
74
-		//fmt.Println(dat["status"])
75 78
 	} else {
76
-		fmt.Println(err)
77 79
 	}
78 80
 
79 81
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -85,15 +87,17 @@ func (c *GdybController) PostTwo() {
85 87
 	psnNo := c.GetString("psn_no")
86 88
 	insutype := c.GetString("insutype")
87 89
 	certNo := c.GetString("cert_no")
88
-	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)
89 96
 
90 97
 	var dat map[string]interface{}
91 98
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
92
-		fmt.Println("22222222")
93
-		fmt.Println(dat)
94 99
 		//fmt.Println(dat["status"])
95 100
 	} else {
96
-		fmt.Println(err)
97 101
 	}
98 102
 
99 103
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -104,7 +108,11 @@ func (c *GdybController) PostTwo() {
104 108
 func (c *GdybController) PostThree() {
105 109
 	psnNo := c.GetString("psn_no")
106 110
 	mdtrtId := c.GetString("mdtrt_id")
107
-	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)
108 116
 	c.ServeSuccessJSON(map[string]interface{}{
109 117
 		"pre": result,
110 118
 	})
@@ -113,7 +121,12 @@ func (c *GdybController) PostThree() {
113 121
 func (c *GdybController) PostFour() {
114 122
 	psnNo := c.GetString("psn_no")
115 123
 	mdtrtId := c.GetString("mdtrt_id")
116
-	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)
117 130
 	c.ServeSuccessJSON(map[string]interface{}{
118 131
 		"pre": result,
119 132
 	})
@@ -156,7 +169,7 @@ func (c *GdybController) PostFive() {
156 169
 		utils.ErrorLog("解析失败:%v", err)
157 170
 		return
158 171
 	}
159
-	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))
160 173
 
161 174
 	var dat map[string]interface{}
162 175
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -173,7 +186,10 @@ func (c *GdybController) PostSix() {
173 186
 	psnNo := c.GetString("psn_no")
174 187
 	mdtrtId := c.GetString("mdtrt_id")
175 188
 	chrgBchno := c.GetString("chrg_bchno")
176
-	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)
177 193
 
178 194
 	c.ServeSuccessJSON(map[string]interface{}{
179 195
 		"pre": result,
@@ -187,8 +203,10 @@ func (c *GdybController) PostSeven() {
187 203
 	certNo := c.GetString("cert_no")
188 204
 	insutype := c.GetString("insutype")
189 205
 	total := c.GetString("total")
206
+	org_name := c.GetString("org_name")
207
+	doctor := c.GetString("doctor")
190 208
 
191
-	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total)
209
+	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor)
192 210
 	var dat map[string]interface{}
193 211
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
194 212
 		fmt.Println(dat)
@@ -207,7 +225,10 @@ func (c *GdybController) PostEight() {
207 225
 	certNo := c.GetString("cert_no")
208 226
 	insutype := c.GetString("insutype")
209 227
 	total := c.GetString("total")
210
-	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)
211 232
 	var dat map[string]interface{}
212 233
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
213 234
 		fmt.Println(dat)
@@ -224,8 +245,21 @@ func (c *GdybController) PostNine() {
224 245
 	psnNo := c.GetString("psn_no")
225 246
 	mdtrtId := c.GetString("mdtrt_id")
226 247
 	setlId := c.GetString("setl_id")
227
-	result := service.Gdyb2208(psnNo, mdtrtId, setlId)
248
+	org_name := c.GetString("org_name")
249
+	doctor := c.GetString("doctor")
250
+
251
+	result := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor)
228 252
 	c.ServeSuccessJSON(map[string]interface{}{
229 253
 		"pre": result,
230 254
 	})
231 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
+//}

+ 40 - 12
controllers/his_api_controller.go Прегледај датотеку

@@ -106,11 +106,14 @@ func (c *HisApiController) GetHisPatientInfo() {
106 106
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
107 107
 	prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
108 108
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
109
+	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
110
+
109 111
 	c.ServeSuccessJSON(map[string]interface{}{
110 112
 		"his_info":     his_patient_info,
111 113
 		"xt_info":      xt_patient_info,
112 114
 		"prescription": prescriptions,
113 115
 		"case_history": case_history,
116
+		"info":         patientPrescriptionInfo,
114 117
 	})
115 118
 	return
116 119
 
@@ -145,8 +148,8 @@ func (c *HisApiController) CreateHisPrescription() {
145 148
 
146 149
 	diagnose := c.GetString("diagnose")
147 150
 	sick_history := c.GetString("sick_history")
148
-	doctor, _ := c.GetInt64("doctor")
149
-	department, _ := c.GetInt64("department")
151
+	doctor := c.GetString("doctor")
152
+	department := c.GetString("department")
150 153
 	his_patient_id, _ := c.GetInt64("his_patient_id")
151 154
 	dataBody := make(map[string]interface{}, 0)
152 155
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
@@ -710,8 +713,19 @@ func (c *HisApiController) GetRegisterInfo() {
710 713
 	id, _ := c.GetInt64("id")
711 714
 	record_time := c.GetString("record_time")
712 715
 
716
+	timeLayout := "2006-01-02"
717
+	loc, _ := time.LoadLocation("Local")
718
+
719
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
720
+	if err != nil {
721
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
722
+		return
723
+	}
724
+	recordDateTime := theTime.Unix()
725
+
713 726
 	adminInfo := c.GetAdminUserInfo()
714 727
 	patient, _ := service.GetPatientByID(adminInfo.CurrentOrgId, id)
728
+	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
715 729
 
716 730
 	if patient == nil {
717 731
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
@@ -722,15 +736,9 @@ func (c *HisApiController) GetRegisterInfo() {
722 736
 		return
723 737
 	}
724 738
 
725
-	timeLayout := "2006-01-02"
726
-	loc, _ := time.LoadLocation("Local")
727
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
728
-	if err != nil {
729
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
730
-		return
731
-	}
739
+	org, _ := service.GetOrgById(adminInfo.CurrentOrgId)
732 740
 
733
-	api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo
741
+	api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor
734 742
 	resp, requestErr := http.Get(api)
735 743
 
736 744
 	if requestErr != nil {
@@ -786,9 +794,18 @@ func (c *HisApiController) GetRegisterInfo() {
786 794
 		return
787 795
 	}
788 796
 
797
+	timestamp := time.Now().Unix()
798
+	tempTime := time.Unix(timestamp, 0)
799
+	timeFormat := tempTime.Format("20060102150405")
800
+	chrgBchno := rand.Intn(100000) + 10000
801
+	ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
802
+
789 803
 	count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
790 804
 	if count <= 0 {
791
-		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
805
+		api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
806
+			res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
807
+			"&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
808
+			"&dept=" + patientPrescription.Departments
792 809
 		resp, requestErr := http.Get(api)
793 810
 		if requestErr != nil {
794 811
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -945,6 +962,8 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
945 962
 	if json["project_id"] != nil || reflect.TypeOf(json["project_id"]).String() == "float64" {
946 963
 		project_id := int64(json["project_id"].(float64))
947 964
 		project.ProjectId = project_id
965
+		fmt.Println(project_id)
966
+		fmt.Println(project.ProjectId)
948 967
 	}
949 968
 
950 969
 	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
@@ -1028,12 +1047,19 @@ func (c *HisApiController) GetUploadInfo() {
1028 1047
 	chrgBchno := rand.Intn(100000) + 10000
1029 1048
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
1030 1049
 
1050
+	org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1051
+	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1052
+
1031 1053
 	client := &http.Client{}
1032 1054
 	data := make(map[string]interface{})
1033 1055
 	data["psn_no"] = his.PsnNo
1034 1056
 	data["mdtrt_id"] = his.Number
1035 1057
 	data["pre"] = prescriptions
1036 1058
 	data["chrg_bchno"] = chrg_bchno
1059
+	data["org_name"] = org.OrgName
1060
+	data["doctor"] = patientPrescription.Doctor
1061
+	data["dept"] = patientPrescription.Departments
1062
+
1037 1063
 	bytesData, _ := json.Marshal(data)
1038 1064
 	req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
1039 1065
 	resp, _ := client.Do(req)
@@ -1152,6 +1178,8 @@ func (c *HisApiController) GetUploadInfo() {
1152 1178
 			}
1153 1179
 		}
1154 1180
 
1181
+		org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1182
+		patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1155 1183
 		allTotal := fmt.Sprintf("%.2f", total)
1156 1184
 		if res.Infcode == 0 {
1157 1185
 			var rf []*ResultFive
@@ -1163,7 +1191,7 @@ func (c *HisApiController) GetUploadInfo() {
1163 1191
 			insutype := rf[0].Insutype
1164 1192
 			api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1165 1193
 				insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1166
-				"&total=" + allTotal
1194
+				"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor
1167 1195
 			resp, requestErr := http.Get(api)
1168 1196
 
1169 1197
 			if requestErr != nil {

+ 33 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Прегледај датотеку

@@ -713,6 +713,39 @@ func (c *CheckWeightApiController) GetPatientList() {
713 713
 		"servicetime": serviceTime,
714 714
 	})
715 715
 }
716
+
717
+func (c *CheckWeightApiController) GetPatientListForSchedules() {
718
+	thisTime := time.Now()
719
+	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
720
+	timeLayout := "2006-01-02 15:04:05"
721
+	loc, _ := time.LoadLocation("Local")
722
+	theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
723
+	syncTime := theStartTime.Unix()
724
+	adminUserInfo := c.GetMobileAdminUserInfo()
725
+	patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
726
+	patientSchedule := make([]map[string]interface{},0)
727
+	for _, item := range patientList {
728
+		patientTemp := make(map[string]interface{})
729
+		patientTemp["patient_id"] = item.PatientId
730
+		patientTemp["patient_name"] = item.Patient.Name
731
+		patientTemp["schedule_type"] = item.ScheduleType
732
+		patientSchedule = append(patientSchedule, patientTemp)
733
+	}
734
+
735
+	if error != nil {
736
+		c.ErrorLog("获取病人列表失败:%v", error)
737
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
738
+		return
739
+	}
740
+	serviceTime := time.Now().Unix()
741
+	c.ServeSuccessJSON(map[string]interface{}{
742
+		"patientlist": patientSchedule,
743
+		"total":       total,
744
+		"servicetime": serviceTime,
745
+	})
746
+}
747
+
748
+
716 749
 func (c *CheckWeightApiController) GetPatientListById() {
717 750
 	patientId, _ := c.GetInt64("patient_id", 0)
718 751
 	if patientId <= 0 {

+ 3 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Прегледај датотеку

@@ -367,6 +367,8 @@ func (this *DialysisAPIController) DialysisRecord() {
367 367
 
368 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 372
 	if getLPEErr != nil {
371 373
 		this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
372 374
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -412,6 +414,7 @@ func (this *DialysisAPIController) DialysisRecord() {
412 414
 		"config":                         gobalConfig,
413 415
 		"dry_weight":                     lastDryWeightDislysis,
414 416
 		"system_prescription":            systemDialysisPrescribe,
417
+		"his_advices":                    his_advices,
415 418
 	}
416 419
 	this.ServeSuccessJSON(returnData)
417 420
 }

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Прегледај датотеку

@@ -12,6 +12,7 @@ func MobileAPIControllersRegisterRouters() {
12 12
 	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
13 13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14 14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15
+	beego.Router("/m/api/getschedulepatient", &CheckWeightApiController{}, "get:GetPatientListForSchedules")
15 16
 	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
16 17
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
17 18
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")

+ 3 - 3
models/his_models.go Прегледај датотеку

@@ -256,8 +256,8 @@ type HisPrescriptionInfo struct {
256 256
 	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
257 257
 	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
258 258
 	RegisterType int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
259
-	Doctor       int64  `gorm:"column:doctor" json:"doctor" form:"doctor"`
260
-	Departments  int64  `gorm:"column:departments" json:"departments" form:"departments"`
259
+	Doctor       string `gorm:"column:doctor" json:"doctor" form:"doctor"`
260
+	Departments  string `gorm:"column:departments" json:"departments" form:"departments"`
261 261
 	SickHistory  string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
262 262
 }
263 263
 
@@ -276,7 +276,7 @@ type HisPrescription struct {
276 276
 	Mtime                  int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
277 277
 	Number                 string                    `gorm:"column:number" json:"number" form:"number"`
278 278
 	Type                   int64                     `gorm:"column:type" json:"type" form:"type"`
279
-	Doctor                 int64                     `gorm:"column:doctor" json:"doctor" form:"doctor"`
279
+	Doctor                 string                    `gorm:"column:doctor" json:"doctor" form:"doctor"`
280 280
 	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
281 281
 	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
282 282
 	IsFinish               int64                     `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`

+ 22 - 0
models/schedule_models.go Прегледај датотеку

@@ -28,6 +28,28 @@ func (Schedule) TableName() string {
28 28
 	return "xt_schedule"
29 29
 }
30 30
 
31
+type SchedulePatients struct {
32
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
33
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
34
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
35
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
36
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
37
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
38
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
39
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
40
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
41
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
42
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
43
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
44
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
45
+	Patient      PatientListForFace        `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
46
+}
47
+
48
+func (SchedulePatients) TableName() string {
49
+	return "xt_schedule"
50
+}
51
+
52
+
31 53
 type PatientSchedule struct {
32 54
 	Schedule
33 55
 

+ 281 - 31
service/gdyb_service.go Прегледај датотеку

@@ -21,14 +21,14 @@ const (
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 26
 	nonce := GetRandomString(32)
27 27
 	timestamp := time.Now().Unix()
28 28
 	signature := setSignature(timestamp, nonce)
29 29
 
30 30
 	// 生成输入报文
31
-	inputMessage := SetInputMessage(nonce, timestamp)
31
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
32 32
 	input := make(map[string]interface{})
33 33
 	inputData := make(map[string]interface{})
34 34
 	inputMessage["infno"] = "1101"      // 交易编码
@@ -80,7 +80,7 @@ func Gdyb1101(certNo string) string {
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 85
 	nonce := GetRandomString(32)
86 86
 	timestamp := time.Now().Unix()
@@ -89,7 +89,7 @@ func Gdyb2201(psnNo string, insutype string, certNo string) string {
89 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 93
 	input := make(map[string]interface{})
94 94
 	inputData := make(map[string]interface{})
95 95
 	inputMessage["infno"] = "2201"        // 交易编码
@@ -98,11 +98,11 @@ func Gdyb2201(psnNo string, insutype string, certNo string) string {
98 98
 	inputData["begntime"] = timeFormatOne // 开始时间
99 99
 	inputData["mdtrt_cert_type"] = "02"   // 就诊凭证类型
100 100
 	inputData["mdtrt_cert_no"] = certNo   // 就诊凭证编号
101
-	inputData["ipt_otp_no"] = "10000110"  // 住院/门诊号
101
+	inputData["ipt_otp_no"] = ipt_otp_no  // 住院/门诊号
102 102
 	inputData["atddr_no"] = "1002"        // 医师编码
103
-	inputData["dr_name"] = "刘志刚"          // 医师姓名
103
+	inputData["dr_name"] = doctor         // 医师姓名
104 104
 	inputData["dept_code"] = "3002"       // 科室编码
105
-	inputData["dept_name"] = "血透中心"       // 科室名称
105
+	inputData["dept_name"] = dept         // 科室名称
106 106
 	inputData["caty"] = "A03.06"          // 科别
107 107
 
108 108
 	input["data"] = inputData
@@ -146,20 +146,20 @@ func Gdyb2201(psnNo string, insutype string, certNo string) string {
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 151
 	nonce := GetRandomString(32)
152 152
 	timestamp := time.Now().Unix()
153 153
 	signature := setSignature(timestamp, nonce)
154 154
 
155 155
 	// 生成输入报文
156
-	inputMessage := SetInputMessage(nonce, timestamp)
156
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
157 157
 	input := make(map[string]interface{})
158 158
 	inputData := make(map[string]interface{})
159 159
 	inputMessage["infno"] = "2202"       // 交易编码
160 160
 	inputData["psn_no"] = psnNo          // 人员编号 (来自1101接口返回)
161 161
 	inputData["mdtrt_id"] = mdtrtId      // 就诊 ID(来自2201接口返回)
162
-	inputData["ipt_otp_no"] = "10000110" // 住院/门诊号
162
+	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
163 163
 
164 164
 	input["data"] = inputData
165 165
 	inputMessage["input"] = input //交易输入
@@ -202,7 +202,7 @@ func Gdyb2202(psnNo string, mdtrtId string) string {
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 207
 	nonce := GetRandomString(32)
208 208
 	timestamp := time.Now().Unix()
@@ -211,7 +211,7 @@ func Gdyb2203(psnNo string, mdtrtId string) string {
211 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 215
 	input := make(map[string]interface{})
216 216
 	inputData := make(map[string]interface{})
217 217
 	diseinfo := make([]map[string]interface{}, 0)
@@ -231,10 +231,10 @@ func Gdyb2203(psnNo string, mdtrtId string) string {
231 231
 	diseinfo_sun["diag_type"] = "1"           // 诊断类别
232 232
 	diseinfo_sun["diag_srt_no"] = "1"         // 诊断排序号
233 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 236
 	diseinfo_sun["dise_dor_no"] = "1002"      // 诊断医生编码
237
-	diseinfo_sun["dise_dor_name"] = "马桂平"     // 诊断医生姓名
237
+	diseinfo_sun["dise_dor_name"] = doctor    // 诊断医生姓名
238 238
 	diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
239 239
 	diseinfo_sun["vali_flag"] = "1"           // 有效标志
240 240
 
@@ -335,7 +335,7 @@ type Result struct {
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 340
 	nonce := GetRandomString(32)
341 341
 	timestamp := time.Now().Unix()
@@ -374,6 +374,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
374 374
 					Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
375 375
 					FeedetlSn:        subItem.FeedetlSn,
376 376
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
377
+					MedListCodg:      subItem.MedListCodg,
377 378
 				}
378 379
 				fmt.Println(cus.FeedetlSn)
379 380
 
@@ -385,7 +386,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
385 386
 	fmt.Println(customs)
386 387
 
387 388
 	// 生成输入报文
388
-	inputMessage := SetInputMessage(nonce, timestamp)
389
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
389 390
 	input := make(map[string]interface{})
390 391
 	feedetail := make([]map[string]interface{}, 0)
391 392
 	inputMessage["infno"] = "2204" // 交易编码
@@ -411,9 +412,9 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
411 412
 		feedetailInfo["prd_days"] = "0"                              // 周期天数
412 413
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
413 414
 		feedetailInfo["bilg_dept_codg"] = "3002"                     // 开单科室编码
414
-		feedetailInfo["bilg_dept_name"] = "血透中心"                     // 开单科室名称
415
+		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
415 416
 		feedetailInfo["bilg_dr_codg"] = "1002"                       // 开单医生编码
416
-		feedetailInfo["bilg_dr_name"] = "刘志刚"                        // 开单医师姓名
417
+		feedetailInfo["bilg_dr_name"] = doctor                       // 开单医师姓名
417 418
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
418 419
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
419 420
 		feedetailInfo["orders_dr_code"] = ""                         // 受单医生编码
@@ -471,14 +472,14 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
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 477
 	nonce := GetRandomString(32)
477 478
 	timestamp := time.Now().Unix()
478 479
 	signature := setSignature(timestamp, nonce)
479 480
 
480 481
 	// 生成输入报文
481
-	inputMessage := SetInputMessage(nonce, timestamp)
482
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
482 483
 	input := make(map[string]interface{})
483 484
 	inputData := make(map[string]interface{})
484 485
 	inputMessage["infno"] = "2205" // 交易编码
@@ -531,20 +532,20 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string) string {
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 537
 	nonce := GetRandomString(32)
537 538
 	timestamp := time.Now().Unix()
538 539
 	signature := setSignature(timestamp, nonce)
539 540
 
540 541
 	// 生成输入报文
541
-	inputMessage := SetInputMessage(nonce, timestamp)
542
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
542 543
 	input := make(map[string]interface{})
543 544
 	inputData := make(map[string]interface{})
544 545
 	inputMessage["infno"] = "2206" // 交易编码
545 546
 
546 547
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
547
-	inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
548
+	inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型,
548 549
 	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
549 550
 	inputData["med_type"] = "11"        // 医疗类别 11 普通门诊  12 门诊挂号
550 551
 	inputData["medfee_sumamt"] = total  // 医疗费总额
@@ -595,14 +596,14 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
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 601
 	nonce := GetRandomString(32)
601 602
 	timestamp := time.Now().Unix()
602 603
 	signature := setSignature(timestamp, nonce)
603 604
 
604 605
 	// 生成输入报文
605
-	inputMessage := SetInputMessage(nonce, timestamp)
606
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
606 607
 	input := make(map[string]interface{})
607 608
 	inputData := make(map[string]interface{})
608 609
 	inputMessage["infno"] = "2207" // 交易编码
@@ -660,14 +661,14 @@ func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
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 666
 	nonce := GetRandomString(32)
666 667
 	timestamp := time.Now().Unix()
667 668
 	signature := setSignature(timestamp, nonce)
668 669
 
669 670
 	// 生成输入报文
670
-	inputMessage := SetInputMessage(nonce, timestamp)
671
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
671 672
 	input := make(map[string]interface{})
672 673
 	inputData := make(map[string]interface{})
673 674
 	inputMessage["infno"] = "2208" // 交易编码
@@ -716,6 +717,200 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string) string {
716 717
 	return str
717 718
 }
718 719
 
720
+//  门诊结算撤销
721
+func Gdyb4101(psnNo string, mdtrtId string, setlId string) string {
722
+	// 生成签名
723
+	nonce := GetRandomString(32)
724
+	timestamp := time.Now().Unix()
725
+	signature := setSignature(timestamp, nonce)
726
+
727
+	// 生成输入报文
728
+	inputMessage := SetInputMessage(nonce, timestamp)
729
+	input := make(map[string]interface{})
730
+	inputData := make(map[string]interface{})
731
+	inputMessage["infno"] = "4101" // 交易编码
732
+
733
+	inputData["mdtrt_id"] = mdtrtId // 就诊 ID  必填(来自2201接口返回)
734
+	inputData["setl_id"] = setlId   // 结算 ID  必填
735
+	inputData["fixmedins_name"] = ""   // 定点医药机构名称  必填
736
+	inputData["fixmedins_code"] = ""   // 定点医药机构编码  必填
737
+	inputData["hi_setl_lv"] = ""   // 医保结算等级
738
+	inputData["hi_no"] = ""   // 医保编号
739
+	inputData["medcasno"] = ""   // 病案号  必填
740
+	inputData["dcla_time"] = ""   // 申报时间  必填
741
+	inputData["psn_name"] = ""   // 人员姓名  必填
742
+	inputData["gend"] = ""   // 性别  必填
743
+	inputData["brdy"] = ""   // 出生日期  必填
744
+	inputData["age"] = ""   // 年龄  必填
745
+	inputData["ntly"] = ""   // 国籍  必填
746
+	inputData["nwb_age"] = ""   // 年龄  必填
747
+	inputData["naty"] = ""   // 民族  必填
748
+	inputData["patn_cert_type"] = ""   // 患者证件类别  必填
749
+	inputData["certno"] = ""   // 证件号码  必填
750
+	inputData["prfs"] = ""   // 职业  必填
751
+	inputData["curr_addr"] = ""   // 现住址  必填
752
+	inputData["emp_name"] = ""   // 单位名称  必填
753
+	inputData["emp_addr"] = ""   // 单位地址  必填
754
+	inputData["emp_tel"] = ""   // 单位电话  必填
755
+	inputData["poscode"] = ""   // 邮编  必填
756
+	inputData["coner_name"] = ""   // 联系人姓名  必填
757
+	inputData["patn_rlts"] = ""   // 与患者关系  必填
758
+	inputData["coner_addr"] = ""   // 联系人地址  必填
759
+	inputData["coner_tel"] = ""   // 联系人电话  必填
760
+	inputData["hi_type"] = ""   // 医保类型  必填
761
+	inputData["insuplc"] = ""   // 参保地  必填
762
+	inputData["sp_psn_type"] = ""   // 特殊人员类型  必填
763
+	inputData["nwb_adm_type"] = ""   // 新生儿入院类型  必填
764
+	inputData["nwb_bir_wt"] = ""   // 新生儿出生体重  必填
765
+	inputData["nwb_adm_wt"] = ""   // 新生儿入院体重  必填
766
+	inputData["opsp_diag_caty"] = ""   // 门诊慢特病诊断  必填
767
+	inputData["opsp_mdtrt_date"] = ""   // 门诊慢特病就诊日期  必填
768
+	inputData["ipt_med_type"] = ""   // 住院医疗类型  必填
769
+	inputData["adm_way"] = ""   // 入院途径  必填
770
+	inputData["trt_type"] = ""   // 治疗类别  必填
771
+	inputData["adm_time"] = ""   // 入院时间  必填
772
+	inputData["adm_caty"] = ""   // 入院科别  必填
773
+	inputData["refldept_dept"] = ""   // 转科科别  必填
774
+	inputData["dscg_time"] = ""   // 出院时间  必填
775
+	inputData["dscg_caty"] = ""   // 出院科别  必填
776
+	inputData["act_ipt_days"] = ""   // 实际住院天数  必填
777
+	inputData["otp_wm_dise"] = ""   // 门(急) 诊西医诊断  必填
778
+	inputData["wm_dise_code"] = ""   // 门(急) 诊中医诊断  必填
779
+	inputData["otp_tcm_dise"] = ""   // 西医诊断疾病代码  必填
780
+	inputData["tcm_dise_code"] = ""   // 中医诊断代码  必填
781
+	inputData["oprn_oprt_code_cnt"] = ""   // 手术操作代码计数  必填
782
+	inputData["vent_used_dura"] = ""   // 呼吸机使用时长  必填
783
+	inputData["pwcry_bfadm_coma_dura"] = ""   // 颅脑损伤患者入院前昏迷时长  必填
784
+	inputData["pwcry_afadm_coma_dura"] = ""   // 颅脑损伤患者入院后昏迷时长  必填
785
+	inputData["bld_cat"] = ""   // 输血品种  必填
786
+	inputData["bld_amt"] = ""   // 输血量  必填
787
+	inputData["bld_unt"] = ""   // 输血计量单位  必填
788
+	inputData["spga_nurscare_days"] = ""   // 特级护理天数  必填
789
+	inputData["lv1_nurscare_days"] = ""   // 一级护理天数  必填
790
+	inputData["scd_nurscare_days"] = ""   // 二级护理天数  必填
791
+	inputData["lv3_nurscare_days"] = ""   // 三级护理天数  必填
792
+	inputData["acp_medins_name"] = ""   // 拟接收机构名称  必填
793
+	inputData["acp_optins_code"] = ""   // 拟接收机构代码  必填
794
+	inputData["bill_code"] = ""   // 票据代码  必填
795
+	inputData["bill_no"] = ""   // 票据号码  必填
796
+	inputData["biz_sn"] = ""   // 业务流水号  必填
797
+	inputData["days_rinp_flag_31"] = ""   // 出院 31 天内再住院计划标志  必填
798
+	inputData["days_rinp_pup_31"] = ""   // 出院 31 天内再住院目的  必填
799
+	inputData["chfpdr_name"] = ""   // 主诊医师姓名  必填
800
+	inputData["chfpdr_code"] = ""   // 主诊医师代码  必填
801
+	inputData["setl_begn_date"] = ""   // 结算开始日期  必填
802
+	inputData["setl_end_date"] = ""   // 结算结束日期  必填
803
+	inputData["psn_selfpay"] = ""   // 个人自付  必填
804
+	inputData["psn_ownpay"] = ""   // 个人自费  必填
805
+	inputData["acct_pay"] = ""   // 个人账户支出  必填
806
+	inputData["hi_paymtd"] = ""   // 医保支付方式  必填
807
+	inputData["hsorg"] = ""   // 医保机构  必填
808
+	inputData["hsorg_opter"] = ""   // 医保机构经办人  必填
809
+	inputData["medins_fill_dept"] = ""   // 医疗机构填报部门  必填
810
+	inputData["medins_fill_psn"] = ""   // 医疗机构填报人  必填
811
+
812
+	payinfo := make([]map[string]interface{},0)  // 基金支付信息
813
+	payinfotemp := make(map[string]interface{})
814
+	payinfotemp["fund_pay_type"] =  "" // 基金支付类型  必填
815
+	payinfotemp["fund_payamt"] = ""    // 基金支付金额
816
+	payinfo = append(payinfo,payinfotemp)
817
+
818
+	opspdiseinfo := make([]map[string]interface{},0) // 门诊慢特病诊断信息
819
+	opspdiseinfotemp := make(map[string]interface{})
820
+	opspdiseinfotemp["diag_name"] =  "" // 诊断名称  必填
821
+	opspdiseinfotemp["diag_code"] = ""    // 诊断代码 必填
822
+	opspdiseinfotemp["oprn_oprt_name"] = ""    // 手术操作名称 必填
823
+	opspdiseinfotemp["oprn_oprt_code"] = ""    // 手术操作代码 必填
824
+	opspdiseinfo = append(opspdiseinfo,opspdiseinfotemp)
825
+
826
+	diseinfo := make([]map[string]interface{},0) // 住院诊断信息
827
+	diseinfotemp := make(map[string]interface{})
828
+	diseinfotemp["diag_type"] =  "" // 诊断类别  必填
829
+	diseinfotemp["diag_code"] = ""    // 诊断代码 必填
830
+	diseinfotemp["diag_name"] = ""    // 诊断名称 必填
831
+	diseinfotemp["adm_cond_type"] = ""    // 入院病情类型 必填
832
+	diseinfo = append(diseinfo,diseinfotemp)
833
+
834
+	iteminfo := make([]map[string]interface{},0) // 住院诊断信息
835
+	iteminfotemp := make(map[string]interface{})
836
+	iteminfotemp["med_chrgitm"] =  "" // 医疗收费项目  必填
837
+	iteminfotemp["amt"] = ""    // 金额 必填
838
+	iteminfotemp["claa_sumfee"] = ""    // 甲类费用合计 必填
839
+	iteminfotemp["clab_amt"] = ""    // 乙类金额 必填
840
+	iteminfotemp["fulamt_ownpay_amt"] = ""    // 全自费金额 必填
841
+	iteminfotemp["oth_amt"] = ""    // 其他金额 必填
842
+	iteminfo = append(iteminfo,iteminfotemp)
843
+
844
+	oprninfo := make([]map[string]interface{},0) // 手术操作信息
845
+	oprninfotemp := make(map[string]interface{})
846
+	oprninfotemp["oprn_oprt_type"] =  "" // 手术操作类别  必填
847
+	oprninfotemp["oprn_oprt_name"] = ""    // 手术操作名称 必填
848
+	oprninfotemp["oprn_oprt_code"] = ""    // 手术操作代码 必填
849
+	oprninfotemp["oprn_oprt_date"] = ""    // 手术操作日期 必填
850
+	oprninfotemp["anst_way"] = ""    // 麻醉方式 必填
851
+	oprninfotemp["oper_dr_name"] = ""    // 术者医师姓名 必填
852
+	oprninfotemp["oper_dr_code"] = ""    // 术者医师代码 必填
853
+	oprninfotemp["anst_dr_name"] = ""    // 麻醉医师姓名 必填
854
+	oprninfotemp["anst_dr_code"] = ""    // 麻醉医师代码 必填
855
+	oprninfo = append(oprninfo,iteminfotemp)
856
+
857
+	icuinfo := make([]map[string]interface{},0) // 重症监护信息
858
+	icuinfotemp := make(map[string]interface{})
859
+	icuinfotemp["scs_cutd_ward_type"] =  "" // 重症监护病房类型  必填
860
+	icuinfotemp["scs_cutd_inpool_time"] = ""    // 重症监护进入时间 必填
861
+	icuinfotemp["scs_cutd_exit_time"] = ""    // 重症监护退出时间 必填
862
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
863
+	icuinfo = append(icuinfo,iteminfotemp)
864
+
865
+
866
+
867
+
868
+	input["setlinfo"] = inputData
869
+	input["payinfo"] = payinfo
870
+	input["opspdiseinfo"] = opspdiseinfo
871
+	input["diseinfo"] = diseinfo
872
+	input["iteminfo"] = iteminfo
873
+	input["oprninfo"] = oprninfo
874
+	input["icuinfo"] = icuinfo
875
+	inputMessage["input"] = input //交易输入
876
+
877
+	bytesData, err := json.Marshal(inputMessage)
878
+	fmt.Println(string(bytesData))
879
+	if err != nil {
880
+		fmt.Println(err.Error())
881
+		return err.Error()
882
+	}
883
+	reader := bytes.NewReader(bytesData)
884
+
885
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
886
+	request, err := http.NewRequest("POST", url, reader)
887
+	if err != nil {
888
+		fmt.Println(err.Error())
889
+		return err.Error()
890
+	}
891
+
892
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
893
+	request.Header.Set("x-tif-paasid", "test_hosp")
894
+	request.Header.Set("x-tif-signature", signature)
895
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
896
+	request.Header.Set("x-tif-nonce", nonce)
897
+
898
+	client := http.Client{}
899
+	resp, err := client.Do(request)
900
+	if err != nil {
901
+		fmt.Println(err.Error())
902
+		return err.Error()
903
+	}
904
+	respBytes, err := ioutil.ReadAll(resp.Body)
905
+	if err != nil {
906
+		fmt.Println(err.Error())
907
+		return err.Error()
908
+	}
909
+	str := string(respBytes)
910
+	fmt.Println(str)
911
+	return str
912
+}
913
+
719 914
 // 生成签名
720 915
 func setSignature(timestamp int64, nonce string) string {
721 916
 	str := strconv.FormatInt(timestamp, 10) + SceretKey + nonce + strconv.FormatInt(timestamp, 10)
@@ -743,7 +938,7 @@ func GetRandomString(l int) string {
743 938
 }
744 939
 
745 940
 // 生成基础报文
746
-func SetInputMessage(nonce string, timestamp int64) map[string]interface{} {
941
+func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string) map[string]interface{} {
747 942
 	// 生成签名
748 943
 	tempTime := time.Unix(timestamp, 0)
749 944
 	timeFormat := tempTime.Format("20060102150405")
@@ -765,10 +960,10 @@ func SetInputMessage(nonce string, timestamp int64) map[string]interface{} {
765 960
 	inputMessage["infver"] = "V1.1"                                                            // 接收方系统代码
766 961
 	inputMessage["opter_type"] = "1"                                                           // 经办人类别
767 962
 	inputMessage["opter"] = "mockuser"                                                         // 经办人
768
-	inputMessage["opter_name"] = "测试用户"                                                        // 经办人姓名
963
+	inputMessage["opter_name"] = doctor                                                        // 经办人姓名
769 964
 	inputMessage["inf_time"] = timeFormatOne                                                   // 交易时间
770 965
 	inputMessage["fixmedins_code"] = FixmedinsCOde                                             // 定点医药机构编号
771
-	inputMessage["fixmedins_name"] = "翁源沅胜血液透析中心"                                              //定点医药机构名称
966
+	inputMessage["fixmedins_name"] = org_name                                                  //定点医药机构名称
772 967
 	inputMessage["sign_no"] = ""                                                               //交易签到流水号
773 968
 	return inputMessage
774 969
 }
@@ -779,3 +974,58 @@ func FindHisRegisterRecord(record_time int64, patient_id int64, org_id int64) (t
779 974
 
780 975
 	return
781 976
 }
977
+
978
+func Gdyb1201(psnNo string, org_name string, doctor string) string {
979
+	// 生成签名
980
+	nonce := GetRandomString(32)
981
+	timestamp := time.Now().Unix()
982
+	signature := setSignature(timestamp, nonce)
983
+
984
+	// 生成输入报文
985
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
986
+	input := make(map[string]interface{})
987
+	inputData := make(map[string]interface{})
988
+	inputMessage["infno"] = "1201"             // 交易编码
989
+	inputData["fixmedins_type"] = psnNo        // 人员编号 (来自1101接口返回)
990
+	inputData["fixmedins_name"] = "翁源沅胜血液透析中心" // 人员编号 (来自1101接口返回)
991
+	inputData["fixmedins_code"] = ""           // 人员编号 (来自1101接口返回)
992
+
993
+	input["medinsinfo"] = inputData
994
+	inputMessage["input"] = input //交易输入
995
+
996
+	bytesData, err := json.Marshal(inputMessage)
997
+	fmt.Println(string(bytesData))
998
+	if err != nil {
999
+		fmt.Println(err.Error())
1000
+		return err.Error()
1001
+	}
1002
+	reader := bytes.NewReader(bytesData)
1003
+
1004
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
1005
+	request, err := http.NewRequest("POST", url, reader)
1006
+	if err != nil {
1007
+		fmt.Println(err.Error())
1008
+		return err.Error()
1009
+	}
1010
+
1011
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1012
+	request.Header.Set("x-tif-paasid", "test_hosp")
1013
+	request.Header.Set("x-tif-signature", signature)
1014
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1015
+	request.Header.Set("x-tif-nonce", nonce)
1016
+
1017
+	client := http.Client{}
1018
+	resp, err := client.Do(request)
1019
+	if err != nil {
1020
+		fmt.Println(err.Error())
1021
+		return err.Error()
1022
+	}
1023
+	respBytes, err := ioutil.ReadAll(resp.Body)
1024
+	if err != nil {
1025
+		fmt.Println(err.Error())
1026
+		return err.Error()
1027
+	}
1028
+	str := string(respBytes)
1029
+	fmt.Println(str)
1030
+	return str
1031
+}

+ 6 - 0
service/mobile_dialysis_service.go Прегледај датотеку

@@ -1611,3 +1611,9 @@ func GetAssessmentBefor(orgid int64, patientid int64, recorddate int64) (*models
1611 1611
 	}
1612 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
+}

+ 6 - 0
service/patient_service.go Прегледај датотеку

@@ -89,6 +89,12 @@ func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patie
89 89
 	return
90 90
 }
91 91
 
92
+func GetPatientListBySchedules(orgID int64, syncTime int64) (patients []*models.SchedulePatients, total int64, err error) {
93
+	db := readDb.Model(&models.SchedulePatients{}).Where("user_org_id=?  AND  status=1  AND  schedule_date = ?", orgID,syncTime).Preload("Patient", "status = 1 AND user_org_id = ? ", orgID,)
94
+	err = db.Count(&total).Find(&patients).Error
95
+	return
96
+}
97
+
92 98
 func GetPatientListById(orgID int64, patientId int64) (patients models.PatientListForFace, err error) {
93 99
 	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID, patientId).First(&patients).Error
94 100
 	return