28169 hace 2 meses
padre
commit
996d40e5b4

+ 7 - 7
controllers/base_api_controller.go Ver fichero

@@ -73,7 +73,7 @@ func (this *BaseAuthAPIController) Prepare() {
73 73
 		var userAdmin models.AdminUser
74 74
 		userAdmin.Id = 16919
75 75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 10344 //4,809
76
+		userAdmin.Id = 10579 //4,809
77 77
 		userAdmin.Mobile = "12222222222"
78 78
 		userAdmin.IsSuperAdmin = true
79 79
 		userAdmin.Status = 1
@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10206 //机构id 10344
84
+		subscibe.OrgId = 10344 //机构id 10344
85 85
 		subscibe.PeriodStart = 1547447814
86 86
 		subscibe.PeriodEnd = 1550039814
87 87
 		subscibe.State = 1
@@ -91,8 +91,8 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
95
-		adminUserInfo.CurrentAppId = 17282 //4
94
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
95
+		adminUserInfo.CurrentAppId = 14655 //4
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
98 98
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10206 //机构id小英10344或4
329
+		subscibe.OrgId = 10344 //机构id小英10344或4
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,8 +336,8 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
340
-		adminUserInfo.CurrentAppId = 17282 //4
339
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
340
+		adminUserInfo.CurrentAppId = 14655 //4
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes
343 343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 1
controllers/data_api_controller.go Ver fichero

@@ -884,7 +884,7 @@ func (c *DataApiController) UpdateExecutionFrequency() {
884 884
 	ef.UpdatedTime = timeNow
885 885
 	ef.Name = efdata.Name
886 886
 	ef.Code = efdata.Code
887
-
887
+	ef.Count = efdata.Count
888 888
 	err = service.UpdateExecutionFrequency(ef)
889 889
 	if err != nil {
890 890
 		utils.ErrorLog("%v", err)

+ 51 - 0
controllers/dialysis_api_controller.go Ver fichero

@@ -141,6 +141,8 @@ func DialysisApiRegistRouters() {
141 141
 	beego.Router("/api/patient/getgathersetting", &DialysisApiController{}, "Get:GetGatherSetting")
142 142
 
143 143
 	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
144
+
145
+	beego.Router("/api/getpatientdialysisrecordlist", &DialysisApiController{}, "Get:GetPatientDialysisRecordList")
144 146
 }
145 147
 
146 148
 func (c *DialysisApiController) GetQueueCall() {
@@ -7618,3 +7620,52 @@ func (this *DialysisApiController) GetDialysisGatherList() {
7618 7620
 	})
7619 7621
 	return
7620 7622
 }
7623
+
7624
+func (this *DialysisApiController) GetPatientDialysisRecordList() {
7625
+
7626
+	patient_id, _ := this.GetInt64("patient_id")
7627
+
7628
+	timeLayout := "2006-01-02"
7629
+	loc, _ := time.LoadLocation("Local")
7630
+
7631
+	start_time := this.GetString("start_time")
7632
+
7633
+	end_time := this.GetString("end_time")
7634
+
7635
+	var startdateunix int64
7636
+	if len(start_time) > 0 {
7637
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7638
+		if err != nil {
7639
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7640
+			return
7641
+		}
7642
+		startdateunix = theTime.Unix()
7643
+	}
7644
+	var enddateunix int64
7645
+	if len(end_time) > 0 {
7646
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
7647
+		if err != nil {
7648
+			utils.ErrorLog(err.Error())
7649
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7650
+			return
7651
+		}
7652
+		enddateunix = theTime.Unix()
7653
+	}
7654
+
7655
+	org_id := this.GetAdminUserInfo().CurrentOrgId
7656
+
7657
+	if org_id == 9538 || org_id == 10101 || org_id == 10353 {
7658
+		list, _ := service.GetPatientDialysisRecordList(patient_id, startdateunix, enddateunix)
7659
+		this.ServeSuccessJSON(map[string]interface{}{
7660
+			"list": list,
7661
+		})
7662
+		return
7663
+	} else {
7664
+		list, _ := service.GetPatientDialysisRecordListOne(patient_id, startdateunix, enddateunix)
7665
+		this.ServeSuccessJSON(map[string]interface{}{
7666
+			"list": list,
7667
+		})
7668
+	}
7669
+
7670
+	return
7671
+}

+ 309 - 64
controllers/mobile_api_controllers/check_weight_api_controller.go Ver fichero

@@ -428,6 +428,11 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
428 428
 				newprescribe.Remark = lastDialysisPrescription.Remark
429 429
 			}
430 430
 
431
+			//恒泰
432
+			if adminUserInfo.Org.Id == 10490 {
433
+				newprescribe.Remark = ""
434
+			}
435
+
431 436
 			//针对普宁和揭阳
432 437
 			if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
433 438
 				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
@@ -524,9 +529,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
524 529
 				newprescribe.TargetUltrafiltration = dewater_amount
525 530
 				newprescribe.PrescriptionWater = dewater_amount
526 531
 				newprescribe.Status = 1
527
-				if adminUserInfo.Org.Id != 10490 {
528
-					newprescribe.Remark = lastDialysisPrescribe.Remark
529
-				} else {
532
+				//if adminUserInfo.Org.Id != 10490 {
533
+				//	newprescribe.Remark = lastDialysisPrescribe.Remark
534
+				//} else {
535
+				//	newprescribe.Remark = ""
536
+				//}
537
+				if adminUserInfo.Org.Id == 10490 {
530 538
 					newprescribe.Remark = ""
531 539
 				}
532 540
 
@@ -1226,7 +1234,126 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
1226 1234
 			if daySchedule[0].Schedule.ID > 0 {
1227 1235
 				sc["code"] = 0
1228 1236
 				sc["msg"] = ""
1229
-				sc["mode"] = daySchedule[0].Schedule.ModeId
1237
+				var mode = "HD"
1238
+				if daySchedule[0].Schedule.ModeId == 1 {
1239
+					mode = "HD"
1240
+				}
1241
+
1242
+				if daySchedule[0].Schedule.ModeId == 2 {
1243
+					mode = "HDF"
1244
+				}
1245
+
1246
+				if daySchedule[0].Schedule.ModeId == 3 {
1247
+					mode = "HD+HP"
1248
+				}
1249
+
1250
+				if daySchedule[0].Schedule.ModeId == 4 {
1251
+					mode = "HP"
1252
+				}
1253
+
1254
+				if daySchedule[0].Schedule.ModeId == 5 {
1255
+					mode = "HF"
1256
+				}
1257
+
1258
+				if daySchedule[0].Schedule.ModeId == 6 {
1259
+					mode = "SCUF"
1260
+				}
1261
+
1262
+				if daySchedule[0].Schedule.ModeId == 7 {
1263
+					mode = "IUF"
1264
+				}
1265
+
1266
+				if daySchedule[0].Schedule.ModeId == 8 {
1267
+					mode = "HFHD"
1268
+				}
1269
+
1270
+				if daySchedule[0].Schedule.ModeId == 9 {
1271
+					mode = "HFHD+HP"
1272
+				}
1273
+				if daySchedule[0].Schedule.ModeId == 10 {
1274
+					mode = "PHF"
1275
+				}
1276
+
1277
+				if daySchedule[0].Schedule.ModeId == 11 {
1278
+					mode = "HFR"
1279
+				}
1280
+
1281
+				if daySchedule[0].Schedule.ModeId == 12 {
1282
+					mode = "HDF+HP"
1283
+				}
1284
+
1285
+				if daySchedule[0].Schedule.ModeId == 13 {
1286
+					mode = "CRRT"
1287
+				}
1288
+
1289
+				if daySchedule[0].Schedule.ModeId == 14 {
1290
+					mode = "腹水回输"
1291
+				}
1292
+				if daySchedule[0].Schedule.ModeId == 19 {
1293
+					mode = "IUF+HD"
1294
+				}
1295
+				if daySchedule[0].Schedule.ModeId == 20 {
1296
+					mode = "UF"
1297
+				}
1298
+				if daySchedule[0].Schedule.ModeId == 21 {
1299
+					mode = "HD+"
1300
+				}
1301
+				if daySchedule[0].Schedule.ModeId == 22 {
1302
+					mode = "血浆胆红素吸附+HDF"
1303
+				}
1304
+				if daySchedule[0].Schedule.ModeId == 23 {
1305
+					mode = "血浆胆红素吸附"
1306
+				}
1307
+				if daySchedule[0].Schedule.ModeId == 24 {
1308
+					mode = "I-HDF"
1309
+				}
1310
+
1311
+				if daySchedule[0].Schedule.ModeId == 25 {
1312
+					mode = "HD高通"
1313
+				}
1314
+
1315
+				if daySchedule[0].Schedule.ModeId == 26 {
1316
+					mode = "CVVH"
1317
+				}
1318
+
1319
+				if daySchedule[0].Schedule.ModeId == 27 {
1320
+					mode = "CVVHD"
1321
+				}
1322
+
1323
+				if daySchedule[0].Schedule.ModeId == 28 {
1324
+					mode = "CVVHDF"
1325
+				}
1326
+
1327
+				if daySchedule[0].Schedule.ModeId == 29 {
1328
+					mode = "PE"
1329
+				}
1330
+
1331
+				if daySchedule[0].Schedule.ModeId == 30 {
1332
+					mode = "血浆胆红素吸附+HP"
1333
+				}
1334
+				if daySchedule[0].Schedule.ModeId == 31 {
1335
+					mode = "HPD"
1336
+				}
1337
+				if daySchedule[0].Schedule.ModeId == 32 {
1338
+					mode = "HDP"
1339
+				}
1340
+				if daySchedule[0].Schedule.ModeId == 33 {
1341
+					mode = "HFD"
1342
+				}
1343
+				if daySchedule[0].Schedule.ModeId == 34 {
1344
+					mode = "HDF100"
1345
+				}
1346
+				if daySchedule[0].Schedule.ModeId == 35 {
1347
+					mode = "HDF600"
1348
+				}
1349
+				if daySchedule[0].Schedule.ModeId == 36 {
1350
+					mode = "HDF800"
1351
+				}
1352
+				if daySchedule[0].Schedule.ModeId == 37 {
1353
+					mode = "HDF1000"
1354
+				}
1355
+
1356
+				sc["mode"] = mode
1230 1357
 				sc["data"] = daySchedule
1231 1358
 			} else {
1232 1359
 				sc["code"] = 1
@@ -1254,7 +1381,125 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
1254 1381
 			if nextSchedule[0].Schedule.ID > 0 {
1255 1382
 				sc["code"] = 0
1256 1383
 				sc["msg"] = ""
1257
-				sc["mode"] = nextSchedule[0].Schedule.ModeId
1384
+				var mode = "HD"
1385
+				if nextSchedule[0].Schedule.ModeId == 1 {
1386
+					mode = "HD"
1387
+				}
1388
+
1389
+				if nextSchedule[0].Schedule.ModeId == 2 {
1390
+					mode = "HDF"
1391
+				}
1392
+
1393
+				if nextSchedule[0].Schedule.ModeId == 3 {
1394
+					mode = "HD+HP"
1395
+				}
1396
+
1397
+				if nextSchedule[0].Schedule.ModeId == 4 {
1398
+					mode = "HP"
1399
+				}
1400
+
1401
+				if nextSchedule[0].Schedule.ModeId == 5 {
1402
+					mode = "HF"
1403
+				}
1404
+
1405
+				if nextSchedule[0].Schedule.ModeId == 6 {
1406
+					mode = "SCUF"
1407
+				}
1408
+
1409
+				if nextSchedule[0].Schedule.ModeId == 7 {
1410
+					mode = "IUF"
1411
+				}
1412
+
1413
+				if nextSchedule[0].Schedule.ModeId == 8 {
1414
+					mode = "HFHD"
1415
+				}
1416
+
1417
+				if nextSchedule[0].Schedule.ModeId == 9 {
1418
+					mode = "HFHD+HP"
1419
+				}
1420
+				if nextSchedule[0].Schedule.ModeId == 10 {
1421
+					mode = "PHF"
1422
+				}
1423
+
1424
+				if nextSchedule[0].Schedule.ModeId == 11 {
1425
+					mode = "HFR"
1426
+				}
1427
+
1428
+				if nextSchedule[0].Schedule.ModeId == 12 {
1429
+					mode = "HDF+HP"
1430
+				}
1431
+
1432
+				if nextSchedule[0].Schedule.ModeId == 13 {
1433
+					mode = "CRRT"
1434
+				}
1435
+
1436
+				if nextSchedule[0].Schedule.ModeId == 14 {
1437
+					mode = "腹水回输"
1438
+				}
1439
+				if nextSchedule[0].Schedule.ModeId == 19 {
1440
+					mode = "IUF+HD"
1441
+				}
1442
+				if nextSchedule[0].Schedule.ModeId == 20 {
1443
+					mode = "UF"
1444
+				}
1445
+				if nextSchedule[0].Schedule.ModeId == 21 {
1446
+					mode = "HD+"
1447
+				}
1448
+				if nextSchedule[0].Schedule.ModeId == 22 {
1449
+					mode = "血浆胆红素吸附+HDF"
1450
+				}
1451
+				if nextSchedule[0].Schedule.ModeId == 23 {
1452
+					mode = "血浆胆红素吸附"
1453
+				}
1454
+				if nextSchedule[0].Schedule.ModeId == 24 {
1455
+					mode = "I-HDF"
1456
+				}
1457
+
1458
+				if nextSchedule[0].Schedule.ModeId == 25 {
1459
+					mode = "HD高通"
1460
+				}
1461
+
1462
+				if nextSchedule[0].Schedule.ModeId == 26 {
1463
+					mode = "CVVH"
1464
+				}
1465
+
1466
+				if nextSchedule[0].Schedule.ModeId == 27 {
1467
+					mode = "CVVHD"
1468
+				}
1469
+
1470
+				if nextSchedule[0].Schedule.ModeId == 28 {
1471
+					mode = "CVVHDF"
1472
+				}
1473
+
1474
+				if nextSchedule[0].Schedule.ModeId == 29 {
1475
+					mode = "PE"
1476
+				}
1477
+
1478
+				if nextSchedule[0].Schedule.ModeId == 30 {
1479
+					mode = "血浆胆红素吸附+HP"
1480
+				}
1481
+				if nextSchedule[0].Schedule.ModeId == 31 {
1482
+					mode = "HPD"
1483
+				}
1484
+				if nextSchedule[0].Schedule.ModeId == 32 {
1485
+					mode = "HDP"
1486
+				}
1487
+				if nextSchedule[0].Schedule.ModeId == 33 {
1488
+					mode = "HFD"
1489
+				}
1490
+				if nextSchedule[0].Schedule.ModeId == 34 {
1491
+					mode = "HDF100"
1492
+				}
1493
+				if nextSchedule[0].Schedule.ModeId == 35 {
1494
+					mode = "HDF600"
1495
+				}
1496
+				if nextSchedule[0].Schedule.ModeId == 36 {
1497
+					mode = "HDF800"
1498
+				}
1499
+				if nextSchedule[0].Schedule.ModeId == 37 {
1500
+					mode = "HDF1000"
1501
+				}
1502
+				sc["mode"] = mode
1258 1503
 				sc["data"] = nextSchedule
1259 1504
 			} else {
1260 1505
 				sc["code"] = 1
@@ -1265,65 +1510,65 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
1265 1510
 		}
1266 1511
 	}
1267 1512
 
1268
-	switch sc["mode"] {
1269
-	case 1:
1270
-		sc["mode"] = "HD"
1271
-		break
1272
-	case 2:
1273
-		sc["mode"] = "HDF"
1274
-		break
1275
-	case 3:
1276
-		sc["mode"] = "HD+HP"
1277
-		break
1278
-	case 4:
1279
-		sc["mode"] = "HP"
1280
-		break
1281
-	case 5:
1282
-		sc["mode"] = "HF"
1283
-		break
1284
-	case 6:
1285
-		sc["mode"] = "SCUF"
1286
-		break
1287
-	case 7:
1288
-		sc["mode"] = "IUF"
1289
-		break
1290
-	case 8:
1291
-		sc["mode"] = "HFHD"
1292
-		break
1293
-	case 9:
1294
-		sc["mode"] = "HFHD+HP"
1295
-		break
1296
-	case 10:
1297
-		sc["mode"] = "PHF"
1298
-		break
1299
-	case 11:
1300
-		sc["mode"] = "HFR"
1301
-		break
1302
-	case 12:
1303
-		sc["mode"] = "HDF+HP"
1304
-		break
1305
-	case 13:
1306
-		sc["mode"] = "CRRT"
1307
-		break
1308
-	case 14:
1309
-		sc["mode"] = "腹水回输"
1310
-		break
1311
-	case 15:
1312
-		sc["mode"] = "HD前置换"
1313
-		break
1314
-	case 16:
1315
-		sc["mode"] = "HD后置换"
1316
-		break
1317
-	case 17:
1318
-		sc["mode"] = "HDF前置换"
1319
-		break
1320
-	case 18:
1321
-		sc["mode"] = "HDF后置换"
1322
-		break
1323
-	default:
1324
-		sc["mode"] = "HD"
1325
-		break
1326
-	}
1513
+	//switch sc["mode"] {
1514
+	//case 1:
1515
+	//	sc["mode"] = "HD"
1516
+	//	break
1517
+	//case 2:
1518
+	//	sc["mode"] = "HDF"
1519
+	//	break
1520
+	//case 3:
1521
+	//	sc["mode"] = "HD+HP"
1522
+	//	break
1523
+	//case 4:
1524
+	//	sc["mode"] = "HP"
1525
+	//	break
1526
+	//case 5:
1527
+	//	sc["mode"] = "HF"
1528
+	//	break
1529
+	//case 6:
1530
+	//	sc["mode"] = "SCUF"
1531
+	//	break
1532
+	//case 7:
1533
+	//	sc["mode"] = "IUF"
1534
+	//	break
1535
+	//case 8:
1536
+	//	sc["mode"] = "HFHD"
1537
+	//	break
1538
+	//case 9:
1539
+	//	sc["mode"] = "HFHD+HP"
1540
+	//	break
1541
+	//case 10:
1542
+	//	sc["mode"] = "PHF"
1543
+	//	break
1544
+	//case 11:
1545
+	//	sc["mode"] = "HFR"
1546
+	//	break
1547
+	//case 12:
1548
+	//	sc["mode"] = "HDF+HP"
1549
+	//	break
1550
+	//case 13:
1551
+	//	sc["mode"] = "CRRT"
1552
+	//	break
1553
+	//case 14:
1554
+	//	sc["mode"] = "腹水回输"
1555
+	//	break
1556
+	//case 15:
1557
+	//	sc["mode"] = "HD前置换"
1558
+	//	break
1559
+	//case 16:
1560
+	//	sc["mode"] = "HD后置换"
1561
+	//	break
1562
+	//case 17:
1563
+	//	sc["mode"] = "HDF前置换"
1564
+	//	break
1565
+	//case 18:
1566
+	//	sc["mode"] = "HDF后置换"
1567
+	//	break
1568
+	//default:
1569
+	//	sc["mode"] = "HD"
1570
+	//	break
1571
+	//}
1327 1572
 
1328 1573
 	// 获取患者透前干体重或者获取患者透前体重
1329 1574
 	var dry_weight map[string]interface{}

+ 29 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Ver fichero

@@ -399,7 +399,7 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
399 399
 	}
400 400
 
401 401
 	//针对百霖和贝尔
402
-	if orgid == 10138 || orgid == 10278 || orgid == 3877 {
402
+	if orgid == 10138 || orgid == 10278 || orgid == 3877 || orgid == 10585 {
403 403
 		//获取今日的排班数据
404 404
 		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
405 405
 		for _, item := range list {
@@ -409,6 +409,30 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
409 409
 		}
410 410
 	}
411 411
 
412
+	//查询排班里面的空透析器
413
+	if orgid == 10375 {
414
+
415
+		schedulesFive, _ := service.GetMobileScheduleListByScheduleDateOne(orgid, startTime)
416
+
417
+		for _, item := range schedulesFive {
418
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
419
+			var DialysisMachineName string
420
+			if len(solution.DialysisDialyszers) > 0 {
421
+				DialysisMachineName = solution.DialysisDialyszers
422
+			}
423
+			if len(solution.DialyzerPerfusionApparatus) > 0 {
424
+				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
425
+			}
426
+
427
+			if len(solution.DialysisIrrigation) > 0 {
428
+				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
429
+			}
430
+			item.DialysisMachineName = DialysisMachineName
431
+			service.UpdateSchOne(item.ID, item.DialysisMachineName)
432
+		}
433
+
434
+	}
435
+
412 436
 	// stockType, _ := service.GetStockType(orgid)
413 437
 	//zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
414 438
 	// if err != nil {
@@ -522,6 +546,10 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
522 546
 			if len(advice) > 0 {
523 547
 				service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
524 548
 			}
549
+			project, _ := service.GetHisPrescriptionProjectList(schedule.PatientId, schedule.ScheduleDate, org_id)
550
+			if len(project) > 0 {
551
+				service.UpdateProjectObj(schedule.PatientId, schedule.ScheduleDate, org_id)
552
+			}
525 553
 		}
526 554
 		redis := service.RedisClient()
527 555
 		//处方

+ 30 - 2
controllers/schedule_api_controller.go Ver fichero

@@ -2012,11 +2012,15 @@ func (c *ScheduleApiController) DeleteSchedule() {
2012 2012
 		}
2013 2013
 	}
