28169 1 år sedan
förälder
incheckning
773d2d527a

+ 248 - 0
controllers/dialysis_api_controller.go Visa fil

@@ -123,6 +123,18 @@ func DialysisApiRegistRouters() {
123 123
 	beego.Router("/api/dialysis/patientsflow", &DialysisApiController{}, "Get:GetDialysisPatientsFlow")
124 124
 
125 125
 	beego.Router("/api/patient/getlongdialysisadvicetoday", &DialysisApiController{}, "Get:GetLongDialysisAdviceToday")
126
+
127
+	beego.Router("/api/patient/getpatientlist", &DialysisApiController{}, "Get:GetPatientList")
128
+
129
+	beego.Router("/api/patient/getprescriptionloglist", &DialysisApiController{}, "Get:GetPrescriptionLogList")
130
+
131
+	beego.Router("/api/patient/getbeforloglist", &DialysisApiController{}, "Get:GetBeforLogList")
132
+
133
+	beego.Router("/api/patient/getdocloglist", &DialysisApiController{}, "Get:GetDocLogList")
134
+
135
+	beego.Router("/api/patient/getmonitorloglist", &DialysisApiController{}, "Get:GetMonitorLogList")
136
+
137
+	beego.Router("/api/patient/getafterloglist", &DialysisApiController{}, "Get:GetAfterLogList")
126 138
 }
127 139
 
128 140
 func (c *DialysisApiController) GetQueueCall() {
@@ -7182,3 +7194,239 @@ func (this *DialysisApiController) GetLongDialysisAdviceToday() {
7182 7194
 		return
7183 7195
 	}
7184 7196
 }
7197
+
7198
+func (this *DialysisApiController) GetPatientList() {
7199
+
7200
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7201
+
7202
+	keyWord := this.GetString("keyword")
7203
+	patientList, err := service.GetPrescriptionPatientList(orgId, keyWord)
7204
+
7205
+	if err == nil {
7206
+		this.ServeSuccessJSON(map[string]interface{}{
7207
+			"patientList": patientList,
7208
+		})
7209
+		return
7210
+
7211
+	} else {
7212
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7213
+		return
7214
+	}
7215
+}
7216
+
7217
+func (this *DialysisApiController) GetPrescriptionLogList() {
7218
+
7219
+	patient_id, _ := this.GetInt64("patient_id")
7220
+
7221
+	record_date := this.GetString("record_date")
7222
+
7223
+	page, _ := this.GetInt64("page")
7224
+
7225
+	limit, _ := this.GetInt64("limit")
7226
+
7227
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7228
+
7229
+	timeLayout := "2006-01-02"
7230
+	loc, _ := time.LoadLocation("Local")
7231
+	var recordDateTime int64
7232
+	if len(record_date) > 0 {
7233
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7234
+		if err != nil {
7235
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7236
+			return
7237
+		}
7238
+		recordDateTime = theTime.Unix()
7239
+	}
7240
+
7241
+	prescriptionlogList, total, err := service.GetPrescriptionLogList(patient_id, page, limit, recordDateTime, orgId)
7242
+
7243
+	patients, _ := service.GetAllPatientLog(orgId)
7244
+
7245
+	role, _ := service.GetAllDoctorLog(orgId)
7246
+
7247
+	if err == nil {
7248
+		this.ServeSuccessJSON(map[string]interface{}{
7249
+			"prescriptionlogList": prescriptionlogList,
7250
+			"total":               total,
7251
+			"patients":            patients,
7252
+			"role":                role,
7253
+		})
7254
+		return
7255
+
7256
+	} else {
7257
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7258
+		return
7259
+	}
7260
+}
7261
+
7262
+func (this *DialysisApiController) GetBeforLogList() {
7263
+
7264
+	patient_id, _ := this.GetInt64("patient_id")
7265
+
7266
+	record_date := this.GetString("record_date")
7267
+
7268
+	page, _ := this.GetInt64("page")
7269
+
7270
+	limit, _ := this.GetInt64("limit")
7271
+
7272
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7273
+
7274
+	timeLayout := "2006-01-02"
7275
+	loc, _ := time.LoadLocation("Local")
7276
+	var recordDateTime int64
7277
+	if len(record_date) > 0 {
7278
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7279
+		if err != nil {
7280
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7281
+			return
7282
+		}
7283
+		recordDateTime = theTime.Unix()
7284
+	}
7285
+	beforLogList, total, err := service.GetBeforLogList(patient_id, page, limit, recordDateTime, orgId)
7286
+
7287
+	patients, _ := service.GetAllPatientLog(orgId)
7288
+
7289
+	role, _ := service.GetAllDoctorLog(orgId)
7290
+	if err == nil {
7291
+		this.ServeSuccessJSON(map[string]interface{}{
7292
+			"beforLogList": beforLogList,
7293
+			"total":        total,
7294
+			"patients":     patients,
7295
+			"role":         role,
7296
+		})
7297
+		return
7298
+
7299
+	} else {
7300
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7301
+		return
7302
+	}
7303
+}
7304
+
7305
+func (this *DialysisApiController) GetDocLogList() {
7306
+
7307
+	patient_id, _ := this.GetInt64("patient_id")
7308
+
7309
+	record_date := this.GetString("record_date")
7310
+
7311
+	page, _ := this.GetInt64("page")
7312
+
7313
+	limit, _ := this.GetInt64("limit")
7314
+
7315
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7316
+
7317
+	timeLayout := "2006-01-02"
7318
+	loc, _ := time.LoadLocation("Local")
7319
+	var recordDateTime int64
7320
+	if len(record_date) > 0 {
7321
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7322
+		if err != nil {
7323
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7324
+			return
7325
+		}
7326
+		recordDateTime = theTime.Unix()
7327
+	}
7328
+	adviceLogList, total, err := service.GetDocLogList(patient_id, page, limit, recordDateTime, orgId)
7329
+
7330
+	patients, _ := service.GetAllPatientLog(orgId)
7331
+
7332
+	role, _ := service.GetAllDoctorLog(orgId)
7333
+	if err == nil {
7334
+		this.ServeSuccessJSON(map[string]interface{}{
7335
+			"adviceLogList": adviceLogList,
7336
+			"total":         total,
7337
+			"patients":      patients,
7338
+			"role":          role,
7339
+		})
7340
+		return
7341
+
7342
+	} else {
7343
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7344
+		return
7345
+	}
7346
+}
7347
+
7348
+func (this *DialysisApiController) GetMonitorLogList() {
7349
+
7350
+	patient_id, _ := this.GetInt64("patient_id")
7351
+
7352
+	record_date := this.GetString("record_date")
7353
+
7354
+	page, _ := this.GetInt64("page")
7355
+
7356
+	limit, _ := this.GetInt64("limit")
7357
+
7358
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7359
+
7360
+	timeLayout := "2006-01-02"
7361
+	loc, _ := time.LoadLocation("Local")
7362
+	var recordDateTime int64
7363
+	if len(record_date) > 0 {
7364
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7365
+		if err != nil {
7366
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7367
+			return
7368
+		}
7369
+		recordDateTime = theTime.Unix()
7370
+	}
7371
+	monitorLogList, total, err := service.GetMonitorLogList(patient_id, page, limit, recordDateTime, orgId)
7372
+
7373
+	patients, _ := service.GetAllPatientLog(orgId)
7374
+
7375
+	role, _ := service.GetAllDoctorLog(orgId)
7376
+	if err == nil {
7377
+		this.ServeSuccessJSON(map[string]interface{}{
7378
+			"monitorLogList": monitorLogList,
7379
+			"total":          total,
7380
+			"patients":       patients,
7381
+			"role":           role,
7382
+		})
7383
+		return
7384
+
7385
+	} else {
7386
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7387
+		return
7388
+	}
7389
+}
7390
+
7391
+func (this *DialysisApiController) GetAfterLogList() {
7392
+
7393
+	patient_id, _ := this.GetInt64("patient_id")
7394
+
7395
+	record_date := this.GetString("record_date")
7396
+
7397
+	page, _ := this.GetInt64("page")
7398
+
7399
+	limit, _ := this.GetInt64("limit")
7400
+
7401
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7402
+
7403
+	timeLayout := "2006-01-02"
7404
+	loc, _ := time.LoadLocation("Local")
7405
+	var recordDateTime int64
7406
+	if len(record_date) > 0 {
7407
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7408
+		if err != nil {
7409
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7410
+			return
7411
+		}
7412
+		recordDateTime = theTime.Unix()
7413
+	}
7414
+	afterLogList, total, err := service.GetAfterLogList(patient_id, page, limit, recordDateTime, orgId)
7415
+
7416
+	patients, _ := service.GetAllPatientLog(orgId)
7417
+
7418
+	role, _ := service.GetAllDoctorLog(orgId)
7419
+	if err == nil {
7420
+		this.ServeSuccessJSON(map[string]interface{}{
7421
+			"afterLogList": afterLogList,
7422
+			"total":        total,
7423
+			"patients":     patients,
7424
+			"role":         role,
7425
+		})
7426
+		return
7427
+
7428
+	} else {
7429
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
7430
+		return
7431
+	}
7432
+}

