Explorar el Código

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

csx hace 4 años
padre
commit
86f00073f8

+ 1 - 1
controllers/base_api_controller.go Ver fichero

@@ -96,7 +96,7 @@ func (this *BaseAuthAPIController) Prepare() {
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
98 98
 		this.SetSession("admin_user_info", &adminUserInfo)
99
-		//
99
+
100 100
 		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101 101
 		//this.StopRun()
102 102
 

+ 6 - 6
controllers/dialysis_api_controller.go Ver fichero

@@ -2537,12 +2537,12 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
2537 2537
 		utils.ErrorLog("len(start_time) == 0")
2538 2538
 		return
2539 2539
 	}
2540
-	//theTimeUnix, err := time.ParseInLocation(timeLayout2, startTime, loc2)
2541
-	//if err != nil {
2542
-	//	utils.ErrorLog(err.Error())
2543
-	//	return
2544
-	//}
2545
-	StartTime := theTime.Unix()
2540
+	theTimeUnix, err := time.ParseInLocation(timeLayout2, startTime, loc2)
2541
+	if err != nil {
2542
+		utils.ErrorLog(err.Error())
2543
+		return
2544
+	}
2545
+	StartTime := theTimeUnix.Unix()
2546 2546
 	fmt.Println("startTIME", StartTime)
2547 2547
 	Remark := ""
