Browse Source

修个部分问题

张保健 4 years ago
parent
commit
dc62043684

+ 4 - 4
controllers/base_api_controller.go View File

136
 			allPermission, _ := service.GetAllFunctionPurview()
136
 			allPermission, _ := service.GetAllFunctionPurview()
137
 
137
 
138
 			for _, item := range allPermission {
138
 			for _, item := range allPermission {
139
-				fmt.Println(len(strings.Split(item.Urlfor, ",")))
139
+				// fmt.Println(len(strings.Split(item.Urlfor, ",")))
140
 
140
 
141
-				fmt.Println(strings.Split(item.Urlfor, ","))
141
+				// fmt.Println(strings.Split(item.Urlfor, ","))
142
 				//fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
142
 				//fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
143
 
143
 
144
 				//判断当前路由是否在权限路由列表里面
144
 				//判断当前路由是否在权限路由列表里面
204
 			allPermission, _ := service.GetAllFunctionPurview()
204
 			allPermission, _ := service.GetAllFunctionPurview()
205
 
205
 
206
 			for _, item := range allPermission {
206
 			for _, item := range allPermission {
207
-				fmt.Println(strings.Split(item.Urlfor, ",")[2])
208
-				fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
207
+				// fmt.Println(strings.Split(item.Urlfor, ",")[2])
208
+				// fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
209
 
209
 
210
 				//判断当前路由是否在权限路由列表里面
210
 				//判断当前路由是否在权限路由列表里面
211
 				if strings.Split(item.Urlfor, ",")[2] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
211
 				if strings.Split(item.Urlfor, ",")[2] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 3 - 0
controllers/dialysis_api_controller.go View File

3308
 		var mode_id int64
3308
 		var mode_id int64
3309
 		if schedual != nil {
3309
 		if schedual != nil {
3310
 			dialysisPrescribe, _ = service.MobileGetDialysisPrescribeByModeId(adminUserInfo.CurrentOrgId, patient, recordDate.Unix(), schedual.ModeId)
3310
 			dialysisPrescribe, _ = service.MobileGetDialysisPrescribeByModeId(adminUserInfo.CurrentOrgId, patient, recordDate.Unix(), schedual.ModeId)
3311
+			if dialysisPrescribe == nil {
3312
+				dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3313
+			}
3311
 			lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribeByModeId(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
3314
 			lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribeByModeId(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
3312
 			// 获取透析模版
3315
 			// 获取透析模版
3313
 			dialysisSolution, _ = service.MobileGetDialysisSolutionByModeId(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
3316
 			dialysisSolution, _ = service.MobileGetDialysisSolutionByModeId(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)

+ 21 - 15
controllers/inspection_api_controller.go View File

124
 		return
124
 		return
125
 	}
125
 	}
126
 
126
 
127
-	timeLayout := "2006-01-02 15:04:05"
127
+	timeLayout := "2006-01-02 15:04"
128
 	loc, _ := time.LoadLocation("Local")
128
 	loc, _ := time.LoadLocation("Local")
129
 
129
 
130
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate+" 00:00:00", loc)
130
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
131
 	if err != nil {
131
 	if err != nil {
132
 		utils.ErrorLog(err.Error())
132
 		utils.ErrorLog(err.Error())
133
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
133
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
226
 }
226
 }
227
 
227
 
228
 func (c *InspectionApiController) EditPatientInspection() {
228
 func (c *InspectionApiController) EditPatientInspection() {
229
-	fmt.Println("触发了没有---------------------------------------")
230
 	patient, _ := c.GetInt64("patient", 0)
229
 	patient, _ := c.GetInt64("patient", 0)
231
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
230
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
232
-	dates := c.GetString("dates")
233
-	projectid := c.GetString("projectid")
234
-	fmt.Println("日期---", dates)
235
-	fmt.Println("projectid", projectid)
231
+	// dates := c.GetString("dates")
232
+	// projectid := c.GetString("projectid")
233
+
236
 	if patient <= 0 {
234
 	if patient <= 0 {
237
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
235
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
 		return
236
 		return
253
 		return
251
 		return
254
 	}
252
 	}
255
 
253
 
256
-	timeLayout := "2006-01-02 15:04:05"
254
+	timeLayout := "2006-01-02 15:04"
257
 	loc, _ := time.LoadLocation("Local")
255
 	loc, _ := time.LoadLocation("Local")
258
 
256
 
259
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate+" 00:00:00", loc)
257
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate , loc)
260
 	if err != nil {
258
 	if err != nil {
261
 		utils.ErrorLog(err.Error())
259
 		utils.ErrorLog(err.Error())
262
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
260
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
263
 		return
261
 		return
264
 	}
262
 	}
265
 
263
 
264
+	oldTime, olderr := time.ParseInLocation(timeLayout, from.OldInspectDate , loc)
265
+	if olderr != nil {
266
+		utils.ErrorLog(olderr.Error())
267
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
268
+		return
269
+	}
270
+
266
 	if len(from.FormItem) == 0 {
271
 	if len(from.FormItem) == 0 {
267
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未填写项目")
272
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未填写项目")
268
 		return
273
 		return
269
 	}
274
 	}
270
 
275
 
271
 	date := theTime.Unix()
276
 	date := theTime.Unix()
272
-	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
277
+	oldDate := oldTime.Unix()
278
+	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, oldDate, from.ProjectId)
273
 	if err != nil {
279
 	if err != nil {
274
 		utils.ErrorLog("%v", err)
280
 		utils.ErrorLog("%v", err)
275
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
281
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
306
 			inspection.CreatedTime = time.Now().Unix()
312
 			inspection.CreatedTime = time.Now().Unix()
307
 			inspection.UpdatedTime = time.Now().Unix()
313
 			inspection.UpdatedTime = time.Now().Unix()
308
 			addinsp = append(addinsp, inspection)
314
 			addinsp = append(addinsp, inspection)
309
-		} else if _, exi := inspMap[item.ID]; exi {
310
-			fmt.Println("2222222222")
315
+		} else {
311
 			inspection := *inspMap[item.ID]
316
 			inspection := *inspMap[item.ID]
312
 			inspection.InspectValue = item.Value
317
 			inspection.InspectValue = item.Value
318
+			inspection.InspectDate = date
313
 			inspection.UpdatedTime = time.Now().Unix()
319
 			inspection.UpdatedTime = time.Now().Unix()
314
 			editinsp = append(editinsp, inspection)
320
 			editinsp = append(editinsp, inspection)
315
 			noMap = append(noMap, item.ID)
321
 			noMap = append(noMap, item.ID)
373
 	patient, _ := c.GetInt64("patient", 0)
379
 	patient, _ := c.GetInt64("patient", 0)
374
 	ProjectId, _ := c.GetInt64("project_id", 0)
380
 	ProjectId, _ := c.GetInt64("project_id", 0)
375
 	InspectDate := c.GetString("date")
381
 	InspectDate := c.GetString("date")
376
-	if patient <= 0 || ProjectId <= 0 || len(InspectDate) != 10 {
382
+	if patient <= 0 || ProjectId <= 0 || len(InspectDate) < 10 {
377
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
383
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
378
 		return
384
 		return
379
 	}
385
 	}
380
 
386
 
381
-	timeLayout := "2006-01-02 15:04:05"
387
+	timeLayout := "2006-01-02 15:04"
382
 	loc, _ := time.LoadLocation("Local")
388
 	loc, _ := time.LoadLocation("Local")
383
 
389
 
384
-	theTime, err := time.ParseInLocation(timeLayout, InspectDate+" 00:00:00", loc)
390
+	theTime, err := time.ParseInLocation(timeLayout, InspectDate, loc)
385
 	if err != nil {
391
 	if err != nil {
386
 		utils.ErrorLog(err.Error())
392
 		utils.ErrorLog(err.Error())
387
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
393
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")

+ 2 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

135
 			allPermission, _ := service.GetAllFunctionPurview()
135
 			allPermission, _ := service.GetAllFunctionPurview()
136
 
136
 
137
 			for _, item := range allPermission {
137
 			for _, item := range allPermission {
138
-				fmt.Println(strings.Split(item.Urlfor, ",")[0])
139
-				fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
138
+				// fmt.Println(strings.Split(item.Urlfor, ",")[0])
139
+				// fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
140
 
140
 
141
 				//判断当前路由是否在权限路由列表里面
141
 				//判断当前路由是否在权限路由列表里面
142
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
142
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 20 - 17
controllers/schedule_api_controller.go View File

10
 	"github.com/jinzhu/gorm"
10
 	"github.com/jinzhu/gorm"
11
 	"reflect"
11
 	"reflect"
12
 	"strconv"
12
 	"strconv"
13
+	"strings"
13
 	"time"
14
 	"time"
14
 
15
 
15
 	"github.com/astaxie/beego"
16
 	"github.com/astaxie/beego"
621
 
622
 
622
 }
623
 }
623
 
624
 
624
-type aa struct {
625
-	b int64
626
-	c int64
627
-}
628
-
629
 func (this *ScheduleApiController) GetWeekDaySchedule() {
625
 func (this *ScheduleApiController) GetWeekDaySchedule() {
630
 	week_type, _ := this.GetInt64("week_type", -1)
626
 	week_type, _ := this.GetInt64("week_type", -1)
631
 	fmt.Println(week_type)
627
 	fmt.Println(week_type)
757
 			} else {
753
 			} else {
758
 				var patient []*models.Patients
754
 				var patient []*models.Patients
759
 				for _, item := range patients {
755
 				for _, item := range patients {
760
-					if item.Name == name {
756
+					if strings.Replace(item.Name, " ", "", -1) == name {
761
 						patient = append(patient, item)
757
 						patient = append(patient, item)
762
 					}
758
 					}
763
 				}
759
 				}
765
 					err_log := models.ExportErrLog{
761
 					err_log := models.ExportErrLog{
766
 						LogType:    2,
762
 						LogType:    2,
767
 						UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
763
 						UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
768
-						ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列的姓名在系统中不存在,请在系统中添加该病人",
764
+						ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列,患者姓名为\"" + name + "\"在系统中不存在,请在系统中添加该病人",
769
 						Status:     1,
765
 						Status:     1,
770
 						CreateTime: time.Now().Unix(),
766
 						CreateTime: time.Now().Unix(),
771
 						UpdateTime: time.Now().Unix(),
767
 						UpdateTime: time.Now().Unix(),
780
 				} else if len(patient) > 1 { //出现同名的情况
776
 				} else if len(patient) > 1 { //出现同名的情况
781
 
777
 
782
 					err_log := models.ExportErrLog{
778
 					err_log := models.ExportErrLog{
783
-						LogType:    2,
784
-						UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
785
-						ErrMsg:     "存在同名同姓的两个病人",
779
+						LogType:   2,
780
+						UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
781
+						//ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列" + "患者姓名为" + name + "在当前机构中存在重名,无法确定到具体患者",
782
+
783
+						ErrMsg: "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列,患者姓名为\"" + name + "\"在在当前机构中存在重名,无法确定到具体患者",
784
+
786
 						Status:     1,
785
 						Status:     1,
787
 						CreateTime: time.Now().Unix(),
786
 						CreateTime: time.Now().Unix(),
788
 						UpdateTime: time.Now().Unix(),
787
 						UpdateTime: time.Now().Unix(),
1311
 			} else {
1310
 			} else {
1312
 				var patient []*models.Patients
1311
 				var patient []*models.Patients
1313
 				for _, item := range patients {
1312
 				for _, item := range patients {
1314
-					if item.Name == name {
1313
+					if strings.Replace(item.Name, " ", "", -1) == name {
1315
 						patient = append(patient, item)
1314
 						patient = append(patient, item)
1316
 					}
1315
 					}
1317
 				}
1316
 				}
1318
 				if len(patient) == 0 { //错误日志
1317
 				if len(patient) == 0 { //错误日志
1319
 					err_log := models.ExportErrLog{
1318
 					err_log := models.ExportErrLog{
1320
-						LogType:    3,
1321
-						UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
1322
-						ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列的姓名在系统中不存在,请在系统中添加该病人",
1319
+						LogType:   3,
1320
+						UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
1321
+						//ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列的姓名在系统中不存在,请在系统中添加该病人",
1322
+						ErrMsg: "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列患者姓名为\"" + name + "\"在系统中不存在,请在系统中添加该病人",
1323
+
1323
 						Status:     1,
1324
 						Status:     1,
1324
 						CreateTime: time.Now().Unix(),
1325
 						CreateTime: time.Now().Unix(),
1325
 						UpdateTime: time.Now().Unix(),
1326
 						UpdateTime: time.Now().Unix(),
1334
 				} else if len(patient) > 1 { //出现同名的情况
1335
 				} else if len(patient) > 1 { //出现同名的情况
1335
 
1336
 
1336
 					err_log := models.ExportErrLog{
1337
 					err_log := models.ExportErrLog{
1337
-						LogType:    3,
1338
-						UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
1339
-						ErrMsg:     "存在同名同姓的两个病人",
1338
+						LogType:   3,
1339
+						UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
1340
+						//ErrMsg:     "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列" + "患者姓名为" + name + "在当前机构中存在重名,无法确定到具体患者",
1341
+						ErrMsg: "第" + strconv.FormatInt(int64(schMapM["index"].(float64)), 10) + "行,第" + schMapM["row"].(string) + "列患者姓名为\"" + name + "\"在当前机构中存在重名,无法确定到具体患者",
1342
+
1340
 						Status:     1,
1343
 						Status:     1,
1341
 						CreateTime: time.Now().Unix(),
1344
 						CreateTime: time.Now().Unix(),
1342
 						UpdateTime: time.Now().Unix(),
1345
 						UpdateTime: time.Now().Unix(),

+ 1 - 0
models/inspection_models.go View File

91
 	Method      string `json:"method"`
91
 	Method      string `json:"method"`
92
 	ProjectId   int64  `json:"project_id"`
92
 	ProjectId   int64  `json:"project_id"`
93
 	InspectDate string `json:"inspect_date"`
93
 	InspectDate string `json:"inspect_date"`
94
+	OldInspectDate string `json:"old_inspect_date"`
94
 	FormItem    []struct {
95
 	FormItem    []struct {
95
 		ID          int64  `json:"id"`
96
 		ID          int64  `json:"id"`
96
 		ProjectId   int64  `json:"project_id"`
97
 		ProjectId   int64  `json:"project_id"`

+ 16 - 0
数据变更脚本.sql View File

1
+--2020-06-17 author 张保健 --
2
+--透前评估添加体液过多症状字段--
3
+ALTER TABLE `sgj_xt`.`xt_assessment_before_dislysis`     ADD COLUMN `humor_excessive_symptom` SMALLINT(2) DEFAULT '0' NULL COMMENT '体液过多症状' AFTER `dialysis_intakes_unit`;
4
+--数据字典表里添加体液过多症状--
5
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '0','hemodialysis','0','体液过多症状','humor_excessive_symptom','0','2020-06-17 16:56:00','2020-06-17 16:56:00','0','1',NULL,'0',NULL,NULL,'0');
6
+--数据字典表里添加体液过多症状配置项,parent_id为上条语句的id--
7
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '1997','hemodialysis','0','无',NULL,'1','2020-06-17 16:00:00','2020-06-17 16:00:00','0','1',NULL,'0',NULL,NULL,'0');
8
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '1997','hemodialysis','0','下肢水肿+',NULL,'2','2020-06-17 16:00:00','2020-06-17 16:00:00','0','1',NULL,'0',NULL,NULL,'0');
9
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '1997','hemodialysis','0','下肢水肿++',NULL,'3','2020-06-17 16:00:00','2020-06-17 16:00:00','0','1',NULL,'0',NULL,NULL,'0');
10
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '1997','hemodialysis','0','下肢水肿+++',NULL,'4','2020-06-17 16:00:00','2020-06-17 16:00:00','0','1',NULL,'0',NULL,NULL,'0');
11
+--显示配置里添加体液过程症状--
12
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '0','3','humor_excessive_symptom','体液过多症状','2',NULL,NULL,'0');
13
+--添加显示体液过程症状的机构 org_id为要显示的机构--
14
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '13','3','humor_excessive_symptom','体液过多症状','1',NULL,NULL,'0');
15
+
16
+