28169 1 anno fa
parent
commit
72163daeec
38 ha cambiato i file con 692 aggiunte e 155 eliminazioni
  1. 1 1
      conf/app.conf
  2. 6 6
      controllers/base_api_controller.go
  3. 1 1
      controllers/data_api_controller.go
  4. 48 4
      controllers/dialysis_api_controller.go
  5. 3 1
      controllers/drug_stock_api_contorller.go
  6. 12 2
      controllers/his_api_controller.go
  7. 29 0
      controllers/his_hospital_api_controller.go
  8. 3 4
      controllers/manage_api_controller.go
  9. 101 1
      controllers/manager_center_api_controller.go
  10. 14 1
      controllers/mobile_api_controllers/dialysis_api_controller.go
  11. 0 1
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  12. 60 19
      controllers/mobile_api_controllers/patient_api_controller.go
  13. 22 4
      controllers/patient_api_controller.go
  14. 53 1
      controllers/patient_dataconfig_api_controller.go
  15. 1 1
      controllers/pharmacy_controller.go
  16. 2 2
      controllers/print_data_api_controller.go
  17. 15 0
      controllers/schedule_api_controller.go
  18. 2 1
      controllers/stock_in_api_controller.go
  19. 14 0
      models/data_models.go
  20. 7 0
      models/dialysis.go
  21. 1 0
      models/drug_stock.go
  22. 1 0
      models/his_models.go
  23. 4 0
      models/patient_models.go
  24. 1 0
      models/stock_models.go
  25. 11 8
      service/dialysis_service.go
  26. 25 0
      service/his_hospital_service.go
  27. 7 0
      service/his_service.go
  28. 44 0
      service/manage_center_service.go
  29. 3 3
      service/manage_service.go
  30. 6 5
      service/mobile_dialysis_service.go
  31. 96 71
      service/new_warehouse_service.go
  32. 44 2
      service/patient_service.go
  33. 1 1
      service/patientmanage_service.go
  34. 1 2
      service/pharmacy_service.go
  35. 7 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  36. 17 0
      service/schedule_service.go
  37. 6 5
      service/stock_service.go
  38. 23 8
      service/warhouse_service.go

+ 1 - 1
conf/app.conf Vedi File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4 4
 #dev/prod
5 5
 
6 6
 #

+ 6 - 6
controllers/base_api_controller.go Vedi File

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 10394 //机构id
85
+		subscibe.OrgId = 9671 //机构id
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,8 +92,8 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 94
 		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 10394 //机构id小英9675或4
96
-		adminUserInfo.CurrentAppId = 3295  //4
95
+		adminUserInfo.CurrentOrgId = 9671  //机构id小英9675或4
96
+		adminUserInfo.CurrentAppId = 15993 //4
97 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
99 99
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -328,7 +328,7 @@ func (this *BaseServeAPIController) Prepare() {
328 328
 		userAdmin.ModifyTime = 1530786071
329 329
 		var subscibe models.ServeSubscibe
330 330
 		subscibe.ID = 11
331
-		subscibe.OrgId = 10394 //机构id小英9675或4
331
+		subscibe.OrgId = 9671 //机构id小英9675或4
332 332
 		subscibe.PeriodStart = 1538035409
333 333
 		subscibe.PeriodEnd = 1569571409
334 334
 		subscibe.State = 1
@@ -338,8 +338,8 @@ func (this *BaseServeAPIController) Prepare() {
338 338
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339 339
 		subscibes[4] = &subscibe
340 340
 		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 10394 //机构id小英9675或4
342
-		adminUserInfo.CurrentAppId = 3295  //4
341
+		adminUserInfo.CurrentOrgId = 9671  //机构id小英9675或4
342
+		adminUserInfo.CurrentAppId = 15993 //4
343 343
 		adminUserInfo.AdminUser = &userAdmin
344 344
 		adminUserInfo.Subscibes = subscibes
345 345
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 1
controllers/data_api_controller.go Vedi File

@@ -400,7 +400,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
400 400
 	}
401 401
 	dataconfig.Module = module
402 402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" || module == "befor_symptoms" {
404 404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405 405
 			utils.ErrorLog("title")
406 406
 			code = enums.ErrorCodeParamWrong

+ 48 - 4
controllers/dialysis_api_controller.go Vedi File

@@ -343,6 +343,7 @@ func (c *DialysisApiController) PostPrescription() {
343 343
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
344 344
 	prescription_water, _ := c.GetFloat("prescription_water")
345 345
 	dialysis_strainer := c.GetString("dialysis_strainer")
346
+	chaptalization := c.GetString("chaptalization")
346 347
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
347 348
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
348 349
 
@@ -460,6 +461,7 @@ func (c *DialysisApiController) PostPrescription() {
460 461
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
461 462
 		PrescriptionWater:          prescription_water,
462 463
 		DialysisStrainer:           dialysis_strainer,
464
+		Chaptalization:             chaptalization,
463 465
 	}
464 466
 
465 467
 	//长沙南雅医院,自动生成抗凝剂的临时处方
@@ -859,6 +861,7 @@ func (c *DialysisApiController) PostSoulution() {
859 861
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
860 862
 	prescription_water, _ := c.GetFloat("prescription_water")
861 863
 	dialysis_strainer := c.GetString("dialysis_strainer")
864
+	chaptalization := c.GetString("chaptalization")
862 865
 	var prescription_doctor int64
863 866
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
864 867
 
@@ -1002,6 +1005,7 @@ func (c *DialysisApiController) PostSoulution() {
1002 1005
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1003 1006
 		PrescriptionWater:          prescription_water,
1004 1007
 		DialysisStrainer:           dialysis_strainer,
1008
+		Chaptalization:             chaptalization,
1005 1009
 	}
1006 1010
 
1007 1011
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1182,6 +1186,7 @@ func (c *DialysisApiController) PostSoulution() {
1182 1186
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1183 1187
 		PrescriptionWater:          prescribing_number,
1184 1188
 		DialysisStrainer:           dialysis_strainer,
1189
+		Chaptalization:             chaptalization,
1185 1190
 	}
1186 1191
 
1187 1192
 	//针对河间咸得
@@ -1915,6 +1920,23 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1915 1920
 	his_department := c.GetString("his_department")
1916 1921
 	his_bed := c.GetString("his_bed")
1917 1922
 	point_puncture := c.GetString("point_puncture")
1923
+
1924
+	catheter_evaluation_program := c.GetString("catheter_evaluation_program")
1925
+	skin_site_catheterization := c.GetString("skin_site_catheterization")
1926
+	pathway_formation_time := c.GetString("pathway_formation_time")
1927
+	timeLayout := "2006-01-02"
1928
+	loc, _ := time.LoadLocation("Local")
1929
+	var startTime int64
1930
+	if len(pathway_formation_time) > 0 {
1931
+		theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", pathway_formation_time+" 00:00:00", loc)
1932
+		startTime = theTime.Unix()
1933
+	}
1934
+	whether_unobstructed, _ := c.GetInt64("whether_unobstructed")
1935
+
1936
+	lien_necessary, _ := c.GetInt64("lien_necessary")
1937
+
1938
+	befor_symptoms := c.GetString("befor_symptoms")
1939
+
1918 1940
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1919 1941
 		DialysisCount:                  dialysis_count,
1920 1942
 		EmergencyTreatment:             emergency_treatment,
@@ -1989,6 +2011,12 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1989 2011
 		HisDepartment:                  his_department,
1990 2012
 		HisBed:                         his_bed,
1991 2013
 		PointPuncture:                  point_puncture,
2014
+		CatheterEvaluationProgram:      catheter_evaluation_program,
2015
+		SkinSiteCatheterization:        skin_site_catheterization,
2016
+		PathwayFormationTime:           startTime,
2017
+		WhetherUnobstructed:            whether_unobstructed,
2018
+		LienNecessary:                  lien_necessary,
2019
+		BeforSymptoms:                  befor_symptoms,
1992 2020
 	}
1993 2021
 
1994 2022
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -3583,6 +3611,11 @@ func (c *DialysisApiController) GetDialysisOrder() {
3583 3611
 
3584 3612
 	project_config, _ := service.GetHisProjectConfig(adminUserInfo.CurrentOrgId)
3585 3613
 	projects, _ := service.FindAllHisProjectById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3614
+
3615
+	//获取诊断
3616
+	prescriptionInfo, _ := service.GetPrescriptionInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3617
+
3618
+	patientDiagnose, _ := service.FindPatientDianose(adminUserInfo.CurrentOrgId)
3586 3619
 	//if config.IsOpen == 1 && project_config.IsOpen == 1 && len(projects) > 0 {
3587 3620
 	//	for _, item := range projects {
3588 3621
 	//		var advice *models.HisDoctorAdviceInfo
@@ -3638,6 +3671,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
3638 3671
 			"last_order":                lastOrder,
3639 3672
 			"project_config":            project_config,
3640 3673
 			"projects":                  projects,
3674
+			"prescriptionInfo":          prescriptionInfo,
3675
+			"patientDiagnose":           patientDiagnose,
3641 3676
 		})
3642 3677
 
3643 3678
 	}
@@ -3675,6 +3710,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
3675 3710
 			"last_order":                lastOrder,
3676 3711
 			"project_config":            project_config,
3677 3712
 			"projects":                  projects,
3713
+			"prescriptionInfo":          prescriptionInfo,
3714
+			"patientDiagnose":           patientDiagnose,
3678 3715
 		})
3679 3716
 	}
3680 3717
 
@@ -4039,10 +4076,12 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4039 4076
 		return
4040 4077
 	}
4041 4078
 	theTimeUnix, err := time.ParseInLocation(timeLayout, startTime, loc)
4042
-	if err != nil {
4043
-		utils.ErrorLog(err.Error())
4044
-		return
4045
-	}
4079
+
4080
+	fmt.Println("theTimeUnix", theTimeUnix.Unix())
4081
+	//if err != nil {
4082
+	//	utils.ErrorLog(err.Error())
4083
+	//	return
4084
+	//}
4046 4085
 	StartTime := theTimeUnix.Unix()
