28169 2 kuukautta sitten
vanhempi
commit
ee67911363

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Näytä tiedosto

@@ -433,6 +433,25 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
433 433
 				newprescribe.Remark = ""
434 434
 			}
435 435
 
436
+			if adminUserInfo.Org.Id == 10599 {
437
+				// 获取透析模版
438
+				solutionone, _ := service.MobileGetDialysisSolutionByModeIdSevenTwety(adminUserInfo.Org.Id, id, schedual.ModeId)
439
+				if solutionone.Anticoagulant > 0 {
440
+					newprescribe.Anticoagulant = solutionone.Anticoagulant
441
+					newprescribe.AnticoagulantShouji = solutionone.AnticoagulantShouji
442
+					newprescribe.AnticoagulantWeichi = solutionone.AnticoagulantWeichi
443
+					newprescribe.AnticoagulantZongliang = solutionone.AnticoagulantZongliang
444
+					newprescribe.BloodAccess = solutionone.BloodAccess
445
+					newprescribe.DialysisDurationHour = solutionone.DialysisDurationHour
446
+					newprescribe.DialysisDurationMinute = solutionone.DialysisDurationMinute
447
+					newprescribe.DialysisIrrigation = solutionone.DialysisIrrigation
448
+					newprescribe.DialysisDialyszers = solutionone.DialysisDialyszers
449
+					newprescribe.DialysisStrainer = solutionone.DialysisStrainer
450
+
451
+				}
452
+
453
+			}
454
+
436 455
 			//针对普宁和揭阳
437 456
 			if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
438 457
 				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go Näytä tiedosto

@@ -1666,22 +1666,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1666 1666
 				//
1667 1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1668 1668
 				fmt.Println("config.IsOpen", item.UserOrgId)
1669
-				//if config.IsOpen == 0 && item.UserOrgId == 10402 {
1670
-				//
1671
-				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
-				//	//更新字典里面的库存
1673
-				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
-				//	var sum_count int64
1675
-				//	for _, its := range stockInfo {
1676
-				//		if its.MaxUnit == medical.MaxUnit {
1677
-				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
-				//		}
1679
-				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1680
-				//	}
1681
-				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
-				//	//剩余库存
1683
-				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
-				//}
1669
+				if config.IsOpen == 1 && item.UserOrgId == 10375 {
1670
+
1671
+					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
+					//更新字典里面的库存
1673
+					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
+					var sum_count int64
1675
+					for _, its := range stockInfo {
1676
+						if its.MaxUnit == medical.MaxUnit {
1677
+							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
+						}
1679
+						sum_count += its.StockMaxNumber + its.StockMinNumber
1680
+					}
1681
+					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
+					//剩余库存
1683
+					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
+				}
1685 1685
 
1686 1686
 			}
1687 1687
 		}

+ 28 - 7
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Näytä tiedosto

@@ -10,6 +10,7 @@ import (
10 10
 	"fmt"
11 11
 	"github.com/astaxie/beego"
12 12
 	"github.com/jinzhu/gorm"
13
+	"github.com/mozillazg/go-pinyin"
13 14
 	"strconv"
14 15
 	"strings"
15 16
 	"time"
@@ -272,6 +273,24 @@ func (this *NewDialysisApiController) SavePatient() {
272 273
 			return
273 274
 		}
274 275
 
276
+		hans := name // 要转换的汉字字符串
277
+		// 创建一个拼音转换器
278
+		p := pinyin.NewArgs()
279
+
280
+		// 将汉字转为拼音
281
+		pinyinSlice := pinyin.Pinyin(hans, p)
282
+
283
+		// 输出拼音
284
+		fmt.Println("Pinyin:", pinyinSlice)
285
+
286
+		// 获取首字母
287
+		firstLetter := ""
288
+		for _, py := range pinyinSlice {
289
+			if len(py) > 0 {
290
+				firstLetter += string(py[0][0])
291
+			}
292
+		}
293
+
275 294
 		patients := models.Patients{
276 295
 			Name:              name,
277 296
 			Gender:            sex,
@@ -296,6 +315,7 @@ func (this *NewDialysisApiController) SavePatient() {
296 315
 			SchRemark:         remark,
297 316
 			TreatmentPlan:     treatment_plan,
298 317
 		}
318
+		patients.FirstLetter = firstLetter
299 319
 		err = service.CreateOldPatient(&patients)
300 320
 		fmt.Print("报错", err)
301 321
 		patient, err := service.GetLastOldPatient(orgid)
@@ -340,6 +360,7 @@ func (this *NewDialysisApiController) SavePatient() {
340 360
 			SchRemark:         remark,
341 361
 			TreatmentPlan:     treatment_plan,
342 362
 		}
363
+		patientsNew.FirstLetter = firstLetter
343 364
 		err = service.CreateNewPatient(&patientsNew)
344 365
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.ID, 10) + ":patient_info"
345 366
 		redis := service.RedisClient()
@@ -1368,13 +1389,13 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1368 1389
 		}