2548 2548
 	if dataBody["remark"] != nil && reflect.TypeOf(dataBody["remark"]).String() == "string" {

+ 129 - 29
controllers/his_api_controller.go Ver fichero

@@ -32,6 +32,9 @@ func HisManagerApiRegistRouters() {
32 32
 	beego.Router("/api/advice/delete", &HisApiController{}, "post:DeleteDoctorAdvice")
33 33
 	beego.Router("/api/project/delete", &HisApiController{}, "post:DeleteProject")
34 34
 
35
+	beego.Router("/api/hisprescription/list", &HisApiController{}, "get:GetHisPrescriptionList")
36
+	beego.Router("/api/hisprescription/info", &HisApiController{}, "get:GetHisPrescriptionInfo")
37
+
35 38
 	beego.Router("/api/hisprescription/create", &HisApiController{}, "post:CreateHisPrescription")
36 39
 
37 40
 	beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
@@ -41,6 +44,10 @@ func HisManagerApiRegistRouters() {
41 44
 	beego.Router("/api/doctorworkstation/casehistorytemplate/get", &HisApiController{}, "get:GetCaseHistoryTemplate")
42 45
 	beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
43 46
 
47
+	beego.Router("/api/hisorder/list", &HisApiController{}, "get:GetHisOrderList")
48
+
49
+	beego.Router("/api/hisorder/get", &HisApiController{}, "get:GetHisOrder")
50
+
44 51
 	beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
45 52
 	beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
46 53
 
@@ -168,39 +175,48 @@ func (c *HisApiController) CreateHisPrescription() {
168 175
 	adminInfo := c.GetAdminUserInfo()
169 176
 	recordDateTime := theTime.Unix()
170 177
 
178
+	var randNum int
179
+	randNum = rand.Intn(10000) + 1000
180
+	timestamp := time.Now().Unix()
181
+	tempTime := time.Unix(timestamp, 0)
182
+	timeFormat := tempTime.Format("20060102150405")
183
+	number := timeFormat + strconv.FormatInt(int64(randNum), 10) + strconv.FormatInt(int64(adminInfo.CurrentOrgId), 10) + strconv.FormatInt(int64(patient_id), 10)
184
+
171 185
 	info, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
172 186
 	if info.ID == 0 {
173 187
 		hpInfo := models.HisPrescriptionInfo{
174
-			UserOrgId:    adminInfo.CurrentOrgId,
175
-			RecordDate:   theTime.Unix(),
176
-			PatientId:    patient_id,
177
-			Status:       1,
178
-			Ctime:        time.Now().Unix(),
179
-			Mtime:        time.Now().Unix(),
180
-			Creator:      adminInfo.AdminUser.Id,
181
-			Modifier:     adminInfo.AdminUser.Id,
182
-			Diagnosis:    diagnose,
183
-			SickHistory:  sick_history,
184
-			Departments:  department,
185
-			RegisterType: reg_type,
188
+			UserOrgId:          adminInfo.CurrentOrgId,
189
+			RecordDate:         theTime.Unix(),
190
+			PatientId:          patient_id,
191
+			Status:             1,
192
+			Ctime:              time.Now().Unix(),
193
+			Mtime:              time.Now().Unix(),
194
+			Creator:            adminInfo.AdminUser.Id,
195
+			Modifier:           adminInfo.AdminUser.Id,
196
+			Diagnosis:          diagnose,
197
+			SickHistory:        sick_history,
198
+			Departments:        department,
199
+			RegisterType:       reg_type,
200
+			PrescriptionNumber: number,
186 201
 		}
187 202
 		service.SavePatientPrescriptionInfo(hpInfo)
188 203
 
189 204
 	} else {
190 205
 		hpInfo := models.HisPrescriptionInfo{
191
-			ID:           info.ID,
192
-			UserOrgId:    adminInfo.CurrentOrgId,
193
-			RecordDate:   info.RecordDate,
194
-			PatientId:    info.PatientId,
195
-			Status:       1,
196
-			Ctime:        info.Ctime,
197
-			Mtime:        time.Now().Unix(),
198
-			Creator:      info.Creator,
199
-			Modifier:     adminInfo.AdminUser.Id,
200
-			Diagnosis:    diagnose,
201
-			SickHistory:  sick_history,
202
-			Departments:  department,
203
-			RegisterType: reg_type,
206
+			ID:                 info.ID,
207
+			UserOrgId:          adminInfo.CurrentOrgId,
208
+			RecordDate:         info.RecordDate,
209
+			PatientId:          info.PatientId,
210
+			Status:             1,
211
+			Ctime:              info.Ctime,
212
+			Mtime:              time.Now().Unix(),
213
+			Creator:            info.Creator,
214
+			Modifier:           adminInfo.AdminUser.Id,
215
+			Diagnosis:          diagnose,
216
+			SickHistory:        sick_history,
217
+			Departments:        department,
218
+			RegisterType:       reg_type,
219
+			PrescriptionNumber: info.PrescriptionNumber,
204 220
 		}
205 221
 		service.SavePatientPrescriptionInfo(hpInfo)
206 222
 	}
@@ -901,26 +917,22 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
901 917
 }
902 918
 
903 919
 func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionProject, json map[string]interface{}) int {
904
-
905 920
 	if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
906 921
 		id := int64(json["id"].(float64))
907 922
 		project.ID = id
908 923
 	}
909
-
910 924
 	if json["project_id"] != nil || reflect.TypeOf(json["project_id"]).String() == "float64" {
911 925
 		project_id := int64(json["project_id"].(float64))
912 926
 		project.ProjectId = project_id
913 927
 		fmt.Println(project_id)
914 928
 		fmt.Println(project.ProjectId)
915 929
 	}
916
-
917 930
 	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
918 931
 		price := int64(json["price"].(float64))
919 932
 		formatInt_price := strconv.FormatInt(price, 10)
920 933
 		float_price, _ := strconv.ParseFloat(formatInt_price, 64)
921 934
 		project.Price = float_price
922 935
 	}
923
-
924 936
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
925 937
 		total, _ := json["total"].(string)
926 938
 		totals, _ := strconv.ParseInt(total, 10, 64)
@@ -931,6 +943,23 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
931 943
 		medical_code, _ := json["medical_code"].(string)
932 944
 		project.MedListCodg = medical_code
933 945
 	}
946
+	if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
947
+		single_dose, _ := json["single_dose"].(string)
948
+		project.SingleDose = single_dose
949
+	}
950
+
951
+	if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
952
+		delivery_way, _ := json["delivery_way"].(string)
953
+		project.DeliveryWay = delivery_way
954
+	}
955
+	if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
956
+		execution_frequency, _ := json["execution_frequency"].(string)
957
+		project.ExecutionFrequency = execution_frequency
958
+	}
959
+	if json["number_days"] != nil && reflect.TypeOf(json["number_days"]).String() == "string" {
960
+		day, _ := json["number_days"].(string)
961
+		project.Day = day
962
+	}
934 963
 	return 0
935 964
 }
936 965
 