4047 4086
 	fmt.Println("startTIME", StartTime)
4048 4087
 	Remark := ""
@@ -4062,7 +4101,11 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4062 4101
 		var advice models.GroupAdvice
4063 4102
 		advice.Remark = Remark
4064 4103
 		advice.AdviceType = adviceType
4104
+
4065 4105
 		advice.StartTime = StartTime
4106
+		if StartTime < 0 {
4107
+			advice.StartTime = time.Now().Unix()
4108
+		}
4066 4109
 		advice.AdviceDate = AdviceDate
4067 4110
 
4068 4111
 		advice.RecordDate = RecordDate
@@ -6216,6 +6259,7 @@ func (this *DialysisApiController) GetDialysisPatientsFlow() {
6216 6259
 
6217 6260
 	} else {
6218 6261
 		dialysisSchedule, err, total := service.GetDialysisWatchFlow(adminUserInfo.CurrentOrgId, startTime/1000, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6262
+		fmt.Println("dialysisSchedule-----------------------", dialysisSchedule)
6219 6263
 		if err == nil {
6220 6264
 			this.ServeSuccessJSON(map[string]interface{}{
6221 6265
 				"schedule": dialysisSchedule,

+ 3 - 1
controllers/drug_stock_api_contorller.go Vedi File

@@ -3538,8 +3538,10 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3538 3538
 	warehousing_id, _ := c.GetInt64("warehousing_id")
3539 3539
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3540 3540
 	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3541
+
3542
+	checker := c.GetAdminUserInfo().AdminUser.Id
3541 3543
 	//更改核对状态
3542
-	err := service.CheckWarehousingInfo(warehousing_id, orgId)
3544
+	err := service.CheckWarehousingInfo(warehousing_id, orgId, checker)
3543 3545
 
3544 3546
 	if err == nil {
3545 3547
 		list, _ := service.GetWarehousingInfoByList(warehousing_id, orgId)

+ 12 - 2
controllers/his_api_controller.go Vedi File

@@ -1461,6 +1461,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1461 1461
 		diagnose, _ := service.FindAllDiagnose(adminInfo.CurrentOrgId)
1462 1462
 		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
1463 1463
 
1464
+		patientDiagnose, _ := service.FindPatientDianose(adminInfo.CurrentOrgId)
1464 1465
 		//获取是否开启保存耗材出库的开关
1465 1466
 		goodOutOpen, _ := service.GetGoodOutOpenConfigOne(adminInfo.CurrentOrgId)
1466 1467
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -1475,6 +1476,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1475 1476
 			"diagnose":         diagnose,
1476 1477
 			"manufacturers":    manufacturers,
1477 1478
 			"goodOutOpen":      goodOutOpen,
1479
+			"patientDiagnose":  patientDiagnose,
1478 1480
 		})
1479 1481
 	}
1480 1482
 	if adminInfo.CurrentOrgId != 9675 && adminInfo.CurrentOrgId != 9671 && adminInfo.CurrentOrgId != 10215 {
@@ -1507,7 +1509,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1507 1509
 		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
1508 1510
 		//获取是否开启保存耗材出库的开关
1509 1511
 		goodOutOpen, _ := service.GetGoodOutOpenConfigOne(adminInfo.CurrentOrgId)
1510
-
1512
+		patientDiagnose, _ := service.FindPatientDianose(adminInfo.CurrentOrgId)
1511 1513
 		c.ServeSuccessJSON(map[string]interface{}{
1512 1514
 			"drugs":            drugs,
1513 1515
 			"advices_template": advices,
@@ -1520,6 +1522,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1520 1522
 			"diagnose":         diagnose,
1521 1523
 			"manufacturers":    manufacturers,
1522 1524
 			"goodOutOpen":      goodOutOpen,
1525
+			"patientDiagnose":  patientDiagnose,
1523 1526
 		})
1524 1527
 	}
1525 1528
 }
@@ -1536,6 +1539,8 @@ func (c *HisApiController) CreateHisPrescription() {
1536 1539
 	his_patient_id, _ := c.GetInt64("his_patient_id")
1537 1540
 
1538 1541
 	p_type, _ := c.GetInt64("p_type")
1542
+	patient_diagnose := c.GetString("patient_diagnose")
1543
+
1539 1544
 	dataBody := make(map[string]interface{}, 0)
1540 1545
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1541 1546
 	if err != nil {
@@ -2628,6 +2633,7 @@ func (c *HisApiController) CreateHisPrescription() {
2628 2633
 			DoctorId:           doctor_id,
2629 2634
 			SickType:           sick_type,
2630 2635
 			PType:              p_type,
2636
+			PatientDiagnosis:   patient_diagnose,
2631 2637
 		}
2632 2638
 		service.SavePatientPrescriptionInfo(hpInfo)
2633 2639
 		redis := service.RedisClient()
@@ -2660,6 +2666,7 @@ func (c *HisApiController) CreateHisPrescription() {
2660 2666
 			SickType:           sick_type,
2661 2667
 			PType:              info.PType,
2662 2668
 			HisPatientId:       info.HisPatientId,
2669
+			PatientDiagnosis:   patient_diagnose,
2663 2670
 		}
2664 2671
 		service.SavePatientPrescriptionInfo(hpInfo)
2665 2672
 		redis := service.RedisClient()
@@ -3004,6 +3011,8 @@ func (c *HisApiController) CreateHisPrescription() {
3004 3011
 
3005 3012
 		//查询今日该患者开的药品处方
3006 3013
 		hisdoctorlist, _ := service.GetHisAdviceListByDrugIdTwo(patient_id, recordDateTime, adminInfo.CurrentOrgId)
3014
+
3015
+		fmt.Println("今日出库2333333333333333333333333333333333333333")
3007 3016
 		drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
3008 3017
 		//药品出库
3009 3018
 		if drugOutConfig.IsOpen == 1 {
@@ -3012,7 +3021,7 @@ func (c *HisApiController) CreateHisPrescription() {
3012 3021
 
3013 3022
 				// 查询该药品最后一次出库记录
3014 3023
 				druginfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(item.DrugId, patient_id, recordDateTime, item.ID)
3015
-
3024
+				fmt.Println("今日最后出库2333333333333333333333333333333333333333", druginfo)
3016 3025
 				if len(druginfo) > 0 {
3017 3026
 					//回退库存
3018 3027
 					for _, it := range druginfo {
@@ -3023,6 +3032,7 @@ func (c *HisApiController) CreateHisPrescription() {
3023 3032
 
3024 3033
 						}
3025 3034
 						if it.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
3035
+
3026 3036
 							service.ModifyDrugWarehouseInfoStockMinNumber(it.Count, it.DrugId, it.OrgId, it.WarehouseInfoId)
3027 3037
 
3028 3038
 						}

+ 29 - 0
controllers/his_hospital_api_controller.go Vedi File

@@ -40,6 +40,35 @@ func HisHospitalManagerApiRegistRouters() {
40 40
 
41 41
 	beego.Router("/api/exportuncharge/get", &HisHospitalApiController{}, "get:GetExportHisHospitalUnChargeData")
42 42
 
43
+	beego.Router("/api/hospital/inhopitalcheck/list", &HisHospitalApiController{}, "get:GetZHInHospitalCheckList")
44
+
45
+}
46
+func (this *HisHospitalApiController) GetZHInHospitalCheckList() {
47
+	timeLayout := "2006-01-02"
48
+	loc, _ := time.LoadLocation("Local")
49
+	keyword := this.GetString("keyword")
50
+	start_time := this.GetString("start_time")
51
+	end_time := this.GetString("end_time")
52
+	limit, _ := this.GetInt64("limit")
53
+	page, _ := this.GetInt64("page")
54
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+":00", loc)
55
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+":59", loc)
56
+	adminUserInfo := this.GetAdminUserInfo()
57
+	orgId := adminUserInfo.CurrentOrgId
58
+	history, total, err := service.GetHisInHospitalHistory(keyword, startTime.Unix(), endTime.Unix(), limit, page, orgId)
59
+	department, err := service.GetAllDepartMent(orgId)
60
+	appId := adminUserInfo.CurrentAppId
61
+	doctor, err := service.GetAllDoctor(orgId, appId)
62
+	if err != nil {
63
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
64
+		return
65
+	}
66
+	this.ServeSuccessJSON(map[string]interface{}{
67
+		"history":    history,
68
+		"total":      total,
69
+		"department": department,
70
+		"doctor":     doctor,
71
+	})
43 72
 }
44 73
 func (c *HisHospitalApiController) RefundDetail() {
45 74
 	patient_id, _ := c.GetInt64("patient_id")

+ 3 - 4
controllers/manage_api_controller.go Vedi File

@@ -957,16 +957,16 @@ func (this *MachineApiController) GetPatient() {
957 957
 func (this *MachineApiController) GetAllOrganization() {
958 958
 	adminUserInfo := this.GetAdminUserInfo()
959 959
 	orgid := adminUserInfo.CurrentOrgId
960
-	//fmt.Println("orgid", orgid)
961 960
 	appid := adminUserInfo.CurrentAppId
962
-	//fmt.Println("appid", appid)
963 961
 	approle, err := service.GetAllOrganization(orgid, appid)
962
+	operators, err := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
964 963
 	if err != nil {
965 964
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
966 965
 		return
967 966
 	}
968 967
 	this.ServeSuccessJSON(map[string]interface{}{
969
-		"approle": approle,
968
+		"approle":   approle,
969
+		"operators": operators,
970 970
 	})
971 971
 }
972 972
 
@@ -2670,7 +2670,6 @@ func (this *MachineApiController) GetBedForm() {
2670 2670
 	fmt.Println("id", id)
2671 2671
 	addmacher, err := service.GetZoneForm(id)
2672 2672
 	bed, err := service.GetZoneId(addmacher.BedId, orgId)
2673
-	fmt.Println("bed--------------------", bed.ZoneID)
2674 2673
 	number, err := service.GetBedForm(bed.ZoneID)
2675 2674
 	if err != nil {
2676 2675
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")

+ 101 - 1
controllers/manager_center_api_controller.go Vedi File

@@ -83,6 +83,11 @@ func ManagerCenterRegistRouters() {
83 83
 	beego.Router("/api/drug/getalldruglist", &ManagerCenterApiController{}, "get:GetAllDrugList")
84 84
 	beego.Router("/api/drug/postsearchdruglist", &ManagerCenterApiController{}, "get:GetSearchDrugList")
85 85
 
86
+	beego.Router("/api/patient/addpatientdiagnose", &ManagerCenterApiController{}, "Post:AddPatientDiagnos")
87
+	beego.Router("/api/patient/getpatientdiagnose", &ManagerCenterApiController{}, "Get:GetPatientDiagnose")
88
+	beego.Router("/api/patient/getpatientdiagnosedetail", &ManagerCenterApiController{}, "Get:GetPatientDiagnoseDetail")
89
+	beego.Router("/api/patient/updatepatientcase", &ManagerCenterApiController{}, "Post:UpdatePatientCase")
90
+	beego.Router("/api/patient/deletepatientdiagnose", &ManagerCenterApiController{}, "Get:DeletePatientDiagnose")
86 91
 }
87 92
 
88 93
 func (c *ManagerCenterApiController) CreateBaseDrugLib() {
@@ -825,7 +830,7 @@ func (c *ManagerCenterApiController) UpdateChildConfig() {
825 830
 	dataconfig.Remark = string(dataBody["remark"].(string))
826 831
 	dataconfig.Order = int64(dataBody["orders"].(float64))
827 832
 	dataconfig.Code = string(dataBody["code"].(string))
828
-	fmt.Println("dataconfitg------", dataconfig.Order)
833
+
829 834
 	//if dataBody["orders"] != nil {
830 835
 	//	dataconfig.Order = int64(dataBody["orders"].(float64))
831 836
 	//	fmt.Println("dataconfig",dataconfig.Order)
@@ -2314,3 +2319,98 @@ func (c *ManagerCenterApiController) GetSearchDrugList() {
2314 2319
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2315 2320
 	}
2316 2321
 }
2322
+
2323
+func (c *ManagerCenterApiController) AddPatientDiagnos() {
2324
+
2325
+	dataBody := make(map[string]interface{}, 0)
2326
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2327
+
2328
+	class_name := dataBody["class_name"].(string)
2329
+	sort := int64(dataBody["sort"].(float64))
2330
+
2331
+	orgId := c.GetAdminUserInfo().CurrentOrgId
2332
+	diagnose := models.XtPatientDiagnose{
2333
+		ClassName: class_name,
2334
+		Sort:      sort,
2335
+		UserOrgId: orgId,
2336
+		Status:    1,
2337
+		Ctime:     time.Now().Unix(),
2338
+		Mtime:     0,
2339
+	}
2340
+
2341
+	err = service.CreatePatientDiagnose(diagnose)
2342
+
2343
+	if err == nil {
2344
+		c.ServeSuccessJSON(map[string]interface{}{
2345
+			"diagnose": diagnose,
2346
+		})
2347
+	} else {
2348
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2349
+	}
2350
+}
2351
+
2352
+func (c *ManagerCenterApiController) GetPatientDiagnose() {
2353
+
2354
+	limit, _ := c.GetInt64("limit")
2355
+	page, _ := c.GetInt64("page")
2356
+	orgId := c.GetAdminUserInfo().CurrentOrgId
2357
+
2358
+	list, total, err := service.GetPatientDiagnose(limit, page, orgId)
2359
+
2360
+	if err == nil {
2361
+		c.ServeSuccessJSON(map[string]interface{}{
2362
+			"list":  list,
2363
+			"total": total,
2364
+		})
2365
+	} else {
2366
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2367
+	}
2368
+}
2369
+
2370
+func (c *ManagerCenterApiController) GetPatientDiagnoseDetail() {
2371
+
2372
+	id, _ := c.GetInt64("id")
2373
+
2374
+	detail, err := service.GetPatientDiagnoseDetail(id)
2375
+
2376
+	if err == nil {
2377
+		c.ServeSuccessJSON(map[string]interface{}{
2378
+			"detail": detail,
2379
+		})
2380
+	} else {
2381
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2382
+	}
2383
+}
2384
+
2385
+func (c *ManagerCenterApiController) UpdatePatientCase() {
2386
+
2387
+	dataBody := make(map[string]interface{}, 0)
2388
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2389
+
2390
+	class_name := dataBody["class_name"].(string)
2391
+	sort := int64(dataBody["sort"].(float64))
2392
+
2393
+	id := int64(dataBody["id"].(float64))
2394
+
2395
+	err = service.UpdatePatientCase(class_name, sort, id)
2396
+
2397
+	if err == nil {
2398
+		c.ServeSuccessJSON(map[string]interface{}{
2399
+			"msg": "msg",
2400
+		})
2401
+	} else {
2402
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2403
+	}
2404
+}
2405
+
2406
+func (c *ManagerCenterApiController) DeletePatientDiagnose() {
2407
+
2408
+	id, _ := c.GetInt64("id")
2409
+
2410
+	service.DeletePatientDiagnose(id)
2411
+
2412
+	returnData := make(map[string]interface{}, 0)
2413
+	returnData["msg"] = "ok"
2414
+	c.ServeSuccessJSON(returnData)
2415
+	return
2416
+}

+ 14 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -1499,6 +1499,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1499 1499
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
1500 1500
 	prescription_water, _ := c.GetFloat("prescription_water")
1501 1501
 	dialysis_strainer := c.GetString("dialysis_strainer")
1502
+	chaptalization := c.GetString("chaptalization")
1502 1503
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1503 1504
 
1504 1505
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -1633,6 +1634,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1633 1634
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1634 1635
 		PrescriptionWater:          prescription_water,
1635 1636
 		DialysisStrainer:           dialysis_strainer,
1637
+		Chaptalization:             chaptalization,
1636 1638
 	}
1637 1639
 
1638 1640
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -2141,6 +2143,11 @@ func (c *DialysisAPIController) Finish() {
2141 2143
 			tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
2142 2144
 		}
2143 2145
 
2146
+		//阳春
2147
+		if adminUserInfo.Org.Id == 10485 {
2148
+			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
2149
+		}
2150
+
2144 2151
 	}
2145 2152
 
2146 2153
 	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 {
@@ -2308,6 +2315,9 @@ func (c *DialysisAPIController) Finish() {
2308 2315
 		tempassessmentAfterDislysis.BloodFlow = lastAssessmentAfterDislysis.BloodFlow
2309 2316
 		tempassessmentAfterDislysis.SealingFluidDispose = lastAssessmentAfterDislysis.SealingFluidDispose
2310 2317
 		tempassessmentAfterDislysis.SealingFluidSpecial = lastAssessmentAfterDislysis.SealingFluidSpecial
2318
+		if tempassessmentAfterDislysis.PatientId == 18695 {
2319
+			tempassessmentAfterDislysis.ActualDisplacement = 0
2320
+		}
2311 2321
 
2312 2322
 	}
2313 2323
 
@@ -2353,7 +2363,7 @@ func (c *DialysisAPIController) Finish() {
2353 2363
 
2354 2364
 		//下机完自动消毒,针对长沙南雅
2355 2365
 		if dialysisOrder.Stage == 1 {
2356
-			if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
2366
+			if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9538 {
2357 2367
 				//根据床位号获取设备型号
2358 2368
 				unitType, _ := service.GetUnitType(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2359 2369
 				//查询使用消毒最后一条消毒记录
@@ -3078,6 +3088,7 @@ func (c *DialysisAPIController) PostSolution() {
3078 3088
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
3079 3089
 	prescription_water, _ := c.GetFloat("prescription_water")
3080 3090
 	dialysis_strainer := c.GetString("dialysis_strainer")
3091
+	chaptalization := c.GetString("chaptalization")
3081 3092
 	if mode_id > 0 {
3082 3093
 
3083 3094
 		var str string
@@ -3210,6 +3221,7 @@ func (c *DialysisAPIController) PostSolution() {
3210 3221
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3211 3222
 		PrescriptionWater:          prescription_water,
3212 3223
 		DialysisStrainer:           dialysis_strainer,
3224
+		Chaptalization:             chaptalization,
3213 3225
 	}
3214 3226
 
3215 3227
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -3324,6 +3336,7 @@ func (c *DialysisAPIController) PostSolution() {
3324 3336
 		DialysisFluidFlow:          dialysis_fluid_flow,
3325 3337
 		PrescriptionWater:          prescription_water,
3326 3338
 		DialysisStrainer:           dialysis_strainer,
3339
+		Chaptalization:             chaptalization,
3327 3340
 	}
3328 3341
 
3329 3342
 	//针对河间咸的

+ 0 - 1
controllers/mobile_api_controllers/mobile_api_base_controller.go Vedi File

@@ -189,7 +189,6 @@ func (this *MobileBaseAPIAuthController) Prepare() {
189 189
 
190 190
 			//系统所记录的权限列表
191 191
 			allPermission, _ := service.GetAllFunctionPurview()
192
-			fmt.Println("allPermission-----------------------", allPermission)
193 192
 			for _, item := range allPermission {
194 193
 				//判断当前路由是否在权限路由列表里面
195 194
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 60 - 19
controllers/mobile_api_controllers/patient_api_controller.go Vedi File

@@ -552,8 +552,6 @@ func (c *PatientApiController) ExecDoctorAdvice() {
552 552
 	origin, _ := c.GetInt64("origin", 0)
553 553
 	groupno, _ := c.GetInt64("groupno", -1)
554 554
 
555
-	fmt.Println("orgind===2=323322323232323", origin)
556
-	fmt.Println("groupno233333333333333333333", groupno)
557 555
 	if origin != 2 {
558 556
 		adminUserInfo := c.GetMobileAdminUserInfo()
559 557
 		execution_staff := adminUserInfo.AdminUser.Id
@@ -621,7 +619,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
621 619
 			UpdatedTime:    time.Now().Unix(),
622 620
 		}
623 621
 		var err error
624
-		fmt.Println("groupno==============", groupno)
622
+
625 623
 		if groupno > 0 {
626 624
 			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
627 625
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -1448,22 +1446,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1448 1446
 					}
1449 1447
 
1450 1448
 					//
1451
-					if config.IsOpen == 1 && item.UserOrgId == 10028 {
1452
-
1453
-						service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1454
-						//更新字典里面的库存
1455
-						stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1456
-						var sum_count int64
1457
-						for _, its := range stockInfo {
1458
-							if its.MaxUnit == medical.MaxUnit {
1459
-								its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1460
-							}
1461
-							sum_count += its.StockMaxNumber + its.StockMinNumber
1462
-						}
1463
-						service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1464
-						//剩余库存
1465
-						service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1466
-					}
1449
+					//if config.IsOpen == 1 && item.UserOrgId == 10188 {
1450
+					//
1451
+					//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1452
+					//	//更新字典里面的库存
1453
+					//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1454
+					//	var sum_count int64
1455
+					//	for _, its := range stockInfo {
1456
+					//		if its.MaxUnit == medical.MaxUnit {
1457
+					//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1458
+					//		}
1459
+					//		sum_count += its.StockMaxNumber + its.StockMinNumber
1460
+					//	}
1461
+					//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1462
+					//	//剩余库存
1463
+					//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1464
+					//}
1467 1465
 
1468 1466
 				}
1469 1467
 			}
@@ -3074,6 +3072,49 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3074 3072
 
3075 3073
 		evaluation.PointPuncture = point_puncture
3076 3074
 	}
3075
+
3076
+	if dataBody["catheter_evaluation_program"] != nil && reflect.TypeOf(dataBody["catheter_evaluation_program"]).String() == "string" {
3077
+		catheter_evaluation_program := dataBody["catheter_evaluation_program"].(string)
3078
+
3079
+		evaluation.CatheterEvaluationProgram = catheter_evaluation_program
3080
+	}
3081
+
3082
+	if dataBody["skin_site_catheterization"] != nil && reflect.TypeOf(dataBody["skin_site_catheterization"]).String() == "string" {
3083
+		skin_site_catheterization := dataBody["skin_site_catheterization"].(string)
3084
+
3085
+		evaluation.SkinSiteCatheterization = skin_site_catheterization
3086
+	}
3087
+
3088
+	if dataBody["whether_unobstructed"] != nil && reflect.TypeOf(dataBody["whether_unobstructed"]).String() == "float64" {
3089
+		whether_unobstructed := int64(dataBody["whether_unobstructed"].(float64))
3090
+		evaluation.WhetherUnobstructed = whether_unobstructed
3091
+	}
3092
+
3093
+	if dataBody["lien_necessary"] != nil && reflect.TypeOf(dataBody["lien_necessary"]).String() == "float64" {
3094
+		lien_necessary := int64(dataBody["lien_necessary"].(float64))
3095
+		evaluation.LienNecessary = lien_necessary
3096
+	}
3097
+
3098
+	if dataBody["pathway_formation_time"] != nil && reflect.TypeOf(dataBody["pathway_formation_time"]).String() == "string" {
3099
+		pathway_formation_time := dataBody["pathway_formation_time"].(string)
3100
+		timeLayout := "2006-01-02"
3101
+		loc, _ := time.LoadLocation("Local")
3102
+		var startTime int64
3103
+		if len(pathway_formation_time) > 0 {
3104
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", pathway_formation_time+" 00:00:00", loc)
3105
+
3106
+			startTime = theTime.Unix()
3107
+		}
3108
+
3109
+		evaluation.PathwayFormationTime = startTime
3110
+	}
3111
+
3112
+	if dataBody["befor_symptoms"] != nil && reflect.TypeOf(dataBody["befor_symptoms"]).String() == "string" {
3113
+		befor_symptoms := dataBody["befor_symptoms"].(string)
3114
+		evaluation.BeforSymptoms = befor_symptoms
3115
+
3116
+		fmt.Println("befor_symptomsss23333333333333333333333333", befor_symptoms)
3117
+	}
3077 3118
 	return
3078 3119
 }
3079 3120
 

+ 22 - 4
controllers/patient_api_controller.go Vedi File

@@ -366,6 +366,7 @@ func (c *PatientApiController) CreatePatient() {
366 366
 		TrobleShoot:                  patient.TrobleShoot,
367 367
 		TreatmentPlan:                patient.TreatmentPlan,
368 368
 		Doctor:                       patient.Doctor,
369
+		RecordNumber:                 patient.RecordNumber,
369 370
 	}
370 371
 
371 372
 	err = service.CreatePatientsNew(&patientsNew)
@@ -582,6 +583,7 @@ func (c *PatientApiController) EditPatient() {
582 583
 		TrobleShoot:               patient.TrobleShoot,
583 584
 		SchRemark:                 patient.SchRemark,
584 585
 		TreatmentPlan:             patient.TreatmentPlan,
586
+		RecordNumber:              patient.RecordNumber,
585 587
 	}
586 588
 	//	//更新病人ID获取新表病人ID
587 589
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -939,6 +941,7 @@ func (c *PatientApiController) UpdateDialysisSolution() {
939 941
 			MaxUltrafiltrationRate:     solution.MaxUltrafiltrationRate,
940 942
 			Amylaceum:                  solution.Amylaceum,
941 943
 			DialysisStrainer:           solution.DialysisStrainer,
944
+			Chaptalization:             solution.Chaptalization,
942 945
 		}
943 946
 		service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
944 947
 	}
@@ -3262,11 +3265,15 @@ func (c *PatientApiController) GetDoctorAdvices() {
3262 3265
 		//相关操作对应的操作人
3263 3266
 		operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
3264 3267
 
3268
+		//获取长期医嘱
3269
+		longAdvice, _, _ := service.GetLongDoctorAdviceList(adminUserInfo.CurrentOrgId, id, 1, stopType, theStartTIme, theEndtTIme, keywords, page, limit)
3265 3270
 		c.ServeSuccessJSON(map[string]interface{}{
3266
-			"advices":   advices,
3267
-			"operators": operators,
3268
-			"total":     total,
3269
-			"advicetwo": advicestwo,
3271
+			"advices":    advices,
3272
+			"operators":  operators,
3273
+			"total":      total,
3274
+			"advicetwo":  advicestwo,
3275
+			"longAdvice": longAdvice,
3276
+			"is_open":    hisconfig.IsOpen,
3270 3277
 		})
3271 3278
 		return
3272 3279
 	} else {
@@ -3298,6 +3305,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
3298 3305
 			"operators": operators,
3299 3306
 			"total":     total,
3300 3307
 			"advicetwo": advicestwo,
3308
+			"is_open":   hisconfig.IsOpen,
3301 3309
 		})
3302 3310
 		return
3303 3311
 	}
@@ -4071,6 +4079,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
4071 4079
 		amylaceum := dataBody["amylaceum"].(string)
4072 4080
 		solution.Amylaceum = amylaceum
4073 4081
 	}
4082
+
4083
+	if dataBody["chaptalization"] != nil && reflect.TypeOf(dataBody["chaptalization"]).String() == "string" {
4084
+		chaptalization := dataBody["chaptalization"].(string)
4085
+		solution.Chaptalization = chaptalization
4086
+	}
4074 4087
 	return
4075 4088
 }
4076 4089
 
@@ -4682,6 +4695,11 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
4682 4695
 		doctor := int64(patientBody["doctor"].(float64))
4683 4696
 		patient.Doctor = doctor
4684 4697
 	}
4698
+
4699
+	if patientBody["record_number"] != nil && reflect.TypeOf(patientBody["record_number"]).String() == "string" {
4700
+		record_number := patientBody["record_number"].(string)
4701
+		patient.RecordNumber = record_number
4702
+	}
4685 4703
 	return
4686 4704
 }
4687 4705
 

+ 53 - 1
controllers/patient_dataconfig_api_controller.go Vedi File

@@ -36,6 +36,8 @@ func PatientDataConfigAPIControllerRegistRouters() {
36 36
 	beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
37 37
 	beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
38 38
 
39
+	beego.Router("/api/patient/getpatientdialysisinforlist", &PatientDataConfigAPIController{}, "get:GetPatientDialysisInforList")
40
+
39 41
 }
40 42
 
41 43
 type PatientDataConfigAPIController struct {
@@ -1000,7 +1002,6 @@ func (this *PatientDataConfigAPIController) ModifyCourse() {
1000 1002
 	//loc, _ := time.LoadLocation("Local")
1001 1003
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
1002 1004
 
1003
-	fmt.Println("checkDate--------------", checkDate)
1004 1005
 	adminUserInfo := this.GetAdminUserInfo()
1005 1006
 	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
1006 1007
 	if getPatientErr != nil {
@@ -1038,3 +1039,54 @@ func (this *PatientDataConfigAPIController) ModifyCourse() {
1038 1039
 		"record": record,
1039 1040
 	})
1040 1041
 }
1042
+
1043
+func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
1044
+
1045
+	patientID, _ := this.GetInt64("patient_id")
1046
+	record_date := this.GetString("record_date")
1047
+
1048
+	timeLayout := "2006-01-02"
1049
+	loc, _ := time.LoadLocation("Local")
1050
+	var startTime int64
1051
+	if len(record_date) > 0 {
1052
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1053
+		if err != nil {
1054
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1055
+			return
1056
+		}
1057
+		startTime = theTime.Unix()
1058
+	}
1059
+	fmt.Println("startTime0000000000000000", startTime)
1060
+
1061
+	//获取患者姓名
1062
+	patient, _ := service.GetPatientName(patientID)
1063
+
1064
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1065
+	//获取透析处方
1066
+	prescription, _ := service.GetDialysisPrescription(patientID, orgId, startTime)
1067
+
1068
+	//获取透前评估
1069
+	assessmentBefor, _ := service.GetAssessmentBefor(orgId, patientID, startTime)
1070
+
1071
+	//透析上机
1072
+	order, _ := service.GetDialysisOrder(orgId, patientID, startTime)
1073
+
1074
+	//透析监测
1075
+	monitor, _ := service.GetFistMonitorSix(orgId, patientID, startTime)
1076
+
1077
+	//透析医嘱
1078
+	advice, _ := service.GetBloodDoctorAdvice(startTime, orgId, patientID)
1079
+
1080
+	//透后评估
1081
+	afterDislysis, _ := service.GetAssessmentAfterDissData(patientID, orgId, startTime)
1082
+
1083
+	this.ServeSuccessJSON(map[string]interface{}{
1084
+		"patient":         patient,
1085
+		"prescription":    prescription,
1086
+		"assessmentBefor": assessmentBefor,
1087
+		"order":           order,
1088
+		"monitor":         monitor,
1089
+		"advice":          advice,
1090
+		"afterDislysis":   afterDislysis,
1091
+	})
1092
+}

+ 1 - 1
controllers/pharmacy_controller.go Vedi File

@@ -438,7 +438,7 @@ func (this *PharmacyController) DispensingMedicine() {
438 438
 
439 439
 // 退药按钮点击
440 440
 func (this *PharmacyController) DrugWithdrawal() {
441
-	fmt.Println("寄哪里2333333333333333333333333333333")
441
+
442 442
 	var err error
443 443
 	defer func() {
444 444
 		if rec := recover(); rec != nil {

+ 2 - 2
controllers/print_data_api_controller.go Vedi File

@@ -37,7 +37,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 38
 	adminUserInfo := this.GetAdminUserInfo()
39 39
 
40
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 {
40
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 {
41 41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42 42
 		for _, item := range schedules {
43 43
 
@@ -136,7 +136,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
136 136
 		})
137 137
 	}
138 138
 
139
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 {
139
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 {
140 140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141 141
 		for _, item := range schedules {
142 142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)

+ 15 - 0
controllers/schedule_api_controller.go Vedi File

@@ -4394,6 +4394,18 @@ func (c *ScheduleApiController) GetScheduleOne() {
4394 4394
 		weekEndPoint = theEndTime.Unix()
4395 4395
 	}
4396 4396
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4397
+
4398
+	if adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10346 {
4399
+
4400
+		if len(schdules) > 0 {
4401
+			//获取长期医嘱里面的透析器灌流器
4402
+			for _, item := range schdules {
4403
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4404
+				service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, solution.DialyzerPerfusionApparatus, item.ScheduleType)
4405
+			}
4406
+
4407
+		}
4408
+	}
4397 4409
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4398 4410
 	c.ServeSuccessJSON(map[string]interface{}{
4399 4411
 		"days":           days,
@@ -4408,6 +4420,8 @@ func (c *ScheduleApiController) GetScheduleOne() {
4408 4420
 func (c *ScheduleApiController) GetScheduleTwo() {
4409 4421
 
4410 4422
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4423
+
4424
+	fmt.Println("weekwoowowowowowowowowowo", week)
4411 4425
 	patitionIdStr := c.GetString("patitionid")
4412 4426
 
4413 4427
 	ids := strings.Split(patitionIdStr, ",")
@@ -4416,6 +4430,7 @@ func (c *ScheduleApiController) GetScheduleTwo() {
4416 4430
 
4417 4431
 	adminInfo := c.GetAdminUserInfo()
4418 4432
 	weekDateStr := c.GetString("week_date")
4433
+	fmt.Println("weekDateStr--------------------", weekDateStr)
4419 4434
 	WeekDayIds := strings.Split(weekDateStr, ",")
4420 4435
 
4421 4436
 	thisTime := time.Now()

+ 2 - 1
controllers/stock_in_api_controller.go Vedi File

@@ -7433,8 +7433,9 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7433 7433
 	//查询默认仓库
7434 7434
 	storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
7435 7435
 
7436
+	checker := this.GetAdminUserInfo().AdminUser.Id
7436 7437
 	//更改审核状态
7437
-	err := service.UpdateCheckWarehouseInfo(warehousing_info_id)
7438
+	err := service.UpdateCheckWarehouseInfo(warehousing_info_id, checker)
7438 7439
 	if err == nil {
7439 7440
 		list, _ := service.GetWarehouseInfoList(warehousing_info_id, orgId)
7440 7441
 

+ 14 - 0
models/data_models.go Vedi File

@@ -192,3 +192,17 @@ type XtHisAddtionConfig struct {
192 192
 func (XtHisAddtionConfig) TableName() string {
193 193
 	return "xt_his_addtion_config"
194 194
 }
195
+
196
+type XtPatientDiagnose struct {
197
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
198
+	ClassName string `gorm:"column:class_name" json:"class_name" form:"class_name"`
199
+	Sort      int64  `gorm:"column:sort" json:"sort" form:"sort"`
200
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
201
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
202
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
203
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
204
+}
205
+
206
+func (XtPatientDiagnose) TableName() string {
207
+	return "xt_patient_diagnose"
208
+}

+ 7 - 0
models/dialysis.go Vedi File

@@ -160,6 +160,7 @@ type SchedualPatient2 struct {
160 160
 	UserSysBeforeCount        int64                `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
161 161
 	SchRemark                 string               `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
162 162
 	HospitalFirstDialysisDate int64                `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
163
+	RecordNumber              string               `gorm:"column:record_number" json:"record_number" form:"record_number"`
163 164
 }
164 165
 
165 166
 func (SchedualPatient2) TableName() string {
@@ -326,6 +327,12 @@ type PredialysisEvaluation struct {
326 327
 	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
327 328
 	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
328 329
 	PointPuncture                  string  `gorm:"column:point_puncture" json:"point_puncture" form:"point_puncture"`
330
+	CatheterEvaluationProgram      string  `gorm:"column:catheter_evaluation_program" json:"catheter_evaluation_program" form:"catheter_evaluation_program"`
331
+	SkinSiteCatheterization        string  `gorm:"column:skin_site_catheterization" json:"skin_site_catheterization" form:"skin_site_catheterization"`
332
+	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
333
+	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
334
+	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
335
+	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
329 336
 }
330 337
 
331 338
 func (PredialysisEvaluation) TableName() string {

+ 1 - 0
models/drug_stock.go Vedi File

@@ -19,6 +19,7 @@ type DrugWarehouse struct {
19 19
 	SecondWarehouseId int64  `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
20 20
 	IsSys             int64  `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
21 21
 	IsCheck           int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
22
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
22 23
 }
23 24
 
24 25
 func (DrugWarehouse) TableName() string {

+ 1 - 0
models/his_models.go Vedi File

@@ -422,6 +422,7 @@ type HisPrescriptionInfo struct {
422 422
 	XtHisDepartment    XtHisDepartment `gorm:"ForeignKey:ID;AssociationForeignKey:Departments" json:"department"`
423 423
 	SickType           int64           `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
424 424
 	PType              int64           `gorm:"column:p_type" json:"p_type" form:"p_type"`
425
+	PatientDiagnosis   string          `gorm:"column:patient_diagnosis" json:"patient_diagnosis" form:"patient_diagnosis"`
425 426
 }
426 427
 
427 428
 func (HisPrescriptionInfo) TableName() string {

+ 4 - 0
models/patient_models.go Vedi File

@@ -221,6 +221,7 @@ type Patients struct {
221 221
 	ZbPatientId              string  `gorm:"column:zb_patient_id" json:"zb_patient_id" form:"zb_patient_id"`
222 222
 	TreatmentPlan            string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
223 223
 	Doctor                   int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
224
+	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
224 225
 }
225 226
 
226 227
 func (Patients) TableName() string {
@@ -366,6 +367,7 @@ type DialysisPrescription struct {
366 367
 	SodiumBicarbonateFlow      string        `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
367 368
 	PrescriptionWater          float64       `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
368 369
 	DialysisStrainer           string        `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
370
+	Chaptalization             string        `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
369 371
 }
370 372
 
371 373
 func (DialysisPrescription) TableName() string {
@@ -583,6 +585,7 @@ type DialysisSolution struct {
583 585
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
584 586
 	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
585 587
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
588
+	Chaptalization             string  `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
586 589
 }
587 590
 
588 591
 func (DialysisSolution) TableName() string {
@@ -810,6 +813,7 @@ type XtPatientsNew struct {
810 813
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
811 814
 	Doctor                       int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
812 815
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
816
+	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
813 817
 }
814 818
 
815 819
 func (XtPatientsNew) TableName() string {

+ 1 - 0
models/stock_models.go Vedi File

@@ -69,6 +69,7 @@ type Warehousing struct {
69 69
 	IsSys             int64        `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
70 70
 	SecondWarehouseId int64        `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
71 71
 	IsCheck           int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
72
+	Checker           int64        `gorm:"column:checker" json:"checker" form:"checker"`
72 73
 }
73 74
 
74 75
 func (Warehousing) TableName() string {

+ 11 - 8
service/dialysis_service.go Vedi File

@@ -1640,6 +1640,7 @@ func GetAllPcDialysisOrdersByList(orgID int64, scheduleDate int64) (dialysisOrde
1640 1640
 	redis := RedisClient()
1641 1641
 	defer redis.Close()
1642 1642
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":dialysis_orders_list_all"
1643
+
1643 1644
 	dialysis_orders_list_all, _ := redis.Get(key).Result()
1644 1645
 
1645 1646
 	if len(dialysis_orders_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -2205,17 +2206,12 @@ func GetDialysisWatchByKeywordFlow(orgID int64, keyword string, schedulType int6
2205 2206
 
2206 2207
 func GetDialysisWatchFlow(orgID int64, schedulDate int64, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) (schedule []*models.DialysisScheduleFlow, err error, total int64) {
2207 2208
 	db := readDb.Model(&models.DialysisScheduleFlow{})
2208
-	if start > 0 && end > 0 {
2209
-		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2210
-			Preload("TreatmentMode", "status = 1").
2211
-			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, start, end).
2212
-			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2213
-		db = db.Where("xt_schedule.status = 1")
2214
-	}
2209
+
2210
+	fmt.Println("schedule_date--------------------", schedulDate)
2215 2211
 	if schedulDate > 0 {
2216 2212
 		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2217 2213
 			Preload("TreatmentMode", "status = 1").
2218
-			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, schedulDate, schedulDate).
2214
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date =?", orgID, schedulDate).
2219 2215
 			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2220 2216
 		db = db.Where("xt_schedule.status = 1")
2221 2217
 		db = db.Where("schedule_date = ?", schedulDate)
@@ -2239,3 +2235,10 @@ func GetDialysisWatchFlow(orgID int64, schedulDate int64, schedulType int64, par
2239 2235
 	err = db.Count(&total).Offset(offset).Limit(limit).Order("bed_id desc").Find(&schedule).Error
2240 2236
 	return schedule, err, total
2241 2237
 }
2238
+
2239
+func GetPrescriptionInfo(user_org_id int64, patient_id int64, record_date int64) (models.HisPrescriptionInfo, error) {
2240
+
2241
+	info := models.HisPrescriptionInfo{}
2242
+	err := XTReadDB().Where("user_org_id = ? and patient_id =? and record_date = ? and status=1", user_org_id, patient_id, record_date).Find(&info).Error
2243
+	return info, err
2244
+}

+ 25 - 0
service/his_hospital_service.go Vedi File

@@ -580,3 +580,28 @@ func GetUnChargeHisHospitalPrescription(org_id int64, start_time int64, end_time
580 580
 		Find(&prescription).Error
581 581
 	return
582 582
 }
583
+
584
+func GetLastInHospitalRecord(patient_id int64, user_org_id int64) (record models.HisHospitalCheckRecord, err error) {
585
+	err = readDb.Model(&models.HisHospitalCheckRecord{}).Where("patient_id = ? AND status = 1 AND user_org_id = ? AND in_hospital_status = 1 AND out_hospital_status = 0", patient_id, user_org_id).Last(&record).Error
586
+	return
587
+}
588
+
589
+func GetHisInHospitalHistory(keyword string, startime int64, endtime int64, limit int64, page int64, orgid int64) (hisPatient []*models.HisHospitalCheckRecord, total int64, err error) {
590
+	offset := (page - 1) * limit
591
+	likeKey := "%" + keyword + "%"
592
+	db := XTReadDB().Model(&models.HisHospitalCheckRecord{})
593
+	if len(keyword) > 0 {
594
+		db = db.Where("name like ?", likeKey)
595
+	}
596
+	if startime > 0 {
597
+		db = db.Where("record_date >= ?", startime)
598
+	}
599
+	if endtime > 0 {
600
+		db = db.Where("record_date<=?", endtime)
601
+	}
602
+	if orgid > 0 {
603
+		db = db.Where("user_org_id = ?", orgid)
604
+	}
605
+	err = db.Offset(offset).Limit(limit).Order("id desc").Find(&hisPatient).Error
606
+	return hisPatient, total, err
607
+}

+ 7 - 0
service/his_service.go Vedi File

@@ -1350,6 +1350,13 @@ func FindAllDiagnose(orgId int64) (list []*models.HisXtDiagnoseConfig, err error
1350 1350
 	return
1351 1351
 }
1352 1352
 
1353
+func FindPatientDianose(orgId int64) (list []*models.XtPatientDiagnose, err error) {
1354
+
1355
+	err = readDb.Where("user_org_id =?", orgId).Find(&list).Error
1356
+
1357
+	return list, err
1358
+}
1359
+
1353 1360
 func FindAllAddition(orgId int64) (list []*models.XtHisAddtionConfig, err error) {
1354 1361
 	db := readDb.Model(&models.XtHisAddtionConfig{})
1355 1362
 	db = db.Where("user_org_id = ? AND status = 1", orgId)

+ 44 - 0
service/manage_center_service.go Vedi File

@@ -1035,3 +1035,47 @@ func GoodAutoAddCancelInfo(good *models.NewDialysisBeforePrepareGoods, creater i
1035 1035
 	}
1036 1036
 	return err
1037 1037
 }
1038
+
1039
+func CreatePatientDiagnose(diagnose models.XtPatientDiagnose) error {
1040
+
1041
+	err := XTWriteDB().Create(&diagnose).Error
1042
+
1043
+	return err
1044
+}
1045
+
1046
+func GetPatientDiagnose(limit int64, page int64, orgid int64) (list []*models.XtPatientDiagnose, total int64, err error) {
1047
+
1048
+	db := XTReadDB().Model(&list).Where("status =1")
1049
+
1050
+	if orgid > 0 {
1051
+		db = db.Where("user_org_id = ?", orgid)
1052
+	}
1053
+	offset := (page - 1) * limit
1054
+
1055
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("sort asc").Find(&list).Error
1056
+	return
1057
+}
1058
+
1059
+func GetPatientDiagnoseDetail(id int64) (models.XtPatientDiagnose, error) {
1060
+
1061
+	diagnose := models.XtPatientDiagnose{}
1062
+
1063
+	err := XTReadDB().Where("id = ? and status =1", id).Find(&diagnose).Error
1064
+
1065
+	return diagnose, err
1066
+}
1067
+
1068
+func UpdatePatientCase(class_name string, sort int64, id int64) error {
1069
+
1070
+	diagnose := models.XtPatientDiagnose{}
1071
+
1072
+	err := XTReadDB().Model(&diagnose).Where("id = ? and status=1", id).Updates(map[string]interface{}{"class_name": class_name, "sort": sort}).Error
1073
+
1074
+	return err
1075
+}
1076
+
1077
+func DeletePatientDiagnose(id int64) error {
1078
+
1079
+	err := XTWriteDB().Model(&models.XtPatientDiagnose{}).Where("id=? and status= 1", id).Updates(map[string]interface{}{"status": 0}).Error
1080
+	return err
1081
+}

+ 3 - 3
service/manage_service.go Vedi File

@@ -374,7 +374,7 @@ func GetDialysisTime(time int64, patientid int64, orgid int64) (models.Assessmen
374 374
 }
375 375
 
376 376
 func GetAllOrganization(orgid int64, appid int64) (approle []*models.App_Role, err error) {
377
-	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = 1", orgid, appid).Find(&approle).Error
377
+	err = UserReadDB().Where("org_id = ? AND app_id = ?", orgid, appid).Find(&approle).Error
378 378
 	return approle, err
379 379
 }
380 380
 
@@ -824,7 +824,7 @@ func GetUserForm(id int64, orgId int64, limit int64, page int64) (infor []*model
824 824
 		if orgId > 0 {
825 825
 			db = db.Where("x.user_org_id = ?", orgId)
826 826
 		}
827
-		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date asc").Scan(&infor).Error
827
+		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.admin_user_id,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date asc").Scan(&infor).Error
828 828
 		if err != nil {
829 829
 			return
830 830
 		}
@@ -844,7 +844,7 @@ func GetUserForm(id int64, orgId int64, limit int64, page int64) (infor []*model
844 844
 		if orgId > 0 {
845 845
 			db = db.Where("x.user_org_id = ?", orgId)
846 846
 		}
847
-		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
847
+		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.admin_user_id,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
848 848
 		if err != nil {
849 849
 			return
850 850
 		}

+ 6 - 5
service/mobile_dialysis_service.go Vedi File

@@ -4482,13 +4482,14 @@ func GetFistMonitor(orgid int64, patient_id int64, dialysis_date int64) (models.
4482 4482
 	return record, err
4483 4483
 }
4484 4484
 
4485
+func GetFistMonitorSix(orgid int64, patient_id int64, dialysis_date int64) (record []*models.MonitoringRecord, err error) {
4486
+
4487
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and monitoring_date = ? and status = 1", orgid, patient_id, dialysis_date).Find(&record).Error
4488
+	return record, err
4489
+}
4490
+
4485 4491
 func MobileGetScheduleDoctorAdvicesOne(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string, scheduleType int64, partitonType int64, patient_id int64, execution_state int64, cost_type int64, execution_frequency string) ([]*MScheduleDoctorAdviceVM, error) {
4486 4492
 
4487
-	fmt.Println("execution_frequency---------------------------", execution_frequency)
4488
-	fmt.Println("cost_type-----------", cost_type)
4489
-	fmt.Println("adviceType-----------", adviceType)
4490
-	fmt.Println("patientType---------", patientType)
4491
-	fmt.Println("len(deliverWay)--------", len(deliverWay))
4492 4493
 	var vms []*MScheduleDoctorAdviceVM
4493 4494
 	adviceWhere := ""
4494 4495
 	adviceCondition := []interface{}{}

+ 96 - 71
service/new_warehouse_service.go Vedi File

@@ -1308,15 +1308,25 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1308 1308
 	// 如果没有对应的库存,则报错
1309 1309
 	storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
1310 1310
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
1311
-	if lastWarehouse.StockMinNumber >= drup.MinNumber {
1312
-		var stockMax int64
1313
-		var stockMin int64
1314
-		stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
1315
-		stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
1311
+	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
1312
+		if lastWarehouse.StockMinNumber >= drup.MinNumber {
1313
+			var stockMax int64
1314
+			var stockMin int64
1315
+			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
1316
+			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
1317
+
1318
+			ChangeMaxNumber(lastWarehouse.ID, stockMax)
1319
+			UpdateMinNumber(lastWarehouse.ID, stockMin)
1320
+		}
1321
+	}
1322
+
1323
+	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
1324
+
1325
+		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
1326
+		ChangeMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber)
1316 1327
 
1317
-		ChangeMaxNumber(lastWarehouse.ID, stockMax)
1318
-		UpdateMinNumber(lastWarehouse.ID, stockMin)
1319 1328
 	}
1329
+
1320 1330
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
1321 1331
 
1322 1332
 	if err != nil {
@@ -1374,12 +1384,16 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1374 1384
 		}
1375 1385
 
1376 1386
 		if drup.MinUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
1387
+			//fmt.Println("金1")
1377 1388
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber*drup.MinNumber
1378 1389
 		}
1390
+
1379 1391
 		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
1392
+			//fmt.Println("金2")
1380 1393
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
1381 1394
 		}
1382 1395
 		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit == drup.MinUnit {
1396
+			//fmt.Println("金3")
1383 1397
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
1384 1398
 		}
1385 1399
 
@@ -1392,13 +1406,16 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1392 1406
 
1393 1407
 		warehouse.Mtime = time.Now().Unix()
1394 1408
 
1409
+		//fmt.Println("stockmin", warehouse.StockMinNumber)
1410
+		//fmt.Println("minnubmerr", minNumber)
1395 1411
 		if warehouse.StockMinNumber < minNumber {
1396
-
1412
+			//fmt.Println("金4")
1397 1413
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1398 1414
 			if warehouse.MaxUnit != warehouse.MinUnit {
1399 1415
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
1400 1416
 			}
1401 1417
 		} else {
1418
+			//fmt.Println("金5")
1402 1419
 			if minNumber > 0 {
1403 1420
 				if (warehouse.StockMinNumber - minNumber) >= 0 {
1404 1421
 					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
@@ -1407,6 +1424,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1407 1424
 			}
1408 1425
 
1409 1426
 			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
1427
+				//fmt.Println("6")
1410 1428
 				if warehouse.StockMinNumber > 0 {
1411 1429
 					if warehouse.StockMinNumber-deliver_number >= 0 {
1412 1430
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
@@ -1418,8 +1436,9 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1418 1436
 
1419 1437
 		}
1420 1438
 
1421
-		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
1439
+		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
1422 1440
 			if (warehouse.StockMinNumber - deliver_number) >= 0 {
1441
+				//fmt.Println("金7")
1423 1442
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1424 1443
 			}
1425 1444
 
@@ -1561,74 +1580,80 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1561 1580
 		}
1562 1581
 
1563 1582
 		//如果本次出库数据大于历史出库数据 新增1条流水
1583
+		//fmt.Println("deliver_number233233223232wi", deliver_number)
1584
+		//fmt.Println("out_coutn23333333333333333", out_count)
1585
+		//fmt.Println("cancel_coutn099992ow", cancel_count)
1564 1586
 		if deliver_number >= (out_count - cancel_count) {
1565
-			drugflow := models.DrugFlow{
1566
-				WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
1567
-				WarehouseOutId:          warehouseout.ID,
1568
-				DrugId:                  advice.DrugId,
1569
-				Number:                  warehouse.Number,
1570
-				ProductDate:             warehouse.ProductDate,
1571
-				ExpireDate:              warehouse.ExpiryDate,
1572
-				Count:                   deliver_number - (out_count - cancel_count), //按最小单位计算,
1573
-				Price:                   warehouse.RetailPrice,
1574
-				Status:                  1,
1575
-				Ctime:                   time.Now().Unix(),
1576
-				UserOrgId:               orgID,
1577
-				Manufacturer:            warehouse.Manufacturer,
1578
-				Dealer:                  warehouse.Dealer,
1579
-				BatchNumber:             warehouse.BatchNumber,
1580
-				MaxUnit:                 drup.MinUnit,
1581
-				ConsumableType:          3,
1582
-				IsEdit:                  1,
1583
-				Creator:                 advice.ExecutionStaff,
1584
-				IsSys:                   1,
1585
-				PatientId:               advice.PatientId,
1586
-				SystemTime:              advice.AdviceDate,
1587
-				WarehousingDetailId:     warehouse.ID,
1588
-				SupplyWarehouseId:       warehouse.SupplyWarehouseId,
1589
-				StorehouseId:            storeConfig.DrugStorehouseOut,
1590
-				WarehouseOutDetailId:    lastDrugOutInfo.ID,
1591
-				OverCount:               sum_count,
1592
-				AdviceId:                advice.ID,
1593
-				LastPrice:               warehouse.Price,
1594
-			}
1587
+			if (deliver_number - out_count - cancel_count) != 0 {
1588
+				drugflow := models.DrugFlow{
1589
+					WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
1590
+					WarehouseOutId:          warehouseout.ID,
1591
+					DrugId:                  advice.DrugId,
1592
+					Number:                  warehouse.Number,
1593
+					ProductDate:             warehouse.ProductDate,
1594
+					ExpireDate:              warehouse.ExpiryDate,
1595
+					Count:                   deliver_number - (out_count - cancel_count), //按最小单位计算,
1596
+					Price:                   warehouse.RetailPrice,
1597
+					Status:                  1,
1598
+					Ctime:                   time.Now().Unix(),
1599
+					UserOrgId:               orgID,
1600
+					Manufacturer:            warehouse.Manufacturer,
1601
+					Dealer:                  warehouse.Dealer,
1602
+					BatchNumber:             warehouse.BatchNumber,
1603
+					MaxUnit:                 drup.MinUnit,
1604
+					ConsumableType:          3,
1605
+					IsEdit:                  1,
1606
+					Creator:                 advice.ExecutionStaff,
1607
+					IsSys:                   1,
1608
+					PatientId:               advice.PatientId,
1609
+					SystemTime:              advice.AdviceDate,
1610
+					WarehousingDetailId:     warehouse.ID,
1611
+					SupplyWarehouseId:       warehouse.SupplyWarehouseId,
1612
+					StorehouseId:            storeConfig.DrugStorehouseOut,
1613
+					WarehouseOutDetailId:    lastDrugOutInfo.ID,
1614
+					OverCount:               sum_count,
1615
+					AdviceId:                advice.ID,
1616
+					LastPrice:               warehouse.Price,
1617
+				}
1595 1618
 
1596
-			errThreeTy := CreateDrugFlowOne(drugflow)
1619
+				errThreeTy := CreateDrugFlowOne(drugflow)
1597 1620
 
1598
-			if errThreeTy != nil {
1599
-				drugError := models.XtDrugError{
1600
-					UserOrgId:             orgID,
1601
-					DrugId:                advice.DrugId,
1602
-					RecordDate:            advice.AdviceDate,
1603
-					PatientId:             advice.PatientId,
1604
-					Remark:                "创建流水失败",
1605
-					Status:                1,
1606
-					Ctime:                 time.Now().Unix(),
1607
-					Mtime:                 0,
1608
-					SumCount:              0,
1609
-					Prescribingnumber:     advice.PrescribingNumber,
1610
-					PrescribingNumberUnit: advice.PrescribingNumberUnit,
1621
+				if errThreeTy != nil {
1622
+					drugError := models.XtDrugError{
1623
+						UserOrgId:             orgID,
1624
+						DrugId:                advice.DrugId,
1625
+						RecordDate:            advice.AdviceDate,
1626
+						PatientId:             advice.PatientId,
1627
+						Remark:                "创建流水失败",
1628
+						Status:                1,
1629
+						Ctime:                 time.Now().Unix(),
1630
+						Mtime:                 0,
1631
+						SumCount:              0,
1632
+						Prescribingnumber:     advice.PrescribingNumber,
1633
+						PrescribingNumberUnit: advice.PrescribingNumberUnit,
1634
+					}
1635
+					CreateDrugError(drugError)
1611 1636
 				}
1612
-				CreateDrugError(drugError)
1613
-			}
1614
-			//出库数量相加
1615
-			errThreeTys := AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
1637
+				//出库数量相加
1638
+				errThreeTys := AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
1616 1639
 
1617
-			if errThreeTys != nil {
1618
-				drugError := models.XtDrugError{
1619
-					UserOrgId:             orgID,
1620
-					DrugId:                advice.DrugId,
1621
-					RecordDate:            advice.AdviceDate,
1622
-					PatientId:             advice.PatientId,
1623
-					Remark:                "出库数量相加失败",
1624
-					Status:                1,
1625
-					Ctime:                 time.Now().Unix(),
1626
-					Mtime:                 0,
1627
-					SumCount:              0,
1628
-					Prescribingnumber:     advice.PrescribingNumber,
1629
-					PrescribingNumberUnit: advice.PrescribingNumberUnit,
1640
+				if errThreeTys != nil {
1641
+					drugError := models.XtDrugError{
1642
+						UserOrgId:             orgID,
1643
+						DrugId:                advice.DrugId,
1644
+						RecordDate:            advice.AdviceDate,
1645
+						PatientId:             advice.PatientId,
1646
+						Remark:                "出库数量相加失败",
1647
+						Status:                1,
1648
+						Ctime:                 time.Now().Unix(),
1649
+						Mtime:                 0,
1650
+						SumCount:              0,
1651
+						Prescribingnumber:     advice.PrescribingNumber,
1652
+						PrescribingNumberUnit: advice.PrescribingNumberUnit,
1653
+					}
1654
+					CreateDrugError(drugError)
1630 1655
 				}
1631
-				CreateDrugError(drugError)
1656
+
1632 1657
 			}
1633 1658
 
1634 1659
 		}

+ 44 - 2
service/patient_service.go Vedi File

@@ -871,7 +871,7 @@ func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error
871 871
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
872 872
 
873 873
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
874
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan}).Error
874
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber}).Error
875 875
 	return err
876 876
 }
877 877
 
@@ -1240,6 +1240,48 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
1240 1240
 	return
1241 1241
 }
1242 1242
 
1243
+func GetLongDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
1244
+
1245
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
1246
+	table := UserReadDB().Table("sgj_user_admin_role as r")
1247
+	fmt.Print("table", table)
1248
+	if orgID > 0 {
1249
+		db = db.Where("x.user_org_id=?", orgID)
1250
+	}
1251
+	if patientID > 0 {
1252
+		db = db.Where("x.patient_id = ?", patientID)
1253
+	}
1254
+	if advice_type == 1 && advice_type > 0 {
1255
+		db = db.Where("x.advice_type = ?", advice_type)
1256
+	}
1257
+	if advice_type == 3 && advice_type > 0 {
1258
+		db = db.Where("x.advice_type = 2 or x.advice_type = 3")
1259
+	}
1260
+	if advice_type == 4 && advice_type > 0 {
1261
+		db = db.Where("x.advice_type = 4")
1262
+	}
1263
+	if stop == 1 {
1264
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
1265
+	} else if stop == 2 {
1266
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
1267
+	}
1268
+
1269
+	if start != 0 {
1270
+		db = db.Where("x.start_time>=?", start)
1271
+	}
1272
+	if end != 0 {
1273
+		db = db.Where("x.start_time<=?", end)
1274
+	}
1275
+	if len(keywords) > 0 {
1276
+		likeKey := "%" + keywords + "%"
1277
+		db = db.Where("x.advice_name LIKE ?", likeKey)
1278
+	}
1279
+	offset := (page - 1) * limit
1280
+	err = db.Group("x.id").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,x.push_start_time,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
1281
+	fmt.Print("err", err)
1282
+	return
1283
+}
1284
+
1243 1285
 func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
1244 1286
 
1245 1287
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
@@ -1949,7 +1991,7 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1949 1991
 
1950 1992
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1951 1993
 
1952
-	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn, "oxygen_uptake": prescription.OxygenUptake, "oxygen_flow": prescription.OxygenFlow, "oxygen_time": prescription.OxygenTime, "dialysis_strainer": prescription.DialysisStrainer}).Error
1994
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn, "oxygen_uptake": prescription.OxygenUptake, "oxygen_flow": prescription.OxygenFlow, "oxygen_time": prescription.OxygenTime, "dialysis_strainer": prescription.DialysisStrainer, "chaptalization": prescription.Chaptalization}).Error
1953 1995
 	return err
1954 1996
 }
1955 1997
 

+ 1 - 1
service/patientmanage_service.go Vedi File

@@ -912,7 +912,7 @@ func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, pag
912 912
 
913 913
 func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.SgjUserAdminRole, err error) {
914 914
 
915
-	err = UserReadDB().Where("org_id = ? and app_id = ? and status = ? ", orgid, appid, 1).Find(&appRole).Error
915
+	err = UserReadDB().Where("org_id = ? and app_id = ?", orgid, appid).Find(&appRole).Error
916 916
 	return appRole, err
917 917
 }
918 918
 

+ 1 - 2
service/pharmacy_service.go Vedi File

@@ -1226,8 +1226,7 @@ func FenDrugInventory(item *models.HisDoctorAdviceInfo, orgid int64) bool {
1226 1226
 		total = list.Count*medical.MinNumber + list.StockMinNumber
1227 1227
 		prescribing_number_total = count
1228 1228
 	}
1229
-	fmt.Println("prescribing_number_total-----", prescribing_number_total)
1230
-	fmt.Println("total-------------", total)
1229
+
1231 1230
 	if prescribing_number_total <= total {
1232 1231
 		//可以扣减
1233 1232
 		return true

+ 7 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Vedi File

@@ -303,6 +303,11 @@ type AssessmentBeforeDislysisVM struct {
303 303
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
304 304
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
305 305
 	UserOrgId                      int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
306
+	CatheterEvaluationProgram      string  `gorm:"column:catheter_evaluation_program" json:"catheter_evaluation_program" form:"catheter_evaluation_program"`
307
+	SkinSiteCatheterization        string  `gorm:"column:skin_site_catheterization" json:"skin_site_catheterization" form:"skin_site_catheterization"`
308
+	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
309
+	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
310
+	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
306 311
 }
307 312
 
308 313
 func (AssessmentBeforeDislysisVM) TableName() string {
@@ -567,6 +572,8 @@ type MonitoringRecordVM struct {
567 572
 	BloodPressureMonitoringSite int64   `gorm:"column:blood_pressure_monitoring_site" json:"blood_pressure_monitoring_site" form:"blood_pressure_monitoring_site"`
568 573
 	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
569 574
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
575
+	Dicarbonate                 float64 `gorm:"column:dicarbonate" json:"dicarbonate" form:"dicarbonate"`
576
+	ReplacementSpeed            float64 `gorm:"column:replacement_speed" json:"replacement_speed" form:"replacement_speed"`
570 577
 }
571 578
 
572 579
 func (MonitoringRecordVM) TableName() string {

+ 17 - 0
service/schedule_service.go Vedi File

@@ -1671,3 +1671,20 @@ func CreateScheduleTwo(m *models.Schedule) error {
1671 1671
 	utx.Commit()
1672 1672
 	return err
1673 1673
 }
1674
+
1675
+func GetLongSolutionByModeId(patient_id int64, mode_id int64, user_org_id int64) (models.DialysisSolution, error) {
1676
+
1677
+	solution := models.DialysisSolution{}
1678
+
1679
+	err := XTReadDB().Where("patient_id = ? and mode_id = ? and user_org_id = ? and status= 1 and solution_status =1", patient_id, mode_id, user_org_id).Find(&solution).Error
1680
+	return solution, err
1681
+}
1682
+
1683
+func UpdateScheduleByDialysis(patient_id int64, mode_id int64, schedule_date int64, user_org_id int64, dialyzer_perfusion_apparatus string, schedule_type int64) error {
1684
+
1685
+	schedule := models.XtSchedule{}
1686
+
1687
+	err := XTWriteDB().Model(&schedule).Where("patient_id = ? and mode_id = ? and schedule_date = ? and user_org_id = ? and schedule_type = ?", patient_id, mode_id, schedule_date, user_org_id, schedule_type).Updates(map[string]interface{}{"dialysis_machine_name": dialyzer_perfusion_apparatus}).Error
1688
+
1689
+	return err
1690
+}

+ 6 - 5
service/stock_service.go Vedi File

@@ -982,6 +982,7 @@ type VMDrugWarehouse struct {
982 982
 	StorehouseId      int64                `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
983 983
 	IsSys             int64                `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
984 984
 	IsCheck           int64                `gorm:"column:is_check" json:"is_check" form:"is_check"`
985
+	Checker           int64                `gorm:"column:checker" json:"checker" form:"checker"`
985 986
 }
986 987
 
987 988
 func (VMDrugWarehouse) TableName() string {
@@ -6299,7 +6300,7 @@ func UpdateWarehouseInfoByGoodId(info models.WarehousingInfo, id int64) error {
6299 6300
 
6300 6301
 func UpdateWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64) error {
6301 6302
 
6302
-	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber}).Error
6303
+	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId}).Error
6303 6304
 	return err
6304 6305
 }
6305 6306
 
@@ -7366,10 +7367,10 @@ func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
7366 7367
 	return err
7367 7368
 }
7368 7369
 
7369
-func UpdateCheckWarehouseInfo(id int64) error {
7370
+func UpdateCheckWarehouseInfo(id int64, checker int64) error {
7370 7371
 
7371 7372
 	tx := XTWriteDB().Begin()
7372
-	err := tx.Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7373
+	err := tx.Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1, "checker": checker}).Error
7373 7374
 	if err != nil {
7374 7375
 		tx.Rollback()
7375 7376
 		return err
@@ -7506,9 +7507,9 @@ func UpdateWarehouseing(info *models.DrugWarehouseInfo) error {
7506 7507
 	return err
7507 7508
 }
7508 7509
 
7509
-func CheckWarehousingInfo(id int64, orgid int64) error {
7510
+func CheckWarehousingInfo(id int64, orgid int64, checker int64) error {
7510 7511
 	tx := XTWriteDB().Begin()
7511
-	err := tx.Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
7512
+	err := tx.Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1, "checker": checker}).Error
7512 7513
 	if err != nil {
7513 7514
 		tx.Rollback()
7514 7515
 		return err

+ 23 - 8
service/warhouse_service.go Vedi File

@@ -131,15 +131,25 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
131 131
 	// 如果没有对应的库存,则报错
132 132
 	storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
133 133
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
134
-	if lastWarehouse.StockMinNumber >= drup.MinNumber {
135
-		var stockMax int64
136
-		var stockMin int64
137
-		stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
138
-		stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
134
+	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
135
+		if lastWarehouse.StockMinNumber >= drup.MinNumber {
136
+			var stockMax int64
137
+			var stockMin int64
138
+			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
139
+			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
140
+
141
+			ChangeMaxNumber(lastWarehouse.ID, stockMax)
142
+			UpdateMinNumber(lastWarehouse.ID, stockMin)
143
+		}
144
+	}
145
+
146
+	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
147
+
148
+		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
149
+		ChangeMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber)
139 150
 
140
-		ChangeMaxNumber(lastWarehouse.ID, stockMax)
141
-		UpdateMinNumber(lastWarehouse.ID, stockMin)
142 151
 	}
152
+
143 153
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
144 154
 
145 155
 	if err != nil {
@@ -554,7 +564,6 @@ func HisDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctorAdvice
554 564
 		drup, _ := FindBaseDrugLibRecord(orgID, advice.DrugId)
555 565
 		if drup.ID > 0 {
556 566
 			prescribingNumber := advice.PrescribingNumber
557
-			//HisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice)
558 567
 
559 568
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice)
560 569
 
@@ -5988,6 +5997,12 @@ func ChangeMaxNumber(id int64, count int64) error {
5988 5997
 	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1 and is_check = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
5989 5998
 	return err
5990 5999
 
6000
+}
6001
+func ChangeMaxNumberOne(id int64, count int64) error {
6002
+
6003
+	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1 and is_check = 1", id).Updates(map[string]interface{}{"stock_max_number": count, "stock_min_number": 0}).Error
6004
+	return err
6005
+
5991 6006
 }
5992 6007
 
5993 6008
 func UpdateMinNumber(id int64, count int64) error {