2014 2014
 
2015
-	if adminINfo.CurrentOrgId == 10206 {
2015
+	if adminINfo.CurrentOrgId == 10206 || adminINfo.CurrentOrgId == 10344 {
2016 2016
 		hisAdvice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2017
+		project, _ := service.GetHisPrescriptionProjectList(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2017 2018
 		if len(hisAdvice) > 0 {
2018 2019
 			service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2019 2020
 		}
2021
+		if len(project) > 0 {
2022
+			service.UpdateProjectObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2023
+		}
2020 2024
 	}
2021 2025
 
2022 2026
 	redis := service.RedisClient()
@@ -4559,7 +4563,7 @@ func (c *ScheduleApiController) GetScheduleOne() {
4559 4563
 	}
4560 4564
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4561 4565
 
4562
-	if adminInfo.CurrentOrgId == 10346 {
4566
+	if adminInfo.CurrentOrgId == 10346 || adminInfo.CurrentOrgId == 10585 {
4563 4567
 
4564 4568
 		if len(schdules) > 0 {
4565 4569
 			//获取长期医嘱里面的透析器灌流器
@@ -4570,6 +4574,30 @@ func (c *ScheduleApiController) GetScheduleOne() {
4570 4574
 
4571 4575
 		}
4572 4576
 	}
4577
+
4578
+	//查询排班里面的空透析器
4579
+	if adminInfo.CurrentOrgId == 10375 {
4580
+
4581
+		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4582
+
4583
+		for _, item := range schedulesFive {
4584
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4585
+			var DialysisMachineName string
4586
+			if len(solution.DialysisDialyszers) > 0 {
4587
+				DialysisMachineName = solution.DialysisDialyszers
4588
+			}
4589
+			if len(solution.DialyzerPerfusionApparatus) > 0 {
4590
+				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
4591
+			}
4592
+
4593
+			if len(solution.DialysisIrrigation) > 0 {
4594
+				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
4595
+			}
4596
+			item.DialysisMachineName = DialysisMachineName
4597
+			service.UpdateSchOne(item.ID, item.DialysisMachineName)
4598
+		}
4599
+
4600
+	}
4573 4601
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4574 4602
 	c.ServeSuccessJSON(map[string]interface{}{
4575 4603
 		"days":           days,

+ 15 - 15
models/schedule_models.go Ver fichero

@@ -168,21 +168,21 @@ type Partition struct {
168 168
 }
169 169
 
170 170
 type Search_Schedule struct {
171
-	ID           int64 `gorm:"column:id" json:"id" form:"id"`
172
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
-	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
-	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
-	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
-	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
-	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
-	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
-	Status       int64 `gorm:"column:status" json:"status" form:"status"`
181
-	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
182
-	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
183
-	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
184
-
185
-	Patient string `gorm:"-" json:"patient" form:"patient"`
171
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
172
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
+	PartitionId         int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
+	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
+	PatientId           int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
+	ScheduleDate        int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
+	ScheduleType        int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
+	ScheduleWeek        int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
181
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
182
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
183
+	IsExport            int64  `gorm:"column:is_export" json:"is_export" form:"is_export"`
184
+	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
185
+	Patient             string `gorm:"-" json:"patient" form:"patient"`
186 186
 }
187 187
 
188 188
 func (Search_Schedule) TableName() string {

+ 17 - 0
service/doctor_schedule_service.go Ver fichero

@@ -819,6 +819,23 @@ func GetMobileScheduleListByScheduleDate(org_id int64, schedule_date int64) (sch
819 819
 	return schedule, err
820 820
 }
821 821
 
822
+func GetMobileScheduleListByScheduleDateOne(org_id int64, schedule_date int64) (schedule []*models.Search_Schedule, err error) {
823
+
824
+	db := XTReadDB().Model(&schedule).Where("status= 1 and dialysis_machine_name=''")
825
+
826
+	if org_id > 0 {
827
+		db = db.Where("user_org_id = ?", org_id)
828
+	}
829
+
830
+	if schedule_date > 0 {
831
+		db = db.Where("schedule_date=?", schedule_date)
832
+	}
833
+
834
+	err = db.Find(&schedule).Error
835
+
836
+	return schedule, err
837
+}
838
+
822 839
 func DeleteStaffScheduleById(id int64, user_org_id int64) (err error) {
823 840
 
824 841
 	schedule := models.StaffSchedule{}

+ 11 - 1
service/pharmacy_service.go Ver fichero

@@ -1035,7 +1035,6 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1035 1035
 				err = fmt.Errorf("!:%v", err)
1036 1036
 				return
1037 1037
 			}
1038
-			//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
1039 1038
 			//查询默认仓库
1040 1039
 			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
1041 1040
 			//查询默认仓库剩余多少库存
@@ -1051,6 +1050,9 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1051 1050
 			UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
1052 1051
 			//扣减库存
1053 1052
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1053
+
1054
+			//退药
1055
+			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1054 1056
 		}
1055 1057
 	}
1056 1058
 
@@ -2210,3 +2212,11 @@ func UpdateAdviceFlow(id int64) error {
2210 2212
 	err := XTWriteDB().Model(&models.HisDoctorAdviceInfo{}).Where("id = ? and status = 1 and is_medicine =0", id).Update(map[string]interface{}{"is_medicine": 1}).Error
2211 2213
 	return err
2212 2214
 }
2215
+
2216
+func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id int64) error {
2217
+
2218
+	err = XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("patient_id = ? and advice_date = ? and user_org_id= ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2219
+
2220
+	err = XTWriteDB().Model(&models.HisPrintPrescription{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2221
+	return err
2222
+}

+ 38 - 0
service/schedule_service.go Ver fichero

@@ -129,6 +129,29 @@ func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, schedule
129 129
 	return
130 130
 }
131 131
 
132
+func GetWeekScheduleFive(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.ScheduleTwo, err error) {
133
+
134
+	db := readDb.Table("xt_schedule as s").Where("s.status=1 and s.dialysis_machine_name='")
135
+	if len(schIds) > 0 {
136
+		db = db.Where("s.partition_id in (?)", schIds)
137
+	}
138
+	if scheduletype > 0 {
139
+		db = db.Where("s.schedule_type = ?", scheduletype)
140
+	}
141
+	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
142
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
143
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
144
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time,s.dialysis_machine_name, p.name as patient").
145
+		Order("updated_time asc").
146
+		Find(&schedules).Error
147
+	return
148
+}
149
+
150
+func UpdateSchOne(id int64, dialysis_machine_name string) (err error) {
151
+	err = writeDb.Model(&models.ScheduleTwo{}).Where("status=1 AND id = ?", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
152
+	return
153
+}
154
+
132 155
 func GetScheduleTotalCount(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.MySchedule, err error) {
133 156
 
134 157
 	db := readDb.Table("xt_schedule as s").Where("status= 1 and (mode_id = 2 or mode_id= 3)")
@@ -1775,6 +1798,21 @@ func GetHisDoctorAdviceListTwenty(patient_id int64, schedule_date int64, user_or
1775 1798
 	return advice, err
1776 1799
 }
1777 1800
 
1801
+func GetHisPrescriptionProjectList(patient_id int64, record_date int64, user_org_id int64) (project []*models.HisPrescriptionProject, err error) {
1802
+	err = XTReadDB().Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, record_date, user_org_id).Find(&project).Error
1803
+	return project, err
1804
+}
1805
+
1806
+func UpdateProjectObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1807
+
1808
+	err = XTWriteDB().Model(&models.HisPrescriptionProject{}).Where("patient_id = ? and record_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1809
+
1810
+	err = XTWriteDB().Model(&models.HisPrescription{}).Where("patient_id = ? and status=1 and record_date = ? and user_org_id =?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1811
+
1812
+	err = XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("patient_id = ? and status=1 and record_date = ? and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1813
+	return err
1814
+}
1815
+
1778 1816
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1779 1817
 
1780 1818
 	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error