+ 277 - 283
controllers/his_print_api_controller.go Visa fil

@@ -5,15 +5,9 @@ import (
5 5
 	"XT_New/models"
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8
-	"bytes"
9
-	"encoding/json"
10
-	"encoding/xml"
11 8
 	"fmt"
12 9
 	"github.com/astaxie/beego"
13
-	"io/ioutil"
14
-	"net/http"
15 10
 	"os"
16
-	"strconv"
17 11
 	"strings"
18 12
 	"time"
19 13
 )
@@ -32,205 +26,205 @@ func HisPrintApiRegistRouters() {
32 26
 	beego.Router("/api/his/prescription/summary", &HisPrintApiController{}, "get:GetUnChargePrescriptionSummary")
33 27
 	beego.Router("/api/his/label/create", &HisPrintApiController{}, "get:CreateLablePrint")
34 28
 	beego.Router("/api/his/label/get", &HisPrintApiController{}, "get:GetLablePrint")
35
-	beego.Router("/api/his/label/send", &HisPrintApiController{}, "get:SendApplyCode")
29
+	//beego.Router("/api/his/label/send", &HisPrintApiController{}, "get:SendApplyCode")
36 30
 }
37 31
 
38
-func (c *HisPrintApiController) SendApplyCode() {
39
-	list, _ := service.GetAllLisDataFor10191(c.GetAdminUserInfo().CurrentOrgId)
40
-	if len(list) > 0 {
41
-		//插入中间库中
42
-		for _, item := range list {
43
-			if len(item.ApplyCode) == 0 {
44
-				var apply models.JYApply
45
-				apply.BedCode = ""
46
-				apply.PatientName = item.Patient.Name
47
-				idCard := item.Patient.IdCardNo // 身份证号码示例
48
-				age, err := GetAge(idCard)
49
-				if err != nil {
50
-					age = int(item.Patient.Age)
51
-					fmt.Println("计算年龄时出错:", err)
52
-				}
53
-
54
-				apply.Age = strconv.FormatInt(int64(age), 10)
55
-				apply.AgeUnit = "岁"
56
-				if item.Patient.Gender == 1 {
57
-					apply.Sex = "男"
58
-				} else if item.Patient.Gender == 2 {
59
-					apply.Sex = "女"
60
-				} else {
61
-					apply.Sex = "不详"
62
-				}
63
-				apply.RegisterCode = ""
64
-				apply.Diagnosis = ""
65
-				apply.Ward = ""
66
-				role, _ := service.GetAdminUserRole(2398, c.GetAdminUserInfo().CurrentOrgId)
67
-				apply.SendDoctor = role.UserName
68
-				apply.PatientType = 1
69
-				apply.PatientPhone = item.Patient.Phone
70
-				//applys = append(applys, apply)
71
-				var jYApplyDetails []models.CustomerApplyDetail
72
-
73
-				if len(item.ItemIds) > 0 {
74
-					team_ids := strings.Split(item.ItemIds, ",")
75
-					for index, subItem := range team_ids {
76
-						//判断一些需要拆分的组套 血透体检(定量):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定量)
77
-						if subItem == "267" {
78
-							//血透体检(定量)
79
-							var jYApplyDetail models.CustomerApplyDetail
80
-							id, _ := strconv.ParseInt(subItem, 10, 64)
81
-							jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
82
-							jYApplyDetail.RowIndex = int64(index + 1)
83
-							jYApplyDetail.Barcode = ""
84
-							jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
85
-							jYApplyDetail.Comment = ""
86
-							jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
87
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
88
-
89
-							//丙型肝炎抗体测定
90
-							var jYApplyDetail2 models.CustomerApplyDetail
91
-							id2, _ := strconv.ParseInt("26701", 10, 64)
92
-							jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
93
-							jYApplyDetail2.RowIndex = int64(index + 1)
94
-							jYApplyDetail2.Barcode = ""
95
-							jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
96
-							jYApplyDetail2.Comment = ""
97
-							jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
98
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
99
-
100
-							//传染病检查(定性)
101
-							var jYApplyDetail3 models.CustomerApplyDetail
102
-							id3, _ := strconv.ParseInt("26700", 10, 64)
103
-							jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
104
-							jYApplyDetail3.RowIndex = int64(index + 1)
105
-							jYApplyDetail3.Barcode = ""
106
-							jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
107
-							jYApplyDetail3.Comment = ""
108
-							jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
109
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
110
-
111
-						}
112
-
113
-						//判断一些需要拆分的组套 血透体检(定性):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定性)
114
-						if subItem == "424" {
115
-							//血透体检(定性)
116
-							var jYApplyDetail models.CustomerApplyDetail
117
-							id, _ := strconv.ParseInt(subItem, 10, 64)
118
-							jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
119
-							jYApplyDetail.RowIndex = int64(index + 1)
120
-							jYApplyDetail.Barcode = ""
121
-							jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
122
-							jYApplyDetail.Comment = ""
123
-							jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
124
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
125
-
126
-							//丙型肝炎抗体测定
127
-							var jYApplyDetail2 models.CustomerApplyDetail
128
-							id2, _ := strconv.ParseInt("42401", 10, 64)
129
-							jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
130
-							jYApplyDetail2.RowIndex = int64(index + 1)
131
-							jYApplyDetail2.Barcode = ""
132
-							jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
133
-							jYApplyDetail2.Comment = ""
134
-							jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
135
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
136
-
137
-							//传染病检查(定性)
138
-							var jYApplyDetail3 models.CustomerApplyDetail
139
-							id3, _ := strconv.ParseInt("42400", 10, 64)
140
-							jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
141
-							jYApplyDetail3.RowIndex = int64(index + 1)
142
-							jYApplyDetail3.Barcode = ""
143
-							jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
144
-							jYApplyDetail3.Comment = ""
145
-							jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
146
-							jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
147
-
148
-						}
149
-						var jYApplyDetail models.CustomerApplyDetail
150
-						id, _ := strconv.ParseInt(subItem, 10, 64)
151
-						jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
152
-						jYApplyDetail.RowIndex = int64(index + 1)
153
-						jYApplyDetail.Barcode = ""
154
-						jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
155
-						jYApplyDetail.Comment = ""
156
-						jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
157
-						jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
158
-					}
159
-				}
160
-
161
-				if len(item.ProjectIds) > 0 {
162
-					team_ids := strings.Split(item.ProjectIds, ",")
163
-					for index, subItem := range team_ids {
164
-						var jYApplyDetail models.CustomerApplyDetail
165
-						id, _ := strconv.ParseInt(subItem, 10, 64)
166
-						jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
167
-						jYApplyDetail.RowIndex = int64(index)
168
-						jYApplyDetail.Barcode = ""
169
-						jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
170
-						jYApplyDetail.Comment = ""
171
-						jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
172
-						jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
173
-					}
174
-				}
175
-				result := PostInspectApply(key, apply, jYApplyDetails)
176
-				if result.Res == 0 {
177
-					item.ApplyCode = result.JYApplyResult.ApplyCode
178
-					jsonData, err := json.Marshal(apply)
179
-					if err != nil {
180
-						fmt.Println("转换为JSON时发生错误:", err)
181
-					}
182
-					jsonStr := string(jsonData)
183
-					jsonData2, err2 := json.Marshal(jYApplyDetails)
184
-					if err2 != nil {
185
-						fmt.Println("转换为JSON时发生错误:", err2)
186
-					}
187
-					jsonStr2 := string(jsonData2)
188
-
189
-					jsonData3, err3 := json.Marshal(result)
190
-					if err3 != nil {
191
-						fmt.Println("转换为JSON时发生错误:", err3)
192
-					}
193
-					jsonStr3 := string(jsonData3)
194
-					saveSuccessLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单成功日志", "申清单")
195
-					err1 := service.CreateLabelPrint(&item)
196
-					if err1 == nil {
197
-						c.ServeSuccessJSON(map[string]interface{}{
198
-							"msg": "发送成功",
199
-						})
200
-					}
201
-					return
202
-				} else {
203
-					jsonData, err := json.Marshal(apply)
204
-					if err != nil {
205
-						fmt.Println("转换为JSON时发生错误:", err)
206
-
207
-					}
208
-					jsonStr := string(jsonData)
209
-
210
-					jsonData2, err2 := json.Marshal(jYApplyDetails)
211
-					if err2 != nil {
212
-						fmt.Println("转换为JSON时发生错误:", err2)
213
-
214
-					}
215
-					jsonStr2 := string(jsonData2)
216
-
217
-					jsonData3, err3 := json.Marshal(result)
218
-					if err3 != nil {
219
-						fmt.Println("转换为JSON时发生错误:", err3)
220
-
221
-					}
222
-					jsonStr3 := string(jsonData3)
223
-
224
-					SaveErrorLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单错误日志", "申清单")
225
-
226
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
227
-					return
228
-				}
229
-			}
230
-		}
231
-
232
-	}
233
-}
32
+//func (c *HisPrintApiController) SendApplyCode() {
33
+//	list, _ := service.GetAllLisDataFor10191(c.GetAdminUserInfo().CurrentOrgId)
34
+//	if len(list) > 0 {
35
+//		//插入中间库中
36
+//		for _, item := range list {
37
+//			if len(item.ApplyCode) == 0 {
38
+//				var apply models.JYApply
39
+//				apply.BedCode = ""
40
+//				apply.PatientName = item.Patient.Name
41
+//				idCard := item.Patient.IdCardNo // 身份证号码示例
42
+//				age, err := GetAge(idCard)
43
+//				if err != nil {
44
+//					age = int(item.Patient.Age)
45
+//					fmt.Println("计算年龄时出错:", err)
46
+//				}
47
+//
48
+//				apply.Age = strconv.FormatInt(int64(age), 10)
49
+//				apply.AgeUnit = "岁"
50
+//				if item.Patient.Gender == 1 {
51
+//					apply.Sex = "男"
52
+//				} else if item.Patient.Gender == 2 {
53
+//					apply.Sex = "女"
54
+//				} else {
55
+//					apply.Sex = "不详"
56
+//				}
57
+//				apply.RegisterCode = ""
58
+//				apply.Diagnosis = ""
59
+//				apply.Ward = ""
60
+//				role, _ := service.GetAdminUserRole(2398, c.GetAdminUserInfo().CurrentOrgId)
61
+//				apply.SendDoctor = role.UserName
62
+//				apply.PatientType = 1
63
+//				apply.PatientPhone = item.Patient.Phone
64
+//				//applys = append(applys, apply)
65
+//				var jYApplyDetails []models.CustomerApplyDetail
66
+//
67
+//				if len(item.ItemIds) > 0 {
68
+//					team_ids := strings.Split(item.ItemIds, ",")
69
+//					for index, subItem := range team_ids {
70
+//						//判断一些需要拆分的组套 血透体检(定量):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定量)
71
+//						if subItem == "267" {
72
+//							//血透体检(定量)
73
+//							var jYApplyDetail models.CustomerApplyDetail
74
+//							id, _ := strconv.ParseInt(subItem, 10, 64)
75
+//							jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
76
+//							jYApplyDetail.RowIndex = int64(index + 1)
77
+//							jYApplyDetail.Barcode = ""
78
+//							jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
79
+//							jYApplyDetail.Comment = ""
80
+//							jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
81
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
82
+//
83
+//							//丙型肝炎抗体测定
84
+//							var jYApplyDetail2 models.CustomerApplyDetail
85
+//							id2, _ := strconv.ParseInt("26701", 10, 64)
86
+//							jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
87
+//							jYApplyDetail2.RowIndex = int64(index + 1)
88
+//							jYApplyDetail2.Barcode = ""
89
+//							jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
90
+//							jYApplyDetail2.Comment = ""
91
+//							jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
92
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
93
+//
94
+//							//传染病检查(定性)
95
+//							var jYApplyDetail3 models.CustomerApplyDetail
96
+//							id3, _ := strconv.ParseInt("26700", 10, 64)
97
+//							jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
98
+//							jYApplyDetail3.RowIndex = int64(index + 1)
99
+//							jYApplyDetail3.Barcode = ""
100
+//							jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
101
+//							jYApplyDetail3.Comment = ""
102
+//							jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
103
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
104
+//
105
+//						}
106
+//
107
+//						//判断一些需要拆分的组套 血透体检(定性):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定性)
108
+//						if subItem == "424" {
109
+//							//血透体检(定性)
110
+//							var jYApplyDetail models.CustomerApplyDetail
111
+//							id, _ := strconv.ParseInt(subItem, 10, 64)
112
+//							jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
113
+//							jYApplyDetail.RowIndex = int64(index + 1)
114
+//							jYApplyDetail.Barcode = ""
115
+//							jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
116
+//							jYApplyDetail.Comment = ""
117
+//							jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
118
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
119
+//
120
+//							//丙型肝炎抗体测定
121
+//							var jYApplyDetail2 models.CustomerApplyDetail
122
+//							id2, _ := strconv.ParseInt("42401", 10, 64)
123
+//							jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
124
+//							jYApplyDetail2.RowIndex = int64(index + 1)
125
+//							jYApplyDetail2.Barcode = ""
126
+//							jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
127
+//							jYApplyDetail2.Comment = ""
128
+//							jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
129
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
130
+//
131
+//							//传染病检查(定性)
132
+//							var jYApplyDetail3 models.CustomerApplyDetail
133
+//							id3, _ := strconv.ParseInt("42400", 10, 64)
134
+//							jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
135
+//							jYApplyDetail3.RowIndex = int64(index + 1)
136
+//							jYApplyDetail3.Barcode = ""
137
+//							jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
138
+//							jYApplyDetail3.Comment = ""
139
+//							jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
140
+//							jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
141
+//
142
+//						}
143
+//						var jYApplyDetail models.CustomerApplyDetail
144
+//						id, _ := strconv.ParseInt(subItem, 10, 64)
145
+//						jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
146
+//						jYApplyDetail.RowIndex = int64(index + 1)
147
+//						jYApplyDetail.Barcode = ""
148
+//						jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
149
+//						jYApplyDetail.Comment = ""
150
+//						jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
151
+//						jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
152
+//					}
153
+//				}
154
+//
155
+//				if len(item.ProjectIds) > 0 {
156
+//					team_ids := strings.Split(item.ProjectIds, ",")
157
+//					for index, subItem := range team_ids {
158
+//						var jYApplyDetail models.CustomerApplyDetail
159
+//						id, _ := strconv.ParseInt(subItem, 10, 64)
160
+//						jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
161
+//						jYApplyDetail.RowIndex = int64(index)
162
+//						jYApplyDetail.Barcode = ""
163
+//						jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
164
+//						jYApplyDetail.Comment = ""
165
+//						jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
166
+//						jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
167
+//					}
168
+//				}
169
+//				result := PostInspectApply(key, apply, jYApplyDetails)
170
+//				if result.Res == 0 {
171
+//					item.ApplyCode = result.JYApplyResult.ApplyCode
172
+//					jsonData, err := json.Marshal(apply)
173
+//					if err != nil {
174
+//						fmt.Println("转换为JSON时发生错误:", err)
175
+//					}
176
+//					jsonStr := string(jsonData)
177
+//					jsonData2, err2 := json.Marshal(jYApplyDetails)
178
+//					if err2 != nil {
179
+//						fmt.Println("转换为JSON时发生错误:", err2)
180
+//					}
181
+//					jsonStr2 := string(jsonData2)
182
+//
183
+//					jsonData3, err3 := json.Marshal(result)
184
+//					if err3 != nil {
185
+//						fmt.Println("转换为JSON时发生错误:", err3)
186
+//					}
187
+//					jsonStr3 := string(jsonData3)
188
+//					saveSuccessLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单成功日志", "申清单")
189
+//					err1 := service.CreateLabelPrint(&item)
190
+//					if err1 == nil {
191
+//						c.ServeSuccessJSON(map[string]interface{}{
192
+//							"msg": "发送成功",
193
+//						})
194
+//					}
195
+//					return
196
+//				} else {
197
+//					jsonData, err := json.Marshal(apply)
198
+//					if err != nil {
199
+//						fmt.Println("转换为JSON时发生错误:", err)
200
+//
201
+//					}
202
+//					jsonStr := string(jsonData)
203
+//
204
+//					jsonData2, err2 := json.Marshal(jYApplyDetails)
205
+//					if err2 != nil {
206
+//						fmt.Println("转换为JSON时发生错误:", err2)
207
+//
208
+//					}
209
+//					jsonStr2 := string(jsonData2)
210
+//
211
+//					jsonData3, err3 := json.Marshal(result)
212
+//					if err3 != nil {
213
+//						fmt.Println("转换为JSON时发生错误:", err3)
214
+//
215
+//					}
216
+//					jsonStr3 := string(jsonData3)
217
+//
218
+//					SaveErrorLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单错误日志", "申清单")
219
+//
220
+//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
221
+//					return
222
+//				}
223
+//			}
224
+//		}
225
+//
226
+//	}
227
+//}
234 228
 