1369 1390
 
1370 1391
 		//查询号透析号是否相同
1371
-		thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
1372
-		if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
1373
-			returnData := make(map[string]interface{}, 0)
1374
-			returnData["msg"] = "透析号码已存在"
1375
-			this.ServeSuccessJSON(returnData)
1376
-			return
1377
-		}
1392
+		//thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
1393
+		//if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
1394
+		//	returnData := make(map[string]interface{}, 0)
1395
+		//	returnData["msg"] = "透析号码已存在"
1396
+		//	this.ServeSuccessJSON(returnData)
1397
+		//	return
1398
+		//}
1378 1399
 
1379 1400
 		patients := models.Patients{
1380 1401
 			Name:              name,

+ 11 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Näytä tiedosto

@@ -399,7 +399,7 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
399 399
 	}
400 400
 
401 401
 	//针对百霖和贝尔
402
-	if orgid == 10138 || orgid == 10278 || orgid == 3877 || orgid == 10585 {
402
+	if orgid == 10138 || orgid == 10278 || orgid == 3877 {
403 403
 		//获取今日的排班数据
404 404
 		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
405 405
 		for _, item := range list {
@@ -409,6 +409,16 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
409 409
 		}
410 410
 	}
411 411
 
412
+	if orgid == 10585 {
413
+		//获取今日的排班数据
414
+		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
415
+		for _, item := range list {
416
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
417
+			var str = solution.DialyzerPerfusionApparatus
418
+			service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
419
+		}
420
+	}
421
+
412 422
 	//查询排班里面的空透析器
413 423
 	if orgid == 10375 {
414 424
 

+ 22 - 0
controllers/patient_api_controller.go Näytä tiedosto

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/utils"
8 8
 	"encoding/json"
9 9
 	"github.com/jinzhu/gorm"
10
+	"github.com/mozillazg/go-pinyin"
10 11
 
11 12
 	//"github.com/jinzhu/gorm"
12 13
 	"math"
@@ -355,6 +356,26 @@ func (c *PatientApiController) CreatePatient() {
355 356
 	patient.BindingState = 2
356 357
 	// patient.Lapseto = 1
357 358
 
359
+	hans := patient.Name // 要转换的汉字字符串
360
+	// 创建一个拼音转换器
361
+	p := pinyin.NewArgs()
362
+
363
+	// 将汉字转为拼音
364
+	pinyinSlice := pinyin.Pinyin(hans, p)
365
+
366
+	// 输出拼音
367
+	fmt.Println("Pinyin:", pinyinSlice)
368
+
369
+	// 获取首字母
370
+	firstLetter := ""
371
+	for _, py := range pinyinSlice {
372
+		if len(py) > 0 {
373
+			firstLetter += string(py[0][0])
374
+		}
375
+	}
376
+
377
+	patient.FirstLetter = firstLetter
378
+
358 379
 	err := service.CreatePatient(&patient, contagions, diseases)
359 380
 	fmt.Println("创建病人失败err")
360 381
 	if err != nil {
@@ -466,6 +487,7 @@ func (c *PatientApiController) CreatePatient() {
466 487
 		AllergicHistory:              patient.AllergicHistory,
467 488
 		PatientAddress:               patient.PatientAddress,
468 489
 	}
490
+	patientsNew.FirstLetter = firstLetter
469 491
 
470 492
 	err = service.CreatePatientsNew(&patientsNew)
471 493
 	fmt.Print("创建失败", err)

+ 1 - 0
controllers/pharmacy_controller.go Näytä tiedosto

@@ -495,6 +495,7 @@ func (this *PharmacyController) DrugWithdrawal() {
495 495
 		etime = stime + 86399
496 496
 	}
497 497
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
498
+
498 499
 	if err != nil {
499 500
 		utils.ErrorLog(err.Error())
500 501
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())

+ 30 - 30
controllers/sign_api_controller.go Näytä tiedosto

@@ -665,40 +665,19 @@ func (this *SignApiController) GetEnterPriseDetail() {
665 665
 
666 666
 func (this *SignApiController) UploadPrintOrder() {
667 667
 
668
-	//list, _ := service.GetAllPatientNew(10622)
669
-	//for _, item := range list {
670
-	//
671
-	//	hans := item.Name // 要转换的汉字字符串
672
-	//	// 创建一个拼音转换器
673
-	//	p := pinyin.NewArgs()
674
-	//
675
-	//	// 将汉字转为拼音
676
-	//	pinyinSlice := pinyin.Pinyin(hans, p)
677
-	//
678
-	//	// 输出拼音
679
-	//	fmt.Println("Pinyin:", pinyinSlice)
680
-	//
681
-	//	// 获取首字母
682
-	//	firstLetter := ""
683
-	//	for _, py := range pinyinSlice {
684
-	//		if len(py) > 0 {
685
-	//			firstLetter += string(py[0][0])
686
-	//		}
687
-	//	}
688
-	//
689
-	//	item.FirstLetter = firstLetter
690
-	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
691
-	//	// 输出首字母
692
-	//	//fmt.Println("First Letter:", firstLetter)
693
-	//}
668
+	list, _ := service.GetAllPatientNew(10375)
669
+	for _, item := range list {
694 670
 
695
-	baseList, _ := service.GeteAllBaseList(10622)
696
-	for _, item := range baseList {
697
-		hans := item.DrugName // 要转换的汉字字符串
671
+		hans := item.Name // 要转换的汉字字符串
698 672
 		// 创建一个拼音转换器
699 673
 		p := pinyin.NewArgs()
674
+
700 675
 		// 将汉字转为拼音
701 676
 		pinyinSlice := pinyin.Pinyin(hans, p)
677
+
678
+		// 输出拼音
679
+		fmt.Println("Pinyin:", pinyinSlice)
680
+
702 681
 		// 获取首字母
703 682
 		firstLetter := ""
704 683
 		for _, py := range pinyinSlice {
@@ -706,9 +685,30 @@ func (this *SignApiController) UploadPrintOrder() {
706 685
 				firstLetter += string(py[0][0])
707 686
 			}
708 687
 		}
688
+
709 689
 		item.FirstLetter = firstLetter
710
-		service.UpdateBaseList(item.ID, item.FirstLetter)
690
+		service.UpdatePatientNew(item.ID, item.FirstLetter)
691
+		// 输出首字母
692
+		//fmt.Println("First Letter:", firstLetter)
711 693
 	}
694
+
695
+	//baseList, _ := service.GeteAllBaseList(10375)
696
+	//for _, item := range baseList {
697
+	//	hans := item.DrugName // 要转换的汉字字符串
698
+	//	// 创建一个拼音转换器
699
+	//	p := pinyin.NewArgs()
700
+	//	// 将汉字转为拼音
701
+	//	pinyinSlice := pinyin.Pinyin(hans, p)
702
+	//	// 获取首字母
703
+	//	firstLetter := ""
704
+	//	for _, py := range pinyinSlice {
705
+	//		if len(py) > 0 {
706
+	//			firstLetter += string(py[0][0])
707
+	//		}
708
+	//	}
709
+	//	item.FirstLetter = firstLetter
710
+	//	service.UpdateBaseList(item.ID, item.FirstLetter)
711
+	//}
712 712
 	//pdf := gofpdf.New("P", "mm", "A4", "")
713 713
 	//pdf.AddPage()
714 714
 	//pdf.Text(5, 10, "血液净化治疗记录单")

+ 1 - 0
models/dialysis.go Näytä tiedosto

@@ -1274,6 +1274,7 @@ type HisDoctorAdvice struct {
1274 1274
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1275 1275
 	IsMobile              int64              `gorm:"column:is_mobile" json:"is_mobile" form:"is_mobile"`
1276 1276
 	IsSelfDrug            int64              `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1277
+	IsMedicine            int64              `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1277 1278
 }
1278 1279
 
1279 1280
 func (HisDoctorAdvice) TableName() string {

+ 3 - 3
service/dialysis_solution_service.go Näytä tiedosto

@@ -2,7 +2,6 @@ package service
2 2
 
3 3
 import (
4 4
 	"XT_New/models"
5
-	"fmt"
6 5
 	"github.com/jinzhu/gorm"
7 6
 )
8 7
 
@@ -42,7 +41,7 @@ func GetLastPatientDialysisSolution(patient_id int64, orgid int64) (models.Dialy
42 41
 }
43 42
 
44 43
 func GetPatientDialysisSolutionGroupList(keywords string, limit int64, page int64, partition_id int64, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
45
-	fmt.Println("ids23322332323232wode", len(ids))
44
+
46 45
 	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
47 46
 	offset := (page - 1) * limit
48 47
 	if scheduleDate > 0 {
@@ -66,13 +65,14 @@ func GetPatientDialysisSolutionGroupList(keywords string, limit int64, page int6
66 65
 		db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
67 66
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
68 67
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
69
-			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID)
68
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).Preload("DialysisPrescription", "status=1 and user_org_id =? and record_date =?", orgID, scheduleDate)
70 69
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
71 70
 		err = db.Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
72 71
 	} else {
73 72
 		err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
74 73
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
75 74
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
75
+			Preload("DialysisPrescription", "status=1 and user_org_id =? and record_date =?", orgID, scheduleDate).
76 76
 			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
77 77
 	}
78 78
 

+ 8 - 0
service/mobile_dialysis_service.go Näytä tiedosto

@@ -2332,6 +2332,14 @@ func MobileGetDialysisSolutionByModeIdSix(orgID int64, patientID int64, mode_id
2332 2332
 	return &record, nil
2333 2333
 }
2334 2334
 
2335
+// 透析方案
2336
+func MobileGetDialysisSolutionByModeIdSevenTwety(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2337
+	var record models.DialysisSolution
2338
+	err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status =1", patientID, orgID, mode_id).Last(&record).Error
2339
+
2340
+	return record, nil
2341
+}
2342
+
2335 2343
 // 透析方案
2336 2344
 func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2337 2345
 	var record models.DialysisSolution

+ 9 - 2
service/pharmacy_service.go Näytä tiedosto

@@ -1053,6 +1053,9 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1053 1053
 			//扣减库存
1054 1054
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1055 1055
 
1056
+			//退药
1057
+			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1058
+
1056 1059
 		}
1057 1060
 	}
1058 1061
 
@@ -1108,8 +1111,6 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1108 1111
 			//扣减库存
1109 1112
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1110 1113
 
1111
-			//退药
1112
-			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1113 1114
 		}
1114 1115
 	}
1115 1116
 
@@ -2277,3 +2278,9 @@ func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id
2277 2278
 	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
2278 2279
 	return err
2279 2280
 }
2281
+
2282
+func GetHisPatientAdviceList(user_org_id int64, patient_id int64, start_time int64, end_time int64) (list []*models.HisDoctorAdvice, err error) {
2283
+
2284
+	err = XTReadDB().Model(&models.HisDoctorAdvice{}).Where("patient_id=? and advice_date=? and advice_date>=? and advice_date<=? and status=1 and user_org_id = ? and is_medicine =1", patient_id, start_time, end_time, user_org_id).Find(&list).Error
2285
+	return list, err
2286
+}