@@ -1008,6 +1037,11 @@ func (c *HisApiController) GetUploadInfo() {
1008 1037
 	data["doctor"] = patientPrescription.Doctor
1009 1038
 	data["dept"] = patientPrescription.Departments
1010 1039
 
1040
+	var ids []int64
1041
+	for _, item := range prescriptions {
1042
+		ids = append(ids, item.ID)
1043
+	}
1044
+
1011 1045
 	bytesData, _ := json.Marshal(data)
1012 1046
 	req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
1013 1047
 	resp, _ := client.Do(req)
@@ -1112,6 +1146,8 @@ func (c *HisApiController) GetUploadInfo() {
1112 1146
 			service.CreateOrderInfo(info)
1113 1147
 		}
1114 1148
 
1149
+		service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
1150
+
1115 1151
 		var total float64
1116 1152
 		for _, item := range prescriptions {
1117 1153
 			if item.Type == 1 { //药品
@@ -1179,3 +1215,67 @@ func (c *HisApiController) GetUploadInfo() {
1179 1215
 
1180 1216
 	}
1181 1217
 }
1218
+
1219
+func (c *HisApiController) GetHisOrderList() {
1220
+	adminUser := c.GetAdminUserInfo()
1221
+	org_id := adminUser.CurrentOrgId
1222
+	order, err := service.GetHisOrderList(org_id)
1223
+	if err == nil {
1224
+		c.ServeSuccessJSON(map[string]interface{}{
1225
+			"order": order,
1226
+		})
1227
+	} else {
1228
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1229
+		return
1230
+	}
1231
+}
1232
+
1233
+func (c *HisApiController) GetHisOrder() {
1234
+	patient_id, _ := c.GetInt64("patient_id", 0)
1235
+	number := c.GetString("number")
1236
+	adminInfo := c.GetAdminUserInfo()
1237
+	order, err := service.GetHisOrder(adminInfo.CurrentOrgId, number, patient_id)
1238
+	prescriptions, _ := service.GetHisPrescriptionThree(adminInfo.CurrentOrgId, patient_id, order.SettleAccountsDate, order.Number)
1239
+
1240
+	if err == nil {
1241
+		c.ServeSuccessJSON(map[string]interface{}{
1242
+			"order":        order,
1243
+			"prescription": prescriptions,
1244
+		})
1245
+	} else {
1246
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1247
+		return
1248
+	}
1249
+
1250
+}
1251
+
1252
+func (c *HisApiController) GetHisPrescriptionList() {
1253
+	adminInfo := c.GetAdminUserInfo()
1254
+	fmt.Println("11111dassdfs11")
1255
+	prescriptionOrder, err := service.GetHisPrescriptionOrderList(adminInfo.CurrentOrgId)
1256
+	fmt.Println(prescriptionOrder)
1257
+
1258
+	if err == nil {
1259
+		c.ServeSuccessJSON(map[string]interface{}{
1260
+			"order": prescriptionOrder,
1261
+		})
1262
+	} else {
1263
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1264
+		return
1265
+	}
1266
+}
1267
+
1268
+func (c *HisApiController) GetHisPrescriptionInfo() {
1269
+	patient_id, _ := c.GetInt64("patient_id")
1270
+	his_patient_id, _ := c.GetInt64("his_patient_id")
1271
+	adminInfo := c.GetAdminUserInfo()
1272
+	prescriptionOrder, err := service.GetHisPrescriptionOrderInfo(patient_id, his_patient_id, adminInfo.CurrentOrgId)
1273
+	if err == nil {
1274
+		c.ServeSuccessJSON(map[string]interface{}{
1275
+			"order": prescriptionOrder,
1276
+		})
1277
+	} else {
1278
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1279
+		return
1280
+	}
1281
+}

+ 1 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go Ver fichero

@@ -336,7 +336,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
336 336
 
337 337
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
338 338
 
339
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 {
339
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 {
340 340
 		dewater_amount = dewater_amount * 1000
341 341
 
342 342
 		if dewater_amount < 0 {

+ 105 - 47
models/his_models.go Ver fichero

@@ -1,5 +1,7 @@
1 1
 package models
2 2
 
3
+import "time"
4
+
3 5
 type XtHisProject struct {
4 6
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
5 7
 	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
@@ -83,7 +85,7 @@ type HisPatient struct {
83 85
 	IdType                 int64   `gorm:"column:id_type" json:"id_type" form:"id_type"`
84 86
 	Birthday               int64   `gorm:"column:birthday" json:"birthday" form:"birthday"`
85 87
 	RecordDate             int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
86
-	Age                    int64   `gorm:"column:age" json:"age" form:"age"`
88
+	Age                    float64 `gorm:"column:age" json:"age" form:"age"`
87 89
 	PhoneNumber            string  `gorm:"column:phone_number" json:"phone_number" form:"phone_number"`
88 90
 	IdNumber               string  `gorm:"column:id_number" json:"id_number" form:"id_number"`
89 91
 	RegisterType           int64   `gorm:"column:register_type" json:"register_type" form:"register_type"`
@@ -239,21 +241,22 @@ func (HisPatientCaseHistory) TableName() string {
239 241
 }
240 242
 
241 243
 type HisPrescriptionInfo struct {
242
-	ID           int64  `gorm:"column:id" json:"id" form:"id"`
243
-	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
244
-	RecordDate   int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
245
-	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
246
-	HisPatientId int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
247
-	Status       int64  `gorm:"column:status" json:"status" form:"status"`
248
-	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
249
-	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
250
-	Creator      int64  `gorm:"column:creator" json:"creator" form:"creator"`
251
-	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
252
-	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
253
-	RegisterType int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
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"`
244
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
245
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
246
+	RecordDate         int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
247
+	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
248
+	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
249
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
250
+	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
251
+	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
252
+	Creator            int64  `gorm:"column:creator" json:"creator" form:"creator"`
253
+	Modifier           int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
254
+	Diagnosis          string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
255
+	RegisterType       int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
256
+	Doctor             string `gorm:"column:doctor" json:"doctor" form:"doctor"`
257
+	Departments        string `gorm:"column:departments" json:"departments" form:"departments"`
258
+	SickHistory        string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
259
+	PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
257 260
 }
258 261
 
259 262
 func (HisPrescriptionInfo) TableName() string {
@@ -408,21 +411,25 @@ func (HisDoctorAdviceTemplate) TableName() string {
408 411
 }
409 412
 
410 413
 type HisPrescriptionProject struct {
411
-	ID             int64       `gorm:"column:id" json:"id" form:"id"`
412
-	ProjectId      int64       `gorm:"column:project_id" json:"project_id" form:"project_id"`
413
-	Price          float64     `gorm:"column:price" json:"price" form:"price"`
414
-	UserOrgId      int64       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
415
-	Status         int64       `gorm:"column:status" json:"status" form:"status"`
416
-	Ctime          int64       `gorm:"column:ctime" json:"ctime" form:"ctime"`
417
-	Mtime          int64       `gorm:"column:mtime" json:"mtime" form:"mtime"`
418
-	PatientId      int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
419
-	HisPatientId   int64       `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
420
-	RecordDate     int64       `gorm:"column:record_date" json:"record_date" form:"record_date"`
421
-	PrescriptionId int64       `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
422
-	Count          int64       `gorm:"column:count" json:"count" form:"count"`
423
-	HisProject     *HisProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
424
-	FeedetlSn      string      `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
425
-	MedListCodg    string      `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
414
+	ID                 int64      `gorm:"column:id" json:"id" form:"id"`
415
+	ProjectId          int64      `gorm:"column:project_id" json:"project_id" form:"project_id"`
416
+	Price              float64    `gorm:"column:price" json:"price" form:"price"`
417
+	UserOrgId          int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
418
+	Status             int64      `gorm:"column:status" json:"status" form:"status"`
419
+	Ctime              int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
420
+	Mtime              int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
421
+	PatientId          int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
422
+	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
423
+	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
424
+	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
425
+	Count              int64      `gorm:"column:count" json:"count" form:"count"`
426
+	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
427
+	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
428
+	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
429
+	DeliveryWay        string     `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
430
+	ExecutionFrequency string     `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
431
+	Day                string     `gorm:"column:day" json:"day" form:"day"`
432
+	HisProject         HisProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
426 433
 }
427 434
 
428 435
 func (HisPrescriptionProject) TableName() string {
@@ -508,22 +515,73 @@ func (XtHisPatient) TableName() string {
508 515
 }
509 516
 
510 517
 type HisOrder struct {
511
-	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
512
-	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
513
-	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
514
-	SettleAccountsDate int64  `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
515
-	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
516
-	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
517
-	Status             int64  `gorm:"column:status" json:"status" form:"status"`
518
-	Number             string `gorm:"column:number" json:"number" form:"number"`
519
-	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
520
-	Infcode            int64  `gorm:"column:infcode" json:"infcode" form:"infcode"`
521
-	WarnMsg            string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
522
-	Cainfo             string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
523
-	ErrMsg             string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
524
-	RespondTime        string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
525
-	InfRefmsgid        string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
526
-	OrderStatus        int64  `gorm:"column:order_status" json:"order_status" form:"order_status"`
518
+	ID                 int64     `gorm:"column:id" json:"id" form:"id"`
519
+	UserOrgId          int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
520
+	HisPatientId       int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
521
+	SettleAccountsDate int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
522
+	Ctime              int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
523
+	Mtime              int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
524
+	Status             int64     `gorm:"column:status" json:"status" form:"status"`
525
+	Number             string    `gorm:"column:number" json:"number" form:"number"`
526
+	PatientId          int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
527
+	Infcode            int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
528
+	WarnMsg            string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
529
+	Cainfo             string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
530
+	ErrMsg             string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
531
+	RespondTime        string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
532
+	InfRefmsgid        string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
533
+	OrderStatus        int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
534
+	MdtrtId            string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
535
+	SetlId             string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
536
+	PsnNo              string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
537
+	PsnName            string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
538
+	PsnCertType        string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
539
+	Certno             string    `gorm:"column:certno" json:"certno" form:"certno"`
540
+	Gend               string    `gorm:"column:gend" json:"gend" form:"gend"`
541
+	Naty               string    `gorm:"column:naty" json:"naty" form:"naty"`
542
+	Brdy               time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
543
+	Age                float64   `gorm:"column:age" json:"age" form:"age"`
544
+	Insutype           string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
545
+	PsnType            string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
546
+	CvlservFlag        string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
547
+	SetlTime           time.Time `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
548
+	MdtrtCertType      string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
549
+	MedType            string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
550
+	MedfeeSumamt       float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
551
+	FulamtOwnpayAmt    float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
552
+	OverlmtSelfPay     float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
553
+	PreselfpayAmt      float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
554
+	InscpScpAmt        float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
555
+	ActPayDedc         float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
556
+	HifpPay            float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
557
+	CvlservPay         float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
558
+	PoolPropSelfpay    float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
559
+	HifesPay           float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
560
+	HifmiPay           float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
561
+	HifobPay           float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
562
+	MafPay             float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
563
+	OthPay             float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
564
+	FundPaySumamt      float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
565
+	PsnPartAmt         float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
566
+	AcctPay            float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
567
+	PsnCashPay         float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
568
+	HospPartAmt        float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
569
+	Balc               float64   `gorm:"column:balc" json:"balc" form:"balc"`
570
+	AcctMulaidPay      float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
571
+	MedinsSetlId       string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
572
+	ClrOptins          string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
573
+	ClrWay             string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
574
+	ClrType            string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
575
+	FundPayType        string    `gorm:"column:fund_pay_type" json:"fund_pay_type" form:"fund_pay_type"`
576
+	CrtPaybLmtAmt      float64   `gorm:"column:crt_payb_lmt_amt" json:"crt_payb_lmt_amt" form:"crt_payb_lmt_amt"`
577
+	FundPayamt         float64   `gorm:"column:fund_payamt" json:"fund_payamt" form:"fund_payamt"`
578
+	FundPayTypeName    string    `gorm:"column:fund_pay_type_name" json:"fund_pay_type_name" form:"fund_pay_type_name"`
579
+	SetlProcInfo       string    `gorm:"column:setl_proc_info" json:"setl_proc_info" form:"setl_proc_info"`
580
+
581
+	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
582
+	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
583
+	HisPatient          HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
584
+	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
527 585
 }
528 586
 
529 587
 func (HisOrder) TableName() string {

+ 17 - 17
service/gdyb_service.go Ver fichero

@@ -754,23 +754,23 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
754 754
 	// 生成输入报文
755 755
 	inputMessage := make(map[string]interface{})
756 756
 
757
-	inputMessage["infno"] = "1101"                                                             // 交易编码
758
-	inputMessage["msgid"] = FixmedinsCOde + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
759
-	inputMessage["mdtrtarea_admvs"] = "440200"                                                 // 就医地医保区划
760
-	inputMessage["insuplc_admdvs"] = "440200"                                                  // 参保地医保区划
761
-	inputMessage["recer_sys_code"] = "01"                                                      // 接收方系统代码
762
-	inputMessage["dev_no"] = ""                                                                // 设备编号
763
-	inputMessage["dev_safe_info"] = ""                                                         // 设备安全信息
764
-	inputMessage["cainfo"] = ""                                                                // 数字签名信息
765
-	inputMessage["signtype"] = ""                                                              // 签名类型
766
-	inputMessage["infver"] = "V1.1"                                                            // 接收方系统代码
767
-	inputMessage["opter_type"] = "1"                                                           // 经办人类别
768
-	inputMessage["opter"] = "mockuser"                                                         // 经办人
769
-	inputMessage["opter_name"] = doctor                                                        // 经办人姓名
770
-	inputMessage["inf_time"] = timeFormatOne                                                   // 交易时间
771
-	inputMessage["fixmedins_code"] = FixmedinsCOde                                             // 定点医药机构编号
772
-	inputMessage["fixmedins_name"] = org_name                                                  //定点医药机构名称
773
-	inputMessage["sign_no"] = ""                                                               //交易签到流水号
757
+	inputMessage["infno"] = "1101"                                                              // 交易编码
758
+	inputMessage["msgid"] = "H44022900158" + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
759
+	inputMessage["mdtrtarea_admvs"] = "440200"                                                  // 就医地医保区划
760
+	inputMessage["insuplc_admdvs"] = "440200"                                                   // 参保地医保区划
761
+	inputMessage["recer_sys_code"] = "01"                                                       // 接收方系统代码
762
+	inputMessage["dev_no"] = ""                                                                 // 设备编号
763
+	inputMessage["dev_safe_info"] = ""                                                          // 设备安全信息
764
+	inputMessage["cainfo"] = ""                                                                 // 数字签名信息
765
+	inputMessage["signtype"] = ""                                                               // 签名类型
766
+	inputMessage["infver"] = "V1.1"                                                             // 接收方系统代码
767
+	inputMessage["opter_type"] = "1"                                                            // 经办人类别
768
+	inputMessage["opter"] = "mockuser"                                                          // 经办人
769
+	inputMessage["opter_name"] = doctor                                                         // 经办人姓名
770
+	inputMessage["inf_time"] = timeFormatOne                                                    // 交易时间
771
+	inputMessage["fixmedins_code"] = FixmedinsCOde                                              // 定点医药机构编号
772
+	inputMessage["fixmedins_name"] = ""                                                         //定点医药机构名称
773
+	inputMessage["sign_no"] = ""                                                                //交易签到流水号
774 774
 	return inputMessage
775 775
 }
776 776
 

+ 99 - 0
service/his_service.go Ver fichero

@@ -219,3 +219,102 @@ func SavePatientPrescriptionInfo(info models.HisPrescriptionInfo) (err error) {
219 219
 	return
220 220
 
221 221
 }
222
+
223
+func GetHisOrderList(user_org_id int64) (order []*models.HisOrder, err error) {
224
+	err = readDb.Model(&models.HisOrder{}).Where("status = 1 AND user_org_id = ?", user_org_id).
225
+		Preload("HisOrderInfo", "status = 1 AND user_org_id = ?", user_org_id).
226
+		Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).
227
+		Preload("HisPatient", "status = 1 AND user_org_id = ?", user_org_id).
228
+		Preload("HisPrescriptionInfo", "status = 1 AND user_org_id = ?", user_org_id).Order("ctime desc").
229
+		Find(&order).Error
230
+	return
231
+}
232
+
233
+func UpDatePrescriptionNumber(user_org_id int64, ids []int64, number string) (err error) {
234
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id in (?)", user_org_id, ids).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
235
+	return
236
+}
237
+
238
+type HisOrder struct {
239
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
240
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
241
+	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
242
+	SettleAccountsDate int64  `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
243
+	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
244
+	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
245
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
246
+	Number             string `gorm:"column:number" json:"number" form:"number"`
247
+	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
248
+
249
+	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
250
+	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
251
+	HisPatient          models.HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
252
+	HisPrescriptionInfo models.HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
253
+	HisPrescription     []*models.HisPrescription  `gorm:"ForeignKey:SettleAccountsDate;AssociationForeignKey:RecordDate" json:"prescriptions"`
254
+}
255
+
256
+func (HisOrder) TableName() string {
257
+	return "his_order"
258
+}
259
+
260
+func GetHisOrder(user_org_id int64, number string, patient_id int64) (order HisOrder, err error) {
261
+	err = readDb.Model(&HisOrder{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND number=?", user_org_id, patient_id, number).
262
+		Preload("HisOrderInfo", "status = 1 AND user_org_id = ?", user_org_id).
263
+		Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).
264
+		Preload("HisPatient", "status = 1 AND user_org_id = ?", user_org_id).
265
+		Preload("HisPrescriptionInfo", "status = 1 AND user_org_id = ?", user_org_id).
266
+		Order("ctime desc").
267
+		Find(&order).Error
268
+	return
269
+}
270
+
271
+func GetHisPrescriptionThree(org_id int64, patient_id int64, record_date int64, number string) (prescription []*models.HisPrescription, err error) {
272
+	err = readDb.Model(&models.HisPrescription{}).
273
+		Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
274
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
275
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
276
+		}).
277
+		Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND batch_number=?", org_id, record_date, patient_id, number).
278
+		Find(&prescription).Error
279
+	return
280
+}
281
+
282
+type HisPrescriptionInfo struct {
283
+	ID           int64             `gorm:"column:id" json:"id" form:"id"`
284
+	UserOrgId    int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
285
+	RecordDate   int64             `gorm:"column:record_date" json:"record_date" form:"record_date"`
286
+	PatientId    int64             `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
287
+	HisPatientId int64             `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
288
+	Status       int64             `gorm:"column:status" json:"status" form:"status"`
289
+	Ctime        int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
290
+	Mtime        int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
291
+	Creator      int64             `gorm:"column:creator" json:"creator" form:"creator"`
292
+	Modifier     int64             `gorm:"column:modifier" json:"modifier" form:"modifier"`
293
+	Diagnosis    string            `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
294
+	RegisterType int64             `gorm:"column:register_type" json:"register_type" form:"register_type"`
295
+	Doctor       string            `gorm:"column:doctor" json:"doctor" form:"doctor"`
296
+	Departments  string            `gorm:"column:departments" json:"departments" form:"departments"`
297
+	SickHistory  string            `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
298
+	Patients     models.Patients   `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
299
+	HisPatient   models.HisPatient `gorm:"ForeignKey:HisPatientId,RecordDate;AssociationForeignKey:ID,RecordDate" json:"his_patient"`
300
+}
301
+
302
+func (HisPrescriptionInfo) TableName() string {
303
+	return "his_prescription_info"
304
+}
305
+
306
+func GetHisPrescriptionOrderList(org_id int64) (prescriptionOrder []*HisPrescriptionInfo, err error) {
307
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND user_org_id = ?", org_id).
308
+		Preload("Patients", "status = 1 AND user_org_id = ?", org_id).
309
+		Preload("HisPatient", "status = 1 AND user_org_id = ?", org_id).Order("ctime desc").Find(&prescriptionOrder).Error
310
+	return
311
+
312
+}
313
+
314
+func GetHisPrescriptionOrderInfo(patient_id, his_patient_id, org_id int64) (prescriptionOrder []*HisPrescriptionInfo, err error) {
315
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND user_org_id = ?", org_id).
316
+		Preload("Patients", "status = 1 AND user_org_id = ?", org_id).
317
+		Preload("HisPatient", "status = 1 AND user_org_id = ?", org_id).Error
318
+	return
319
+
320
+}

+ 1 - 1
service/mobile_dialysis_service.go Ver fichero

@@ -1073,7 +1073,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
1073 1073
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
1074 1074
 	tx := writeDb.Begin()
1075 1075
 	updateTime := time.Now().Unix()
1076
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType}).Error
1076
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse}).Error
1077 1077
 	if err != nil {
1078 1078
 		tx.Rollback()
1079 1079
 		return err