235 229
 func (c *HisPrintApiController) GetLablePrint() {
236 230
 	patient_id, _ := c.GetInt64("patient_id")
@@ -431,86 +425,86 @@ func calculateAge(birthDate time.Time) int {
431 425
 }
432 426
 
433 427
 // 送检单
434
-func PostInspectApply(key string, apply models.JYApply, list []models.CustomerApplyDetail) models.InspectApplyData {
435
-	// 构建SOAP请求数据
436
-	requestData := &models.JYApplyEnvelope{
437
-		Soap: "http://schemas.xmlsoap.org/soap/envelope/",
438
-		Xsi:  "http://www.w3.org/2001/XMLSchema-instance",
439
-		Xsd:  "http://www.w3.org/2001/XMLSchema",
440
-		Body: models.JYApplyBody{
441
-			InspectApplyReq: models.InspectApplyReq{
442
-				XMLName: xml.Name{Local: "InspectApplyByInstituteItemCode", Space: "http://tempuri.org/"},
443
-				ApiKey:  key,
444
-				Apply:   apply,
445
-				ApplyDetailList: struct {
446
-					CustomerApplyDetail []models.CustomerApplyDetail `xml:"CustomerApplyDetail"`
447
-				}{
448
-					CustomerApplyDetail: list,
449
-				},
450
-				ApplyAdditional: nil,
451
-			},
452
-		},
453
-	}
454
-
455
-	// 将SOAP请求数据转换为XML格式
456
-	requestBody, err := xml.Marshal(requestData)
457
-	if err != nil {
458
-		fmt.Println("XML Marshal error:", err)
459
-	}
460
-	fmt.Println(string(requestBody))
461
-
462
-	// 创建POST请求
463
-	url := "http://gpis.cnhiqc.com:9799/InstituteLISService.asmx"
464
-	req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
465
-	if err != nil {
466
-		fmt.Println("Request creation error:", err)
467
-	}
468
-
469
-	// 设置请求头
470
-	req.Header.Set("Content-Type", "text/xml; charset=utf-8")
471
-	req.Header.Set("Content-Length", "length")
472
-	req.Header.Set("SOAPAction", "http://tempuri.org/InspectApplyByInstituteItemCode")
473
-
474
-	// 发送请求
475
-	client := &http.Client{}
476
-	resp, err := client.Do(req)
477
-	if err != nil {
478
-		fmt.Println("Request error:", err)
479
-	}
480
-	defer resp.Body.Close()
481
-
482
-	// 读取响应数据
483
-	responseBody, err := ioutil.ReadAll(resp.Body)
484
-	if err != nil {
485
-		fmt.Println("Response read error:", err)
486
-
487
-	}
488
-	fmt.Println(string(responseBody))
489
-
490
-	// 解析XML数据
491
-	var envelope_four models.EnvelopeFour
492
-	err2 := xml.Unmarshal(responseBody, &envelope_four)
493
-	if err2 != nil {
494
-		fmt.Println("XML Unmarshal error:", err2)
495
-
496
-	}
497
-
498
-	// 获取GetReportListResult的JSON字符串
499
-	jsonStr := envelope_four.Body.InspectApplyByInstituteItemCodeResponse.InspectApply
500
-
501
-	// 解析JSON字符串到结构体
502
-	var reportData models.InspectApplyData
503
-	err = json.Unmarshal([]byte(jsonStr), &reportData)
504
-
505
-	if err != nil {
506
-		fmt.Println("JSON Unmarshal error:", err)
507
-	}
508
-	if reportData.Res != 0 {
509
-		fmt.Println("Data:", reportData)
510
-		//return reportData.JYApplyResult
511
-	}
512
-	return reportData
513
-}
428
+//func PostInspectApply(key string, apply models.JYApply, list []models.CustomerApplyDetail) models.InspectApplyData {
429
+//	// 构建SOAP请求数据
430
+//	requestData := &models.JYApplyEnvelope{
431
+//		Soap: "http://schemas.xmlsoap.org/soap/envelope/",
432
+//		Xsi:  "http://www.w3.org/2001/XMLSchema-instance",
433
+//		Xsd:  "http://www.w3.org/2001/XMLSchema",
434
+//		Body: models.JYApplyBody{
435
+//			InspectApplyReq: models.InspectApplyReq{
436
+//				XMLName: xml.Name{Local: "InspectApplyByInstituteItemCode", Space: "http://tempuri.org/"},
437
+//				ApiKey:  key,
438
+//				Apply:   apply,
439
+//				ApplyDetailList: struct {
440
+//					CustomerApplyDetail []models.CustomerApplyDetail `xml:"CustomerApplyDetail"`
441
+//				}{
442
+//					CustomerApplyDetail: list,
443
+//				},
444
+//				ApplyAdditional: nil,
445
+//			},
446
+//		},
447
+//	}
448
+//
449
+//	// 将SOAP请求数据转换为XML格式
450
+//	requestBody, err := xml.Marshal(requestData)
451
+//	if err != nil {
452
+//		fmt.Println("XML Marshal error:", err)
453
+//	}
454
+//	fmt.Println(string(requestBody))
455
+//
456
+//	// 创建POST请求
457
+//	url := "http://gpis.cnhiqc.com:9799/InstituteLISService.asmx"
458
+//	req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
459
+//	if err != nil {
460
+//		fmt.Println("Request creation error:", err)
461
+//	}
462
+//
463
+//	// 设置请求头
464
+//	req.Header.Set("Content-Type", "text/xml; charset=utf-8")
465
+//	req.Header.Set("Content-Length", "length")
466
+//	req.Header.Set("SOAPAction", "http://tempuri.org/InspectApplyByInstituteItemCode")
467
+//
468
+//	// 发送请求
469
+//	client := &http.Client{}
470
+//	resp, err := client.Do(req)
471
+//	if err != nil {
472
+//		fmt.Println("Request error:", err)
473
+//	}
474
+//	defer resp.Body.Close()
475
+//
476
+//	// 读取响应数据
477
+//	responseBody, err := ioutil.ReadAll(resp.Body)
478
+//	if err != nil {
479
+//		fmt.Println("Response read error:", err)
480
+//
481
+//	}
482
+//	fmt.Println(string(responseBody))
483
+//
484
+//	// 解析XML数据
485
+//	var envelope_four models.EnvelopeFour
486
+//	err2 := xml.Unmarshal(responseBody, &envelope_four)
487
+//	if err2 != nil {
488
+//		fmt.Println("XML Unmarshal error:", err2)
489
+//
490
+//	}
491
+//
492
+//	// 获取GetReportListResult的JSON字符串
493
+//	jsonStr := envelope_four.Body.InspectApplyByInstituteItemCodeResponse.InspectApply
494
+//
495
+//	// 解析JSON字符串到结构体
496
+//	var reportData models.InspectApplyData
497
+//	err = json.Unmarshal([]byte(jsonStr), &reportData)
498
+//
499
+//	if err != nil {
500
+//		fmt.Println("JSON Unmarshal error:", err)
501
+//	}
502
+//	if reportData.Res != 0 {
503
+//		fmt.Println("Data:", reportData)
504
+//		//return reportData.JYApplyResult
505
+//	}
506
+//	return reportData
507
+//}
514 508
 
515 509
 func SaveErrorLog(result string, request string, infno string, desc string) {
516 510
 	//org_id, _ := beego.AppConfig.Int64("org_id")

+ 10 - 10
controllers/mobile_api_controllers/check_weight_api_controller.go Visa fil

@@ -543,13 +543,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
543 543
 				//记录日志
544 544
 				byterequest, _ := json.Marshal(newprescribe)
545 545
 				prescriptionLog := models.XtDialysisPrescriptionLog{
546
-					UserOrgId:   newprescribe.UserOrgId,
546
+					UserOrgId:   adminUserInfo.Org.Id,
547 547
 					Ctime:       time.Now().Unix(),
548 548
 					Mtime:       0,
549 549
 					ErrLog:      string(byterequest),
550 550
 					AdminUserId: adminUserInfo.AdminUser.Id,
551 551
 					RecordDate:  newprescribe.RecordDate,
552
-					PatientId:   newprescribe.PatientId,
552
+					PatientId:   id,
553 553
 					Source:      "物联网上传",
554 554
 					Status:      1,
555 555
 				}
@@ -634,13 +634,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
634 634
 				//记录日志
635 635
 				byterequest, _ := json.Marshal(newprescribe)
636 636
 				prescriptionLog := models.XtDialysisPrescriptionLog{
637
-					UserOrgId:   newprescribe.UserOrgId,
637
+					UserOrgId:   adminUserInfo.Org.Id,
638 638
 					Ctime:       time.Now().Unix(),
639 639
 					Mtime:       0,
640 640
 					ErrLog:      string(byterequest),
641 641
 					AdminUserId: adminUserInfo.AdminUser.Id,
642 642
 					RecordDate:  newprescribe.RecordDate,
643
-					PatientId:   newprescribe.PatientId,
643
+					PatientId:   id,
644 644
 					Source:      "物联网上传",
645 645
 					Status:      1,
646 646
 				}
@@ -676,13 +676,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
676 676
 				//记录日志
677 677
 				byterequest, _ := json.Marshal(newprescribe)
678 678
 				prescriptionLog := models.XtDialysisPrescriptionLog{
679
-					UserOrgId:   newprescribe.UserOrgId,
679
+					UserOrgId:   adminUserInfo.Org.Id,
680 680
 					Ctime:       time.Now().Unix(),
681 681
 					Mtime:       0,
682 682
 					ErrLog:      string(byterequest),
683 683
 					AdminUserId: adminUserInfo.AdminUser.Id,
684 684
 					RecordDate:  newprescribe.RecordDate,
685
-					PatientId:   newprescribe.PatientId,
685
+					PatientId:   id,
686 686
 					Source:      "物联网上传",
687 687
 					Status:      1,
688 688
 				}
@@ -717,13 +717,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
717 717
 			//记录日志
718 718
 			byterequest, _ := json.Marshal(dialysisPrescribe)
719 719
 			prescriptionLog := models.XtDialysisPrescriptionLog{
720
-				UserOrgId:   dialysisPrescribe.UserOrgId,
720
+				UserOrgId:   adminUserInfo.Org.Id,
721 721
 				Ctime:       time.Now().Unix(),
722 722
 				Mtime:       0,
723 723
 				ErrLog:      string(byterequest),
724 724
 				AdminUserId: adminUserInfo.AdminUser.Id,
725 725
 				RecordDate:  dialysisPrescribe.RecordDate,
726
-				PatientId:   dialysisPrescribe.PatientId,
726
+				PatientId:   id,
727 727
 				Source:      "物联网上传",
728 728
 				Status:      1,
729 729
 			}
@@ -849,13 +849,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
849 849
 		//记录日志
850 850
 		byterequest, _ := json.Marshal(evaluation)
851 851
 		beforLog := models.XtAssessmentBeforeDislysisLog{
852
-			UserOrgId:   evaluation.UserOrgId,
852
+			UserOrgId:   adminUserInfo.Org.Id,
853 853
 			Ctime:       time.Now().Unix(),
854 854
 			Mtime:       0,
855 855
 			ErrLog:      string(byterequest),
856 856
 			AdminUserId: adminUserInfo.AdminUser.Id,
857 857
 			RecordDate:  evaluation.AssessmentDate,
858
-			PatientId:   evaluation.PatientId,
858
+			PatientId:   id,
859 859
 			Source:      "物联网上传",
860 860
 			Status:      1,
861 861
 		}

+ 1 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

@@ -1631,7 +1631,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1631 1631
 			Status:      1,
1632 1632
 			ErrLog:      string(byterequest),
1633 1633
 			AdminUserId: adminUserInfo.AdminUser.Id,
1634
-			Ctime:       0,
1634
+			Ctime:       time.Now().Unix(),
1635 1635
 			Mtime:       0,
1636 1636
 			Source:      "手机端修改保存透后评估",
1637 1637
 		}

+ 36 - 1
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Visa fil

@@ -211,7 +211,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
211 211
 		PatientId:   record.PatientId,
212 212
 		Module:      1,
213 213
 		AdminUserId: adminInfo.AdminUser.Id,
214
-		Ctime:       0,
214
+		Ctime:       time.Now().Unix(),
215 215
 		Mtime:       0,
216 216
 		Status:      1,
217 217
 		UserOrgId:   record.UserOrgId,
@@ -663,6 +663,24 @@ func (this *DialysisAPIController) AddUrgentSchedule() {
663 663
 				IsExport:     5,
664 664
 			}
665 665
 			createErr := service.CreateScheduleTwo(newSchedule)
666
+
667
+			//记录日志
668
+			byterequest, _ := json.Marshal(newSchedule)
669
+			scheduleLog := models.XtScheduleLog{
670
+				UserOrgId:   adminUserInfo.Org.Id,
671
+				RecordDate:  scheduleDate.Unix(),
672
+				Status:      1,
673
+				PatientId:   patientID,
674
+				Ctime:       time.Now().Unix(),
675
+				Mtime:       0,
676
+				ErrLog:      string(byterequest),
677
+				Source:      "手机端新增排班",
678
+				Module:      1,
679
+				AdminUserId: adminUserInfo.AdminUser.Id,
680
+			}
681
+
682
+			service.CreateScheduleLog(scheduleLog)
683
+
666 684
 			redis := service.RedisClient()
667 685
 			timeStr := time.Now().Format("2006-01-02")
668 686
 			key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
@@ -725,6 +743,23 @@ func (this *DialysisAPIController) AddUrgentSchedule() {
725 743
 					daySchedule.ScheduleType = scheduleType
726 744
 					daySchedule.UpdatedTime = time.Now().Unix()
727 745
 					err := service.UpdateSchedule(&daySchedule)
746
+
747
+					//记录日志
748
+					byterequest, _ := json.Marshal(daySchedule)
749
+					scheduleLog := models.XtScheduleLog{
750
+						UserOrgId:   adminUserInfo.Org.Id,
751
+						RecordDate:  scheduleDate.Unix(),
752
+						Status:      1,
753
+						PatientId:   patientID,
754
+						Ctime:       time.Now().Unix(),
755
+						Mtime:       0,
756
+						ErrLog:      string(byterequest),
757
+						Source:      "手机端修改排班",
758
+						Module:      1,
759
+						AdminUserId: adminUserInfo.AdminUser.Id,
760
+					}
761
+					service.CreateScheduleLog(scheduleLog)
762
+
728 763
 					redis := service.RedisClient()
729 764
 
730 765
 					timeStr := time.Now().Format("2006-01-02")

+ 67 - 50
controllers/mobile_api_controllers/patient_api_controller.go Visa fil

@@ -669,6 +669,23 @@ func (c *PatientApiController) ExecDoctorAdvice() {
669 669
 				if item.ExecutionState == 2 {
670 670
 					advice = item
671 671
 				}
672
+
673
+				//记录日志
674
+				byterequest, _ := json.Marshal(item)
675
+				adviceLog := models.XtDoctorAdviceLog{
676
+					UserOrgId:   item.UserOrgId,
677
+					PatientId:   item.PatientId,
678
+					AdminUserId: adminUserInfo.AdminUser.Id,
679
+					Module:      2,
680
+					ErrLog:      string(byterequest),
681
+					Status:      1,
682
+					Ctime:       time.Now().Unix(),
683
+					Mtime:       0,
684
+					Source:      "手机端执行医嘱",
685
+					RecordDate:  item.AdviceDate,
686
+				}
687
+
688
+				service.CreateDoctorAdviceLog(adviceLog)
672 689
 			}
673 690
 		} else {
674 691
 			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
@@ -737,22 +754,6 @@ func (c *PatientApiController) ExecDoctorAdvice() {
737 754
 				}
738 755
 			}
739 756
 			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
740
-			//记录日志
741
-			byterequest, _ := json.Marshal(advices)
742
-			adviceLog := models.XtDoctorAdviceLog{
743
-				UserOrgId:   advices.UserOrgId,
744
-				PatientId:   advices.PatientId,
745
-				AdminUserId: advices.ExecutionStaff,
746
-				Module:      2,
747
-				ErrLog:      string(byterequest),
748
-				Status:      1,
749
-				Ctime:       time.Now().Unix(),
750
-				Mtime:       0,
751
-				Source:      "手机端执行医嘱",
752
-				RecordDate:  advices.RecordDate,
753
-			}
754
-
755
-			service.CreateDoctorAdviceLog(adviceLog)
756 757
 
757 758
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
758 759
 			redis := service.RedisClient()
@@ -802,11 +803,11 @@ func (c *PatientApiController) ExecDoctorAdvice() {
802 803
 			err = service.BatchExceOldDoctorAdvice(&advices, ids)
803 804
 
804 805
 			//记录日志
805
-			byterequest, _ := json.Marshal(advices)
806
+			byterequest, _ := json.Marshal(advice)
806 807
 			adviceLog := models.XtDoctorAdviceLog{
807
-				UserOrgId:   advices.UserOrgId,
808
-				PatientId:   advices.PatientId,
809
-				AdminUserId: advices.ExecutionStaff,
808
+				UserOrgId:   advice.UserOrgId,
809
+				PatientId:   advice.PatientId,
810
+				AdminUserId: adminUserInfo.AdminUser.Id,
810 811
 				Module:      2,
811 812
 				ErrLog:      string(byterequest),
812 813
 				Status:      1,
@@ -1994,6 +1995,22 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1994 1995
 				if item.CheckState == 0 {
1995 1996
 					advice = item
1996 1997
 				}
1998
+
1999
+				//记录日志
2000
+				byterequest, _ := json.Marshal(advices)
2001
+				adviceLog := models.XtDoctorAdviceLog{
2002
+					UserOrgId:   adminUserInfo.Org.Id,
2003
+					PatientId:   item.PatientId,
2004
+					AdminUserId: adminUserInfo.AdminUser.Id,
2005
+					Module:      3,
2006
+					ErrLog:      string(byterequest),
2007
+					Status:      1,
2008
+					Ctime:       time.Now().Unix(),
2009
+					Mtime:       0,
2010
+					Source:      "手机端核对医嘱",
2011
+					RecordDate:  item.AdviceDate,
2012
+				}
2013
+				service.CreateDoctorAdviceLog(adviceLog)
1997 2014
 			}
1998 2015
 			if advice.CheckState == 1 {
1999 2016
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
@@ -2011,6 +2028,22 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2011 2028
 					advice = item
2012 2029
 
2013 2030
 				}
2031
+
2032
+				//记录日志
2033
+				byterequest, _ := json.Marshal(advices)
2034
+				adviceLog := models.XtDoctorAdviceLog{
2035
+					UserOrgId:   adminUserInfo.Org.Id,
2036
+					PatientId:   item.PatientId,
2037
+					AdminUserId: adminUserInfo.AdminUser.Id,
2038
+					Module:      3,
2039
+					ErrLog:      string(byterequest),
2040
+					Status:      1,
2041
+					Ctime:       time.Now().Unix(),
2042
+					Mtime:       0,
2043
+					Source:      "手机端核对医嘱",
2044
+					RecordDate:  item.AdviceDate,
2045
+				}
2046
+				service.CreateDoctorAdviceLog(adviceLog)
2014 2047
 			}
2015 2048
 			if advice.CheckState == 1 {
2016 2049
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
@@ -2059,22 +2092,6 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2059 2092
 			}
2060 2093
 			err = service.CheckDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
2061 2094
 
2062
-			//记录日志
2063
-			byterequest, _ := json.Marshal(advices)
2064
-			adviceLog := models.XtDoctorAdviceLog{
2065
-				UserOrgId:   adminUserInfo.Org.Id,
2066
-				PatientId:   advices.PatientId,
2067
-				AdminUserId: advices.Checker,
2068
-				Module:      3,
2069
-				ErrLog:      string(byterequest),
2070
-				Status:      1,
2071
-				Ctime:       time.Now().Unix(),
2072
-				Mtime:       0,
2073
-				Source:      "手机端核对医嘱",
2074
-				RecordDate:  advices.AdviceDate,
2075
-			}
2076
-			service.CreateDoctorAdviceLog(adviceLog)
2077
-
2078 2095
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
2079 2096
 			redis := service.RedisClient()
2080 2097
 			//清空key 值
@@ -2451,13 +2468,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2451 2468
 			//记录日志
2452 2469
 			byterequest, _ := json.Marshal(newprescribe)
2453 2470
 			prescriptionLog := models.XtDialysisPrescriptionLog{
2454
-				UserOrgId:   newprescribe.UserOrgId,
2471
+				UserOrgId:   adminUserInfo.Org.Id,
2455 2472
 				Ctime:       time.Now().Unix(),
2456 2473
 				Mtime:       0,
2457 2474
 				ErrLog:      string(byterequest),
2458 2475
 				AdminUserId: adminUserInfo.AdminUser.Id,
2459 2476
 				RecordDate:  newprescribe.RecordDate,
2460
-				PatientId:   newprescribe.PatientId,
2477
+				PatientId:   id,
2461 2478
 				Source:      "手机端新增透前评估插入处方",
2462 2479
 				Status:      1,
2463 2480
 			}
@@ -2506,13 +2523,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2506 2523
 			//记录日志
2507 2524
 			byterequest, _ := json.Marshal(newprescribe)
2508 2525
 			prescriptionLog := models.XtDialysisPrescriptionLog{
2509
-				UserOrgId:   newprescribe.UserOrgId,
2526
+				UserOrgId:   adminUserInfo.Org.Id,
2510 2527
 				Ctime:       time.Now().Unix(),
2511 2528
 				Mtime:       0,
2512 2529
 				ErrLog:      string(byterequest),
2513 2530
 				AdminUserId: adminUserInfo.AdminUser.Id,
2514 2531
 				RecordDate:  newprescribe.RecordDate,
2515
-				PatientId:   newprescribe.PatientId,
2532
+				PatientId:   id,
2516 2533
 				Source:      "手机端新增透前评估插入处方",
2517 2534
 				Status:      1,
2518 2535
 			}
@@ -2610,13 +2627,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2610 2627
 				//记录日志
2611 2628
 				byterequest, _ := json.Marshal(newprescribe)
2612 2629
 				prescriptionLog := models.XtDialysisPrescriptionLog{
2613
-					UserOrgId:   newprescribe.UserOrgId,
2630
+					UserOrgId:   adminUserInfo.Org.Id,
2614 2631
 					Ctime:       time.Now().Unix(),
2615 2632
 					Mtime:       0,
2616 2633
 					ErrLog:      string(byterequest),
2617 2634
 					AdminUserId: adminUserInfo.AdminUser.Id,
2618 2635
 					RecordDate:  newprescribe.RecordDate,
2619
-					PatientId:   newprescribe.PatientId,
2636
+					PatientId:   id,
2620 2637
 					Source:      "手机端新增透前评估插入处方",
2621 2638
 					Status:      1,
2622 2639
 				}
@@ -2660,13 +2677,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2660 2677
 				//记录日志
2661 2678
 				byterequest, _ := json.Marshal(newprescribe)
2662 2679
 				prescriptionLog := models.XtDialysisPrescriptionLog{
2663
-					UserOrgId:   newprescribe.UserOrgId,
2680
+					UserOrgId:   adminUserInfo.Org.Id,
2664 2681
 					Ctime:       time.Now().Unix(),
2665 2682
 					Mtime:       0,
2666 2683
 					ErrLog:      string(byterequest),
2667 2684
 					AdminUserId: adminUserInfo.AdminUser.Id,
2668 2685
 					RecordDate:  newprescribe.RecordDate,
2669
-					PatientId:   newprescribe.PatientId,
2686
+					PatientId:   id,
2670 2687
 					Source:      "手机端新增透前评估插入处方",
2671 2688
 					Status:      1,
2672 2689
 				}
@@ -2763,13 +2780,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2763 2780
 				//记录日志
2764 2781
 				byterequest, _ := json.Marshal(newprescribe)
2765 2782
 				prescriptionLog := models.XtDialysisPrescriptionLog{
2766
-					UserOrgId:   newprescribe.UserOrgId,
2783
+					UserOrgId:   adminUserInfo.Org.Id,
2767 2784
 					Ctime:       time.Now().Unix(),
2768 2785
 					Mtime:       0,
2769 2786
 					ErrLog:      string(byterequest),
2770 2787
 					AdminUserId: adminUserInfo.AdminUser.Id,
2771 2788
 					RecordDate:  newprescribe.RecordDate,
2772
-					PatientId:   newprescribe.PatientId,
2789
+					PatientId:   id,
2773 2790
 					Source:      "手机端新增透前评估插入处方",
2774 2791
 					Status:      1,
2775 2792
 				}
@@ -2816,13 +2833,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2816 2833
 				//记录日志
2817 2834
 				byterequest, _ := json.Marshal(newprescribe)
2818 2835
 				prescriptionLog := models.XtDialysisPrescriptionLog{
2819
-					UserOrgId:   newprescribe.UserOrgId,
2836
+					UserOrgId:   adminUserInfo.Org.Id,
2820 2837
 					Ctime:       time.Now().Unix(),
2821 2838
 					Mtime:       0,
2822 2839
 					ErrLog:      string(byterequest),
2823 2840
 					AdminUserId: adminUserInfo.AdminUser.Id,
2824 2841
 					RecordDate:  newprescribe.RecordDate,
2825
-					PatientId:   newprescribe.PatientId,
2842
+					PatientId:   id,
2826 2843
 					Source:      "手机端新增透前评估插入处方",
2827 2844
 					Status:      1,
2828 2845
 				}
@@ -2920,13 +2937,13 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2920 2937
 				//记录日志
2921 2938
 				byterequest, _ := json.Marshal(newprescribe)
2922 2939
 				prescriptionLog := models.XtDialysisPrescriptionLog{
2923
-					UserOrgId:   newprescribe.UserOrgId,
2940
+					UserOrgId:   adminUserInfo.Org.Id,
2924 2941
 					Ctime:       time.Now().Unix(),
2925 2942
 					Mtime:       0,
2926 2943
 					ErrLog:      string(byterequest),
2927 2944
 					AdminUserId: adminUserInfo.AdminUser.Id,
2928 2945
 					RecordDate:  newprescribe.RecordDate,
2929
-					PatientId:   newprescribe.PatientId,
2946
+					PatientId:   id,
2930 2947
 					Source:      "手机端新增透前评估插入处方",
2931 2948
 					Status:      1,
2932 2949
 				}

+ 84 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Visa fil

@@ -491,8 +491,25 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
491 491
 	id, _ := this.GetInt64("id")
492 492
 	org_id := this.GetMobileAdminUserInfo().Org.Id
493 493
 	err := service.DeleteSchedule(id)
494
+
494 495
 	if err == nil {
495 496
 		schedule, _ := service.GetScheduleNight(org_id, id)
497
+
498
+		//记录日志
499
+		byterequest, _ := json.Marshal(schedule)
500
+		xtScheduleLog := models.XtScheduleLog{
501
+			UserOrgId:   org_id,
502
+			RecordDate:  schedule.ScheduleDate,
503
+			Status:      1,
504
+			PatientId:   schedule.PatientId,
505
+			Ctime:       time.Now().Unix(),
506
+			Mtime:       0,
507
+			ErrLog:      string(byterequest),
508
+			Source:      "手机端删除排班",
509
+			Module:      5,
510
+			AdminUserId: this.GetAdminUserInfo().AdminUser.Id,
511
+		}
512
+		service.CreateScheduleLog(xtScheduleLog)
496 513
 		redis := service.RedisClient()
497 514
 		//处方
498 515
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
@@ -640,6 +657,24 @@ func (this *StaffScheduleApiController) UpdateBloodScheduleMode() {
640 657
 		ModeId: mode_id,
641 658
 	}
642 659
 	service.UpdatedScheduleMode(schedule, id)
660
+
661
+	orgId := this.GetAdminUserInfo().CurrentOrgId
662
+	//记录日志
663
+	byterequest, _ := json.Marshal(schedule)
664
+	scheduleLog := models.XtScheduleLog{
665
+		UserOrgId:   orgId,
666
+		RecordDate:  schedule.ScheduleDate,
667
+		Status:      1,
668
+		PatientId:   schedule.PatientId,
669
+		Ctime:       time.Now().Unix(),
670
+		Mtime:       0,
671
+		ErrLog:      string(byterequest),
672
+		Source:      "手机端修改排班模式",
673
+		Module:      5,
674
+		AdminUserId: this.GetAdminUserInfo().AdminUser.Id,
675
+	}
676
+
677
+	service.CreateScheduleLog(scheduleLog)
643 678
 	this.ServeSuccessJSON(map[string]interface{}{
644 679
 		"msg": "保存成功",
645 680
 	})
@@ -663,6 +698,23 @@ func (this *StaffScheduleApiController) UpdateBloodSchedule() {
663 698
 	_, errschedulecode := service.GetPatientScheduleIsExist(start_time, schedule_type, bed_id, orgid)
664 699
 	if errschedulecode == gorm.ErrRecordNotFound {
665 700
 		service.UpdatedSchedule(schedule, patient_id, start_time, schedule_type, bed_id)
701
+
702
+		//记录日志
703
+		byterequest, _ := json.Marshal(schedule)
704
+		scheduleLog := models.XtScheduleLog{
705
+			UserOrgId:   orgid,
706
+			RecordDate:  schedule.ScheduleDate,
707
+			Status:      1,
708
+			PatientId:   schedule.PatientId,
709
+			Ctime:       time.Now().Unix(),
710
+			Mtime:       0,
711
+			ErrLog:      string(byterequest),
712
+			Source:      "手机修改排班班次",
713
+			Module:      5,
714
+			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
715
+		}
716
+
717
+		service.CreateScheduleLog(scheduleLog)
666 718
 		this.ServeSuccessJSON(map[string]interface{}{
667 719
 			"msgerr": "保存成功",
668 720
 		})
@@ -1132,6 +1184,22 @@ func (c *StaffScheduleApiController) ChangeScheduleBed() {
1132 1184
 		}
1133 1185
 		schedu.DialysisMachineName = DialysisMachineName1
1134 1186
 		err := service.UpdateScheduleById(schedule.ID, schedu, id, sch)
1187
+		//记录日志
1188
+		byterequest, _ := json.Marshal(schedule)
1189
+		scheduleLog := models.XtScheduleLog{
1190
+			UserOrgId:   org_id,
1191
+			RecordDate:  schedule.ScheduleDate,
1192
+			Status:      1,
1193
+			PatientId:   schedule.PatientId,
1194
+			Ctime:       time.Now().Unix(),
1195
+			Mtime:       0,
1196
+			ErrLog:      string(byterequest),
1197
+			Source:      "手机端修改调班",
1198
+			Module:      4,
1199
+			AdminUserId: c.GetMobileAdminUserInfo().AdminUser.Id,
1200
+		}
1201
+
1202
+		service.CreateScheduleLog(scheduleLog)
1135 1203
 		if err == nil {
1136 1204
 			c.ServeSuccessJSON(map[string]interface{}{
1137 1205
 				"msg": "ok",
@@ -1171,6 +1239,22 @@ func (c *StaffScheduleApiController) ChangeScheduleBed() {
1171 1239
 		}
1172 1240
 		var err error
1173 1241
 		err = service.CreateSchedule(&xtSchedule, id)
1242
+		//记录日志
1243
+		byterequest, _ := json.Marshal(schedule)
1244
+		scheduleLog := models.XtScheduleLog{
1245
+			UserOrgId:   org_id,
1246
+			RecordDate:  schedule.ScheduleDate,
1247
+			Status:      1,
1248
+			PatientId:   schedule.PatientId,
1249
+			Ctime:       time.Now().Unix(),
1250
+			Mtime:       0,
1251
+			ErrLog:      string(byterequest),
1252
+			Source:      "手机端新建调班",
1253
+			Module:      1,
1254
+			AdminUserId: c.GetMobileAdminUserInfo().AdminUser.Id,
1255
+		}
1256
+
1257
+		service.CreateScheduleLog(scheduleLog)
1174 1258
 		if err == nil {
1175 1259
 			c.ServeSuccessJSON(map[string]interface{}{
1176 1260
 				"msg": "ok",

+ 69 - 0
controllers/schedule_api_controller.go Visa fil

@@ -1558,6 +1558,23 @@ func (c *ScheduleApiController) CreateSchedule() {
1558 1558
 	schedule.IsExport = 1000
1559 1559
 	err = service.CreateScheduleTwo(&schedule)
1560 1560
 
1561
+	//记录日志
1562
+	byterequest, _ := json.Marshal(schedule)
1563
+	scheduleLog := models.XtScheduleLog{
1564
+		UserOrgId:   adminUserInfo.CurrentOrgId,
1565
+		RecordDate:  schedule.ScheduleDate,
1566
+		Status:      1,
1567
+		PatientId:   schedule.PatientId,
1568
+		Ctime:       time.Now().Unix(),
1569
+		Mtime:       0,
1570
+		ErrLog:      string(byterequest),
1571
+		Source:      "电脑端新增排班",
1572
+		Module:      1,
1573
+		AdminUserId: adminUserInfo.AdminUser.Id,
1574
+	}
1575
+
1576
+	service.CreateScheduleLog(scheduleLog)
1577
+
1561 1578
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1562 1579
 
1563 1580
 	redis.Set(key, "", time.Second)
@@ -1900,6 +1917,24 @@ func (c *ScheduleApiController) DeleteSchedule() {
1900 1917
 	schedule.Status = 0
1901 1918
 	schedule.UpdatedTime = time.Now().Unix()
1902 1919
 	err = service.UpdateSchedule(schedule)
1920
+
1921
+	//记录日志
1922
+	byterequest, _ := json.Marshal(schedule)
1923
+	scheduleLog := models.XtScheduleLog{
1924
+		UserOrgId:   adminINfo.CurrentOrgId,
1925
+		RecordDate:  schedule.ScheduleDate,
1926
+		Status:      1,
1927
+		PatientId:   schedule.PatientId,
1928
+		Ctime:       time.Now().Unix(),
1929
+		Mtime:       0,
1930
+		ErrLog:      string(byterequest),
1931
+		Source:      "电脑端删除排班",
1932
+		Module:      5,
1933
+		AdminUserId: adminINfo.AdminUser.Id,
1934
+	}
1935
+
1936
+	service.CreateScheduleLog(scheduleLog)
1937
+
1903 1938
 	redis := service.RedisClient()
1904 1939
 
1905 1940
 	//处方
@@ -2026,6 +2061,23 @@ func (c *ScheduleApiController) ChangeSchedule() {
2026 2061
 			return
2027 2062
 		}
2028 2063
 
2064
+		//记录日志
2065
+		byterequest, _ := json.Marshal(schedule)
2066
+		scheduleLog := models.XtScheduleLog{
2067
+			UserOrgId:   adminINfo.CurrentOrgId,
2068
+			RecordDate:  schedule.ScheduleDate,
2069
+			Status:      1,
2070
+			PatientId:   schedule.PatientId,
2071
+			Ctime:       time.Now().Unix(),
2072
+			Mtime:       0,
2073
+			ErrLog:      string(byterequest),
2074
+			Source:      "电脑端改变模式排班",
2075
+			Module:      1,
2076
+			AdminUserId: adminINfo.AdminUser.Id,
2077
+		}
2078
+
2079
+		service.CreateScheduleLog(scheduleLog)
2080
+
2029 2081
 	} else if changeAction == "change_device" {
2030 2082
 		order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule.ScheduleDate, schedule.PatientId)
2031 2083
 		if err != nil {
@@ -2107,6 +2159,23 @@ func (c *ScheduleApiController) ChangeSchedule() {
2107 2159
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePointScheduleExist)
2108 2160
 			return
2109 2161
 		}
2162
+
2163
+		//记录日志
2164
+		byterequest, _ := json.Marshal(schedule)
2165
+		scheduleLog := models.XtScheduleLog{
2166
+			UserOrgId:   adminINfo.CurrentOrgId,
2167
+			RecordDate:  schedule.ScheduleDate,
2168
+			Status:      1,
2169
+			PatientId:   schedule.PatientId,
2170
+			Ctime:       time.Now().Unix(),
2171
+			Mtime:       0,
2172
+			ErrLog:      string(byterequest),
2173
+			Source:      "电脑端改变分区床位",
2174
+			Module:      4,
2175
+			AdminUserId: adminINfo.AdminUser.Id,
2176
+		}
2177
+
2178
+		service.CreateScheduleLog(scheduleLog)
2110 2179
 	} else {
2111 2180
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2112 2181
 		return

+ 18 - 0
models/patient_models.go Visa fil

@@ -2107,3 +2107,21 @@ type XtMonitorRecordLog struct {
2107 2107
 func (XtMonitorRecordLog) TableName() string {
2108 2108
 	return "xt_monitor_record_log"
2109 2109
 }
2110
+
2111
+type XtScheduleLog struct {
2112
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
2113
+	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2114
+	RecordDate  int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2115
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
2116
+	PatientId   int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2117
+	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2118
+	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2119
+	ErrLog      string `gorm:"column:err_log" json:"err_log" form:"err_log"`
2120
+	Source      string `gorm:"column:source" json:"source" form:"source"`
2121
+	Module      int64  `gorm:"column:module" json:"module" form:"module"`
2122
+	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2123
+}
2124
+
2125
+func (XtScheduleLog) TableName() string {
2126
+	return "xt_schedule_log"
2127
+}

+ 1 - 1
service/common_service.go Visa fil

@@ -3488,7 +3488,7 @@ func GetModeIdCount(startime int64, endtime int64, orgid int64, page int64, limi
3488 3488
 
3489 3489
 func GetScheduleModeIdCount(startime int64, endtime int64, orgid int64, page int64, limit int64) (order []*models.BloodDialysisModeIdCount, err error) {
3490 3490
 
3491
-	db := XTReadDB().Table("xt_schedule as s")
3491
+	db := XTReadDB().Table("xt_schedule as s").Where("s.status = 1")
3492 3492
 	if orgid > 0 {
3493 3493
 		db = db.Where("s.user_org_id = ?", orgid)
3494 3494
 	}

+ 135 - 0
service/gobal_config_service.go Visa fil

@@ -1146,3 +1146,138 @@ func CheckMobileInformation(id int64, application_status int64, checker int64, c
1146 1146
 	err := XTWriteDB().Model(&models.XtDialysisInformation{}).Where("id = ? and status= 1", id).Update(map[string]interface{}{"application_status": application_status, "checker": checker, "check_time": checker_time}).Error
1147 1147
 	return err
1148 1148
 }
1149
+
1150
+func GetPrescriptionPatientList(orgID int64, keywords string) (patient []*models.Patients, err error) {
1151
+	fmt.Println("keyworsosososo", keywords)
1152
+	db := readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID)
1153
+	if len(keywords) > 0 {
1154
+		likekey := "%" + keywords + "%"
1155
+		err = db.Where("(name LIKE ?)", likekey).Find(&patient).Error
1156
+	} else {
1157
+		err = db.Find(&patient).Error
1158
+	}
1159
+	return
1160
+}
1161
+
1162
+func GetPrescriptionLogList(patient_id int64, page int64, limit int64, record_date int64, orgId int64) (prescriptionlog []*models.XtDialysisPrescriptionLog, total int64, err error) {
1163
+
1164
+	offset := (page - 1) * limit
1165
+
1166
+	db := XTReadDB().Model(prescriptionlog).Where("status =1")
1167
+
1168
+	if patient_id > 0 {
1169
+		db = db.Where("patient_id = ?", patient_id)
1170
+	}
1171
+
1172
+	if record_date > 0 {
1173
+		db = db.Where("record_date = ?", record_date)
1174
+	}
1175
+	if orgId > 0 {
1176
+		db = db.Where("user_org_id = ? ", orgId)
1177
+	}
1178
+
1179
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&prescriptionlog).Error
1180
+
1181
+	return prescriptionlog, total, err
1182
+
1183
+}
1184
+
1185
+func GetBeforLogList(patient_id int64, page int64, limit int64, record_date int64, orgId int64) (befor []*models.XtAssessmentBeforeDislysisLog, total int64, err error) {
1186
+
1187
+	offset := (page - 1) * limit
1188
+
1189
+	db := XTReadDB().Model(befor).Where("status =1")
1190
+
1191
+	if patient_id > 0 {
1192
+		db = db.Where("patient_id = ?", patient_id)
1193
+	}
1194
+
1195
+	if record_date > 0 {
1196
+		db = db.Where("record_date = ?", record_date)
1197
+	}
1198
+	if orgId > 0 {
1199
+		db = db.Where("user_org_id = ? ", orgId)
1200
+	}
1201
+
1202
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&befor).Error
1203
+
1204
+	return befor, total, err
1205
+}
1206
+
1207
+func GetAllPatientLog(orgid int64) (patients []*models.VMMonitorPatients, err error) {
1208
+
1209
+	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Find(&patients).Error
1210
+
1211
+	return patients, err
1212
+}
1213
+
1214
+func GetAllDoctorLog(orgid int64) (appRole []*models.App_Role, err error) {
1215
+	err = UserReadDB().Where("org_id = ? AND status = 1", orgid).Find(&appRole).Error
1216
+	return appRole, err
1217
+}
1218
+
1219
+func GetDocLogList(patient_id int64, page int64, limit int64, record_date int64, orgId int64) (doctorlist []*models.XtDoctorAdviceLog, total int64, err error) {
1220
+
1221
+	offset := (page - 1) * limit
1222
+
1223
+	db := XTReadDB().Model(doctorlist).Where("status =1")
1224
+
1225
+	if patient_id > 0 {
1226
+		db = db.Where("patient_id = ?", patient_id)
1227
+	}
1228
+
1229
+	if record_date > 0 {
1230
+		db = db.Where("record_date = ?", record_date)
1231
+	}
1232
+	if orgId > 0 {
1233
+		db = db.Where("user_org_id = ? ", orgId)
1234
+	}
1235
+
1236
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&doctorlist).Error
1237
+
1238
+	return doctorlist, total, err
1239
+}
1240
+
1241
+func GetMonitorLogList(patient_id int64, page int64, limit int64, record_date int64, orgId int64) (monitorlist []*models.XtMonitorRecordLog, total int64, err error) {
1242
+
1243
+	offset := (page - 1) * limit
1244
+
1245
+	db := XTReadDB().Model(monitorlist).Where("status =1")
1246
+
1247
+	if patient_id > 0 {
1248
+		db = db.Where("patient_id = ?", patient_id)
1249
+	}
1250
+
1251
+	if record_date > 0 {
1252
+		db = db.Where("record_date = ?", record_date)
1253
+	}
1254
+	if orgId > 0 {
1255
+		db = db.Where("user_org_id = ? ", orgId)
1256
+	}
1257
+
1258
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&monitorlist).Error
1259
+
1260
+	return monitorlist, total, err
1261
+}
1262
+
1263
+func GetAfterLogList(patient_id int64, page int64, limit int64, record_date int64, orgId int64) (afterlist []*models.XtMonitorRecordLog, total int64, err error) {
1264
+
1265
+	offset := (page - 1) * limit
1266
+
1267
+	db := XTReadDB().Model(afterlist).Where("status =1")
1268
+
1269
+	if patient_id > 0 {
1270
+		db = db.Where("patient_id = ?", patient_id)
1271
+	}
1272
+
1273
+	if record_date > 0 {
1274
+		db = db.Where("record_date = ?", record_date)
1275
+	}
1276
+	if orgId > 0 {
1277
+		db = db.Where("user_org_id = ? ", orgId)
1278
+	}
1279
+
1280
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&afterlist).Error
1281
+
1282
+	return afterlist, total, err
1283
+}

+ 7 - 0
service/schedule_service.go Visa fil

@@ -1725,3 +1725,10 @@ func GetNumberListById(id int64, org_id int64) (number []*models.DeviceNumber, e
1725 1725
 
1726 1726
 	return number, err
1727 1727
 }
1728
+
1729
+func CreateScheduleLog(log models.XtScheduleLog) error {
1730
+
1731
+	err := XTWriteDB().Create(log).Error
1732
+
1733
+	return err
1734
+}